static void report_error(struct gui_entry *ge, GError *error) { struct gui *ui = ge->ui; if (ui->error_info_bar == NULL) { GtkWidget *container; ui->error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); g_signal_connect(ui->error_info_bar, "response", G_CALLBACK(on_info_bar_response), ui); gtk_info_bar_set_message_type(GTK_INFO_BAR(ui->error_info_bar), GTK_MESSAGE_ERROR); ui->error_label = gtk_label_new(error->message); container = gtk_info_bar_get_content_area(GTK_INFO_BAR(ui->error_info_bar)); gtk_container_add(GTK_CONTAINER(container), ui->error_label); gtk_box_pack_start(GTK_BOX(ui->vbox), ui->error_info_bar, FALSE, FALSE, 0); gtk_widget_show_all(ui->vbox); } else { char buffer[256]; snprintf(buffer, sizeof(buffer), "Failed to open file."); gtk_label_set_text(GTK_LABEL(ui->error_label), buffer); } }
void report_error(GError* error) { if (error == NULL) { return; } if (error_info_bar == NULL) { error_count = 1; error_info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); g_signal_connect(error_info_bar, "response", G_CALLBACK(on_info_bar_response), NULL); gtk_info_bar_set_message_type(GTK_INFO_BAR(error_info_bar), GTK_MESSAGE_ERROR); error_label = gtk_label_new(error->message); GtkWidget *container = gtk_info_bar_get_content_area(GTK_INFO_BAR(error_info_bar)); gtk_container_add(GTK_CONTAINER(container), error_label); gtk_box_pack_start(GTK_BOX(main_vbox), error_info_bar, FALSE, FALSE, 0); gtk_widget_show_all(main_vbox); } else { error_count++; char buffer[256]; snprintf(buffer, sizeof(buffer), "Failed to open %i files.", error_count); gtk_label_set(GTK_LABEL(error_label), buffer); } }
static void spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget *self, const gchar *message, GtkMessageType message_type, const gchar *stock_icon_id) { SpiceUsbDeviceWidgetPrivate *priv = self->priv; GtkWidget *info_bar, *content_area, *hbox, *widget; spice_usb_device_widget_hide_info_bar(self); info_bar = gtk_info_bar_new(); gtk_info_bar_set_message_type(GTK_INFO_BAR(info_bar), message_type); content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); #if GTK_CHECK_VERSION(3,0,0) hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); #else hbox = gtk_hbox_new(FALSE, 12); #endif gtk_container_add(GTK_CONTAINER(content_area), hbox); widget = gtk_image_new_from_stock(stock_icon_id, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); widget = gtk_label_new(message); gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); priv->info_bar = gtk_alignment_new(0.0, 0.0, 1.0, 0.0); gtk_alignment_set_padding(GTK_ALIGNMENT(priv->info_bar), 0, 0, 12, 0); gtk_container_add(GTK_CONTAINER(priv->info_bar), info_bar); gtk_box_pack_start(GTK_BOX(self), priv->info_bar, FALSE, FALSE, 0); gtk_widget_show_all(priv->info_bar); }
static GtkWidget * gui_connection_infobar_new(GtkWidget **out_infobar_close, GtkWidget **out_infobar_reconnect) { GtkWidget *infobar; GtkWidget *msg_label, *content_area, *action_area; msg_label = gtk_label_new(""); gtk_label_set_markup(GTK_LABEL(msg_label), "<b>ERROR: Connection lost</b>"); gtk_widget_show(msg_label); infobar = gtk_info_bar_new(); gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_ERROR); content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(infobar)); gtk_container_add(GTK_CONTAINER(content_area), msg_label); *out_infobar_close = gtk_info_bar_add_button(GTK_INFO_BAR(infobar), "Close", 0); *out_infobar_reconnect = gtk_info_bar_add_button(GTK_INFO_BAR(infobar), "Reconnect", 0); gtk_widget_set_no_show_all(infobar, TRUE); action_area = gtk_info_bar_get_action_area(GTK_INFO_BAR(infobar)); gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), GTK_ORIENTATION_HORIZONTAL); return infobar; }
GtkWidget * create_info_bar_import_music(struct con_win *cwin) { const gchar *dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); GtkWidget *info_bar = gtk_info_bar_new(); GtkWidget *action_area = gtk_info_bar_get_action_area(GTK_INFO_BAR (info_bar)); GtkWidget *content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), GTK_ORIENTATION_HORIZONTAL); //GtkInfoBar has undocumented behavior for GTK_RESPONSE_CANCEL gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_NO, GTK_RESPONSE_CANCEL); gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_YES, GTK_RESPONSE_YES); gchar *content = g_strdup_printf(_("Would you like to import %s to library?"), dir); GtkWidget *label = gtk_label_new(content); gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0); g_signal_connect(info_bar, "response", G_CALLBACK(info_bar_response_cb), cwin); gtk_widget_show_all(info_bar); g_free(content); return info_bar; }
void tabmanagergui_create_infobar (GuTabPage* tp) { // we will probably want to make a separate file for infobar // procedures that we can attach to hboxes in both the editor // and the preview window, TODO for 0.7.0 -Alex GtkWidget* infobar = NULL; GtkWidget* message = NULL; GtkWidget* area = NULL; infobar = gtk_info_bar_new (); gtk_widget_set_no_show_all (infobar, TRUE); message = gtk_label_new (""); gtk_label_set_line_wrap (GTK_LABEL(message), TRUE); gtk_widget_show (message); area = gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar)); gtk_container_add (GTK_CONTAINER (area), message); gtk_info_bar_add_button (GTK_INFO_BAR (infobar), GTK_STOCK_YES, GTK_RESPONSE_YES); gtk_info_bar_add_button (GTK_INFO_BAR (infobar), GTK_STOCK_NO, GTK_RESPONSE_NO); gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), GTK_MESSAGE_WARNING); tp->barlabel = message; tp->infobar = infobar; }
static void show_info_bar(GtWin* self) { GtWinPrivate* priv = gt_win_get_instance_private(self); QueuedInfoData* data = g_queue_pop_head(priv->info_queue); if (data) { if (data->cb) { if (data->cb == G_CALLBACK(show_error_dialogue_cb)) { gtk_widget_set_visible(priv->info_bar_ok_button, FALSE); gtk_widget_set_visible(priv->info_bar_yes_button, FALSE); gtk_widget_set_visible(priv->info_bar_no_button, FALSE); gtk_widget_set_visible(priv->info_bar_details_button, TRUE); gtk_widget_set_visible(priv->info_bar_close_button, TRUE); gtk_label_set_markup(GTK_LABEL(priv->info_label), data->msg); gtk_info_bar_set_message_type(GTK_INFO_BAR(priv->info_bar), GTK_MESSAGE_ERROR); g_signal_connect(priv->info_bar, "response", G_CALLBACK(data->cb), data->udata); } else { g_signal_connect(priv->info_bar, "response", G_CALLBACK(data->cb), data->udata); gtk_widget_set_visible(priv->info_bar_ok_button, FALSE); gtk_widget_set_visible(priv->info_bar_yes_button, TRUE); gtk_widget_set_visible(priv->info_bar_no_button, TRUE); gtk_widget_set_visible(priv->info_bar_details_button, FALSE); gtk_widget_set_visible(priv->info_bar_close_button, FALSE); gtk_label_set_markup(GTK_LABEL(priv->info_label), data->msg); gtk_info_bar_set_message_type(GTK_INFO_BAR(priv->info_bar), GTK_MESSAGE_QUESTION); } } else { gtk_widget_set_visible(priv->info_bar_yes_button, FALSE); gtk_widget_set_visible(priv->info_bar_no_button, FALSE); gtk_widget_set_visible(priv->info_bar_ok_button, TRUE); gtk_widget_set_visible(priv->info_bar_details_button, FALSE); gtk_widget_set_visible(priv->info_bar_close_button, FALSE); gtk_label_set_markup(GTK_LABEL(priv->info_label), data->msg); gtk_info_bar_set_message_type(GTK_INFO_BAR(priv->info_bar), GTK_MESSAGE_INFO); } priv->cur_info_data = data; gtk_revealer_set_reveal_child(GTK_REVEALER(priv->info_revealer), TRUE); } else { priv->cur_info_data = NULL; gtk_revealer_set_reveal_child(GTK_REVEALER(priv->info_revealer), FALSE); } }
static GtkWidget * create_top_bar (EmpathyAppPluginWidget *self) { GtkWidget *bar, *content, *action, *label; GtkCssProvider *css; AgProvider *provider; gchar *str; GError *error = NULL; bar = gtk_info_bar_new_with_buttons ( GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Done"), GTK_RESPONSE_OK, NULL); gtk_widget_set_hexpand (bar, TRUE); gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION); action = gtk_info_bar_get_action_area (GTK_INFO_BAR (bar)); gtk_orientable_set_orientation (GTK_ORIENTABLE (action), GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_name (bar, "authorization-infobar"); css = gtk_css_provider_new (); if (gtk_css_provider_load_from_data (css, "@define-color question_bg_color rgb (222, 222, 222);" "GtkInfoBar#authorization-infobar" "{" " color: @fg_color;" "}", -1, &error)) { GtkStyleContext *context = gtk_widget_get_style_context (bar); gtk_style_context_add_provider (context, (GtkStyleProvider *) css, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } else { g_warning ("Error processing CSS theme override: %s", error->message); g_clear_error (&error); } g_object_unref (css); content = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar)); provider = ag_manager_get_provider ( ag_account_get_manager (self->priv->account), ag_account_get_provider_name (self->priv->account)); str = g_strdup_printf (_("Edit %s account options"), ag_provider_get_display_name (provider)); label = gtk_label_new (str); gtk_container_add (GTK_CONTAINER (content), label); gtk_widget_show (label); ag_provider_unref (provider); g_free (str); g_signal_connect (bar, "response", G_CALLBACK (response_cb), self); return bar; }
/*! \private * \brief Initialize GschemTranslateWidget instance * * \param [in,out] widget the GschemTranslateWidget */ static void instance_init (GschemTranslateWidget *widget) { GtkWidget *action = gtk_info_bar_get_action_area (GTK_INFO_BAR (widget)); GtkWidget *button_box; GtkWidget *cancel_button; GtkWidget *content = gtk_info_bar_get_content_area (GTK_INFO_BAR (widget)); g_return_if_fail (widget != NULL); gtk_widget_set_no_show_all (GTK_WIDGET (widget), TRUE); widget->label = gtk_label_new (NULL); gtk_widget_set_visible (widget->label, TRUE); gtk_box_pack_start (GTK_BOX (content), widget->label, FALSE, FALSE, 0); widget->entry = gtk_entry_new (); gtk_widget_set_visible (widget->entry, TRUE); gtk_box_pack_start (GTK_BOX (content), widget->entry, TRUE, TRUE, 0); button_box = gtk_hbutton_box_new (); gtk_widget_set_visible (button_box, TRUE); gtk_box_pack_start (GTK_BOX (content), button_box, FALSE, FALSE, 0); widget->evaluate_button = gtk_button_new_with_label (_("Translate")); gtk_widget_set_sensitive (widget->evaluate_button, FALSE); gtk_widget_set_visible (widget->evaluate_button, TRUE); gtk_box_pack_start (GTK_BOX (button_box), widget->evaluate_button, FALSE, FALSE, 0); cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_widget_set_visible (cancel_button, TRUE); gtk_box_pack_start (GTK_BOX (button_box), cancel_button, FALSE, FALSE, 0); gtk_widget_set_no_show_all (action, TRUE); gtk_widget_set_visible (action, FALSE); g_signal_connect (G_OBJECT (widget->entry), "activate", G_CALLBACK (activate_entry), widget); g_signal_connect (G_OBJECT (cancel_button), "clicked", G_CALLBACK (click_cancel), widget); g_signal_connect (G_OBJECT (widget->evaluate_button), "clicked", G_CALLBACK (click_evaluate), widget); g_signal_connect (G_OBJECT (widget->entry), "notify::text", G_CALLBACK (notify_entry_text), widget); }
/* Callback for when the user presses enter in the entry widget */ static void activate_entry (GtkWidget *entry, GschemTranslateWidget *widget) { g_return_if_fail (widget != NULL); if (gtk_entry_get_text_length (GTK_ENTRY (widget->entry)) == 0) { gtk_info_bar_response (GTK_INFO_BAR (widget), GTK_RESPONSE_CANCEL); } else if (convert_value (gtk_entry_get_text (GTK_ENTRY (widget->entry)), NULL)) { gtk_info_bar_response (GTK_INFO_BAR (widget), GTK_RESPONSE_OK); } }
/* Callback for when the user presses enter in the entry widget */ static void activate_entry (GtkWidget *entry, GschemShowHideTextWidget *widget) { g_return_if_fail (widget != NULL); if (gtk_entry_get_text_length (GTK_ENTRY (widget->entry)) > 0) { gtk_info_bar_response (GTK_INFO_BAR (widget), GTK_RESPONSE_OK); } else { gtk_info_bar_response (GTK_INFO_BAR (widget), GTK_RESPONSE_CANCEL); } }
static void button_clicked(GtkWidget *button, gchar* message) { gchar *text = g_strdup_printf("InfoBar displaying %s message", message); gtk_label_set_text(GTK_LABEL(label), text); if (message == "information") gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_INFO); else if (message == "warning") gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_WARNING); else if (message == "question") gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_QUESTION); else if (message == "error") gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_ERROR); gtk_widget_show(GTK_WIDGET(infobar)); }
static void setup_root_info_bar (NemoToolbar *self) { GtkWidget *root_bar = gtk_info_bar_new (); gtk_info_bar_set_message_type (GTK_INFO_BAR (root_bar), GTK_MESSAGE_ERROR); GtkWidget *content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (root_bar)); GtkWidget *label = gtk_label_new (_("Elevated Privileges")); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (content_area), label); self->priv->root_bar = root_bar; gtk_box_pack_start (GTK_BOX (self), self->priv->root_bar, TRUE, TRUE, 0); }
GtkWidget *gnome_info_bar(gchar *message, GtkMessageType type) { GtkWidget *info_bar = gtk_info_bar_new(); gtk_widget_set_no_show_all(info_bar, TRUE); GtkWidget *message_label = gtk_label_new(NULL); gtk_widget_show(message_label); GtkWidget *content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); gtk_container_add(GTK_CONTAINER(content_area), message_label); gtk_label_set_markup(GTK_LABEL(message_label), message); gtk_info_bar_set_message_type(GTK_INFO_BAR(info_bar), type); gtk_widget_show(info_bar); return info_bar; }
/* compare_on_changed */ static void _compare_on_changed(gpointer data) { Compare * compare = data; GtkLabel * label = GTK_LABEL(compare->label); char const * string1; char const * string2; GtkMessageType type = GTK_MESSAGE_OTHER; string1 = gtk_entry_get_text(GTK_ENTRY(compare->entry1)); string2 = gtk_entry_get_text(GTK_ENTRY(compare->entry2)); if(string1[0] == '\0' && string2[0] == '\0') gtk_label_set_text(label, ""); else if(strcmp(string1, string2) == 0) { gtk_label_set_text(label, _("The strings MATCH")); type = GTK_MESSAGE_INFO; } else { gtk_label_set_text(label, _("The strings do NOT match")); type = GTK_MESSAGE_ERROR; } #if GTK_CHECK_VERSION(2, 18, 0) gtk_info_bar_set_message_type(GTK_INFO_BAR(compare->infobar), type); #endif }
static void missing_plugins_retry_cb (gpointer instance, gboolean installed, RBImportErrorsSource *source) { GtkTreeIter iter; RhythmDBEntryType *error_entry_type; gtk_info_bar_set_response_sensitive (GTK_INFO_BAR (source->priv->infobar), GTK_RESPONSE_OK, TRUE); if (installed == FALSE) { rb_debug ("installer failed, not retrying imports"); return; } g_object_get (source, "entry-type", &error_entry_type, NULL); do { RhythmDBEntry *entry; entry = rhythmdb_query_model_iter_to_entry (source->priv->missing_plugin_model, &iter); rhythmdb_add_uri_with_types (source->priv->db, rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION), source->priv->normal_entry_type, source->priv->ignore_entry_type, error_entry_type); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (source->priv->missing_plugin_model), &iter)); g_object_unref (error_entry_type); }
void selections__gth_browser_update_extra_widget_cb (GthBrowser *browser) { GthFileData *location_data; GtkWidget *info_bar; int n_selection; char *msg; location_data = gth_browser_get_location_data (browser); if (! _g_content_type_is_a (g_file_info_get_content_type (location_data->info), "gthumb/selection")) return; n_selection = g_file_info_get_attribute_int32 (location_data->info, "gthumb::n-selection"); if (n_selection <= 0) return; info_bar = gth_browser_get_list_info_bar (browser); gtk_info_bar_set_message_type (GTK_INFO_BAR(info_bar), GTK_MESSAGE_INFO); gth_info_bar_set_icon_name (GTH_INFO_BAR (info_bar), "dialog-information-symbolic", GTK_ICON_SIZE_MENU); gth_info_bar_set_primary_text (GTH_INFO_BAR (info_bar), NULL); msg = g_strdup_printf (_("Use Alt-%d to add files to this selection, Ctrl-%d to view this selection."), n_selection, n_selection); gth_info_bar_set_secondary_text (GTH_INFO_BAR (info_bar), msg); gtk_widget_show (info_bar); g_free (msg); }
/** * e_webdav_discover_content_show_error: * @content: a WebDAV discovery content, created by e_webdav_discover_content_new() * @error: (allow-none): a #GError to show in the UI, or %NULL * * Shows the @error within @content, unless it's a #G_IO_ERROR_CANCELLED, or %NULL, * which are safely ignored. The advantage of this function is that the error * message is removed when the refresh operation is started. * * Since: 3.18 **/ void e_webdav_discover_content_show_error (GtkWidget *content, const GError *error) { EWebDAVDiscoverContentData *data; GtkWidget *label; g_return_if_fail (GTK_IS_GRID (content)); data = g_object_get_data (G_OBJECT (content), WEBDAV_DISCOVER_CONTENT_DATA_KEY); g_return_if_fail (data != NULL); if (data->info_bar) { gtk_widget_destroy (GTK_WIDGET (data->info_bar)); data->info_bar = NULL; } if (!error || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; data->info_bar = GTK_INFO_BAR (gtk_info_bar_new ()); gtk_info_bar_set_message_type (data->info_bar, GTK_MESSAGE_ERROR); gtk_info_bar_set_show_close_button (data->info_bar, TRUE); label = gtk_label_new (error->message); gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (data->info_bar)), label); gtk_widget_show (label); gtk_widget_show (GTK_WIDGET (data->info_bar)); g_signal_connect (data->info_bar, "response", G_CALLBACK (e_webdav_discover_info_bar_error_response_cb), content); gtk_grid_attach (GTK_GRID (content), GTK_WIDGET (data->info_bar), 0, 2, 1, 1); }
void gtkui_cheats_par_add(GtkWidget *widget, gpointer userdata) { // Add a Pro Action Rocky code to the list GtkTreeIter iter; Cheats cheats(emulator); Cheats::Code code; char codebuf[9]; char descbuf[512]; snprintf(codebuf, sizeof(codebuf), "%.8s", gtk_entry_get_text(GTK_ENTRY(paredit))); snprintf(descbuf, sizeof(descbuf), "%s", gtk_entry_get_text(GTK_ENTRY(descedit))); if (cheats.ProActionRockyDecode(codebuf, code) == Nes::RESULT_OK) { gtk_tree_store_append(treestore, &iter, NULL); gtk_tree_store_set(treestore, &iter, 0, true, 1, codebuf, 4, descbuf, -1); gtk_entry_set_text(GTK_ENTRY(descedit), ""); gtk_entry_set_text(GTK_ENTRY(ggedit), ""); gtk_entry_set_text(GTK_ENTRY(paredit), ""); gtk_widget_hide(infobar); gtk_label_set_text(GTK_LABEL(infolabel), ""); cheats.SetCode(code); } else { gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_ERROR); gtk_label_set_text(GTK_LABEL(infolabel), "Error: Invalid PAR code"); gtk_widget_show(infobar); } }
void wxInfoBar::ShowMessage(const wxString& msg, int flags) { if ( !UseNative() ) { wxInfoBarGeneric::ShowMessage(msg, flags); return; } // if we don't have any buttons, create a standard close one to give the // user at least some way to close the bar if ( m_impl->m_buttons.empty() && !m_impl->m_close ) { m_impl->m_close = GTKAddButton(wxID_CLOSE); } GtkMessageType type; if ( wxGTKImpl::ConvertMessageTypeFromWX(flags, &type) ) gtk_info_bar_set_message_type(GTK_INFO_BAR(m_widget), type); gtk_label_set_text(GTK_LABEL(m_impl->m_label), wxGTK_CONV(msg)); if ( !IsShown() ) Show(); UpdateParent(); }
void InterfaceGtk::msg_clear(void) { gtk_info_bar_set_message_type(GTK_INFO_BAR(info_widget), GTK_MESSAGE_OTHER); gtk_label_set_text(GTK_LABEL(message_widget), ""); }
static void nautilus_trash_bar_init (NautilusTrashBar *bar) { GtkWidget *content_area, *action_area, *w; GtkWidget *label; PangoAttrList *attrs; bar->priv = NAUTILUS_TRASH_BAR_GET_PRIVATE (bar); content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar)); action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (bar)); gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area), GTK_ORIENTATION_HORIZONTAL); attrs = pango_attr_list_new (); pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); label = gtk_label_new (_("Trash")); gtk_label_set_attributes (GTK_LABEL (label), attrs); pango_attr_list_unref (attrs); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (content_area), label); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("_Restore"), TRASH_BAR_RESPONSE_RESTORE); gtk_widget_set_tooltip_text (w, _("Restore selected items to their original position")); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), /* Translators: "Empty" is an action (for the trash) , not a state */ _("_Empty"), TRASH_BAR_RESPONSE_EMPTY); gtk_widget_set_tooltip_text (w, _("Delete all items in the Trash")); g_signal_connect_object (nautilus_trash_monitor_get (), "trash-state-changed", G_CALLBACK (nautilus_trash_bar_trash_state_changed), bar, 0); nautilus_trash_bar_trash_state_changed (nautilus_trash_monitor_get (), FALSE, bar); g_signal_connect (bar, "response", G_CALLBACK (trash_bar_response_cb), bar); }
static void nemo_interesting_folder_bar_constructed (GObject *obj) { G_OBJECT_CLASS (nemo_interesting_folder_bar_parent_class)->constructed (obj); NemoInterestingFolderBar *bar = NEMO_INTERESTING_FOLDER_BAR (obj); GtkWidget *content_area, *action_area, *w; GtkWidget *label; content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar)); action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (bar)); gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area), GTK_ORIENTATION_HORIZONTAL); switch (bar->priv->type) { case TYPE_ACTIONS_FOLDER: label = gtk_label_new (_("Actions: Action files can be added to this folder and will appear in the menu.")); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("More info"), INTERESTING_FOLDER_BAR_ACTION_OPEN_DOC); gtk_widget_set_tooltip_text (w, _("View a sample action file with documentation")); break; case TYPE_SCRIPTS_FOLDER: label = gtk_label_new (_("Scripts: All executable files in this folder will appear in the " "Scripts menu.")); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("More info"), INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC); gtk_widget_set_tooltip_text (w, _("View additional information about creating scripts")); break; case TYPE_NONE_FOLDER: default: label = gtk_label_new ("undefined"); break; } gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_style_context_add_class (gtk_widget_get_style_context (label), "nemo-cluebar-label"); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (content_area), label); g_signal_connect (bar, "response", G_CALLBACK (interesting_folder_bar_response_cb), bar); }
/* Callback for when the user clicks the evaluate button */ static void click_evaluate (GtkWidget *entry, GschemTranslateWidget *widget) { g_return_if_fail (widget != NULL); if (convert_value (gtk_entry_get_text (GTK_ENTRY (widget->entry)), NULL)) { gtk_info_bar_response (GTK_INFO_BAR (widget), GTK_RESPONSE_OK); } }
int main(int argc, char *argv[]) { GtkWidget *button; GtkWidget *content_area; gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL); GtkWidget *vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(window), vbox); infobar = gtk_info_bar_new(); gtk_info_bar_add_button(GTK_INFO_BAR(infobar), GTK_STOCK_CLOSE, GTK_RESPONSE_OK); g_signal_connect(infobar, "response", G_CALLBACK(gtk_widget_hide), NULL); gtk_box_pack_start(GTK_BOX(vbox), infobar, TRUE, TRUE, 0); label = gtk_label_new("InfoBar displaying information message"); content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(infobar)); gtk_box_pack_start(GTK_BOX(content_area), label, TRUE, TRUE, 0); GtkWidget *hbox = gtk_hbox_new(TRUE, 5); gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); button = gtk_button_new_with_label("Information"); g_signal_connect(button, "clicked", G_CALLBACK(button_clicked), "information"); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); button = gtk_button_new_with_label("Warning"); g_signal_connect(button, "clicked", G_CALLBACK(button_clicked), "warning"); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); button = gtk_button_new_with_label("Question"); g_signal_connect(button, "clicked", G_CALLBACK(button_clicked), "question"); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); button = gtk_button_new_with_label("Error"); g_signal_connect(button, "clicked", G_CALLBACK(button_clicked), "error"); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show_all(window); gtk_main(); return 0; }
static void nemo_trash_bar_init (NemoTrashBar *bar) { GtkWidget *content_area, *action_area, *w; GtkWidget *label; bar->priv = NEMO_TRASH_BAR_GET_PRIVATE (bar); content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar)); action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (bar)); gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area), GTK_ORIENTATION_HORIZONTAL); label = gtk_label_new (_("Trash")); gtk_style_context_add_class (gtk_widget_get_style_context (label), "nemo-cluebar-label"); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (content_area), label); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("Restore Selected Items"), TRASH_BAR_RESPONSE_RESTORE); gtk_widget_set_tooltip_text (w, _("Restore selected items to their original position")); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("Empty _Trash"), TRASH_BAR_RESPONSE_EMPTY); gtk_widget_set_tooltip_text (w, _("Delete all items in the Trash")); g_signal_connect_object (nemo_trash_monitor_get (), "trash_state_changed", G_CALLBACK (nemo_trash_bar_trash_state_changed), bar, 0); nemo_trash_bar_trash_state_changed (nemo_trash_monitor_get (), FALSE, bar); g_signal_connect (bar, "response", G_CALLBACK (trash_bar_response_cb), bar); }
void bisho_pane_set_banner (BishoPane *pane, const char *message) { if (message) { gtk_info_bar_set_message_type (GTK_INFO_BAR (pane->banner), GTK_MESSAGE_INFO); gtk_label_set_text (GTK_LABEL (pane->banner_label), message); gtk_widget_show (pane->banner); } else { gtk_widget_hide (pane->banner); } }
static GtkWidget * create_io_loading_error_message_area (const gchar *primary_text, const gchar *secondary_text, gboolean recoverable_error) { GtkWidget *message_area; #if !GTK_CHECK_VERSION (2, 17, 1) message_area = gedit_message_area_new_with_buttons ( GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); #else message_area = gtk_info_bar_new_with_buttons ( GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_info_bar_set_message_type (GTK_INFO_BAR (message_area), GTK_MESSAGE_ERROR); #endif set_message_area_text_and_icon (message_area, "gtk-dialog-error", primary_text, secondary_text); if (recoverable_error) { #if !GTK_CHECK_VERSION (2, 17, 1) gedit_message_area_add_stock_button_with_text (GEDIT_MESSAGE_AREA (message_area), _("_Retry"), GTK_STOCK_REFRESH, GTK_RESPONSE_OK); #else info_bar_add_stock_button_with_text (GTK_INFO_BAR (message_area), _("_Retry"), GTK_STOCK_REFRESH, GTK_RESPONSE_OK); #endif } return message_area; }
GtkWidget *create_info_bar_update_music(struct con_win *cwin) { GtkWidget *info_bar = gtk_info_bar_new(); GtkWidget *action_area = gtk_info_bar_get_action_area(GTK_INFO_BAR (info_bar)); GtkWidget *content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), GTK_ORIENTATION_HORIZONTAL); //GtkInfoBar has undocumented behavior for GTK_RESPONSE_CANCEL gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_NO, GTK_RESPONSE_CANCEL); gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_YES, GTK_RESPONSE_YES); GtkWidget *label = gtk_label_new(_("Want to upgrade your music library?")); gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0); g_signal_connect(info_bar, "response", G_CALLBACK(info_bar_update_response_cb), cwin); gtk_widget_show_all(info_bar); return info_bar; }
static void selection_changed_cb (NautilusView *view, NautilusTrashBar *bar) { int count; count = nautilus_view_get_selection_count (view); gtk_info_bar_set_response_sensitive (GTK_INFO_BAR (bar), TRASH_BAR_RESPONSE_RESTORE, (count > 0)); }