[libpeas] Return FALSE if creating the view's popup failed



commit f2569787d8b965da824662fa0c1974364090a807
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Mar 6 05:00:48 2011 -0800

    Return FALSE if creating the view's popup failed

 libpeas-gtk/peas-gtk-plugin-manager-view.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index 75823ec..e51f158 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -433,7 +433,7 @@ menu_position_under_tree_view (GtkMenu     *menu,
   *push_in = TRUE;
 }
 
-static void
+static gboolean
 show_popup_menu (GtkTreeView              *tree_view,
                  PeasGtkPluginManagerView *view,
                  GdkEventButton           *event)
@@ -444,7 +444,7 @@ show_popup_menu (GtkTreeView              *tree_view,
   view->priv->popup_menu = create_popup_menu (view);
 
   if (view->priv->popup_menu == NULL)
-    return;
+    return FALSE;
 
   gtk_menu_attach_to_widget (GTK_MENU (view->priv->popup_menu),
                              GTK_WIDGET (view),
@@ -464,6 +464,8 @@ show_popup_menu (GtkTreeView              *tree_view,
       gtk_menu_shell_select_first (GTK_MENU_SHELL (view->priv->popup_menu),
                                    FALSE);
     }
+
+  return TRUE;
 }
 
 static void
@@ -573,19 +575,15 @@ peas_gtk_plugin_manager_view_button_press_event (GtkWidget      *tree_view,
   if (event->type != GDK_BUTTON_PRESS || event->button != 3 || !handled)
     return handled;
 
-  show_popup_menu (GTK_TREE_VIEW (tree_view), view, event);
-
-  return TRUE;
+  return show_popup_menu (GTK_TREE_VIEW (tree_view), view, event);
 }
 
 static gboolean
-peas_gtk_plugin_manager_view_popup_menu (GtkWidget *widget)
+peas_gtk_plugin_manager_view_popup_menu (GtkWidget *tree_view)
 {
-  GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
-
-  show_popup_menu (tree_view, PEAS_GTK_PLUGIN_MANAGER_VIEW (tree_view), NULL);
+  PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (tree_view);
 
-  return TRUE;
+  return show_popup_menu (GTK_TREE_VIEW (tree_view), view, NULL);
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]