[gtk+/open-with-dialog: 49/53] open-with-widget: remove context menu
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/open-with-dialog: 49/53] open-with-widget: remove context menu
- Date: Tue, 23 Nov 2010 16:55:22 +0000 (UTC)
commit 0833894c380bd373852193a39f524d5d128283a2
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Nov 23 16:47:24 2010 +0100
open-with-widget: remove context menu
The widget should not modify itself the application list in any way.
gtk/gtkopenwithwidget.c | 108 -----------------------------------------------
1 files changed, 0 insertions(+), 108 deletions(-)
---
diff --git a/gtk/gtkopenwithwidget.c b/gtk/gtkopenwithwidget.c
index 640f251..bba2e60 100644
--- a/gtk/gtkopenwithwidget.c
+++ b/gtk/gtkopenwithwidget.c
@@ -170,111 +170,6 @@ program_list_selection_activated (GtkTreeView *view,
self->priv->selected_app_info);
}
-static void
-item_forget_association_cb (GtkMenuItem *item,
- gpointer user_data)
-{
- GtkOpenWithWidget *self = user_data;
- GtkTreePath *path = NULL;
- GtkTreeIter iter;
- GtkTreeModel *model;
- GAppInfo *info;
-
- gtk_tree_view_get_cursor (GTK_TREE_VIEW (self->priv->program_list), &path, NULL);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->program_list));
-
- if (path != NULL)
- {
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
- COLUMN_APP_INFO, &info,
- -1);
-
- if (info != NULL && g_app_info_can_remove_supports_type (info))
- g_app_info_remove_supports_type (info, self->priv->content_type, NULL);
- }
-
- gtk_open_with_refresh (GTK_OPEN_WITH (self));
-}
-
-static GtkWidget *
-gtk_open_with_widget_build_popup_menu (GtkOpenWithWidget *self)
-{
- GtkWidget *menu;
- GtkWidget *item;
-
- menu = gtk_menu_new ();
-
- item = gtk_menu_item_new_with_label (_("Forget association"));
- g_signal_connect (item, "activate",
- G_CALLBACK (item_forget_association_cb), self);
- gtk_widget_show (item);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- return menu;
-}
-
-static gboolean
-should_show_menu (GtkOpenWithWidget *self,
- GdkEventButton *event)
-{
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeModel *model;
- gboolean recommended, retval;
- GAppInfo *info;
-
- gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (self->priv->program_list),
- event->x, event->y,
- &path, NULL, NULL, NULL);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->program_list));
- gtk_tree_model_get_iter (model, &iter, path);
-
- gtk_tree_model_get (model, &iter,
- COLUMN_RECOMMENDED, &recommended,
- COLUMN_APP_INFO, &info,
- -1);
-
- retval = recommended && (info != NULL);
-
- gtk_tree_path_free (path);
-
- if (info != NULL)
- g_object_unref (info);
-
- return retval;
-}
-
-static void
-do_popup_menu (GtkOpenWithWidget *self,
- GdkEventButton *event)
-{
- GtkWidget *menu;
-
- if (!should_show_menu (self, event))
- return;
-
- menu = gtk_open_with_widget_build_popup_menu (self);
- gtk_menu_attach_to_widget (GTK_MENU (menu), self->priv->program_list, NULL);
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
-}
-
-static gboolean
-program_list_button_press_event_cb (GtkWidget *treeview,
- GdkEventButton *event,
- gpointer user_data)
-{
- GtkOpenWithWidget *self = user_data;
-
- if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
- do_popup_menu (self, event);
-
- return FALSE;
-}
-
static gboolean
gtk_open_with_search_equal_func (GtkTreeModel *model,
int column,
@@ -976,9 +871,6 @@ gtk_open_with_widget_init (GtkOpenWithWidget *self)
g_signal_connect (self->priv->program_list, "row-activated",
G_CALLBACK (program_list_selection_activated),
self);
- g_signal_connect (self->priv->program_list, "button-press-event",
- G_CALLBACK (program_list_button_press_event_cb),
- self);
}
static GAppInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]