[Xfce4-commits] [apps/ristretto] 01/02: Resolve or suppress GtkImageMenuItem-related deprecation warnings
noreply at xfce.org
noreply at xfce.org
Sun Jul 28 18:52:00 CEST 2019
This is an automated email from the git hooks/post-receive script.
f 2 4 0 4 p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/ristretto.
commit d88c92b0d59f1ce7b7480c77102cb5ed77dc7bb3
Author: Igor <f2404 at yandex.ru>
Date: Sun Jul 28 12:51:40 2019 -0400
Resolve or suppress GtkImageMenuItem-related deprecation warnings
---
src/app_menu_item.c | 58 ++++++++++++++++++-----------------------------------
src/app_menu_item.h | 29 ++++++++-------------------
src/main_window.c | 16 +++++++--------
3 files changed, 36 insertions(+), 67 deletions(-)
diff --git a/src/app_menu_item.c b/src/app_menu_item.c
index 530f16d..1b381cf 100644
--- a/src/app_menu_item.c
+++ b/src/app_menu_item.c
@@ -23,7 +23,7 @@
#include "app_menu_item.h"
-struct _RsttoAppMenuItemPriv
+struct _RsttoAppMenuItemPrivate
{
GAppInfo *app_info;
GFile *file;
@@ -32,55 +32,37 @@ struct _RsttoAppMenuItemPriv
static GtkWidgetClass *parent_class = NULL;
static void
-rstto_app_menu_item_init(RsttoAppMenuItem *);
+rstto_app_menu_item_init (RsttoAppMenuItem *);
static void
-rstto_app_menu_item_class_init(RsttoAppMenuItemClass *);
+rstto_app_menu_item_class_init (RsttoAppMenuItemClass *);
static void
-rstto_app_menu_item_finalize(GObject *object);
+rstto_app_menu_item_finalize (GObject *object);
static void
rstto_app_menu_item_activate (GtkMenuItem *object);
-GType
-rstto_app_menu_item_get_type (void)
-{
- static GType rstto_app_menu_item_type = 0;
-
- if (!rstto_app_menu_item_type)
- {
- static const GTypeInfo rstto_app_menu_item_info =
- {
- sizeof (RsttoAppMenuItemClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) rstto_app_menu_item_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (RsttoAppMenuItem),
- 0,
- (GInstanceInitFunc) rstto_app_menu_item_init,
- NULL
- };
-
- rstto_app_menu_item_type = g_type_register_static (GTK_TYPE_IMAGE_MENU_ITEM, "RsttoAppMenuItem", &rstto_app_menu_item_info, 0);
- }
- return rstto_app_menu_item_type;
-}
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+G_DEFINE_TYPE_WITH_CODE (
+ RsttoAppMenuItem,
+ rstto_app_menu_item,
+ GTK_TYPE_IMAGE_MENU_ITEM,
+ G_ADD_PRIVATE (RsttoAppMenuItem))
+G_GNUC_END_IGNORE_DEPRECATIONS
static void
rstto_app_menu_item_init (RsttoAppMenuItem *menu_item)
{
- menu_item->priv = g_new0 (RsttoAppMenuItemPriv, 1);
+ menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu_item, RSTTO_TYPE_APP_MENU_ITEM, RsttoAppMenuItemPrivate);
}
static void
-rstto_app_menu_item_class_init(RsttoAppMenuItemClass *app_menu_item_class)
+rstto_app_menu_item_class_init (RsttoAppMenuItemClass *app_menu_item_class)
{
GtkMenuItemClass *menu_item_class;
GObjectClass *object_class;
- object_class = (GObjectClass*)app_menu_item_class;
- menu_item_class = (GtkMenuItemClass*)app_menu_item_class;
+ object_class = G_OBJECT_CLASS (app_menu_item_class);
+ menu_item_class = GTK_MENU_ITEM_CLASS (app_menu_item_class);
parent_class = g_type_class_peek_parent (app_menu_item_class);
@@ -96,9 +78,9 @@ rstto_app_menu_item_class_init(RsttoAppMenuItemClass *app_menu_item_class)
*
*/
static void
-rstto_app_menu_item_finalize(GObject *object)
+rstto_app_menu_item_finalize (GObject *object)
{
- RsttoAppMenuItem *menu_item = RSTTO_APP_MENU_ITEM(object);
+ RsttoAppMenuItem *menu_item = RSTTO_APP_MENU_ITEM (object);
if (menu_item->priv)
{
if (menu_item->priv->app_info)
@@ -111,8 +93,6 @@ rstto_app_menu_item_finalize(GObject *object)
g_object_unref (menu_item->priv->file);
menu_item->priv->file = NULL;
}
- g_free (menu_item->priv);
- menu_item->priv = NULL;
}
}
@@ -130,7 +110,7 @@ rstto_app_menu_item_activate (GtkMenuItem *object)
g_app_info_launch (app_menu_item->priv->app_info, files, NULL, NULL);
- GTK_MENU_ITEM_CLASS(parent_class)->activate (GTK_MENU_ITEM (object));
+ GTK_MENU_ITEM_CLASS (parent_class)->activate (GTK_MENU_ITEM (object));
}
/**
@@ -166,7 +146,9 @@ rstto_app_menu_item_new (GAppInfo *app_info, GFile *file)
}
gtk_menu_item_set_label (GTK_MENU_ITEM (menu_item), g_app_info_get_name (app_info));
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+G_GNUC_END_IGNORE_DEPRECATIONS
return GTK_WIDGET (menu_item);
}
diff --git a/src/app_menu_item.h b/src/app_menu_item.h
index 90f55bd..1318a7a 100644
--- a/src/app_menu_item.h
+++ b/src/app_menu_item.h
@@ -24,34 +24,21 @@
G_BEGIN_DECLS
-#define RSTTO_TYPE_APP_MENU_ITEM rstto_app_menu_item_get_type()
+#define RSTTO_TYPE_APP_MENU_ITEM (rstto_app_menu_item_get_type())
+#define RSTTO_APP_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RSTTO_TYPE_APP_MENU_ITEM, RsttoAppMenuItem))
+#define RSTTO_APP_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RSTTO_TYPE_APP_MENU_ITEM, RsttoAppMenuItemClass))
+#define RSTTO_IS_APP_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RSTTO_TYPE_APP_MENU_ITEM))
+#define RSTTO_IS_APP_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RSTTO_TYPE_APP_MENU_ITEM ()))
+#define RSTTO_APP_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RSTTO_TYPE_APP_MENU_ITEM, RsttoAppMenuItemClass))
-#define RSTTO_APP_MENU_ITEM(obj)( \
- G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- RSTTO_TYPE_APP_MENU_ITEM, \
- RsttoAppMenuItem))
-
-#define RSTTO_IS_APP_MENU_ITEM(obj)( \
- G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- RSTTO_TYPE_APP_MENU_ITEM))
-
-#define RSTTO_APP_MENU_ITEM_CLASS(klass)( \
- G_TYPE_CHECK_CLASS_CAST ((klass), \
- RSTTO_TYPE_APP_MENU_ITEM, \
- RsttoAppMenuItemClass))
-
-#define RSTTO_IS_APP_MENU_ITEM_CLASS(klass)( \
- G_TYPE_CHECK_CLASS_TYPE ((klass), \
- RSTTO_TYPE_APP_MENU_ITEM()))
-
-typedef struct _RsttoAppMenuItemPriv RsttoAppMenuItemPriv;
+typedef struct _RsttoAppMenuItemPrivate RsttoAppMenuItemPrivate;
typedef struct _RsttoAppMenuItem RsttoAppMenuItem;
struct _RsttoAppMenuItem
{
GtkImageMenuItem parent;
- RsttoAppMenuItemPriv *priv;
+ RsttoAppMenuItemPrivate *priv;
};
typedef struct _RsttoAppMenuItemClass RsttoAppMenuItemClass;
diff --git a/src/main_window.c b/src/main_window.c
index afe87bb..31c57bc 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -1443,7 +1443,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
rstto_icon_bar_show_active (RSTTO_ICON_BAR (window->priv->thumbnailbar));
content_type = rstto_file_get_content_type (cur_file);
- rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER(window->priv->image_viewer), cur_file, -1.0, 0);
+ rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER (window->priv->image_viewer), cur_file, -1.0, 0);
pixbuf = rstto_file_get_thumbnail (cur_file, THUMBNAIL_SIZE_SMALL);
if (pixbuf != NULL)
@@ -1464,7 +1464,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (editor)
{
app_info = g_desktop_app_info_new (editor);
- if ( app_info != NULL )
+ if (app_info != NULL)
{
menu_item = rstto_app_menu_item_new (G_APP_INFO (app_info), rstto_file_get_file (cur_file));
gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
@@ -1508,11 +1508,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS
menu_item = gtk_menu_item_new_with_mnemonic (_("Open With Other _Application..."));
gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
- g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(cb_rstto_main_window_open_with_other_app), window);
+ g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (cb_rstto_main_window_open_with_other_app), window);
menu_item = gtk_menu_item_new_with_mnemonic (_("Open With Other _Application..."));
gtk_menu_shell_append (GTK_MENU_SHELL (open_with_window_menu), menu_item);
- g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(cb_rstto_main_window_open_with_other_app), window);
+ g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (cb_rstto_main_window_open_with_other_app), window);
gtk_widget_show_all (open_with_menu);
gtk_widget_show_all (open_with_window_menu);
@@ -1525,19 +1525,19 @@ G_GNUC_END_IGNORE_DEPRECATIONS
}
else
{
- title = g_strdup_printf ("%s - %s", file_basename, RISTRETTO_APP_TITLE );
+ title = g_strdup_printf ("%s - %s", file_basename, RISTRETTO_APP_TITLE);
}
}
else
{
- menu_item = gtk_image_menu_item_new_with_label (_("Empty"));
+ menu_item = gtk_menu_item_new_with_label (_("Empty"));
gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
gtk_widget_set_sensitive (menu_item, FALSE);
- rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER(window->priv->image_viewer), NULL, -1, 0);
+ rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER (window->priv->image_viewer), NULL, -1, 0);
- menu_item = gtk_image_menu_item_new_with_label (_("Empty"));
+ menu_item = gtk_menu_item_new_with_label (_("Empty"));
gtk_menu_shell_append (GTK_MENU_SHELL (open_with_window_menu), menu_item);
gtk_widget_set_sensitive (menu_item, FALSE);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list