static void setup_search (GtkAppChooserDialog *self) { gboolean use_header; g_object_get (self, "use-header-bar", &use_header, NULL); if (use_header) { GtkWidget *button; GtkWidget *image; GtkWidget *header; button = gtk_toggle_button_new (); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); image = gtk_image_new_from_icon_name ("edit-find-symbolic", GTK_ICON_SIZE_MENU); gtk_widget_show (image); gtk_container_add (GTK_CONTAINER (button), image); gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button"); gtk_style_context_remove_class (gtk_widget_get_style_context (button), "text-button"); gtk_widget_show (button); header = gtk_dialog_get_header_bar (GTK_DIALOG (self)); gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button); g_object_bind_property (button, "active", self->priv->search_bar, "search-mode-enabled", G_BINDING_BIDIRECTIONAL); g_object_bind_property (self->priv->search_entry, "sensitive", button, "sensitive", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); } }
Php::Value GtkDialog_::get_header_bar() { GtkWidget *ret = gtk_dialog_get_header_bar (GTK_DIALOG(instance)); GtkWidget_ *return_parsed = new GtkWidget_(); return_parsed->set_instance((gpointer *)ret); return Php::Object("GtkWidget", return_parsed); }
static void gt_settings_dlg_init(GtSettingsDlg* self) { GtSettingsDlgPrivate* priv = gt_settings_dlg_get_instance_private(self); //So it's not optimised away volatile gpointer type = (gpointer) PEAS_GTK_TYPE_PLUGIN_MANAGER; gtk_widget_init_template(GTK_WIDGET(self)); gtk_widget_show_all(priv->players_view); GtkWidget* header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(self)); gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header_bar), priv->settings_switcher); /* NOTE: This is a hack to show a label at the bottom of the dialogue*/ GList* children = gtk_container_get_children(GTK_CONTAINER(priv->players_view)); GtkToolbar* toolbar = GTK_TOOLBAR(g_list_nth(children, 1)->data); GtkToolItem* item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(item), gtk_link_button_new_with_label( "https://github.com/vinszent/gnome-twitch/wiki/How-to-install-player-backends", _("How to install player backends"))); gtk_widget_show_all(GTK_WIDGET(item)); gtk_toolbar_insert(toolbar, item, 0); g_list_free(children); g_settings_bind(main_app->settings, "prefer-dark-theme", priv->prefer_dark_theme_button, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(main_app->settings, "default-quality", priv->quality_combo, "active-id", G_SETTINGS_BIND_DEFAULT); g_settings_bind(main_app->settings, "language-filter", priv->language_filter_combo, "active-id", G_SETTINGS_BIND_DEFAULT); g_settings_bind(main_app->settings, "show-notifications", priv->notifications_switch, "active", G_SETTINGS_BIND_DEFAULT); }
static void set_dialog_properties (GtkAppChooserDialog *self) { gchar *name; gchar *extension; gchar *description; gchar *string; gboolean unknown; gchar *title; gchar *subtitle; gboolean use_header; GtkWidget *header; name = NULL; extension = NULL; description = NULL; unknown = TRUE; if (self->priv->gfile != NULL) { name = g_file_get_basename (self->priv->gfile); extension = get_extension (name); } if (self->priv->content_type) { description = g_content_type_get_description (self->priv->content_type); unknown = g_content_type_is_unknown (self->priv->content_type); } if (name != NULL) { title = g_strdup (_("Select Application")); /* Translators: %s is a filename */ subtitle = g_strdup_printf (_("Opening “%s”."), name); string = g_strdup_printf (_("No applications found for “%s”"), name); } else { title = g_strdup (_("Select Application")); /* Translators: %s is a file type description */ subtitle = g_strdup_printf (_("Opening “%s” files."), unknown ? self->priv->content_type : description); string = g_strdup_printf (_("No applications found for “%s” files"), unknown ? self->priv->content_type : description); } g_object_get (self, "use-header-bar", &use_header, NULL); if (use_header) { header = gtk_dialog_get_header_bar (GTK_DIALOG (self)); gtk_header_bar_set_title (GTK_HEADER_BAR (header), title); gtk_header_bar_set_subtitle (GTK_HEADER_BAR (header), subtitle); } else { gtk_window_set_title (GTK_WINDOW (self), _("Select Application")); } if (self->priv->heading != NULL) { gtk_label_set_markup (GTK_LABEL (self->priv->label), self->priv->heading); gtk_widget_show (self->priv->label); } else { gtk_widget_hide (self->priv->label); } gtk_app_chooser_widget_set_default_text (GTK_APP_CHOOSER_WIDGET (self->priv->app_chooser_widget), string); g_free (title); g_free (subtitle); g_free (name); g_free (extension); g_free (description); g_free (string); }