gtk_widget_destroy (dialog);
}
-static void
-midori_view_add_bookmark_cb (GtkWidget* menuitem,
- const gchar* uri,
- GtkWidget* view)
-{
- KatzeItem* item;
- MidoriBrowser* browser;
-
- item = katze_item_new ();
- katze_item_set_uri (item, uri);
- browser = midori_browser_get_for_widget (menuitem);
- midori_browser_edit_bookmark_dialog_new (browser, item, TRUE, FALSE);
-}
-
#if WEBKIT_CHECK_VERSION (1, 1, 3)
static gboolean
midori_browser_prepare_download (MidoriBrowser* browser,
#endif
"signal::search-text",
midori_view_search_text_cb, browser,
- "signal::add-bookmark",
- midori_view_add_bookmark_cb, browser,
"signal::save-as",
midori_view_save_as_cb, browser,
"signal::add-speed-dial",
_action_bookmark_add_activate (GtkAction* action,
MidoriBrowser* browser)
{
- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
-}
-
-static void
-_action_bookmark_folder_add_activate (GtkAction* action,
- MidoriBrowser* browser)
-{
- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE);
+ if (g_str_equal (gtk_action_get_name (action), "BookmarkFolderAdd"))
+ midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE);
+ else
+ midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
}
static void
N_("Add a new bookmark"), G_CALLBACK (_action_bookmark_add_activate) },
{ "BookmarkFolderAdd", NULL,
N_("Add a new _folder"), "",
- N_("Add a new bookmark folder"), G_CALLBACK (_action_bookmark_folder_add_activate) },
+ N_("Add a new bookmark folder"), G_CALLBACK (_action_bookmark_add_activate) },
{ "BookmarksImport", NULL,
N_("_Import bookmarks"), "",
NULL, G_CALLBACK (_action_bookmarks_import_activate) },
G_TYPE_BOOLEAN,
G_TYPE_STRING);
+ /**
+ * MidoriView::add-bookmark:
+ * @view: the object on which the signal is emitted
+ * @uri: the bookmark URI
+ *
+ * Emitted when a bookmark is added.
+ *
+ * Deprecated: 0.2.7
+ */
signals[ADD_BOOKMARK] = g_signal_new (
"add-bookmark",
G_TYPE_FROM_CLASS (class),
{
MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
/* FIXME: Take selected folder into account */
- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
+ if (g_str_equal (gtk_widget_get_name (toolitem), "BookmarkFolderAdd"))
+ midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE);
+ else
+ midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
}
static void
}
}
-static void
-midori_bookmarks_folder_clicked_cb (GtkWidget* toolitem)
-{
- MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (toolitem));
- /* FIXME: Take selected folder into account */
- midori_browser_edit_bookmark_dialog_new (browser,
- NULL, TRUE, TRUE);
-}
-
static void
midori_bookmarks_cursor_or_row_changed_cb (GtkTreeView* treeview,
MidoriBookmarks* bookmarks)
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
bookmarks->toolbar = toolbar;
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD);
+ gtk_widget_set_name (GTK_WIDGET (toolitem), "BookmarkAdd");
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Add a new bookmark"));
gtk_tool_item_set_is_important (toolitem, TRUE);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY);
+ gtk_widget_set_name (GTK_WIDGET (toolitem), "BookmarkFolderAdd");
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
_("Add a new folder"));
g_signal_connect (toolitem, "clicked",
- G_CALLBACK (midori_bookmarks_folder_clicked_cb), bookmarks);
+ G_CALLBACK (midori_bookmarks_add_clicked_cb), bookmarks);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
return FALSE;
}
-static void
-midori_history_add_clicked_cb (GtkWidget* toolitem)
-{
- MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
- /* FIXME: Take selected folder into account */
- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
-}
-
static void
midori_history_delete_clicked_cb (GtkWidget* toolitem,
MidoriHistory* history)
}
#endif
+static void
+midori_history_bookmark_add_cb (GtkWidget* menuitem,
+ MidoriHistory* history)
+{
+ KatzeItem* item;
+
+ MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (history));
+ item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
+
+ if (KATZE_IS_ITEM (item) && katze_item_get_uri (item))
+ midori_browser_edit_bookmark_dialog_new (browser, item, TRUE, FALSE);
+ else
+ midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
+}
+
static GtkWidget*
midori_history_get_toolbar (MidoriViewable* viewable)
{
_("Bookmark the selected history item"));
gtk_tool_item_set_is_important (toolitem, TRUE);
g_signal_connect (toolitem, "clicked",
- G_CALLBACK (midori_history_add_clicked_cb), history);
+ G_CALLBACK (midori_history_bookmark_add_cb), history);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
history->bookmark = GTK_WIDGET (toolitem);
}
}
-static void
-midori_history_bookmark_activate_cb (GtkWidget* menuitem,
- MidoriHistory* history)
-{
- KatzeItem* item;
- const gchar* uri;
-
- item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
- uri = katze_item_get_uri (item);
-
- if (uri && *uri)
- {
- MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (history));
- midori_browser_edit_bookmark_dialog_new (browser, item, TRUE, FALSE);
- }
-}
static void
midori_history_popup (GtkWidget* widget,
midori_history_popup_item (menu, STOCK_WINDOW_NEW, _("Open in New _Window"),
item, midori_history_open_in_window_activate_cb, history);
midori_history_popup_item (menu, STOCK_BOOKMARK_ADD, NULL,
- item, midori_history_bookmark_activate_cb, history);
+ item, midori_history_bookmark_add_cb, history);
}
menuitem = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);