[gtksourceview] Adapt gtk_source_view_populate_popup()



commit 1e287c7b2a8108ec554cb736bab956089042ef72
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Mar 15 22:48:41 2013 +0100

    Adapt gtk_source_view_populate_popup()
    
    The parameter of ::populate_popup() is now a GtkWidget instead of a
    GtkMenu. See this commit:
    
    https://git.gnome.org/browse/gtk+/commit/?id=88623b98a7ca0afca08ac21bc3aa662c6ed3ab7f

 configure.ac                  |    4 ++--
 gtksourceview/gtksourceview.c |   20 +++++++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e2db901..6819c72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,8 +33,8 @@ AC_CHECK_HEADERS([unistd.h])
 GLIB_REQUIRED_VERSION=2.34.0
 GLIB_REQUIRED_VERSION_MACRO=GLIB_VERSION_2_34
 
-GTK_REQUIRED_VERSION=3.4.0
-GDK_REQUIRED_VERSION_MACRO=GDK_VERSION_3_4
+GTK_REQUIRED_VERSION=3.7.12
+GDK_REQUIRED_VERSION_MACRO=GDK_VERSION_3_8
 
 LIBXML_REQUIRED_VERSION=2.6.0
 GLADE_UI_REQUIRED=3.9
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 3d99d10..f686faf 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -206,7 +206,7 @@ static void gtk_source_view_show_completion_real    (GtkSourceView      *view);
 static void    set_source_buffer                       (GtkSourceView      *view,
                                                                 GtkTextBuffer      *buffer);
 static void    gtk_source_view_populate_popup          (GtkTextView        *view,
-                                                                GtkMenu            *menu);
+                                                        GtkWidget          *popup);
 static void    gtk_source_view_move_cursor             (GtkTextView        *text_view,
                                                                 GtkMovementStep     step,
                                                                 gint                count,
@@ -1313,18 +1313,28 @@ gtk_source_view_show_completion_real (GtkSourceView *view)
 
 static void
 gtk_source_view_populate_popup (GtkTextView *text_view,
-                               GtkMenu     *menu)
+                               GtkWidget   *popup)
 {
        GtkTextBuffer *buffer;
+       GtkMenuShell *menu;
        GtkWidget *menu_item;
 
        buffer = gtk_text_view_get_buffer (text_view);
        if (!GTK_SOURCE_IS_BUFFER (buffer))
+       {
                return;
+       }
+
+       if (!GTK_IS_MENU_SHELL (popup))
+       {
+               return;
+       }
+
+       menu = GTK_MENU_SHELL (popup);
 
        /* separator */
        menu_item = gtk_separator_menu_item_new ();
-       gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+       gtk_menu_shell_prepend (menu, menu_item);
        gtk_widget_show (menu_item);
 
        /* create redo menu_item. */
@@ -1332,7 +1342,7 @@ gtk_source_view_populate_popup (GtkTextView *text_view,
        g_object_set_data (G_OBJECT (menu_item), "gtk-signal", "redo");
        g_signal_connect (G_OBJECT (menu_item), "activate",
                          G_CALLBACK (menu_item_activate_cb), text_view);
-       gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+       gtk_menu_shell_prepend (menu, menu_item);
        gtk_widget_set_sensitive (menu_item,
                                  (gtk_text_view_get_editable (text_view) &&
                                   gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (buffer))));
@@ -1343,7 +1353,7 @@ gtk_source_view_populate_popup (GtkTextView *text_view,
        g_object_set_data (G_OBJECT (menu_item), "gtk-signal", "undo");
        g_signal_connect (G_OBJECT (menu_item), "activate",
                          G_CALLBACK (menu_item_activate_cb), text_view);
-       gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+       gtk_menu_shell_prepend (menu, menu_item);
        gtk_widget_set_sensitive (menu_item,
                                  (gtk_text_view_get_editable (text_view) &&
                                   gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (buffer))));


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