本文整理汇总了C++中GTK_INFO_BAR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_INFO_BAR函数的具体用法?C++ GTK_INFO_BAR怎么用?C++ GTK_INFO_BAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_INFO_BAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: report_error
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);
}
}
示例2: report_error
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);
}
}
示例3: spice_usb_device_widget_show_info_bar
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);
}
示例4: create_info_bar_import_music
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;
}
示例5: tabmanagergui_create_infobar
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;
}
示例6: show_info_bar
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);
}
}
示例7: create_top_bar
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;
}
示例8: instance_init
/*! \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);
}
示例9: activate_entry
/* 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);
}
}
示例10: activate_entry
/* 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);
}
}
示例11: button_clicked
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));
}
示例12: setup_root_info_bar
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);
}
示例13: gtk_info_bar_new
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;
}
示例14: _compare_on_changed
/* 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
}
示例15: missing_plugins_retry_cb
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);
}