Open bookmarks from the panel as apps or internal consistently

This commit is contained in:
Christian Dywan 2009-11-25 23:55:12 +01:00
parent 76cf21146d
commit ffee6e3850
2 changed files with 16 additions and 10 deletions

View file

@ -2866,16 +2866,20 @@ _action_bookmarks_populate_popup (GtkAction* action,
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
} }
static void /* static */ void
midori_browser_open_bookmark (MidoriBrowser* browser, midori_browser_open_bookmark (MidoriBrowser* browser,
KatzeItem* item) KatzeItem* item)
{ {
const gchar* uri = katze_item_get_uri (item);
if (!(uri && *uri))
return;
/* FIXME: Use the same binary that is running right now */ /* FIXME: Use the same binary that is running right now */
if (katze_item_get_meta_integer (item, "app") != -1) if (katze_item_get_meta_integer (item, "app") != -1)
sokoke_spawn_program ("midori -a", katze_item_get_uri (item), FALSE); sokoke_spawn_program ("midori -a", uri, FALSE);
else else
{ {
midori_browser_set_current_uri (browser, katze_item_get_uri (item)); midori_browser_set_current_uri (browser, uri);
gtk_widget_grab_focus (midori_browser_get_current_tab (browser)); gtk_widget_grab_focus (midori_browser_get_current_tab (browser));
} }
} }

View file

@ -32,6 +32,10 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
gboolean new_bookmark, gboolean new_bookmark,
gboolean is_folder); gboolean is_folder);
void
midori_browser_open_bookmark (MidoriBrowser* browser,
KatzeItem* item);
struct _MidoriBookmarks struct _MidoriBookmarks
{ {
GtkVBox parent_instance; GtkVBox parent_instance;
@ -601,19 +605,17 @@ midori_bookmarks_row_activated_cb (GtkTreeView* treeview,
GtkTreeModel* model; GtkTreeModel* model;
GtkTreeIter iter; GtkTreeIter iter;
KatzeItem* item; KatzeItem* item;
const gchar* uri;
model = gtk_tree_view_get_model (treeview); model = gtk_tree_view_get_model (treeview);
if (gtk_tree_model_get_iter (model, &iter, path)) if (gtk_tree_model_get_iter (model, &iter, path))
{ {
MidoriBrowser* browser;
gtk_tree_model_get (model, &iter, 0, &item, -1); gtk_tree_model_get (model, &iter, 0, &item, -1);
uri = katze_item_get_uri (item);
if (uri && *uri) browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
{ midori_browser_open_bookmark (browser, item);
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
midori_browser_set_current_uri (browser, uri);
}
g_object_unref (item); g_object_unref (item);
} }