static const gchar * gtk_tool_button_get_action_name (GtkActionable *actionable) { GtkToolButton *button = GTK_TOOL_BUTTON (actionable); return gtk_actionable_get_action_name (GTK_ACTIONABLE (button->priv->button)); }
static void set_accel (GtkApplication *app, GtkWidget *widget) { GtkWidget *accel_label; const gchar *action; gchar **accels; guint key; GdkModifierType mods; accel_label = gtk_bin_get_child (GTK_BIN (widget)); g_assert (GTK_IS_ACCEL_LABEL (accel_label)); action = gtk_actionable_get_action_name (GTK_ACTIONABLE (widget)); accels = gtk_application_get_accels_for_action (app, action); gtk_accelerator_parse (accels[0], &key, &mods); gtk_accel_label_set_accel (GTK_ACCEL_LABEL (accel_label), key, mods); g_strfreev (accels); }
static GObject * find_action_owner (GtkActionable *actionable) { GtkWidget *widget = GTK_WIDGET (actionable); const gchar *full_name; const gchar *dot; const gchar *name; gchar *prefix; GtkWidget *win; GActionGroup *group; full_name = gtk_actionable_get_action_name (actionable); if (!full_name) return NULL; dot = strchr (full_name, '.'); prefix = g_strndup (full_name, dot - full_name); name = dot + 1; win = gtk_widget_get_ancestor (widget, GTK_TYPE_APPLICATION_WINDOW); if (g_strcmp0 (prefix, "win") == 0) { if (G_IS_OBJECT (win)) return (GObject *)win; } else if (g_strcmp0 (prefix, "app") == 0) { if (GTK_IS_WINDOW (win)) return (GObject *)gtk_window_get_application (GTK_WINDOW (win)); } while (widget != NULL) { group = _gtk_widget_get_action_group (widget, prefix); if (group && g_action_group_has_action (group, name)) return (GObject *)widget; widget = action_ancestor (widget); } return NULL; }
static const gchar * photos_tool_filter_button_get_action_name (GtkActionable *actionable) { PhotosToolFilterButton *self = PHOTOS_TOOL_FILTER_BUTTON (actionable); return gtk_actionable_get_action_name (GTK_ACTIONABLE (self->button)); }