• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GTK_DIALOG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_DIALOG函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_DIALOG函数的具体用法?C++ GTK_DIALOG怎么用?C++ GTK_DIALOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_DIALOG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: logview_filter_manager_init

static void
logview_filter_manager_init (LogviewFilterManager *manager)
{
  GtkWidget *table;
  GtkWidget *scrolled_window;
  GtkTreeViewColumn *column;
  GtkCellRenderer *text_renderer;
  LogviewFilterManagerPrivate *priv;

  manager->priv = LOGVIEW_FILTER_MANAGER_GET_PRIVATE (manager);
  priv = manager->priv;

  priv->builder = gtk_builder_new ();
  g_object_ref (priv->builder);
  priv->prefs = logview_prefs_get ();

  gtk_dialog_add_button (GTK_DIALOG(manager),
                         GTK_STOCK_CLOSE,
                         GTK_RESPONSE_CLOSE);
  gtk_window_set_modal (GTK_WINDOW (manager),
                        TRUE);

  priv->model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS,
                                                    G_TYPE_STRING,
                                                    G_TYPE_OBJECT));
  logview_filter_manager_update_model (manager);

  table = gtk_table_new (3, 2, FALSE);
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
                                       GTK_SHADOW_ETCHED_IN);
  priv->tree = gtk_tree_view_new_with_model (priv->model);
  gtk_widget_set_size_request (priv->tree, 150, 200);
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree), FALSE);
  gtk_container_add (GTK_CONTAINER (scrolled_window), priv->tree);

  text_renderer = gtk_cell_renderer_text_new ();

  column = gtk_tree_view_column_new();
  gtk_tree_view_column_pack_start (column, text_renderer, TRUE);
  gtk_tree_view_column_set_attributes (column,
                                       text_renderer,
                                       "text", COLUMN_NAME,
                                       NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree),
                               column);

  priv->add_button = gtk_button_new_from_stock (GTK_STOCK_ADD);
  priv->edit_button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES);
  priv->remove_button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);

  gtk_window_set_title (GTK_WINDOW (manager),
                        _("Filters"));

  g_signal_connect (priv->add_button, "clicked", 
                    G_CALLBACK (on_add_clicked), manager);
  g_signal_connect (priv->edit_button, "clicked", 
                    G_CALLBACK (on_edit_clicked), manager);
  g_signal_connect (priv->remove_button, "clicked", 
                    G_CALLBACK (on_remove_clicked), manager);

  gtk_widget_set_sensitive (priv->edit_button, FALSE);
  gtk_widget_set_sensitive (priv->remove_button, FALSE);

  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree)),
                    "changed", G_CALLBACK (on_tree_selection_changed),
                    manager);

  gtk_table_attach_defaults (GTK_TABLE (table),
                             scrolled_window,
                             0, 1, 0, 3);
  gtk_table_attach (GTK_TABLE (table),
                    priv->add_button,
                    1, 2, 0, 1, GTK_FILL, 0, 5, 5);
  gtk_table_attach (GTK_TABLE (table),
                    priv->edit_button,
                    1, 2, 1, 2, GTK_FILL, 0, 5, 5);
  gtk_table_attach (GTK_TABLE (table),
                    priv->remove_button,
                    1, 2, 2, 3, GTK_FILL, 0, 5, 5);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (manager))),
                      table, TRUE, TRUE, 5);
  gtk_widget_show_all (GTK_WIDGET (manager));
}
开发者ID:kenvandine,项目名称:gnome-utils,代码行数:86,代码来源:logview-filter-manager.c


示例2: gtk_list_store_new

void
DictMngr::CreateDictMngrDialog()
{
    GtkWidget *dialog, *selector;
    GtkCellRenderer *renderer;
    HildonTouchSelectorColumn *column;
    GtkTreeModel *tree_model;
    GtkTreeIter iter;
    gboolean iter_valid = TRUE;
    std::list < std::string > all_dict_list;
    std::list < std::string > selected_dict_list;
    GtkListStore *dict_list = NULL;
    const gint RESPONSE_REORDER = 1;
    gint response;

    dict_list = gtk_list_store_new(N_DICT_INFO_COLUMNS,
				   G_TYPE_STRING,	/* bookname */
				   G_TYPE_STRING);	/* filename */

    /* create dialog */
    dialog = gtk_dialog_new();
    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
    gtk_window_set_title(GTK_WINDOW(dialog), _("Dictionaries"));
    gtk_dialog_add_button(GTK_DIALOG(dialog), _("Reorder"), RESPONSE_REORDER);
    gtk_dialog_add_button(GTK_DIALOG(dialog), "OK", GTK_RESPONSE_ACCEPT);
    gtk_window_set_default_size(GTK_WINDOW(dialog), -1, 400);

    /* dictionary selector */
    selector = hildon_touch_selector_new();
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), selector);

    renderer = gtk_cell_renderer_text_new();
    g_object_set(G_OBJECT(renderer),
		 "xpad", 10,
		 "ellipsize", PANGO_ELLIPSIZE_END,
		 "ellipsize-set", TRUE,
		 NULL);

    column =
	hildon_touch_selector_append_column(HILDON_TOUCH_SELECTOR
					    (selector),
					    GTK_TREE_MODEL(dict_list),
					    renderer, "text", BOOKNAME_DICT_INFO_COLUMN, NULL);
    hildon_touch_selector_column_set_text_column(column, 0);

    /* fill list with all available dictionaries */
    GetAllDictionaryList(all_dict_list);
    for (std::list < std::string >::iterator i = all_dict_list.begin();
	 i != all_dict_list.end(); ++i) {
	DictInfo dictinfo;

	dictinfo.load_from_ifo_file(i->c_str(), 0);
	gtk_list_store_append(dict_list, &iter);
	gtk_list_store_set(dict_list, &iter,
			   BOOKNAME_DICT_INFO_COLUMN,
			   dictinfo.bookname.c_str(), FILENAME_DICT_INFO_COLUMN, i->c_str(), -1);
    }
    g_object_unref(dict_list);

    /* set selector mode to multiple */
    hildon_touch_selector_set_column_selection_mode(HILDON_TOUCH_SELECTOR
						    (selector),
						    HILDON_TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE);
    hildon_touch_selector_unselect_all(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN);

    /* select all load dictionaries */
    tree_model =
	hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN);
    for (iter_valid = gtk_tree_model_get_iter_first(tree_model, &iter);
	 iter_valid; iter_valid = gtk_tree_model_iter_next(tree_model, &iter)) {
	const gchar *bookname;

	gtk_tree_model_get(tree_model, &iter, BOOKNAME_DICT_INFO_COLUMN, &bookname, -1);
	for (size_t iLib = 0; iLib < oStarDict->oLibs->query_dictmask.size(); iLib++) {
	    if (!strcmp(oStarDict->oLibs->dict_name(iLib).c_str(), bookname)) {
		hildon_touch_selector_select_iter(HILDON_TOUCH_SELECTOR
						  (selector),
						  BOOKNAME_DICT_INFO_COLUMN, &iter, FALSE);
		break;
	    }
	}
    }

    /* show dialog */
    gtk_widget_show_all(GTK_WIDGET(dialog));

    /* run the dialog */
    response = gtk_dialog_run(GTK_DIALOG(dialog));
    if (response == GTK_RESPONSE_ACCEPT || response == RESPONSE_REORDER) {
	GList *selected_dicts = NULL;

	selected_dicts =
	    hildon_touch_selector_get_selected_rows(HILDON_TOUCH_SELECTOR
						    (selector), BOOKNAME_DICT_INFO_COLUMN);
	if (selected_dicts) {
	    GList *dict = selected_dicts;
	    const gchar *filename;

	    while (dict) {
		gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_model), &iter,
//.........这里部分代码省略.........
开发者ID:Forever-Young,项目名称:mstardict,代码行数:101,代码来源:dictmngr.cpp


示例3: main

gint main(gint argc, gchar * argv[]){
  GtkWidget *colorseldlg;
  GdkColor color;
  GtkColorSelection *colorsel;
  gint response;
  gint r, g, b;
  guint16 alpha=65535;
  float f;

  self = argv[0];
  gtk_init(&argc, &argv);

  if(argc == 2){
    g = 0;
    b = 0;
    if(argv[1][0] == 'r'){
      if(argv[1][3] == 'a'){
	//rgba(...)
	sscanf(argv[1], "rgba(%d, %d, %d, %f)", &r, &g, &b, &f);
	color.red = r * 256;
	color.green = g * 256;
	color.blue = b * 256;
	alpha = f * 65535;
      }else if(argv[1][3] == '('){
	//rgb(...)
	sscanf(argv[1], "rgb(%d, %d, %d)", &r, &g, &b);
	color.red = r * 256;
	color.green = g * 256;
	color.blue = b * 256;
      }else{
	usage();
	return 2;
      }
      goto option_ok;
    }
    if(argv[1][0] == '#'){
      b = 1;
    }
    for(r=b; r<b+6; r++){
      if(!isxdigit(argv[1][r])){
	usage();
	return 2;
      }
    }
    if(b){
      /* # 开头 */
      argv[1] = (char*)((int)argv[1] + 1);
    }
    sscanf(argv[1], "%2x%2x%2x", &r, &g, &b);
    color.red = r * 256;
    color.green = g * 256;
    color.blue = b * 256;
  }else if(argc == 1){
    color.red = 0xffff;
    color.green = 0xffff;
    color.blue = 0xffff;
  }else{
    usage();
    return 2;
  }

option_ok:
  colorseldlg = gtk_color_selection_dialog_new("Select color");
  colorsel = GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(colorseldlg)->colorsel);
  gtk_color_selection_set_current_color(colorsel, &color);
  gtk_color_selection_set_has_palette(colorsel, TRUE);
  gtk_color_selection_set_has_opacity_control(colorsel, TRUE);
  gtk_color_selection_set_current_alpha(colorsel, alpha);
  gtk_window_set_position(GTK_WINDOW(colorseldlg), GTK_WIN_POS_MOUSE);
  gtk_window_set_keep_above(GTK_WINDOW(colorseldlg), TRUE);

  response = gtk_dialog_run(GTK_DIALOG(colorseldlg));
  if(response == GTK_RESPONSE_OK){
    gtk_color_selection_get_current_color(colorsel, &color);
    r = color.red / 256;
    g = color.green / 256;
    b = color.blue / 256;
    alpha = gtk_color_selection_get_current_alpha(colorsel);
    alpha /= 256;
    if(alpha == 255)
      printf("#%02x%02x%02x\n", r, g, b);
    else
      printf("rgba(%d, %d, %d, %.2f\n)", r, g, b, (float)alpha/256);
  }else
    /* 取消了 */
    return 1;

  return 0;
}
开发者ID:iamcheyan,项目名称:git-dotfile,代码行数:89,代码来源:colorpicker.c


示例4: delete_button_clicked

static void delete_button_clicked(GtkButton *button, gpointer user_data)
{
    dt_lib_module_t *self = (dt_lib_module_t *)user_data;
    dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;

    int res = GTK_RESPONSE_YES;

    guint tagid;
    GtkTreeIter iter;
    GtkTreeModel *model = NULL;
    GtkTreeView *view = d->related;
    GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
    if(!gtk_tree_selection_get_selected(selection, &model, &iter)) return;
    gtk_tree_model_get(model, &iter, DT_LIB_TAGGING_COL_ID, &tagid, -1);

    // First check how many images are affected by the remove
    int count = dt_tag_remove(tagid, FALSE);
    if(count > 0 && dt_conf_get_bool("plugins/lighttable/tagging/ask_before_delete_tag"))
    {
        GtkWidget *dialog;
        GtkWidget *win = dt_ui_main_window(darktable.gui->ui);
        gchar *tagname = dt_tag_get_name(tagid);
        dialog = gtk_message_dialog_new(
                     GTK_WINDOW(win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
                     ngettext("do you really want to delete the tag `%s'?\n%d image is assigned this tag!",
                              "do you really want to delete the tag `%s'?\n%d images are assigned this tag!", count),
                     tagname, count);
        gtk_window_set_title(GTK_WINDOW(dialog), _("delete tag?"));
        res = gtk_dialog_run(GTK_DIALOG(dialog));
        gtk_widget_destroy(dialog);
        free(tagname);
    }
    if(res != GTK_RESPONSE_YES) return;

    GList *tagged_images = NULL;
    sqlite3_stmt *stmt;
    DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from tagged_images where tagid=?1",
                                -1, &stmt, NULL);
    DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, tagid);
    while(sqlite3_step(stmt) == SQLITE_ROW)
    {
        tagged_images = g_list_append(tagged_images, GINT_TO_POINTER(sqlite3_column_int(stmt, 0)));
    }
    sqlite3_finalize(stmt);

    dt_tag_remove(tagid, TRUE);

    GList *list_iter;
    if((list_iter = g_list_first(tagged_images)) != NULL)
    {
        do
        {
            dt_image_synch_xmp(GPOINTER_TO_INT(list_iter->data));
        } while((list_iter = g_list_next(list_iter)) != NULL);
    }
    g_list_free(g_list_first(tagged_images));

    update(self, 0);
    update(self, 1);

    dt_control_signal_raise(darktable.signals, DT_SIGNAL_TAG_CHANGED);
}
开发者ID:kublaj,项目名称:darktable,代码行数:62,代码来源:tagging.c


示例5: create_file_chooser_dialog


//.........这里部分代码省略.........
        NULL);

    // we need to extract the buttons, so we can connect them to our
    // button handlers, above
    GtkHButtonBox *box =
        (GtkHButtonBox*)(((GtkDialog*)browse_widget)->action_area);
    GList *buttons = box->button_box.box.children;

    GtkWidget *cancel_btn = ((GtkBoxChild*)buttons->data)->widget;
    GtkWidget *ok_btn = ((GtkBoxChild*)buttons->next->data)->widget;

    g_signal_connect((gpointer)cancel_btn, "clicked",
        G_CALLBACK(new_cancel_clicked), NULL);
    g_signal_connect((gpointer)ok_btn, "clicked",
        G_CALLBACK(new_ok_clicked), NULL);
    g_signal_connect(browse_widget, "destroy",
        G_CALLBACK(browse_widget_destroy), NULL);
    g_signal_connect(browse_widget, "destroy_event",
        G_CALLBACK(browse_widget_destroy), NULL);
    g_signal_connect(browse_widget, "delete_event",
        G_CALLBACK(browse_widget_destroy), NULL);

    // add the filters
    GtkFileFilter *D_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(D_filt, "CEOS Data Files (*.D)");
    gtk_file_filter_add_pattern(D_filt, "*.D");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), D_filt);

    GtkFileFilter *alos2_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(alos2_filt, "ALOS Image Files (IMG-*)");
    gtk_file_filter_add_pattern(alos2_filt, "IMG-*");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), alos2_filt);

    GtkFileFilter *img_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(img_filt, "ASF Internal Files (*.img)");
    gtk_file_filter_add_pattern(img_filt, "*.img");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), img_filt);

    GtkFileFilter *airsar_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(airsar_filt, "AirSAR Files");
    gtk_file_filter_add_pattern(airsar_filt, "*.vvi2");
    gtk_file_filter_add_pattern(airsar_filt, "*.demi2");
    gtk_file_filter_add_pattern(airsar_filt, "*.corgr");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), airsar_filt);

    GtkFileFilter *tiff_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(tiff_filt, "GeoTIFF Image Files (*.tif)");
    gtk_file_filter_add_pattern(tiff_filt, "*.tif");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), tiff_filt);

    GtkFileFilter *tsx_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(tsx_filt, "TerraSAR-X Files (*.xml)");
    gtk_file_filter_add_pattern(tsx_filt, "*.xml");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), tsx_filt);

    GtkFileFilter *jpg_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(jpg_filt, "JPEG Image Files (*.jpg)");
    gtk_file_filter_add_pattern(jpg_filt, "*.jpg");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), jpg_filt);

    GtkFileFilter *png_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(png_filt, "PNG Image Files (*.png)");
    gtk_file_filter_add_pattern(png_filt, "*.png");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), png_filt);

    GtkFileFilter *pgm_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(pgm_filt, "PGM Image Files (*.pgm)");
    gtk_file_filter_add_pattern(pgm_filt, "*.pgm");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), pgm_filt);

    GtkFileFilter *envi_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(envi_filt, "ENVI Files (*.hdr)");
    gtk_file_filter_add_pattern(envi_filt, "*.hdr");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), envi_filt);

    GtkFileFilter *roipac_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(roipac_filt, "ROI_PAC Files (*.rsc)");
    gtk_file_filter_add_pattern(roipac_filt, "*.rsc");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), roipac_filt);

    //GtkFileFilter *ppm_filt = gtk_file_filter_new();
    //gtk_file_filter_set_name(ppm_filt, "PPM Image Files (*.ppm)");
    //gtk_file_filter_add_pattern(ppm_filt, "*.ppm");
    //gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), ppm_filt);

    GtkFileFilter *all_filt = gtk_file_filter_new();
    gtk_file_filter_set_name(all_filt, "All Files (*.*)");
    gtk_file_filter_add_pattern(all_filt, "*");
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(browse_widget), all_filt);

    // allow multi-select
    gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(browse_widget), TRUE);

    // we need to make these modal -- if the user opens multiple "open"
    // dialogs, we'll get confused on the callbacks
    gtk_window_set_modal(GTK_WINDOW(browse_widget), TRUE);
    gtk_window_set_destroy_with_parent(GTK_WINDOW(browse_widget), TRUE);
    gtk_dialog_set_default_response(GTK_DIALOG(browse_widget),
                                    GTK_RESPONSE_OK);
}
开发者ID:asfadmin,项目名称:ASF_MapReady,代码行数:101,代码来源:new.c


示例6: gtk_tooltips_new

GtkWidget *create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkWidget *label5;
  GtkWidget *label6;
  GtkWidget *label7;
  GtkWidget *label8;
  GtkObject *spinbuttonTreshold_adj;
  GtkWidget *spinbuttonTreshold;
  GtkObject *spinbuttonNoise_adj;
  GtkWidget *spinbuttonNoise;
  GtkObject *spinbuttonIdentical_adj;
  GtkWidget *spinbuttonIdentical;
  GtkWidget *checkbuttonShow;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("Blend removal / Hard pulldown removal"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  table1 = gtk_table_new (4, 3, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (_("%"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (_("%"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  label3 = gtk_label_new (_("%"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label4 = gtk_label_new (_(" "));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 2, 3, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  label5 = gtk_label_new (_("Threshold :"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);

  label6 = gtk_label_new (_("Noise threshold :"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  label7 = gtk_label_new (_("Identical threshold :"));
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table1), label7, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);

  label8 = gtk_label_new (_("Show metrics"));
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);

  spinbuttonTreshold_adj = gtk_adjustment_new (1, 1, 99, 1, 10, 10);
  spinbuttonTreshold = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonTreshold_adj), 1, 0);
  gtk_widget_show (spinbuttonTreshold);
  gtk_table_attach (GTK_TABLE (table1), spinbuttonTreshold, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:101,代码来源:DIA_deblend.cpp


示例7: gnc_style_sheet_new

static SCM
gnc_style_sheet_new (StyleSheetDialog * ssd)
{
    SCM              make_ss   = scm_c_eval_string("gnc:make-html-style-sheet");
    SCM              templates = scm_c_eval_string("(gnc:get-html-templates)");
    SCM              t_name = scm_c_eval_string("gnc:html-style-sheet-template-name");
    SCM              new_ss = SCM_BOOL_F;
    GtkWidget        * template_combo;
    GtkTreeModel     * template_model;
    GtkWidget        * name_entry;
    gint             dialog_retval;
    GList *template_names = NULL;

    /* get the new name for the style sheet */
    GladeXML *xml = gnc_glade_xml_new ("report.glade",
                                       "New Style Sheet Dialog");
    GtkWidget * dlg = glade_xml_get_widget (xml, "New Style Sheet Dialog");
    template_combo = glade_xml_get_widget (xml, "template_combobox");
    name_entry     = glade_xml_get_widget (xml, "name_entry");

    g_assert(ssd);

    /* Erase the initial dummy entry. */
    template_model = gtk_combo_box_get_model(GTK_COMBO_BOX(template_combo));
    gtk_list_store_clear(GTK_LIST_STORE(template_model));

    /* put in the list of style sheet type names */
    for (; !scm_is_null(templates); templates = SCM_CDR(templates))
    {
        char * str;
        const char* orig_name;

        SCM t = SCM_CAR(templates);
        scm_dynwind_begin (0); 
        str = scm_to_locale_string (scm_call_1(t_name, t));
        orig_name = g_strdup (str);
        scm_dynwind_free (str); 
        scm_dynwind_end (); 

        /* Store the untranslated names for lookup later */
        template_names = g_list_prepend (template_names, (gpointer)orig_name);

        /* The displayed name should be translated */
        gtk_combo_box_prepend_text(GTK_COMBO_BOX(template_combo),
                                   _(orig_name));
    }
    gtk_combo_box_set_active(GTK_COMBO_BOX(template_combo), 0);

    /* get the name */
    gtk_window_set_transient_for (GTK_WINDOW(dlg), GTK_WINDOW(ssd->toplevel));
    dialog_retval = gtk_dialog_run(GTK_DIALOG(dlg));

    if (dialog_retval == GTK_RESPONSE_OK)
    {
        gint choice = gtk_combo_box_get_active (GTK_COMBO_BOX(template_combo));
        const char *template_str = g_list_nth_data (template_names, choice);
        const char *name_str     = gtk_entry_get_text(GTK_ENTRY(name_entry));
        if (name_str && strlen(name_str) == 0)
        {
            /* If the name is empty, we display an error dialog but
             * refuse to create the new style sheet. */
            gnc_error_dialog (ssd->toplevel, "%s", _("You must provide a name for the new style sheet."));
            name_str = NULL;
        }
        if (template_str && name_str)
        {
            new_ss = scm_call_2(make_ss,
                                scm_makfrom0str(template_str),
                                scm_makfrom0str(name_str));
        }
    }

    g_list_free (template_names);
    gtk_widget_destroy(dlg);
    return(new_ss);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:76,代码来源:dialog-style-sheet.c


示例8: main

int main( int   argc, char *argv[] )
{

	#ifdef	__HYPHYMPI__
		  int 		   rank, 
		  			   size;
		  			   			   			 
		  MPI_Init	   (&argc, &argv);
		  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
		  MPI_Comm_size(MPI_COMM_WORLD, &size);
		  
		  _hy_mpi_node_rank = rank;
		  
		  setParameter  (mpiNodeID, (_Parameter)rank);
		  setParameter	(mpiNodeCount, (_Parameter)size);
		  
		  if (rank == 0)
	#endif
   
	gtk_init (&argc, &argv);

	/* set up globals */
	
	char curWd[4096];
	getcwd (curWd,4096);

	_String baseDir (curWd);
	baseDir=baseDir&'/';

	pathNames&& &baseDir;
	baseDirectory = baseDir;
	for (long i=1; i<argc;i++)
	{
		_String thisArg (argv[i]);
		if (thisArg.beginswith ("BASEPATH="))
		{
			baseDirectory = thisArg.Cut(9,-1);
			if (baseDirectory.sLength)
			{
				if (baseDirectory.sData[baseDirectory.sLength-1]!='/')
					baseDirectory = baseDirectory&"/";
			}
		}
		else
			if (thisArg.beginswith ("USEPATH="))
			{
				_String		baseArgDir 			(thisArg,8,-1);
				errorFileName					= baseArgDir & errorFileName;
				messageFileName					= baseArgDir & messageFileName;
				pathNames.Delete				(0);
				pathNames&&						&baseDir;
			}
			else
				if (thisArg.beginswith ("CPU="))
				{
					#ifdef __MP__
					_String cpus = thisArg.Cut(4,-1);
					systemCPUCount = cpus.toNum();
					if (systemCPUCount<1)
						systemCPUCount = 1;
					#ifdef __MP2__
						pthread_setconcurrency (systemCPUCount+1);
					#endif
					#endif
				}
				#ifdef	__HYPHYMPI__
					else
						if (thisArg == _String("MPIOPTIMIZER"))
						{
							mpiParallelOptimizer = true;
							setParameter	(mpiNodeCount, 0.0);
						}
						else
							if (thisArg == _String("MPIPARTITIONS"))
							{
								mpiPartitionOptimizer = true;
								setParameter	(mpiNodeCount, 0.0);
							}
				#endif
	}
	
	#ifdef	__HYPHYMPI__
	if (rank == 0)
	#endif
	{
		baseDir = baseDirectory & "GTKResources";
		_List scanRes;
		ScanDirectoryForFileNames(baseDir,scanRes,false);
		if (scanRes.lLength == 0)
		{
			GtkWidget * noRez = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "HYPHY_GTK was unable to find a required GTKResources directory in %s. Please use BASEPATH= command line option to specify where the installation directory of HyPhy can be found.", baseDirectory.sData);
			gtk_dialog_run (GTK_DIALOG (noRez));
			gtk_widget_destroy (noRez);
			return 1;
		}
		_String rcPath = baseDir & "/theme/theme.rc";
		//printf ("Loading res files from %s\n", rcPath.sData);
		gtk_rc_parse (rcPath.sData);
	}
	
//.........这里部分代码省略.........
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:101,代码来源:main-GTK.cpp


示例9: ppg_add_instrument_dialog_init

static void
ppg_add_instrument_dialog_init (PpgAddInstrumentDialog *dialog)
{
	PpgAddInstrumentDialogPrivate *priv;
	GtkWidget *content_area;
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *l;
	GtkWidget *scroller;

	priv = G_TYPE_INSTANCE_GET_PRIVATE(dialog, PPG_TYPE_ADD_INSTRUMENT_DIALOG,
	                                   PpgAddInstrumentDialogPrivate);
	dialog->priv = priv;

	g_object_set(dialog,
	             "border-width", 6,
	             "default-width", 350,
	             "default-height", 400,
#if !GTK_CHECK_VERSION(2, 91, 0)
	             "has-separator", FALSE,
#endif
	             "title", _("Add Instrument"),
	             NULL);

	content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));

	vbox = g_object_new(GTK_TYPE_VBOX,
	                    "border-width", 6,
	                    "spacing", 12,
	                    "visible", TRUE,
	                    NULL);
	gtk_container_add(GTK_CONTAINER(content_area), vbox);

	l = g_object_new(GTK_TYPE_LABEL,
	                 "justify", GTK_JUSTIFY_CENTER,
	                 "label", _("Choose one or more instruments to\n"
	                            "add to your session."),
	                 "visible", TRUE,
	                 "wrap", TRUE,
	                 NULL);
	gtk_container_add_with_properties(GTK_CONTAINER(vbox), l,
	                                  "expand", FALSE,
	                                  NULL);

	hbox = g_object_new(GTK_TYPE_HBOX,
	                    "spacing", 12,
	                    "visible", TRUE,
	                    NULL);
	gtk_container_add_with_properties(GTK_CONTAINER(vbox), hbox,
	                                  "expand", FALSE,
	                                  NULL);

	priv->entry = g_object_new(GTK_TYPE_ENTRY,
	                           "activates-default", TRUE,
	                           "visible", TRUE,
	                           NULL);
	gtk_container_add_with_properties(GTK_CONTAINER(hbox), priv->entry,
	                                  "position", 1,
	                                  NULL);
	g_signal_connect(priv->entry,
	                 "changed",
	                 G_CALLBACK(ppg_add_instrument_dialog_entry_changed),
	                 dialog);

	l = g_object_new(GTK_TYPE_LABEL,
	                 "label", _("_Search:"),
	                 "mnemonic-widget", priv->entry,
	                 "use-underline", TRUE,
	                 "visible", TRUE,
	                 NULL);
	gtk_container_add_with_properties(GTK_CONTAINER(hbox), l,
	                                  "expand", FALSE,
	                                  "position", 0,
	                                  NULL);

	scroller = g_object_new(GTK_TYPE_SCROLLED_WINDOW,
	                        "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
	                        "shadow-type", GTK_SHADOW_IN,
	                        "visible", TRUE,
	                        "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
	                        NULL);
	gtk_container_add(GTK_CONTAINER(vbox), scroller);

	priv->model = ppg_instruments_store_new();
	priv->filter = g_object_new(GTK_TYPE_TREE_MODEL_FILTER,
	                            "child-model", priv->model,
	                            NULL);
	gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(priv->filter),
	                                       ppg_add_instrument_dialog_filter_func,
	                                       dialog, NULL);

	priv->icon_view = g_object_new(GTK_TYPE_ICON_VIEW,
	                               "model", priv->filter,
	                               "pixbuf-column", PPG_INSTRUMENTS_STORE_COLUMN_PIXBUF,
	                               "visible", TRUE,
	                               "text-column", PPG_INSTRUMENTS_STORE_COLUMN_TITLE,
	                               NULL);
	gtk_container_add(GTK_CONTAINER(scroller), priv->icon_view);
	g_signal_connect(priv->icon_view,
	                 "selection-changed",
//.........这里部分代码省略.........
开发者ID:chergert,项目名称:perfkit,代码行数:101,代码来源:ppg-add-instrument-dialog.c


示例10: edit_connection

/**
 * Shows a dialog to edit the given connection (or create a new one,
 * if conn is NULL)
 */
static void
edit_connection (gpointer *parent, StrongswanConnection *conn)
{
	GtkWidget *dialog;
	dialog = gtk_dialog_new_with_buttons (
							conn ? "Edit Connection" : "New Connection",
							GTK_WINDOW (parent),
							GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
							GTK_STOCK_CANCEL,
							GTK_RESPONSE_CANCEL,
							GTK_STOCK_SAVE,
							GTK_RESPONSE_OK,
							NULL);
	GtkWidget *vbox = GTK_DIALOG (dialog)->vbox;
	GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

	GtkWidget *name = hildon_entry_new (HILDON_SIZE_AUTO);
	hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (name), "Connection Name");
	hildon_gtk_entry_set_input_mode (GTK_ENTRY (name),
									 HILDON_GTK_INPUT_MODE_AUTOCAP |
									 HILDON_GTK_INPUT_MODE_ALPHA |
									 HILDON_GTK_INPUT_MODE_NUMERIC);
	GtkWidget *ncap = hildon_caption_new (group,
										  "Name",
										  name,
										  NULL,
										  HILDON_CAPTION_OPTIONAL);
	gtk_box_pack_start (GTK_BOX (vbox), ncap, TRUE, TRUE, 0);

	GtkWidget *host = hildon_entry_new (HILDON_SIZE_AUTO);
	hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (host), "Hostname / IP");
	hildon_gtk_entry_set_input_mode (GTK_ENTRY (host),
									 HILDON_GTK_INPUT_MODE_FULL);
	GtkWidget *hcap = hildon_caption_new (group,
										  "Host",
										  host,
										  NULL,
										  HILDON_CAPTION_OPTIONAL);
	gtk_box_pack_start (GTK_BOX (vbox), hcap, TRUE, TRUE, 0);

	GtkWidget *cert = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT |
										 HILDON_SIZE_AUTO_WIDTH,
										 HILDON_BUTTON_ARRANGEMENT_VERTICAL);
	hildon_button_set_text (HILDON_BUTTON (cert),
							"Host or CA Certificate",
							"None");
	hildon_button_set_alignment (HILDON_BUTTON (cert), 0, 0.5, 1, 1);
	g_signal_connect (cert, "clicked", G_CALLBACK (select_cert), dialog);
	GtkWidget *ccap = hildon_caption_new (group,
										  "Certificate",
										  cert,
										  NULL,
										  HILDON_CAPTION_OPTIONAL);
	gtk_box_pack_start (GTK_BOX (vbox), ccap, TRUE, TRUE, 0);

	GtkWidget *user = hildon_entry_new (HILDON_SIZE_AUTO);
	hildon_gtk_entry_set_placeholder_text (GTK_ENTRY (user), "Username");
	hildon_gtk_entry_set_input_mode (GTK_ENTRY (user),
									 HILDON_GTK_INPUT_MODE_FULL);
	GtkWidget *ucap = hildon_caption_new (group,
										  "Username",
										  user,
										  NULL,
										  HILDON_CAPTION_OPTIONAL);
	gtk_box_pack_start (GTK_BOX (vbox), ucap, TRUE, TRUE, 0);

	if (conn)
	{
		gchar *c_name, *c_host, *c_cert, *c_user;
		g_object_get (conn,
					  "name", &c_name,
					  "host", &c_host,
					  "cert", &c_cert,
					  "user", &c_user,
					  NULL);
		gtk_entry_set_text (GTK_ENTRY (name), c_name);
		gtk_entry_set_text (GTK_ENTRY (host), c_host);
		hildon_button_set_value (HILDON_BUTTON (cert),
								 c_cert ? c_cert : "None");
		gtk_entry_set_text (GTK_ENTRY (user), c_user);
		g_free (c_name);
		g_free (c_host);
		g_free (c_cert);
		g_free (c_user);
	}

	gtk_widget_show_all (dialog);

	gint retval = gtk_dialog_run (GTK_DIALOG (dialog));
	if (retval == GTK_RESPONSE_OK)
	{
		const gchar *c_name, *c_cert;
		c_name = gtk_entry_get_text (GTK_ENTRY (name));
		if (!conn)
		{
			conn = strongswan_connection_new (c_name);
//.........这里部分代码省略.........
开发者ID:21superman,项目名称:strongswan,代码行数:101,代码来源:strongswan-settings.c


示例11: prop_cb

void
prop_cb (GtkAction    *action,
				 ProgressData *battstat)
{
  GtkBuilder *builder;
  GtkWidget *combo_ptr, *spin_ptr;
  GtkListStore *liststore;
  GtkCellRenderer *renderer;
  GtkTreeIter iter;

  if (DEBUG) g_print("prop_cb()\n");

   if (battstat->prop_win) { 
     gtk_window_set_screen (GTK_WINDOW (battstat->prop_win),
			    gtk_widget_get_screen (battstat->applet));
     gtk_window_present (GTK_WINDOW (battstat->prop_win));
     return;
   } 

  builder = gtk_builder_new ();
  gtk_builder_add_from_file (builder, GTK_BUILDERDIR"/battstat_applet.ui", NULL);

  battstat->prop_win = GTK_DIALOG (gtk_builder_get_object (builder, 
  				   "battstat_properties"));
  gtk_window_set_screen (GTK_WINDOW (battstat->prop_win),
			 gtk_widget_get_screen (battstat->applet));

  g_signal_connect (G_OBJECT (battstat->prop_win), "delete_event",
		  G_CALLBACK (gtk_true), NULL);
  
  battstat->lowbatt_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "lowbatt_toggle"));
  g_signal_connect (G_OBJECT (battstat->lowbatt_toggle), "toggled",
  		    G_CALLBACK (lowbatt_toggled), battstat);

  if (!g_settings_is_writable (battstat->settings,
			  "low-battery-notification"))
  {
	  hard_set_sensitive (battstat->lowbatt_toggle, FALSE);
  }

  battstat->hbox_ptr = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_ptr"));
  hard_set_sensitive (battstat->hbox_ptr, battstat->lowbattnotification);

  combo_ptr = GTK_WIDGET (gtk_builder_get_object (builder, "combo_ptr"));
  g_signal_connect (G_OBJECT (combo_ptr), "changed",
		  G_CALLBACK (combo_ptr_cb), battstat);

  liststore = gtk_list_store_new (1, G_TYPE_STRING);
  gtk_combo_box_set_model (GTK_COMBO_BOX (combo_ptr),
		  GTK_TREE_MODEL (liststore));
  gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_ptr));
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_ptr),
		  renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_ptr),
		  renderer,
		  "text", 0,
		  NULL);
  gtk_list_store_append (liststore, &iter);
  /* TRANSLATOR: this is a selectable item in a drop-down menu to end
   * this sentence:
   *   "Warn when battery charge drops to: [XX] percent".
   */
  gtk_list_store_set (liststore, &iter, 0, _("Percent"), -1);
  gtk_list_store_append (liststore, &iter);
  /* TRANSLATOR: this is a selectable item in a drop-down menu to end
   * this sentence:
   *   "Warn when battery charge drops to: [XX] minutes remaining"
   */
  gtk_list_store_set (liststore, &iter, 0, _("Minutes Remaining"), -1);

  spin_ptr = GTK_WIDGET (gtk_builder_get_object (builder, "spin_ptr"));
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_ptr),
		  battstat->red_val);
  g_signal_connect (G_OBJECT (spin_ptr), "value-changed",
		  G_CALLBACK (spin_ptr_cb), battstat);

  if (battstat->red_value_is_time)
	  gtk_combo_box_set_active (GTK_COMBO_BOX (combo_ptr), 1);
  else
	  gtk_combo_box_set_active (GTK_COMBO_BOX (combo_ptr), 0);

  battstat->full_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "full_toggle"));
  g_signal_connect (G_OBJECT (battstat->full_toggle), "toggled",
  		    G_CALLBACK (full_toggled), battstat);

  if (!g_settings_is_writable (battstat->settings,
			  "full-battery-notification"))
  {
	  hard_set_sensitive (battstat->full_toggle, FALSE);
  }
  if (battstat->fullbattnot)
  {
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (battstat->full_toggle),
		     TRUE);
  }
  if (battstat->lowbattnotification)
  {
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (battstat->lowbatt_toggle),
		    TRUE);
//.........这里部分代码省略.........
开发者ID:anastasis2014,项目名称:mate-applets,代码行数:101,代码来源:properties.c


示例12: no_certificate

/**
 * Callback if no certificate should be selected
 */
void no_certificate(HildonButton *button, gpointer user_data)
{
	gtk_dialog_response (GTK_DIALOG (user_data), GTK_RESPONSE_REJECT);
}
开发者ID:21superman,项目名称:strongswan,代码行数:7,代码来源:strongswan-settings.c


示例13: execute

/**
 * main callback for control panel plugins
 */
osso_return_t execute(osso_context_t *osso, gpointer data,
					  gboolean user_activated)
{
	gint response;

	create_list_dialog (data);

	if (!user_activated)
	{
		/* load state */
	}

	do
	{
		gchar *selected;
		response = gtk_dialog_run (GTK_DIALOG (ListDialog.dialog));
		switch (response)
		{
			case RESPONSE_NEW:
			{
				edit_connection (data, NULL);
				break;
			}
			case RESPONSE_EDIT:
			{
				StrongswanConnection *conn;
				selected = get_selected ();
				conn = strongswan_connections_get_connection (ListDialog.conns,
															  selected);
				if (conn)
				{
					edit_connection (data, conn);
				}
				else
				{
					hildon_banner_show_information (NULL, NULL,
												"Select a connection first");
				}
				g_free (selected);
				break;
			}
			case RESPONSE_DELETE:
			{
				GtkWidget *confirm;
				gint retval;
				gchar *msg;
				selected = get_selected ();
				if (!selected)
				{
					hildon_banner_show_information (NULL, NULL,
												"Select a connection first");
					break;
				}
				msg = g_strdup_printf ("Delete connection?\n%s", selected);
				confirm = hildon_note_new_confirmation (data, msg);
				retval = gtk_dialog_run (GTK_DIALOG (confirm));
				if (retval == GTK_RESPONSE_OK)
				{
					strongswan_connections_remove_connection (ListDialog.conns,
															  selected);
				}
				gtk_widget_destroy (confirm);
				g_free (msg);
				g_free (selected);
				break;
			}
			default:
				break;
		}
	}
	while (response > 0);

	gtk_widget_destroy (ListDialog.dialog);
	g_object_unref (ListDialog.conns);
	return OSSO_OK;
}
开发者ID:21superman,项目名称:strongswan,代码行数:79,代码来源:strongswan-settings.c


示例14: do_simple_message_box

static void
do_simple_message_box(ESD_TYPE_E type, gboolean *notagain,
                      const char *secondary_msg, const char *msg_format,
                      va_list ap)
{
  GtkMessageType  gtk_message_type;
  gchar          *message;
  GtkWidget      *msg_dialog;
  GtkWidget      *checkbox = NULL;

  if (notagain != NULL) {
    if (*notagain) {
      /*
       * The user had checked the "Don't show this message again" checkbox
       * in the past; don't bother showing it.
       */
      return;
    }
  }

  switch (type) {

  case ESD_TYPE_INFO:
    gtk_message_type = GTK_MESSAGE_INFO;
    break;

  case ESD_TYPE_WARN:
    gtk_message_type = GTK_MESSAGE_WARNING;
    break;

  case ESD_TYPE_ERROR:
    gtk_message_type = GTK_MESSAGE_ERROR;
    break;

  default:
    g_assert_not_reached();
    gtk_message_type = GTK_MESSAGE_INFO;
    break;
  }

  /* Format the message. */
  message = g_strdup_vprintf(msg_format, ap);
  msg_dialog = gtk_message_dialog_new(GTK_WINDOW(top_level),
                                      (GtkDialogFlags)(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT),
                                      gtk_message_type,
                                      GTK_BUTTONS_OK,
                                      "%s", message);
  g_free(message);
  if (secondary_msg != NULL)
    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(msg_dialog),
                                             "%s", secondary_msg);

  if (notagain != NULL) {
    checkbox = gtk_check_button_new_with_label("Don't show this message again.");
    gtk_container_set_border_width(GTK_CONTAINER(checkbox), 12);
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(msg_dialog))),
                       checkbox, TRUE, TRUE, 0);
    gtk_widget_show(checkbox);
  }

  gtk_dialog_run(GTK_DIALOG(msg_dialog));
  if (notagain != NULL) {
    /*
     * OK, did they check the checkbox?
     */
    *notagain = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox));
  }
  gtk_widget_destroy(msg_dialog);
}
开发者ID:pvons,项目名称:wireshark,代码行数:69,代码来源:simple_dialog.c


示例15: set_dialog_properties

static void
set_dialog_properties (GtkAppChooserDialog *self)
{
  gchar *name;
  gchar *extension;
  gchar *description;
  gchar *string;
  gboolean unknown;
  gchar *title;
  gchar *subtitle;
  gboolean use_header;
  GtkWidget *header;

  name = NULL;
  extension = NULL;
  d 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_EDITABLE函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_CTREE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap