当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_INFO_BAR函数代码示例

本文整理汇总了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);
	}
}
开发者ID:Andiry,项目名称:fio,代码行数:25,代码来源:gerror.c

示例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);
	}
}
开发者ID:leaonfm,项目名称:subsurface,代码行数:32,代码来源:gtk-gui.c

示例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);
}
开发者ID:dezelin,项目名称:spice-gtk,代码行数:35,代码来源:usb-device-widget.c

示例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;
}
开发者ID:pingax,项目名称:pragha,代码行数:27,代码来源:info-bar-import-music.c

示例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;
}
开发者ID:JasonGross,项目名称:gummi,代码行数:28,代码来源:gui-tabmanager.c

示例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);
    }
}
开发者ID:AlejandroC90,项目名称:gnome-twitch,代码行数:58,代码来源:gt-win.c

示例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;
}
开发者ID:Evnsan,项目名称:empathy,代码行数:58,代码来源:empathy-app-plugin-widget.c

示例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);
}
开发者ID:gareth8118,项目名称:geda-gaf,代码行数:61,代码来源:gschem_translate_widget.c

示例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);
  }
}
开发者ID:gareth8118,项目名称:geda-gaf,代码行数:14,代码来源:gschem_translate_widget.c

示例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);
  }
}
开发者ID:rlutz,项目名称:geda-gaf,代码行数:14,代码来源:gschem_show_hide_text_widget.c

示例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));
}
开发者ID:dsqiu,项目名称:qzystudy,代码行数:14,代码来源:infobar.c

示例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);
}
开发者ID:leigh123linux,项目名称:nemo,代码行数:14,代码来源:nemo-toolbar.c

示例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;
}
开发者ID:ThereIsNoYeti,项目名称:sflphone,代码行数:14,代码来源:utils.c

示例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
}
开发者ID:DeforaOS,项目名称:Accessories,代码行数:27,代码来源:compare.c

示例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);
}
开发者ID:dignan,项目名称:control,代码行数:30,代码来源:rb-import-errors-source.c


注:本文中的GTK_INFO_BAR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。