[gnome-panel] use PanelImageMenuItem not GtkImageMenuItem



commit 7807bf814c1170d4cd84df8698d0e8a6719d7251
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Jul 11 18:44:49 2014 +0300

    use PanelImageMenuItem not GtkImageMenuItem

 gnome-panel/menu.c             |   13 +++++--------
 gnome-panel/panel-menu-bar.c   |    6 ++----
 gnome-panel/panel-menu-items.c |   25 +++++++++++--------------
 gnome-panel/panel-menu-items.h |   16 +++++++---------
 gnome-panel/panel-recent.c     |    5 +++--
 5 files changed, 28 insertions(+), 37 deletions(-)
---
diff --git a/gnome-panel/menu.c b/gnome-panel/menu.c
index 0b484f8..de9444c 100644
--- a/gnome-panel/menu.c
+++ b/gnome-panel/menu.c
@@ -782,8 +782,7 @@ setup_menuitem (GtkWidget   *menuitem,
                                        g_object_ref (image),
                                        (GDestroyNotify) g_object_unref);
                gtk_widget_show (image);
-               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
-                                              image);
+               panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menuitem), image);
        } else if (icon_size != GTK_ICON_SIZE_INVALID)
                 image_menuitem_set_size_request (menuitem, icon_size);
 
@@ -969,9 +968,8 @@ panel_image_menu_item_new2 (void)
        GtkWidget *menuitem;
        GtkStyleContext *context;
 
-       menuitem = gtk_image_menu_item_new ();
-       gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem),
-                                                  TRUE);
+       menuitem = panel_image_menu_item_new ();
+       panel_image_menu_item_set_always_show_image (PANEL_IMAGE_MENU_ITEM (menuitem), TRUE);
        context = gtk_widget_get_style_context (menuitem);
        gtk_style_context_add_class (context, "gnome-panel-menu-item");
 
@@ -991,7 +989,7 @@ create_submenu_entry (GtkWidget          *menu,
        if (force_categories_icon)
                menuitem = panel_image_menu_item_new2 ();
        else
-               menuitem = gtk_image_menu_item_new ();
+               menuitem = panel_image_menu_item_new ();
 
        panel_load_menu_image_deferred (menuitem,
                                        panel_menu_icon_get_size (),
@@ -1474,8 +1472,7 @@ panel_load_menu_image_deferred (GtkWidget   *image_menu_item,
                                g_object_ref (image),
                                (GDestroyNotify) g_object_unref);
 
-       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (image_menu_item),
-                                      image);
+       panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (image_menu_item), image);
 
        g_signal_connect_data (image, "map",
                               G_CALLBACK (image_menu_shown), icon,
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index 733abfc..8c736ea 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -168,11 +168,9 @@ panel_menu_bar_style_updated (GtkWidget *widget)
        gtk_widget_style_get (widget, "icon-visible", &visible, NULL);
 
        if (visible)
-               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menubar->priv->applications_item),
-                                              menubar->priv->image);
+               panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menubar->priv->applications_item), 
menubar->priv->image);
        else
-               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menubar->priv->applications_item),
-                                              NULL);
+               panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menubar->priv->applications_item), 
NULL);
 }
 
 static void
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 15ab68d..74c30e1 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -64,8 +64,8 @@
 #define MAX_ITEMS_OR_SUBMENU    8
 #define MAX_BOOKMARK_ITEMS      100
 
-G_DEFINE_TYPE (PanelPlaceMenuItem, panel_place_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
-G_DEFINE_TYPE (PanelDesktopMenuItem, panel_desktop_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
+G_DEFINE_TYPE (PanelPlaceMenuItem, panel_place_menu_item, PANEL_TYPE_IMAGE_MENU_ITEM)
+G_DEFINE_TYPE (PanelDesktopMenuItem, panel_desktop_menu_item, PANEL_TYPE_IMAGE_MENU_ITEM)
 
 #define PANEL_PLACE_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_PLACE_MENU_ITEM, 
PanelPlaceMenuItemPrivate))
 #define PANEL_DESKTOP_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
PANEL_TYPE_DESKTOP_MENU_ITEM, PanelDesktopMenuItemPrivate))
@@ -326,7 +326,7 @@ panel_menu_item_desktop_new (char      *path,
        if (use_icon) {
                item = panel_image_menu_item_new2 ();
         } else {
-               item = gtk_image_menu_item_new ();
+               item = panel_image_menu_item_new ();
        }
 
        setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
@@ -405,7 +405,7 @@ panel_menu_items_create_action_item_full (PanelActionButtonType  action_type,
        if (!create_even_if_disabled && panel_action_get_is_disabled (action_type))
                return NULL;
 
-       item = gtk_image_menu_item_new ();
+       item = panel_image_menu_item_new ();
         setup_menu_item_with_icon (item,
                                   panel_menu_icon_get_size (),
                                   panel_action_get_icon_name (action_type),
@@ -477,7 +477,7 @@ panel_menu_items_create_switch_user (gboolean use_icon)
        if (use_icon) {
                item = panel_image_menu_item_new2 ();
         } else {
-               item = gtk_image_menu_item_new ();
+               item = panel_image_menu_item_new ();
        }
 
        setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
@@ -608,7 +608,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
        } else {
                GtkWidget *item;
 
-               item = gtk_image_menu_item_new ();
+               item = panel_image_menu_item_new ();
                setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
                                           PANEL_ICON_BOOKMARKS, NULL,
                                           _("Bookmarks"));
@@ -1051,7 +1051,7 @@ panel_place_menu_item_append_local_gio (PanelPlaceMenuItem *place_item,
        } else {
                GtkWidget  *item;
 
-               item = gtk_image_menu_item_new ();
+               item = panel_image_menu_item_new ();
                setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
                                           PANEL_ICON_REMOVABLE_MEDIA,
                                           NULL,
@@ -1582,8 +1582,7 @@ panel_place_menu_item_new (gboolean use_image,
                        GtkWidget *image;
                        image = gtk_image_new_from_icon_name (icon_name,
                                                              panel_menu_bar_object_icon_get_size ());
-                       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
-                                                      image);
+                       panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menuitem), image);
                }
        } else {
                if (use_image)
@@ -1630,7 +1629,7 @@ panel_desktop_menu_item_on_presence_changed (PanelSessionManager             *ma
                break;
        }
 
-       image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (desktop_item));
+       image = panel_image_menu_item_get_image (PANEL_IMAGE_MENU_ITEM (desktop_item));
        /* we only have an image if we are specifically using an icon for this
         * menu */
        if (image) {
@@ -1687,8 +1686,7 @@ panel_desktop_menu_item_new (gboolean use_image,
                        GtkWidget *image;
                        image = gtk_image_new_from_icon_name (icon_name,
                                                              menuitem->priv->icon_size);
-                       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
-                                                      image);
+                       panel_image_menu_item_set_image (PANEL_IMAGE_MENU_ITEM (menuitem), image);
                }
        } else {
                menuitem->priv->icon_size = panel_menu_icon_get_size ();
@@ -1706,8 +1704,7 @@ panel_desktop_menu_item_new (gboolean use_image,
 
 #ifdef HAVE_TELEPATHY_GLIB
        if (use_image)
-               gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem),
-                                                          TRUE);
+               panel_image_menu_item_set_always_show_image (PANEL_IMAGE_MENU_ITEM (menuitem), TRUE);
 #endif
 
        g_free (name);
diff --git a/gnome-panel/panel-menu-items.h b/gnome-panel/panel-menu-items.h
index 2a8e93c..cb5d96b 100644
--- a/gnome-panel/panel-menu-items.h
+++ b/gnome-panel/panel-menu-items.h
@@ -22,7 +22,7 @@
 #ifndef __PANEL_MENU_ITEMS_H__
 #define __PANEL_MENU_ITEMS_H__
 
-#include <gtk/gtk.h>
+#include "panel-image-menu-item.h"
 #include "panel-widget.h"
 
 G_BEGIN_DECLS
@@ -39,13 +39,12 @@ typedef struct _PanelPlaceMenuItemClass   PanelPlaceMenuItemClass;
 typedef struct _PanelPlaceMenuItemPrivate PanelPlaceMenuItemPrivate;
 
 struct _PanelPlaceMenuItem {
-       GtkImageMenuItem            menuitem;
-
-       PanelPlaceMenuItemPrivate  *priv;
+       PanelImageMenuItem         parent;
+       PanelPlaceMenuItemPrivate *priv;
 };
 
 struct _PanelPlaceMenuItemClass {
-       GtkImageMenuItemClass       menuitem_class;
+       PanelImageMenuItemClass parent_class;
 };
 
 GType panel_place_menu_item_get_type (void) G_GNUC_CONST;
@@ -64,13 +63,12 @@ typedef struct _PanelDesktopMenuItemClass   PanelDesktopMenuItemClass;
 typedef struct _PanelDesktopMenuItemPrivate PanelDesktopMenuItemPrivate;
 
 struct _PanelDesktopMenuItem{
-       GtkImageMenuItem            menuitem;
-
-       PanelDesktopMenuItemPrivate  *priv;
+       PanelImageMenuItem           parent;
+       PanelDesktopMenuItemPrivate *priv;
 };
 
 struct _PanelDesktopMenuItemClass {
-       GtkImageMenuItemClass       menuitem_class;
+       PanelImageMenuItemClass parent_class;
 };
 
 GType panel_desktop_menu_item_get_type (void) G_GNUC_CONST;
diff --git a/gnome-panel/panel-recent.c b/gnome-panel/panel-recent.c
index c7163ba..6bd8175 100644
--- a/gnome-panel/panel-recent.c
+++ b/gnome-panel/panel-recent.c
@@ -37,6 +37,7 @@
 #include "panel-stock-icons.h"
 #include "panel-multiscreen.h"
 #include "panel-icon-names.h"
+#include "panel-image-menu-item.h"
 
 static gboolean
 show_uri (const char *uri, const char *mime_type, GdkScreen *screen,
@@ -186,7 +187,7 @@ panel_recent_append_documents_menu (GtkWidget        *top_menu,
        GtkWidget      *menu_item;
        int             size;
 
-       menu_item = gtk_image_menu_item_new ();
+       menu_item = panel_image_menu_item_new ();
        setup_menu_item_with_icon (menu_item,
                                   panel_menu_icon_get_size (),
                                   PANEL_ICON_RECENT,
@@ -225,7 +226,7 @@ panel_recent_append_documents_menu (GtkWidget        *top_menu,
 
        add_menu_separator (recent_menu);
 
-       menu_item = gtk_image_menu_item_new ();
+       menu_item = panel_image_menu_item_new ();
        setup_menu_item_with_icon (menu_item,
                                   panel_menu_icon_get_size (),
                                   "edit-clear", NULL,


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