[gtk+/wip/otte/gtk4: 57/121] recentchoosermenu: Stop using GtkImageMenuItem
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gtk4: 57/121] recentchoosermenu: Stop using GtkImageMenuItem
- Date: Fri, 7 Oct 2016 04:06:54 +0000 (UTC)
commit a94309df605afb0cc82b9e63a92bf3a1e6aed9db
Author: Timm Bäder <mail baedert org>
Date: Mon Oct 3 09:57:57 2016 +0200
recentchoosermenu: Stop using GtkImageMenuItem
gtk/gtkrecentchoosermenu.c | 36 ++++++++++++++----------------------
1 files changed, 14 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c
index b902640..8da36d4 100644
--- a/gtk/gtkrecentchoosermenu.c
+++ b/gtk/gtkrecentchoosermenu.c
@@ -37,6 +37,7 @@
#include "gtkmenu.h"
#include "gtkimage.h"
#include "gtklabel.h"
+#include "gtkbox.h"
#include "gtktooltip.h"
#include "deprecated/gtkactivatable.h"
#include "gtktypebuiltins.h"
@@ -805,6 +806,7 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu,
gchar *text;
GtkWidget *item, *image, *label;
GIcon *icon;
+ GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
g_assert (info != NULL);
@@ -834,9 +836,7 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu,
*/
text = g_strdup_printf (C_("recent menu label", "%d. %s"), count, escaped);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- item = gtk_image_menu_item_new_with_mnemonic (text);
- G_GNUC_END_IGNORE_DEPRECATIONS;
+ label = gtk_label_new_with_mnemonic (text);
g_free (escaped);
g_free (name);
@@ -844,41 +844,33 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu,
else
{
text = g_strdup (gtk_recent_info_get_display_name (info));
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- item = gtk_image_menu_item_new_with_label (text);
- G_GNUC_END_IGNORE_DEPRECATIONS;
+ label = gtk_label_new (text);
}
g_free (text);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item),
- TRUE);
- G_GNUC_END_IGNORE_DEPRECATIONS;
-
/* ellipsize the menu item label, in case the recent document
* display name is huge.
*/
- label = gtk_bin_get_child (GTK_BIN (item));
- if (GTK_IS_LABEL (label))
- {
- gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
- gtk_label_set_max_width_chars (GTK_LABEL (label), priv->label_width);
- }
-
+ gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+ gtk_label_set_max_width_chars (GTK_LABEL (label), priv->label_width);
+
if (priv->show_icons)
{
icon = gtk_recent_info_get_gicon (info);
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
- G_GNUC_END_IGNORE_DEPRECATIONS;
if (icon)
g_object_unref (icon);
+
+ gtk_container_add (GTK_CONTAINER (box), image);
}
+ item = gtk_menu_item_new ();
+ gtk_container_add (GTK_CONTAINER (box), label);
+ gtk_widget_show_all (box);
+ gtk_container_add (GTK_CONTAINER (item), box);
+
g_signal_connect (item, "activate",
G_CALLBACK (item_activate_cb),
menu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]