Remove unused extension panel popup logic

This commit is contained in:
Christian Dywan 2010-05-06 23:41:07 +02:00
parent affde90e2c
commit 2611a24803

View file

@ -286,147 +286,6 @@ midori_extensions_treeview_row_activated_cb (GtkTreeView* treeview,
}
}
static void
midori_extensions_preferences_activate_cb (GtkWidget* menuitem,
MidoriExtensions* extensions)
{
MidoriExtension* extension;
extension = g_object_get_data (G_OBJECT (menuitem), "MidoriExtension");
g_return_if_fail (extension != NULL);
}
static void
midori_extensions_website_activate_cb (GtkWidget* menuitem,
MidoriExtensions* extensions)
{
gchar* uri;
gint n;
MidoriBrowser* browser;
MidoriExtension* extension;
extension = g_object_get_data (G_OBJECT (menuitem), "MidoriExtension");
g_return_if_fail (extension != NULL);
uri = katze_object_get_string (extension, "website");
browser = midori_browser_get_for_widget (GTK_WIDGET (extensions));
n = midori_browser_add_uri (browser, uri);
midori_browser_set_current_page (browser, n);
g_free (uri);
}
static void
midori_extensions_about_activate_cb (GtkWidget* menuitem,
MidoriExtensions* extensions)
{
MidoriExtension* extension;
extension = g_object_get_data (G_OBJECT (menuitem), "MidoriExtension");
g_return_if_fail (extension != NULL);
}
static GtkWidget*
midori_extensions_popup_menu_item (GtkMenu* menu,
const gchar* stock_id,
const gchar* label,
MidoriExtension* extension,
gpointer callback,
gboolean enabled,
MidoriExtensions* extensions)
{
GtkWidget* menuitem;
menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
if (label)
gtk_label_set_text_with_mnemonic (GTK_LABEL (gtk_bin_get_child (
GTK_BIN (menuitem))), label);
if (!enabled)
gtk_widget_set_sensitive (menuitem, FALSE);
g_object_set_data (G_OBJECT (menuitem), "MidoriExtension", extension);
if (callback)
g_signal_connect (menuitem, "activate", G_CALLBACK (callback), extensions);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
return menuitem;
}
static void
midori_extensions_popup (GtkWidget* widget,
GdkEventButton* event,
MidoriExtension* extension,
MidoriExtensions* extensions)
{
GtkWidget* menu;
gchar* website;
website = katze_object_get_string (extension, "website");
menu = gtk_menu_new ();
midori_extensions_popup_menu_item (GTK_MENU (menu), GTK_STOCK_PREFERENCES, NULL, extension,
midori_extensions_preferences_activate_cb, FALSE,
extensions);
midori_extensions_popup_menu_item (GTK_MENU (menu), GTK_STOCK_HOME, NULL, extension,
midori_extensions_website_activate_cb, website != NULL,
extensions);
midori_extensions_popup_menu_item (GTK_MENU (menu), GTK_STOCK_ABOUT, NULL, extension,
midori_extensions_about_activate_cb, FALSE,
extensions);
katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
g_free (website);
}
static gboolean
midori_extensions_popup_menu_cb (GtkWidget* widget,
MidoriExtensions* extensions)
{
GtkTreeModel* model;
GtkTreeIter iter;
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
{
MidoriExtension *extension;
gtk_tree_model_get (model, &iter, 0, &extension, -1);
midori_extensions_popup (widget, NULL, extension, extensions);
g_object_unref (extension);
return TRUE;
}
return FALSE;
}
static gboolean
midori_extensions_button_release_event_cb (GtkWidget* widget,
GdkEventButton* event,
MidoriExtensions* extensions)
{
GtkTreeModel* model;
GtkTreeIter iter;
if (event->button != 3)
return FALSE;
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
{
MidoriExtension* extension;
gtk_tree_model_get (model, &iter, 0, &extension, -1);
midori_extensions_popup (widget, event, extension, extensions);
g_object_unref (extension);
return TRUE;
}
return FALSE;
}
static void
midori_extensions_cell_renderer_toggled_cb (GtkCellRendererToggle* renderer,
const gchar* path,
@ -511,10 +370,6 @@ midori_extensions_init (MidoriExtensions* extensions)
g_object_connect (extensions->treeview,
"signal::row-activated",
midori_extensions_treeview_row_activated_cb, extensions,
"signal::button-release-event",
midori_extensions_button_release_event_cb, extensions,
"signal::popup-menu",
midori_extensions_popup_menu_cb, extensions,
NULL);
gtk_widget_show (extensions->treeview);
gtk_box_pack_start (GTK_BOX (extensions), extensions->treeview, TRUE, TRUE, 0);