[gtk] modelbutton: Replace map() with root()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] modelbutton: Replace map() with root()
- Date: Wed, 9 Oct 2019 15:00:52 +0000 (UTC)
commit b8f37da9117c090fd0a2743b4e324245f6113440
Author: Timm Bäder <mail baedert org>
Date: Sat Sep 28 10:30:35 2019 +0200
modelbutton: Replace map() with root()
gtk/gtkmodelbutton.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index 833365115f..4fc89f9ab4 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -984,21 +984,25 @@ gtk_model_button_finalize (GObject *object)
}
static void
-gtk_model_button_map (GtkWidget *widget)
+gtk_model_button_root (GtkWidget *widget)
{
- GtkModelButton *button = GTK_MODEL_BUTTON (widget);
- GtkWindow *window;
+ GtkModelButton *self = GTK_MODEL_BUTTON (widget);
+ GtkRoot *root;
GtkApplication *app;
const char *action_name;
GVariant *action_target;
- GTK_WIDGET_CLASS (gtk_model_button_parent_class)->map (widget);
+ GTK_WIDGET_CLASS (gtk_model_button_parent_class)->root (widget);
+
+ if (!self->accel)
+ return;
+
+ root = gtk_widget_get_root (widget);
- if (button->accel)
+ if (!GTK_IS_WINDOW (root))
return;
- window = GTK_WINDOW (gtk_widget_get_root (widget));
- app = gtk_window_get_application (window);
+ app = gtk_window_get_application (GTK_WINDOW (root));
if (!app)
return;
@@ -1014,7 +1018,7 @@ gtk_model_button_map (GtkWidget *widget)
detailed = g_action_print_detailed_name (action_name, action_target);
accels = gtk_application_get_accels_for_action (app, detailed);
- update_accel (button, accels[0]);
+ update_accel (self, accels[0]);
g_strfreev (accels);
g_free (detailed);
@@ -1081,10 +1085,10 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
widget_class->measure = gtk_model_button_measure;
widget_class->size_allocate = gtk_model_button_size_allocate;
widget_class->destroy = gtk_model_button_destroy;
- widget_class->map = gtk_model_button_map;
widget_class->state_flags_changed = gtk_model_button_state_flags_changed;
widget_class->direction_changed = gtk_model_button_direction_changed;
widget_class->focus = gtk_model_button_focus;
+ widget_class->root = gtk_model_button_root;
button_class->clicked = gtk_model_button_clicked;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]