static void schema_browser_perspective_customize (BrowserPerspective *perspective, GtkToolbar *toolbar, GtkHeaderBar *header) { g_print ("%s ()\n", __FUNCTION__); customization_data_init (G_OBJECT (perspective), toolbar, header); /* add perspective's actions */ customization_data_add_actions (G_OBJECT (perspective), win_entries, G_N_ELEMENTS (win_entries)); /* add to toolbar */ GtkToolItem *titem; titem = gtk_toggle_tool_button_new (); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "user-bookmarks-symbolic"); gtk_widget_set_tooltip_text (GTK_WIDGET (titem), _("Show favorites")); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.show-favorites"); gtk_widget_show (GTK_WIDGET (titem)); customization_data_add_part (G_OBJECT (perspective), G_OBJECT (titem)); #ifdef HAVE_GOOCANVAS titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "tab-new-symbolic"); gtk_widget_set_tooltip_text (GTK_WIDGET (titem), _("Create a new diagram")); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.action-diagram-new"); gtk_widget_show (GTK_WIDGET (titem)); customization_data_add_part (G_OBJECT (perspective), G_OBJECT (titem)); #endif }
static void gtk_tool_button_sync_action_properties (GtkActivatable *activatable, GtkAction *action) { GtkToolButton *button; GIcon *icon; const gchar *stock_id; GtkIconSet *icon_set = NULL; parent_activatable_iface->sync_action_properties (activatable, action); if (!action) return; if (!gtk_activatable_get_use_action_appearance (activatable)) return; button = GTK_TOOL_BUTTON (activatable); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; stock_id = gtk_action_get_stock_id (action); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); gtk_tool_button_set_use_underline (button, TRUE); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_tool_button_set_stock_id (button, stock_id); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); if (stock_id) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS; icon_set = gtk_icon_factory_lookup_default (stock_id); G_GNUC_END_IGNORE_DEPRECATIONS; } if (icon_set != NULL) gtk_tool_button_set_icon_widget (button, NULL); else if ((icon = gtk_action_get_gicon (action)) != NULL) { GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button)); GtkWidget *image = gtk_tool_button_get_icon_widget (button); if (!image) { image = gtk_image_new (); gtk_widget_show (image); gtk_tool_button_set_icon_widget (button, image); } gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size); } else if (gtk_action_get_icon_name (action)) gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); else gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); }
static void gtk_tool_button_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkToolButton *button = GTK_TOOL_BUTTON (object); switch (prop_id) { case PROP_LABEL: gtk_tool_button_set_label (button, g_value_get_string (value)); break; case PROP_USE_UNDERLINE: gtk_tool_button_set_use_underline (button, g_value_get_boolean (value)); break; case PROP_LABEL_WIDGET: gtk_tool_button_set_label_widget (button, g_value_get_object (value)); break; case PROP_STOCK_ID: gtk_tool_button_set_stock_id (button, g_value_get_string (value)); break; case PROP_ICON_NAME: gtk_tool_button_set_icon_name (button, g_value_get_string (value)); break; case PROP_ICON_WIDGET: gtk_tool_button_set_icon_widget (button, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/*# @method set_icon_name GtkToolButton @brief Sets the icon for the tool button from a named themed icon. @param the name of the themed icon, or nil. The "icon_name" property only has an effect if not overridden by non-NULL "label", "icon_widget" and "stock_id" properties. */ FALCON_FUNC ToolButton::set_icon_name( VMARG ) { Gtk::ArgCheck1 args( vm, "[S]" ); const gchar* ico = args.getCString( 0, false ); MYSELF; GET_OBJ( self ); gtk_tool_button_set_icon_name( (GtkToolButton*)_obj, ico ); }
static GtkToolItem * toggle_button_new (const char * icon, void (* toggled) (GtkToggleToolButton * button)) { GtkToolItem * item = gtk_toggle_tool_button_new (); gtk_tool_button_set_icon_name ((GtkToolButton *) item, icon); g_signal_connect (item, "toggled", (GCallback) toggled, NULL); return item; }
static GtkToolItem * toolbar_button_add (GtkWidget * toolbar, void (* callback) (void), const char * icon) { GtkToolItem * item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name ((GtkToolButton *) item, icon); gtk_toolbar_insert ((GtkToolbar *) toolbar, item, -1); g_signal_connect (item, "clicked", callback, NULL); return item; }
static void load_icon_items (GtkToolPalette *palette) { GList *contexts; GList *l; GtkIconTheme *icon_theme; icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (palette))); contexts = gtk_icon_theme_list_contexts (icon_theme); for (l = contexts; l; l = g_list_next (l)) { gchar *context = l->data; GList *icon_names; GList *ll; const guint max_icons = 10; guint icons_count = 0; GtkWidget *group = gtk_tool_item_group_new (context); gtk_container_add (GTK_CONTAINER (palette), group); if (g_strcmp0 (context, "Animations") == 0) continue; g_message ("Got context '%s'", context); icon_names = gtk_icon_theme_list_icons (icon_theme, context); icon_names = g_list_sort (icon_names, (GCompareFunc) strcmp); for (ll = icon_names; ll; ll = g_list_next (ll)) { GtkToolItem *item; gchar *id = ll->data; if (g_str_equal (id, "emblem-desktop")) continue; if (g_str_has_suffix (id, "-symbolic")) continue; g_message ("Got id '%s'", id); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), id); gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); /* Prevent us having an insane number of icons: */ ++icons_count; if(icons_count >= max_icons) break; } g_list_free_full (icon_names, g_free); } g_list_free_full (contexts, g_free); }
gboolean download_handle(WebKitDownload *download, gchar *suggested_filename, gpointer data) { gchar *sug_clean, *path, *path2 = NULL, *uri; GtkToolItem *tb; int suffix = 1; size_t i; sug_clean = g_strdup(suggested_filename); for (i = 0; i < strlen(sug_clean); i++) if (sug_clean[i] == G_DIR_SEPARATOR) sug_clean[i] = '_'; path = g_build_filename(download_dir, sug_clean, NULL); path2 = g_strdup(path); while (g_file_test(path2, G_FILE_TEST_EXISTS) && suffix < 1000) { g_free(path2); path2 = g_strdup_printf("%s.%d", path, suffix); suffix++; } if (suffix == 1000) { fprintf(stderr, __NAME__": Suffix reached limit for download.\n"); webkit_download_cancel(download); } else { uri = g_filename_to_uri(path2, NULL, NULL); webkit_download_set_destination(download, uri); g_free(uri); tb = gtk_tool_button_new(NULL, NULL); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(tb), "gtk-delete"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(tb), sug_clean); gtk_toolbar_insert(GTK_TOOLBAR(dm.toolbar), tb, 0); gtk_widget_show_all(dm.win); g_signal_connect(G_OBJECT(download), "notify::estimated-progress", G_CALLBACK(changed_download_progress), tb); g_object_ref(download); g_signal_connect(G_OBJECT(tb), "clicked", G_CALLBACK(downloadmanager_cancel), download); } g_free(sug_clean); g_free(path); g_free(path2); /* Propagate -- to whom it may concern. */ return FALSE; }
static inline GtkToolItem *_add_category_button (GtkWidget *pToolBar, const gchar *cLabel, const gchar *cIconName, int pos, GtkToolItem *group) { GtkToolItem *pCategoryButton; if (group) pCategoryButton= gtk_radio_tool_button_new_from_widget (GTK_RADIO_TOOL_BUTTON (group)); else pCategoryButton = gtk_radio_tool_button_new (NULL); gtk_tool_button_set_label (GTK_TOOL_BUTTON (pCategoryButton), cLabel); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (pCategoryButton), cIconName); g_signal_connect (G_OBJECT (pCategoryButton), "toggled", G_CALLBACK(on_click_category_button), GINT_TO_POINTER (pos)); gtk_toolbar_insert (GTK_TOOLBAR (pToolBar) , pCategoryButton, -1); return pCategoryButton; }
GtkWidget * create_toolbar (void) { GtkWidget *toolbar; GtkToolItem *item; toolbar = gtk_toolbar_new (); gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_tool_button_new (NULL, "Hello World"); gtk_tool_item_set_is_important (item, TRUE); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); return toolbar; }
static void glade_gtk_tool_button_set_icon_name (GObject * object, const GValue * value) { const gchar *name; g_return_if_fail (GTK_IS_TOOL_BUTTON (object)); name = g_value_get_string (value); if (name && strlen (name) == 0) name = NULL; gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (object), name); }
static GtkToolItem * toggle_button_new (const gchar * icon, const gchar * alt, void (* toggled) (GtkToggleToolButton * button)) { GtkToolItem * item = gtk_toggle_tool_button_new (); if (! alt) gtk_tool_button_set_stock_id ((GtkToolButton *) item, icon); else if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), icon)) gtk_tool_button_set_icon_name ((GtkToolButton *) item, icon); else gtk_tool_button_set_label ((GtkToolButton *) item, alt); g_signal_connect (item, "toggled", (GCallback) toggled, NULL); return item; }
void show_menu (bool_t show) { aud_set_bool ("gtkui", "menu_visible", show); if (show) { /* remove menu button from toolbar and show menu bar */ if (menu_main) gtk_widget_destroy (menu_main); if (menu_button) gtk_widget_destroy ((GtkWidget *) menu_button); if (! menu) { menu = make_menu_bar (accel); g_signal_connect (menu, "destroy", (GCallback) gtk_widget_destroyed, & menu); gtk_widget_show (menu); gtk_box_pack_start ((GtkBox *) menu_box, menu, TRUE, TRUE, 0); } } else { /* hide menu bar and add menu item to toolbar */ if (menu) gtk_widget_destroy (menu); if (! menu_main) { menu_main = make_menu_main (accel); g_signal_connect (menu_main, "destroy", (GCallback) gtk_widget_destroyed, & menu_main); g_signal_connect (menu_main, "hide", (GCallback) menu_hide_cb, NULL); } if (! menu_button) { menu_button = gtk_toggle_tool_button_new (); gtk_tool_button_set_icon_name ((GtkToolButton *) menu_button, "audacious"); g_signal_connect (menu_button, "destroy", (GCallback) gtk_widget_destroyed, & menu_button); gtk_widget_show ((GtkWidget *) menu_button); gtk_toolbar_insert ((GtkToolbar *) toolbar, menu_button, 0); g_signal_connect (menu_button, "toggled", (GCallback) menu_button_cb, NULL); } } }
void pragha_toolbar_playback_state_cb (PraghaBackend *backend, GParamSpec *pspec, gpointer user_data) { PraghaToolbar *toolbar = user_data; PraghaBackendState state = pragha_backend_get_state (backend); gboolean playing = (state != ST_STOPPED); gtk_widget_set_sensitive (GTK_WIDGET(toolbar->prev_button), playing); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(toolbar->play_button), (state == ST_PLAYING) ? "media-playback-pause" : "media-playback-start"); gtk_widget_set_sensitive (GTK_WIDGET(toolbar->stop_button), playing); gtk_widget_set_sensitive (GTK_WIDGET(toolbar->next_button), playing); if (playing == FALSE) pragha_toolbar_unset_song_info(toolbar); }
static void on_speaking(CainteoirSpeechSynthesizers *synthesizers, gboolean is_speaking, ReaderWindowPrivate *priv) { if (is_speaking) { cainteoir_timebar_set_time(CAINTEOIR_TIMEBAR(priv->timebar), cainteoir_speech_synthesizers_get_elapsed_time(priv->tts), cainteoir_speech_synthesizers_get_total_time(priv->tts)); cainteoir_timebar_set_progress(CAINTEOIR_TIMEBAR(priv->timebar), cainteoir_speech_synthesizers_get_percentage_complete(priv->tts)); } else { gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(priv->play_stop), "media-playback-start-symbolic"); reset_timebar(priv); } }
static void gtk_tool_button_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name) { GtkToolButton *button; GtkWidget *image; parent_activatable_iface->update (activatable, action, property_name); if (!gtk_activatable_get_use_action_appearance (activatable)) return; button = GTK_TOOL_BUTTON (activatable); if (strcmp (property_name, "short-label") == 0) gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); else if (strcmp (property_name, "stock-id") == 0) gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action)); else if (strcmp (property_name, "gicon") == 0) { const gchar *stock_id = gtk_action_get_stock_id (action); GIcon *icon = gtk_action_get_gicon (action); GtkIconSize icon_size = GTK_ICON_SIZE_BUTTON; if ((stock_id && gtk_icon_factory_lookup_default (stock_id)) || !icon) image = NULL; else { image = gtk_tool_button_get_icon_widget (button); icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button)); if (!image) image = gtk_image_new (); } gtk_tool_button_set_icon_widget (button, image); gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size); } else if (strcmp (property_name, "icon-name") == 0) gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); }
static void relations_diagram_customize (BrowserPage *page, GtkToolbar *toolbar, GtkHeaderBar *header) { g_print ("%s ()\n", __FUNCTION__); customization_data_init (G_OBJECT (page), toolbar, header); /* add perspective's actions */ customization_data_add_actions (G_OBJECT (page), win_entries, G_N_ELEMENTS (win_entries)); /* add to toolbar */ GtkToolItem *titem; titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "go-jump-symbolic"); gtk_widget_set_tooltip_text (GTK_WIDGET (titem), _("Manage data in selected tables")); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.ViewContents"); gtk_widget_show (GTK_WIDGET (titem)); customization_data_add_part (G_OBJECT (page), G_OBJECT (titem)); }
static void query_console_customize (BrowserPage *page, GtkToolbar *toolbar, GtkHeaderBar *header) { g_print ("%s ()\n", __FUNCTION__); customization_data_init (G_OBJECT (page), toolbar, header); /* add perspective's actions */ customization_data_add_actions (G_OBJECT (page), win_entries, G_N_ELEMENTS (win_entries)); /* add to toolbar */ GtkToolItem *titem; titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "system-run-symbolic"); gtk_widget_set_tooltip_text (GTK_WIDGET (titem), _("Execute query")); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.ExecuteQuery"); gtk_widget_show (GTK_WIDGET (titem)); customization_data_add_part (G_OBJECT (page), G_OBJECT (titem)); }
static void gtk_tool_button_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkToolButton *button = GTK_TOOL_BUTTON (object); switch (prop_id) { case PROP_LABEL: gtk_tool_button_set_label (button, g_value_get_string (value)); break; case PROP_USE_UNDERLINE: gtk_tool_button_set_use_underline (button, g_value_get_boolean (value)); break; case PROP_LABEL_WIDGET: gtk_tool_button_set_label_widget (button, g_value_get_object (value)); break; case PROP_STOCK_ID: G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_tool_button_set_stock_id (button, g_value_get_string (value)); G_GNUC_END_IGNORE_DEPRECATIONS; break; case PROP_ICON_NAME: gtk_tool_button_set_icon_name (button, g_value_get_string (value)); break; case PROP_ICON_WIDGET: gtk_tool_button_set_icon_widget (button, g_value_get_object (value)); break; case PROP_ACTION_NAME: g_object_set_property (G_OBJECT (button->priv->button), "action-name", value); break; case PROP_ACTION_TARGET: g_object_set_property (G_OBJECT (button->priv->button), "action-target", value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void ui_playback_stop (void) { if (update_song_timeout_source) { g_source_remove(update_song_timeout_source); update_song_timeout_source = 0; } if (delayed_title_change_source) g_source_remove (delayed_title_change_source); /* Don't update the window title immediately; we may be about to start * another song. */ delayed_title_change_source = g_idle_add ((GSourceFunc) title_change_cb, NULL); gtk_tool_button_set_icon_name ((GtkToolButton *) button_play, "media-playback-start"); gtk_widget_set_sensitive ((GtkWidget *) button_stop, FALSE); gtk_widget_hide (slider); gtk_widget_hide (label_time); }
static void set_button(gint number, gboolean visible) { Button *button = &buttons[number]; GtkToolItem *item = button_widgets[number]; if (item == NULL) { if (button->icon == NULL) item = ((GtkToolItem* (*)(void))button->cb)(); else { item = gtk_tool_button_new(NULL, button->label); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), button->icon); g_signal_connect(item, "clicked", G_CALLBACK(button->cb), button->user_data); } g_object_ref_sink(item); button_widgets[number] = item; } if (visible) { if (gtk_widget_get_parent(GTK_WIDGET(item)) == NULL) { int i; int item_pos = 0; for (i = 0; i < number; ++i) if (buttons_mask & (1 << i)) ++item_pos; gtk_widget_show(GTK_WIDGET(item)); gtk_toolbar_insert(toolbar, item, item_pos); buttons_mask |= (1 << number); } } else { if (gtk_widget_get_parent(GTK_WIDGET(item))) { gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); buttons_mask &= ~(1 << number); } } }
static void tpaw_irc_network_chooser_dialog_constructed (GObject *object) { TpawIrcNetworkChooserDialog *self = (TpawIrcNetworkChooserDialog *) object; GtkDialog *dialog = GTK_DIALOG (self); GtkCellRenderer *renderer; GtkWidget *vbox; GtkTreeViewColumn *column; GtkWidget *scroll; GtkWidget *toolbar; GtkToolItem *item; GtkStyleContext *context; g_assert (self->priv->settings != NULL); gtk_window_set_title (GTK_WINDOW (self), _("Choose an IRC network")); /* Create store and treeview */ self->priv->store = gtk_list_store_new (2, G_TYPE_OBJECT, G_TYPE_STRING); gtk_tree_sortable_set_sort_column_id ( GTK_TREE_SORTABLE (self->priv->store), COL_NETWORK_NAME, GTK_SORT_ASCENDING); self->priv->treeview = gtk_tree_view_new (); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (self->priv->treeview), FALSE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (self->priv->treeview), FALSE); column = gtk_tree_view_column_new (); gtk_tree_view_append_column (GTK_TREE_VIEW (self->priv->treeview), column); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column), renderer, "text", COL_NETWORK_NAME, NULL); /* add the treeview in a GtkScrolledWindow */ vbox = gtk_dialog_get_content_area (dialog); scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (scroll), self->priv->treeview); gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 6); /* Treeview toolbar */ toolbar = gtk_toolbar_new (); gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0); item = gtk_tool_button_new (NULL, ""); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-add-symbolic"); g_signal_connect (item, "clicked", G_CALLBACK (add_clicked_cb), self); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_tool_button_new (NULL, ""); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-remove-symbolic"); g_signal_connect (item, "clicked", G_CALLBACK (remove_clicked_cb), self); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_tool_button_new (NULL, ""); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "preferences-system-symbolic"); g_signal_connect (item, "clicked", G_CALLBACK (edit_clicked_cb), self); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); context = gtk_widget_get_style_context (scroll); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM); context = gtk_widget_get_style_context (toolbar); gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); /* Live search */ self->priv->search = tpaw_live_search_new (self->priv->treeview); gtk_box_pack_start (GTK_BOX (vbox), self->priv->search, FALSE, TRUE, 0); self->priv->filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new ( GTK_TREE_MODEL (self->priv->store), NULL)); gtk_tree_model_filter_set_visible_func (self->priv->filter, filter_visible_func, self, NULL); gtk_tree_view_set_model (GTK_TREE_VIEW (self->priv->treeview), GTK_TREE_MODEL (self->priv->filter)); self->priv->search_sig = g_signal_connect (self->priv->search, "notify::text", G_CALLBACK (search_text_notify_cb), self); self->priv->activate_sig = g_signal_connect (self->priv->search, "activate", G_CALLBACK (search_activate_cb), self); /* Add buttons */ gtk_dialog_add_buttons (dialog, _("Reset _Networks List"), RESPONSE_RESET, NULL); self->priv->select_button = gtk_dialog_add_button (dialog, C_("verb displayed on a button to select an IRC network", "Select"), GTK_RESPONSE_CLOSE); fill_store (self); g_signal_connect (self->priv->treeview, "cursor-changed", G_CALLBACK (treeview_changed_cb), self); g_signal_connect (self, "response", G_CALLBACK (dialog_response_cb), self); /* Request a side ensuring to display at least some networks */ gtk_widget_set_size_request (GTK_WIDGET (self), -1, 300); gtk_window_set_modal (GTK_WINDOW (self), TRUE); }
GtkWidget * reader_window_new(GtkApplication *application, CainteoirSettings *settings, CainteoirSpeechSynthesizers *synthesizers, const gchar *filename) { ReaderWindow *reader = READER_WINDOW(g_object_new(READER_TYPE_WINDOW, "application", application, nullptr)); ReaderWindowPrivate *priv = READER_WINDOW_PRIVATE(reader); priv->self = GTK_WIDGET(reader); priv->settings = CAINTEOIR_SETTINGS(g_object_ref(G_OBJECT(settings))); priv->tts = CAINTEOIR_SPEECH_SYNTHESIZERS(g_object_ref(G_OBJECT(synthesizers))); priv->application = READER_APPLICATION(application); gtk_window_set_default_size(GTK_WINDOW(reader), INDEX_PANE_WIDTH + DOCUMENT_PANE_WIDTH + 5, 300); gtk_window_set_title(GTK_WINDOW(reader), i18n("Cainteoir Text-to-Speech")); GtkWidget *layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(reader), layout); priv->header = gtk_header_bar_new(); gtk_header_bar_set_title(GTK_HEADER_BAR(priv->header), i18n("Cainteoir Text-to-Speech")); if (cainteoir_settings_get_boolean(priv->settings, "window", "have-csd", TRUE)) { // Use client-side decorations (e.g. on Gnome Shell and Unity) ... gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(priv->header), TRUE); gtk_window_set_titlebar(GTK_WINDOW(reader), priv->header); } else { // Don't use client-side decorations (e.g. on KDE) ... gtk_box_pack_start(GTK_BOX(layout), priv->header, FALSE, FALSE, 0); } priv->actions = create_action_group(priv); gtk_widget_insert_action_group(GTK_WIDGET(reader), "cainteoir", G_ACTION_GROUP(priv->actions)); priv->view = reader_document_view_new(priv->settings); gtk_box_pack_start(GTK_BOX(layout), priv->view, TRUE, TRUE, 0); reader_document_view_set_index_pane_close_action_name(READER_DOCUMENT_VIEW(priv->view), "cainteoir.side-pane"); GtkWidget *bottombar = gtk_toolbar_new(); gtk_widget_set_size_request(bottombar, -1, 45); gtk_style_context_add_class(gtk_widget_get_style_context(bottombar), "bottombar"); gtk_box_pack_start(GTK_BOX(layout), bottombar, FALSE, FALSE, 0); GtkToolItem *record = gtk_tool_button_new(gtk_image_new_from_icon_name("media-record-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR), nullptr); gtk_toolbar_insert(GTK_TOOLBAR(bottombar), record, -1); gtk_actionable_set_action_name(GTK_ACTIONABLE(record), "cainteoir.record"); priv->play_stop = gtk_tool_button_new(nullptr, nullptr); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(priv->play_stop), "media-playback-start-symbolic"); gtk_toolbar_insert(GTK_TOOLBAR(bottombar), priv->play_stop, -1); gtk_actionable_set_action_name(GTK_ACTIONABLE(priv->play_stop), "cainteoir.play-stop"); GtkToolItem *open = gtk_tool_button_new(gtk_image_new_from_icon_name("document-open-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR), nullptr); gtk_toolbar_insert(GTK_TOOLBAR(bottombar), open, -1); gtk_actionable_set_action_name(GTK_ACTIONABLE(open), "cainteoir.open"); GtkToolItem *timebar = gtk_tool_item_new(); gtk_tool_item_set_expand(GTK_TOOL_ITEM(timebar), TRUE); gtk_toolbar_insert(GTK_TOOLBAR(bottombar), timebar, -1); priv->timebar = cainteoir_timebar_new(); gtk_style_context_add_class(gtk_widget_get_style_context(priv->timebar), "timebar"); gtk_container_add(GTK_CONTAINER(timebar), priv->timebar); priv->previous = gtk_button_new(); gtk_button_set_image(GTK_BUTTON(priv->previous), gtk_image_new_from_icon_name("go-previous-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR)); gtk_header_bar_pack_start(GTK_HEADER_BAR(priv->header), priv->previous); gtk_actionable_set_action_name(GTK_ACTIONABLE(priv->previous), "cainteoir.view-previous"); GtkWidget *menu_button = gtk_menu_button_new(); gtk_button_set_image(GTK_BUTTON(menu_button), gtk_image_new_from_icon_name(HAMBURGER_MENU_ICON, GTK_ICON_SIZE_SMALL_TOOLBAR)); gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(menu_button), create_main_menu()); gtk_header_bar_pack_end(GTK_HEADER_BAR(priv->header), menu_button); g_signal_connect(reader, "window-state-event", G_CALLBACK(on_window_state_changed), priv->settings); g_signal_connect(reader, "delete_event", G_CALLBACK(on_window_delete), priv); g_signal_connect(reader, "show", G_CALLBACK(on_window_show), priv); g_signal_connect(priv->tts, "speaking", G_CALLBACK(on_speaking), priv); g_signal_connect(priv->tts, "text-range-changed", G_CALLBACK(on_text_range_changed), priv); gtk_window_resize(GTK_WINDOW(reader), cainteoir_settings_get_integer(priv->settings, "window", "width", 700), cainteoir_settings_get_integer(priv->settings, "window", "height", 445)); gtk_window_move(GTK_WINDOW(reader), cainteoir_settings_get_integer(priv->settings, "window", "left", 0), cainteoir_settings_get_integer(priv->settings, "window", "top", 0)); if (cainteoir_settings_get_boolean(priv->settings, "window", "maximized", FALSE)) gtk_window_maximize(GTK_WINDOW(reader)); if (filename) reader_window_load_document(reader, filename); else { gchar *prev_filename = cainteoir_settings_get_string(priv->settings, "document", "filename", nullptr); if (prev_filename) { reader_window_load_document(reader, prev_filename); g_free(prev_filename); } } gchar *anchor = cainteoir_settings_get_string(priv->settings, "highlight", "anchor", "none"); if (anchor) { if (!strcmp(anchor, "top")) reader_window_set_highlight_anchor(reader, GTK_ALIGN_START); else if (!strcmp(anchor, "middle")) reader_window_set_highlight_anchor(reader, GTK_ALIGN_CENTER); else if (!strcmp(anchor, "bottom")) reader_window_set_highlight_anchor(reader, GTK_ALIGN_END); g_free(anchor); } return GTK_WIDGET(reader); }
static void on_speak(ReaderWindowPrivate *priv) { gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(priv->play_stop), "media-playback-stop-symbolic"); }
void ghb_queue_buttons_grey(signal_user_data_t *ud) { GtkWidget *widget; GtkAction *action; gint queue_count; gint titleindex; gint queue_state, scan_state; gboolean show_start, show_stop, paused; queue_count = ghb_array_len(ud->queue); titleindex = ghb_settings_combo_int(ud->settings, "title"); queue_state = ghb_get_queue_state(); scan_state = ghb_get_scan_state(); show_stop = queue_state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING | GHB_STATE_SCANNING | GHB_STATE_MUXING); show_start = !(scan_state & GHB_STATE_SCANNING) && (titleindex >= 0 || queue_count > 0); paused = queue_state & GHB_STATE_PAUSED; widget = GHB_WIDGET(ud->builder, "queue_add"); gtk_widget_set_sensitive(widget, show_start); action = GHB_ACTION(ud->builder, "queue_add_menu"); gtk_action_set_sensitive(action, show_start); action = GHB_ACTION(ud->builder, "queue_add_all_menu"); gtk_action_set_sensitive(action, show_start); widget = GHB_WIDGET (ud->builder, "queue_start1"); if (show_stop) { gtk_widget_set_sensitive (widget, TRUE); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding"); } else { gtk_widget_set_sensitive (widget, show_start); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding"); } widget = GHB_WIDGET (ud->builder, "queue_start2"); if (show_stop) { gtk_widget_set_sensitive (widget, TRUE); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding"); } else { gtk_widget_set_sensitive (widget, show_start); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding"); } widget = GHB_WIDGET (ud->builder, "queue_pause1"); if (paused) { gtk_widget_set_sensitive (widget, show_stop); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding"); } else { gtk_widget_set_sensitive (widget, show_stop); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding"); } widget = GHB_WIDGET (ud->builder, "queue_pause2"); if (paused) { gtk_widget_set_sensitive (widget, show_stop); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding"); } else { gtk_widget_set_sensitive (widget, show_stop); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause"); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding"); } action = GHB_ACTION (ud->builder, "queue_start_menu"); if (show_stop) { gtk_action_set_sensitive (action, TRUE); #if GTK_CHECK_VERSION(2, 16, 0) gtk_action_set_icon_name(action, "hb-stop"); gtk_action_set_label(action, "S_top Queue"); gtk_action_set_tooltip(action, "Stop Encoding"); #else g_object_set_property(G_OBJECT(action), "icon-name", ghb_string_value("hb-stop")); g_object_set_property(G_OBJECT(action), "label", ghb_string_value("S_top Queue")); g_object_set_property(G_OBJECT(action), "tooltip", ghb_string_value("Stop Encoding")); #endif } else { gtk_action_set_sensitive (action, show_start); #if GTK_CHECK_VERSION(2, 16, 0) gtk_action_set_icon_name(action, "hb-start"); gtk_action_set_label(action, "_Start Queue"); gtk_action_set_tooltip(action, "Start Encoding"); #else g_object_set_property(G_OBJECT(action), "icon-name", ghb_string_value("hb-start")); g_object_set_property(G_OBJECT(action), "label", ghb_string_value("_Start Queue")); g_object_set_property(G_OBJECT(action), "tooltip", ghb_string_value("Start Encoding")); #endif } action = GHB_ACTION (ud->builder, "queue_pause_menu"); if (paused) { gtk_action_set_sensitive (action, show_start); #if GTK_CHECK_VERSION(2, 16, 0) gtk_action_set_icon_name(action, "hb-start"); gtk_action_set_label(action, "_Resume Queue"); gtk_action_set_tooltip(action, "Resume Encoding"); #else g_object_set_property(G_OBJECT(action), "icon-name", ghb_string_value("hb-start")); g_object_set_property(G_OBJECT(action), "label", ghb_string_value("_Resume Queue")); g_object_set_property(G_OBJECT(action), "tooltip", ghb_string_value("Resume Encoding")); #endif } else { gtk_action_set_sensitive (action, show_stop); #if GTK_CHECK_VERSION(2, 16, 0) gtk_action_set_icon_name(action, "hb-pause"); gtk_action_set_label(action, "_Pause Queue"); gtk_action_set_tooltip(action, "Pause Encoding"); #else g_object_set_property(G_OBJECT(action), "icon-name", ghb_string_value("hb-pause")); g_object_set_property(G_OBJECT(action), "label", ghb_string_value("_Pause Queue")); g_object_set_property(G_OBJECT(action), "tooltip", ghb_string_value("Pause Encoding")); #endif } }
static void load_special_items (GtkToolPalette *palette) { GtkToolItem *item; GtkWidget *group; GtkWidget *label_button; group = gtk_tool_item_group_new (NULL); label_button = gtk_button_new_with_label ("Advanced Features"); gtk_widget_show (label_button); gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group), label_button); gtk_container_add (GTK_CONTAINER (palette), group); item = create_entry_item ("homogeneous=FALSE"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item), "homogeneous", FALSE, NULL); item = create_entry_item ("homogeneous=FALSE, expand=TRUE"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item), "homogeneous", FALSE, "expand", TRUE, NULL); item = create_entry_item ("homogeneous=FALSE, expand=TRUE, fill=FALSE"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item), "homogeneous", FALSE, "expand", TRUE, "fill", FALSE, NULL); item = create_entry_item ("homogeneous=FALSE, expand=TRUE, new-row=TRUE"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item), "homogeneous", FALSE, "expand", TRUE, "new-row", TRUE, NULL); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-up"); gtk_tool_item_set_tooltip_text (item, "Show on vertical palettes only"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_tool_item_set_visible_horizontal (item, FALSE); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next"); gtk_tool_item_set_tooltip_text (item, "Show on horizontal palettes only"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_tool_item_set_visible_vertical (item, FALSE); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "edit-delete"); gtk_tool_item_set_tooltip_text (item, "Do not show at all"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_widget_set_no_show_all (GTK_WIDGET (item), TRUE); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "view-fullscreen"); gtk_tool_item_set_tooltip_text (item, "Expanded this item"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item), "homogeneous", FALSE, "expand", TRUE, NULL); item = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "help-browser"); gtk_tool_item_set_tooltip_text (item, "A regular item"); gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1); }
int main( int argc, char *argv[]) { gtk_init(&argc, &argv); //applet_widget_init(PACKAGE, VERSION, argc, argv, NULL, 0, NULL); GError **error; GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); //GtkWidget *view = create_tree(); GtkWidget *vbox = gtk_vbox_new(FALSE, 8); //GtkWidget *iconbox = gtk_hbox_new(FALSE, 8); GtkWidget *iconbox = gtk_toolbar_new (); GdkPixbuf *session_pixbuf; GtkToolItem *session_icon; GdkPixbuf *system_pixbuf; GtkToolItem *system_icon; GtkWidget *service_name_list = gtk_scrolled_window_new(NULL, NULL); GtkTreeModel *model; GtkWidget *treeview; GtkCellRenderer *renderer; GtkTreeViewColumn *column; gtk_window_set_title(GTK_WINDOW(window), "DBus-Xray" ); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new( "System and Session Service Name List") , FALSE, FALSE, 0); session_icon = gtk_tool_button_new( NULL, "Session List" ); gtk_tool_button_set_icon_name( GTK_TOOL_BUTTON( session_icon ), "config-users" ); system_icon = gtk_tool_button_new( NULL, "System List" ); gtk_tool_button_set_icon_name( GTK_TOOL_BUTTON( session_icon ), "ksysguard" ); gtk_toolbar_insert (GTK_TOOLBAR (iconbox), system_icon , -1); gtk_toolbar_insert (GTK_TOOLBAR (iconbox), session_icon , -1); gtk_box_pack_start(GTK_BOX(vbox), iconbox , FALSE, FALSE, 0); //gtk_box_pack_start(GTK_BOX(iconbox), gtk_icon_new("system"), FALSE, FALSE, 0); //gtk_box_pack_start(GTK_BOX(iconbox), gtk_icon_new("session"), FALSE, FALSE, 0); // need to update to non-fix path search //session_pixbuf = gdk_pixbuf_new_from_file ("/usr/share/icons/Tango/scalable/apps/system-users.svg", error); //system_pixbuf = gdk_pixbuf_new_from_file ("/usr/share/icons/Tango/scalable/apps/ksysguard.svg", error); //gtk_box_pack_start(GTK_BOX(vbox), service_name_list, FALSE, FALSE, 0); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (service_name_list), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (service_name_list), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (vbox), service_name_list , TRUE, TRUE, 0); /* create tree model */ model = create_model (); /* create tree view */ treeview = gtk_tree_view_new_with_model (model); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE); //gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview), COLUMN_DESCRIPTION); // g_object_unref (model); gtk_container_add (GTK_CONTAINER (service_name_list), treeview); /* column for fixed toggles */ renderer = gtk_cell_renderer_text_new (); //g_signal_connect (renderer, "toggled", G_CALLBACK (fixed_toggled), model); column = gtk_tree_view_column_new_with_attributes ("Index", renderer, "text", INDEX, NULL); gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 100); gtk_tree_view_append_column (treeview, column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Service Name", renderer, "text", SERVICE_NAME, NULL); gtk_tree_view_column_set_sort_column_id (column, SERVICE_NAME ); gtk_tree_view_append_column (treeview, column); gtk_widget_show_all(window); gtk_main(); return 0; }
GtkWidget * dsn_config_new (void) { DsnConfigPrivate *priv; GtkWidget *dsn; GtkWidget *label; GtkWidget *sw; gchar *title; GdaDataModel *model; priv = g_new0 (DsnConfigPrivate, 1); dsn = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_widget_show (dsn); gtk_container_set_border_width (GTK_CONTAINER (dsn), 6); g_object_set_data_full (G_OBJECT (dsn), DSN_CONFIG_DATA, priv, (GDestroyNotify) free_private_data); /* title */ title = g_strdup_printf ("<b>%s</b>\n%s", _("Data Sources"), _("Data sources are the means by which database " "connections are identified: all " "the information needed to open a connection to " "a specific database using a 'provider' is referenced using " "a unique name.")); priv->title = gdaui_bar_new (title); g_free (title); gdaui_bar_set_icon_from_resource (GDAUI_BAR (priv->title), "/images/gdaui-generic.png"); gtk_box_pack_start (GTK_BOX (dsn), priv->title, FALSE, FALSE, 0); gtk_widget_show (priv->title); /* horizontal box for the provider list and its properties */ GtkWidget *hbox; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (dsn), hbox, TRUE, TRUE, 0); /* left part */ GtkWidget *vbox; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_size_request (vbox, 150, -1); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); /* create the data source list */ sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); model = gda_config_list_dsn (); priv->dsn_list = gdaui_raw_grid_new (model); gtk_tree_view_move_column_after (GTK_TREE_VIEW (priv->dsn_list), gtk_tree_view_get_column (GTK_TREE_VIEW (priv->dsn_list), 1), gtk_tree_view_get_column (GTK_TREE_VIEW (priv->dsn_list), 2)); g_object_unref (model); g_object_set_data (G_OBJECT (dsn), "grid", priv->dsn_list); gdaui_data_proxy_column_set_editable (GDAUI_DATA_PROXY (priv->dsn_list), 0, FALSE); gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), -1, FALSE); gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), 0, TRUE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->dsn_list), FALSE); g_object_set (priv->dsn_list, "info-cell-visible", FALSE, NULL); gtk_container_add (GTK_CONTAINER (sw), priv->dsn_list); g_signal_connect (priv->dsn_list, "selection-changed", G_CALLBACK (list_selection_changed_cb), dsn); g_signal_connect (priv->dsn_list, "populate-popup", G_CALLBACK (list_popup_cb), dsn); /* add/delete buttons */ GtkWidget *toolbar; toolbar = gtk_toolbar_new (); gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "inline-toolbar"); gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0); GtkToolItem *titem; titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "list-add-symbolic"); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.DatasourceNew"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); titem = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (titem), "list-remove-symbolic"); gtk_actionable_set_action_name (GTK_ACTIONABLE (titem), "win.DatasourceDelete"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), titem, -1); /* create the data source's properties */ GtkWidget *stack; stack = gtk_stack_new (); priv->stack = stack; gtk_box_pack_start (GTK_BOX (hbox), stack, TRUE, TRUE, 10); label = gtk_label_new (_("No data source selected.")); gtk_stack_add_named (GTK_STACK (stack), label, ST_NOPROP); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_stack_add_named (GTK_STACK (stack), vbox, ST_PROP); GtkWidget *form; form = gdaui_dsn_editor_new (); priv->dsn_editor = GDAUI_DSN_EDITOR (form); gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0); g_signal_connect (priv->dsn_editor, "changed", G_CALLBACK (dsn_editor_changed_cb), dsn); /* action buttons */ GtkWidget *hbox2; hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 6); GtkWidget *bbox; bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_hexpand (bbox, TRUE); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_CENTER); gtk_box_pack_start (GTK_BOX (hbox2), bbox, FALSE, FALSE, 6); GtkWidget *button; button = gtk_toggle_button_new_with_label (_("Definition")); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); priv->view_buttons [GDAUI_DSN_EDITOR_PANE_DEFINITION] = GTK_TOGGLE_BUTTON (button); g_signal_connect (button, "toggled", G_CALLBACK (view_toggled_cb), dsn); button = gtk_toggle_button_new_with_label (_("Parameters")); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); priv->view_buttons [GDAUI_DSN_EDITOR_PANE_PARAMS] = GTK_TOGGLE_BUTTON (button); g_signal_connect (button, "toggled", G_CALLBACK (view_toggled_cb), dsn); button = gtk_toggle_button_new_with_label (_("Authentication")); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); priv->view_buttons [GDAUI_DSN_EDITOR_PANE_AUTH] = GTK_TOGGLE_BUTTON (button); g_signal_connect (button, "toggled", G_CALLBACK (view_toggled_cb), dsn); button = gtk_button_new_from_icon_name ("document-save-symbolic", GTK_ICON_SIZE_BUTTON); gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0); priv->commit_button = button; gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_tooltip_text (button, _("Write changes made to the DSN")); g_signal_connect (button, "clicked", G_CALLBACK (save_cb), dsn); gtk_widget_show_all (hbox); return dsn; }
static void pragha_toolbar_init (PraghaToolbar *toolbar) { PraghaPreferences *preferences; GtkToolItem *prev_button, *play_button, *stop_button, *next_button; GtkToolItem *unfull_button, *shuffle_button, *repeat_button; GtkWidget *vol_button; const GBindingFlags binding_flags = G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL; preferences = pragha_preferences_get(); /* Setup Left control buttons */ prev_button = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(prev_button), "media-skip-backward"); gtk_widget_set_tooltip_text(GTK_WIDGET(prev_button), _("Previous Track")); toolbar->prev_button = prev_button; play_button = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(play_button), "media-playback-start"); gtk_widget_set_tooltip_text(GTK_WIDGET(play_button), _("Play / Pause Track")); toolbar->play_button = play_button; stop_button = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(stop_button), "media-playback-stop"); gtk_widget_set_tooltip_text(GTK_WIDGET(stop_button), _("Stop playback")); toolbar->stop_button = stop_button; next_button = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(next_button), "media-skip-forward"); gtk_widget_set_tooltip_text(GTK_WIDGET(next_button), _("Next Track")); toolbar->next_button = next_button; #if GTK_CHECK_VERSION (3, 12, 0) gtk_header_bar_pack_start(GTK_HEADER_BAR(toolbar), GTK_WIDGET(prev_button)); gtk_header_bar_pack_start(GTK_HEADER_BAR(toolbar), GTK_WIDGET(play_button)); gtk_header_bar_pack_start(GTK_HEADER_BAR(toolbar), GTK_WIDGET(stop_button)); gtk_header_bar_pack_start(GTK_HEADER_BAR(toolbar), GTK_WIDGET(next_button)); #else gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(prev_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(play_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(stop_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(next_button)); #endif /* Song info Box */ #if !GTK_CHECK_VERSION (3, 12, 0) GtkToolItem *boxitem = gtk_tool_item_new (); gtk_tool_item_set_expand (GTK_TOOL_ITEM(boxitem), TRUE); gtk_toolbar_insert (GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(boxitem), -1); GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add (GTK_CONTAINER(boxitem), box); GtkWidget *playing = pragha_toolbar_get_song_box (toolbar); gtk_box_pack_start (GTK_BOX(box), playing, TRUE, TRUE, 5); #endif /* Setup Right control buttons */ unfull_button = gtk_tool_button_new (NULL, NULL); gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(unfull_button), "view-restore"); gtk_widget_set_tooltip_text(GTK_WIDGET(unfull_button), _("Leave Fullscreen")); toolbar->unfull_button = unfull_button; shuffle_button = gtk_toggle_tool_button_new(); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(shuffle_button), "media-playlist-shuffle"); gtk_widget_set_tooltip_text(GTK_WIDGET(shuffle_button), _("Play songs in a random order")); repeat_button = gtk_toggle_tool_button_new (); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(repeat_button), "media-playlist-repeat"); gtk_widget_set_tooltip_text(GTK_WIDGET(repeat_button), _("Repeat playback list at the end")); vol_button = gtk_volume_button_new(); g_object_set(vol_button, "use-symbolic", FALSE, NULL); gtk_button_set_relief(GTK_BUTTON(vol_button), GTK_RELIEF_NONE); g_object_set(G_OBJECT(vol_button), "size", GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); toolbar->vol_button = vol_button; toolbar->extra_button_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); #if GTK_CHECK_VERSION (3, 12, 0) gtk_header_bar_pack_end(GTK_HEADER_BAR(toolbar), GTK_WIDGET(toolbar->extra_button_box)); gtk_header_bar_pack_end(GTK_HEADER_BAR(toolbar), GTK_WIDGET(vol_button)); gtk_header_bar_pack_end(GTK_HEADER_BAR(toolbar), GTK_WIDGET(repeat_button)); gtk_header_bar_pack_end(GTK_HEADER_BAR(toolbar), GTK_WIDGET(shuffle_button)); gtk_header_bar_pack_end(GTK_HEADER_BAR(toolbar), GTK_WIDGET(unfull_button)); #else gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(unfull_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(shuffle_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(repeat_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(vol_button)); gtk_tool_insert_generic_item(GTK_TOOLBAR(toolbar), GTK_WIDGET(toolbar->extra_button_box)); #endif /* Connect signals */ g_signal_connect(G_OBJECT(prev_button), "clicked", G_CALLBACK(prev_button_handler), toolbar); g_signal_connect(G_OBJECT(play_button), "clicked", G_CALLBACK(play_button_handler), toolbar); g_signal_connect(G_OBJECT(stop_button), "clicked", G_CALLBACK(stop_button_handler), toolbar); g_signal_connect(G_OBJECT(next_button), "clicked", G_CALLBACK(next_button_handler), toolbar); g_signal_connect(G_OBJECT(unfull_button), "clicked", G_CALLBACK(unfull_button_handler), toolbar); /*g_signal_connect(G_OBJECT (prev_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (play_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (stop_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (next_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (next_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (unfull_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (shuffle_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (repeat_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar); g_signal_connect(G_OBJECT (vol_button), "key-press-event", G_CALLBACK(panel_button_key_press), toolbar);*/ g_signal_connect (G_OBJECT (vol_button), "value-changed", G_CALLBACK (vol_button_value_changed), toolbar); g_object_bind_property(preferences, "shuffle", shuffle_button, "active", binding_flags); g_object_bind_property(preferences, "repeat", repeat_button, "active", binding_flags); /* Fix styling */ #if GTK_CHECK_VERSION (3, 12, 0) pragha_toolbar_set_style(toolbar, pragha_preferences_get_gnome_style (preferences)); #endif gtk_widget_show(GTK_WIDGET(prev_button)); gtk_widget_show(GTK_WIDGET(play_button)); gtk_widget_show(GTK_WIDGET(stop_button)); gtk_widget_show(GTK_WIDGET(next_button)); gtk_widget_show(GTK_WIDGET(shuffle_button)); gtk_widget_show(GTK_WIDGET(repeat_button)); gtk_widget_show(GTK_WIDGET(vol_button)); gtk_widget_hide(GTK_WIDGET(toolbar->unfull_button)); gtk_widget_show(GTK_WIDGET(toolbar)); g_object_unref(preferences); }
static void gw_settingswindow_init_styles (GwSettingsWindow *window) { //Declarations GtkToolbar *toolbar; GtkStyleContext *context; GtkWidget *widget; //Vocabulary list pane widget = GTK_WIDGET (gw_window_get_object (GW_WINDOW (window), "dictionary_scrolledwindow")); context = gtk_widget_get_style_context (widget); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM); gtk_widget_reset_style (widget); toolbar = GTK_TOOLBAR (gw_window_get_object (GW_WINDOW (window), "dictionary_toolbar")); widget = GTK_WIDGET (toolbar); context = gtk_widget_get_style_context (widget); gtk_style_context_add_class (context, "inline-toolbar"); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); gtk_widget_reset_style (widget); { GtkIconTheme *theme; GtkToolItem *item; theme = gtk_icon_theme_get_default (); item = gtk_tool_button_new_from_stock (GTK_STOCK_ADD); if (gtk_icon_theme_has_icon (theme, "list-add-symbolic")) { gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-add-symbolic"); gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (item), NULL); } gtk_toolbar_insert (toolbar, item, -1); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (item), "win.add-dictionary"); gtk_widget_show (GTK_WIDGET (item)); item = gtk_tool_button_new_from_stock (GTK_STOCK_REMOVE); if (gtk_icon_theme_has_icon (theme, "list-remove-symbolic")) { gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-remove-symbolic"); gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (item), NULL); } gtk_toolbar_insert (toolbar, item, -1); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (item), "win.remove-dictionary"); gtk_widget_show (GTK_WIDGET (item)); } //Vocabulary listitem pane widget = GTK_WIDGET (gw_window_get_object (GW_WINDOW (window), "plugin_scrolledwindow")); context = gtk_widget_get_style_context (widget); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM); gtk_widget_reset_style (widget); toolbar = GTK_TOOLBAR (gw_window_get_object (GW_WINDOW (window), "plugin_toolbar")); widget = GTK_WIDGET (toolbar); context = gtk_widget_get_style_context (widget); gtk_style_context_add_class (context, "inline-toolbar"); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); gtk_widget_reset_style (widget); { GtkIconTheme *theme; GtkToolItem *item; theme = gtk_icon_theme_get_default (); item = gtk_tool_button_new_from_stock (GTK_STOCK_ADD); if (gtk_icon_theme_has_icon (theme, "list-add-symbolic")) { gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-add-symbolic"); gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (item), NULL); } gtk_toolbar_insert (toolbar, item, -1); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (item), "win.add-plugin"); gtk_widget_show (GTK_WIDGET (item)); item = gtk_tool_button_new_from_stock (GTK_STOCK_REMOVE); if (gtk_icon_theme_has_icon (theme, "list-remove-symbolic")) { gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-remove-symbolic"); gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (item), NULL); } gtk_toolbar_insert (toolbar, item, -1); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (item), "win.remove-plugin"); gtk_widget_show (GTK_WIDGET (item)); } }