Ejemplo n.º 1
0
static void
on_romaji_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data)
{
    bool success;

    if (__widget_romaji_theme_menu != GTK_WIDGET (omenu)) {
        g_signal_handlers_block_by_func (
            G_OBJECT (__widget_romaji_theme_menu),
            (gpointer) (on_romaji_theme_menu_changed),
            NULL);
        gtk_option_menu_set_history (
            GTK_OPTION_MENU (__widget_romaji_theme_menu),
            gtk_option_menu_get_history (omenu));
        g_signal_handlers_unblock_by_func (
            G_OBJECT (__widget_romaji_theme_menu),
            (gpointer) (on_romaji_theme_menu_changed),
            NULL);

        success = load_romaji_theme ();

        setup_romaji_window_value (SCIM_ANTHY_TABLE_EDITOR (user_data));
    } else {
        success = load_romaji_theme ();
    }

    if (success) {
        // sync widgets
        __style_changed  = true;
        __config_changed = true;
    }
}
Ejemplo n.º 2
0
GtkWidget *
sp_fill_style_widget_new (void)
{
	GtkWidget *spw, *vb, *psel, *hb, *l, *om, *m, *mi;

	spw = sp_widget_new_global (INKSCAPE);

	vb = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vb);
	gtk_container_add (GTK_CONTAINER (spw), vb);

	psel = sp_paint_selector_new ();
	gtk_widget_show (psel);
	gtk_box_pack_start (GTK_BOX (vb), psel, TRUE, TRUE, 0);
	g_object_set_data (G_OBJECT (spw), "paint-selector", psel);

	g_signal_connect (G_OBJECT (psel), "mode_changed", G_CALLBACK (sp_fill_style_widget_paint_mode_changed), spw);
	g_signal_connect (G_OBJECT (psel), "dragged", G_CALLBACK (sp_fill_style_widget_paint_dragged), spw);
	g_signal_connect (G_OBJECT (psel), "changed", G_CALLBACK (sp_fill_style_widget_paint_changed), spw);

	hb = gtk_hbox_new (FALSE, 4);
	gtk_widget_show (hb);
	gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);

	l = gtk_label_new (_("Fill Rule"));
	gtk_widget_show (l);
	gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
	gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0);

	om = gtk_option_menu_new ();
	gtk_widget_show (om);
	gtk_box_pack_start (GTK_BOX (hb), om, FALSE, FALSE, 0);
	g_object_set_data (G_OBJECT (spw), "fill-rule", om);

	/* 0 - nonzero 1 - evenodd */
	m = gtk_menu_new ();
	gtk_widget_show (m);

	mi = gtk_menu_item_new_with_label (_("nonzero"));
	gtk_widget_show (mi);
	gtk_menu_append (GTK_MENU (m), mi);
	g_object_set_data (G_OBJECT (mi), "fill-rule", (void *)"nonzero");
	g_signal_connect (G_OBJECT (mi), "activate", G_CALLBACK (sp_fill_style_widget_fill_rule_activate), spw);
	mi = gtk_menu_item_new_with_label (_("evenodd"));
	gtk_widget_show (mi);
	gtk_menu_append (GTK_MENU (m), mi);
	g_object_set_data (G_OBJECT (mi), "fill-rule", (void *)"evenodd");
	g_signal_connect (G_OBJECT (mi), "activate", G_CALLBACK (sp_fill_style_widget_fill_rule_activate), spw);

	gtk_option_menu_set_menu (GTK_OPTION_MENU (om), m);

	g_signal_connect (G_OBJECT (spw), "construct", G_CALLBACK (sp_fill_style_widget_construct), psel);
	g_signal_connect (G_OBJECT (spw), "modify_selection", G_CALLBACK (sp_fill_style_widget_modify_selection), psel);
	g_signal_connect (G_OBJECT (spw), "change_selection", G_CALLBACK (sp_fill_style_widget_change_selection), psel);
	g_signal_connect (G_OBJECT (spw), "attr_changed", G_CALLBACK (sp_fill_style_widget_attr_changed), psel);

	sp_fill_style_widget_update (SP_WIDGET (spw), SP_ACTIVE_DESKTOP ? SP_DT_SELECTION (SP_ACTIVE_DESKTOP) : NULL);

	return spw;
}
Ejemplo n.º 3
0
void ACDProcCopy4to8(bool cw)
{
  GtkWidget *opt = cw ? optAC2 : optAC3;

  GtkWidget *menu, *active_item;
  menu = GTK_OPTION_MENU(opt)->menu;
  active_item = gtk_menu_get_active(GTK_MENU(menu));
  int noact = g_list_index(GTK_MENU_SHELL(menu)->children, active_item);
  int numact = actor->GetNumAction() - noact * 8;
  if (numact < 8) {
    GtkWidget *mes;
    mes = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
            GTK_BUTTONS_OK, _("This act doesn't have 8 actions."));
    gtk_dialog_run(GTK_DIALOG(mes));
    gtk_widget_destroy(mes);
    return;
  }

  int baseact = noact * 8;
  for (int i=0; i<4; i++) {
    if (cw) {
      actor->CopyAction(baseact+i*2+1, baseact+i*2);
    } else {
      actor->CopyAction(baseact+i*2, baseact+i*2+1);
    }
  }
}
Ejemplo n.º 4
0
static void
add_menuitem_to_source (GtkWidget * widget,
			GbWriteMenuItemSourceData * write_data)
{
  gchar *label_text;
  GtkWidget *menuitem, *child = GTK_BIN (widget)->child;

  menuitem = GTK_OPTION_MENU (write_data->option_menu)->menu_item;
  if (child == NULL && menuitem == widget)
    {
      child = GTK_BUTTON (write_data->option_menu)->child;
      write_data->selected_index = write_data->index;
    }

  if (child && GTK_IS_LABEL (child))
    {
      gtk_label_get (GTK_LABEL (child), &label_text);

      source_add (write_data->data,
		  "  glade_menuitem = gtk_menu_item_new_with_label (%s);\n"
		  "  gtk_widget_show (glade_menuitem);\n"
		  "  gtk_menu_append (GTK_MENU (%s_menu), glade_menuitem);\n",
		  source_make_string (label_text,
				      write_data->data->use_gettext),
		  write_data->data->real_wname);
    }

  write_data->index++;
}
Ejemplo n.º 5
0
static time_t
get_requested_time (DialogData *data, 
		    const char *filename)
{
	int idx  = gtk_option_menu_get_history (GTK_OPTION_MENU (data->date_optionmenu));
	time_t t = (time_t)0;

	switch (idx) {
	case NO_DATE:
		break;
	case FOLLOWING_DATE:
		t = gnome_date_edit_get_time (GNOME_DATE_EDIT (data->date_dateedit));
		break;
	case CURRENT_DATE:
		t = time (NULL);
		break;
	case EXIF_DATE:
		t = get_metadata_time (NULL, filename);
		break;
	case LAST_MODIFIED_DATE:
		t = get_file_mtime (filename);
		break;
	case IMAGE_CREATION_DATE:
		t = get_file_ctime (filename);
		break;
	}

	return t;
}
Ejemplo n.º 6
0
static bool
load_romaji_theme (void)
{
    GtkOptionMenu *omenu = GTK_OPTION_MENU (__widget_romaji_theme_menu);
    gint idx = gtk_option_menu_get_history (omenu);
    GtkWidget *menu = gtk_option_menu_get_menu (omenu);
    GList *list = gtk_container_get_children (GTK_CONTAINER (menu));
    GtkWidget *menuitem = GTK_WIDGET (g_list_nth_data (list, idx));

    if (!menuitem)
        return false;

    gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem),
                                                         INDEX_KEY));

    // set new romaji table
    if (idx == ROMAJI_THEME_INDEX_USER_DEFINED) {
        // User defined table
        __config_romaji_theme_file = __user_style_file.get_file_name ();
        StyleLines lines;
        bool success = __user_style_file.get_entry_list
                           (lines, __romaji_fund_table);
        if (!success || lines.empty ())
            setup_default_romaji_table ();

        return true;

    } else if (idx == ROMAJI_THEME_INDEX_DEFAULT) {
        // Default table
        __config_romaji_theme_file = "";
        setup_default_romaji_table ();

        return true;

    } else if (theme_idx >= 0 && theme_idx < (int) __style_list.size ()) {
        // Tables defined in system theme files
        __config_romaji_theme_file = __style_list[theme_idx].get_file_name ();
        __user_style_file.delete_section (__romaji_fund_table);

        std::vector<String> keys;
        bool success = __style_list[theme_idx].get_key_list
                           (keys, __romaji_fund_table);
        if (success) {
            std::vector<String>::iterator it;
            for (it = keys.begin (); it != keys.end (); it++) {
                std::vector<WideString> value;
                __style_list[theme_idx].get_string_array
                    (value, __romaji_fund_table, *it);
                __user_style_file.set_string_array (__romaji_fund_table,
                                                    *it, value);
            }
        }
        return true;

    } else {
        // error
        return false;
    }
}
static void
util_option_fwd_cb(GtkOptionMenu * opt_menu, gpointer callback)
{
	((util_option_changed_cb)callback)(
		gtk_option_menu_get_history(GTK_OPTION_MENU(opt_menu)),
		g_object_get_data(G_OBJECT(opt_menu), "changed_userdata")
	);
}
Ejemplo n.º 8
0
static void
change_toolbar_style (GtkWidget *option_menu, GtkWidget *toolbar)
{
  GtkToolbarStyle style;

  style = gtk_option_menu_get_history (GTK_OPTION_MENU (option_menu));
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style);
}
Ejemplo n.º 9
0
void KeyOptionView::onValueChange() {
	if (!myCurrentKey.empty()) {
		((ZLKeyOptionEntry*)myOption)->onValueChange(
			myCurrentKey,
			gtk_option_menu_get_history(GTK_OPTION_MENU(myComboBox))
		);
	}
}
Ejemplo n.º 10
0
static void
comments_load(JamView *view) {
	LJCommentsType type = jam_doc_get_comments(view->doc);
	if (type != LJ_COMMENTS_DEFAULT)
		show_meta(view, JAM_VIEW_COMMENTS);
	if (comments_visible(view))
		gtk_option_menu_set_history(GTK_OPTION_MENU(view->comments), type);
}
Ejemplo n.º 11
0
static void
sp_fill_style_widget_update_repr (SPWidget *spw, SPRepr *repr)
{
	SPPaintSelector *psel;
	GtkWidget *fillrule;
	SPPaintSelectorMode pselmode;
	SPStyle *style;
	gfloat c[5];

	if (g_object_get_data (G_OBJECT (spw), "update")) return;

	g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (TRUE));

#ifdef SP_FS_VERBOSE
	g_print ("FillStyleWidget: Set update flag\n");
#endif
	psel = SP_PAINT_SELECTOR(g_object_get_data (G_OBJECT (spw), "paint-selector"));

	style = sp_style_new ();
	sp_style_read_from_repr (style, repr);

	pselmode = sp_fill_style_determine_paint_selector_mode (style);
#ifdef SP_FS_VERBOSE
	g_print ("FillStyleWidget: paint selector mode %d\n", pselmode);
#endif
	switch (pselmode) {
	case SP_PAINT_SELECTOR_MODE_NONE:
		/* No paint at all */
		sp_paint_selector_set_mode (psel, SP_PAINT_SELECTOR_MODE_NONE);
		break;
	case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
		sp_paint_selector_set_mode (psel, SP_PAINT_SELECTOR_MODE_COLOR_RGB);
		sp_color_get_rgb_floatv (&style->fill.value.color, c);
		c[3] = SP_SCALE24_TO_FLOAT (style->fill_opacity.value);
		sp_paint_selector_set_color_rgba_floatv (psel, c);
		break;
	case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
		sp_paint_selector_set_mode (psel, SP_PAINT_SELECTOR_MODE_COLOR_CMYK);
		sp_color_get_cmyk_floatv (&style->fill.value.color, c);
		c[4] = SP_SCALE24_TO_FLOAT (style->fill_opacity.value);
		sp_paint_selector_set_color_cmyka_floatv (psel, c);
		break;
	case SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR:
		break;
	default:
		break;
	}

	fillrule = GTK_WIDGET(g_object_get_data (G_OBJECT (spw), "fill-rule"));
	gtk_option_menu_set_history (GTK_OPTION_MENU (fillrule), (style->fill_rule.computed == ART_WIND_RULE_NONZERO) ? 0 : 1);

	sp_style_unref (style);

	g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (FALSE));
#ifdef SP_FS_VERBOSE
	g_print ("FillStyleWidget: Cleared update flag\n");
#endif
}
Ejemplo n.º 12
0
static GtkWidget*
command_make(SettingsWidget *sw) {
    CommandList *cmds = sw->data;
    GtkWidget *vbox, *menu;
    GtkSizeGroup *sg;
    char *cmd = *((char**)sw->conf);
    int cur = -1;
    int i;

    menu = gtk_menu_new();
    for (i = 0; cmds[i].label; i++) {
        char *curcmd = cmds[i].command;
        gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                              gtk_menu_item_new_with_label(_(cmds[i].label)));
        if (cur == -1 &&
                ((cmd == curcmd) ||
                 (cmd && curcmd && (strcmp(cmd, curcmd) == 0))))
            cur = i;
    }
    gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                          gtk_menu_item_new_with_label(_("Custom Command")));
    if (cur == -1) cur = i;

    sw->widget = gtk_option_menu_new();
    gtk_option_menu_set_menu(GTK_OPTION_MENU(sw->widget), menu);
    gtk_option_menu_set_history(GTK_OPTION_MENU(sw->widget), cur);

    sw->subwidget = gtk_entry_new();
    tie_text(GTK_ENTRY(sw->subwidget), (char**)sw->conf);

    g_signal_connect(G_OBJECT(sw->widget), "changed",
                     G_CALLBACK(command_changed_cb), sw);
    jam_widget_set_visible(sw->subwidget, cur == i);

    sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
    vbox = gtk_vbox_new(FALSE, 3);
    gtk_box_pack_start(GTK_BOX(vbox),
                       labelled_box_new_sg(_(sw->caption), sw->widget, sg),
                       FALSE, FALSE, 0);
    sw->data2 = labelled_box_new_sg(NULL, sw->subwidget, sg);  /* ugh. */
    gtk_box_pack_start(GTK_BOX(vbox),
                       sw->data2,
                       FALSE, FALSE, 0);
    return vbox;
}
Ejemplo n.º 13
0
/**
 * Populate fields from control data.
 * \param ctl Export control data.
 */
static void export_html_fill_fields( ExportHtmlCtl *ctl ) {
	gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), "" );
	if( ctl->path ) {
		gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml),
			ctl->path );
	}

	gtk_option_menu_set_history(
		GTK_OPTION_MENU( exphtml_dlg.optmenuCSS ), ctl->stylesheet );
	gtk_option_menu_set_history(
		GTK_OPTION_MENU( exphtml_dlg.optmenuName ), ctl->nameFormat );
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON( exphtml_dlg.checkBanding ), ctl->banding );
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON( exphtml_dlg.checkLinkEMail ), ctl->linkEMail );
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON( exphtml_dlg.checkAttributes ), ctl->showAttribs );
}
Ejemplo n.º 14
0
void select_polsarpro_classification_lut(const char *lut_basename)
{
  int which = GPOINTER_TO_INT(
                  g_hash_table_lookup(g_polsarpro_classification_optionmenu_ht,
                                      lut_basename));
  GtkWidget *option_menu;
  option_menu = get_widget_checked("browse_select_colormap_optionmenu");
  gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), which);
}
Ejemplo n.º 15
0
int
menu_select_cb(GtkMenuItem * menuitem, GtkWidget * menu)
{
    const char *label = menuitem_get_label(menuitem);

//      printf( "menuitem = %s(%p), menu = %s(%p)\n", G_OBJECT_TYPE_NAME(menuitem), menuitem, G_OBJECT_TYPE_NAME(menu), menu );

    if(label[0] == '<')
    {
        GtkWidget *selection = menu_get_first_menuitem(GTK_MENU(menu));
        gtk_widget_hide(selection);
    }
    else
    {
        char *str = g_strdup(label);

        GtkWidget *parent;

        for (;;)
        {
            GtkMenuItem *parentitem;
            const char *label2;
            char *temp;

            parent = gtk_widget_get_parent(GTK_WIDGET(menuitem));
//                      printf( "parent = %s(%p)\n", G_OBJECT_TYPE_NAME(parent), parent);
            if(menu == parent)
                break;

            parentitem = GTK_MENU_ITEM(gtk_menu_get_attach_widget(GTK_MENU(parent)));
//                      printf( "parentitem = %s(%p)\n", G_OBJECT_TYPE_NAME(parentitem), parentitem);
            label2 = menuitem_get_label(parentitem);
            if(strcmp(label2, MORE_STRING) != 0)
            {
                temp = g_strconcat(label2, "/", str, NULL);
                g_free(str);
                str = temp;
            }

            menuitem = parentitem;
        }
        {
            GtkLabel *label;

            GtkWidget *selection = menu_get_first_menuitem(GTK_MENU(menu));
            GtkOptionMenu *optionmenu = GTK_OPTION_MENU(gtk_menu_get_attach_widget(GTK_MENU(menu)));

            label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(selection)));

            gtk_label_set_text(label, str);
            gtk_widget_show(GTK_WIDGET(selection));
            gtk_option_menu_set_history(optionmenu, 0);
            g_free(str);
        }
    }
    return 0;
}
Ejemplo n.º 16
0
static void
pollmultidlg_init(PollMultiDlg *pmdlg, GtkWindow *parent) {
	GtkWidget *mainbox, *vbox, *paned;
	GtkWidget *menu, *label;

	pmdlg->dlg = gtk_dialog_new_with_buttons(_("Multi Poll Question"),
			parent, GTK_DIALOG_MODAL,
			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			GTK_STOCK_OK, GTK_RESPONSE_OK,
			NULL);
	jam_win_set_size(GTK_WINDOW(pmdlg->dlg), 500, -1);

	mainbox = gtk_vbox_new(FALSE, 12);

	menu = gtk_menu_new();
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),
		gtk_menu_item_new_with_mnemonic(_("Choose best answer (_radio buttons)")));
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),
		gtk_menu_item_new_with_mnemonic(_("Choose best answer (_drop-down menu)")));
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),
		gtk_menu_item_new_with_mnemonic(_("Select _all that apply (checkboxes)")));

	pmdlg->typemenu = gtk_option_menu_new();
	gtk_option_menu_set_menu(GTK_OPTION_MENU(pmdlg->typemenu), menu);
	gtk_box_pack_start(GTK_BOX(mainbox),
			labelled_box_new_expand(_("Choice _Type:"), pmdlg->typemenu, TRUE),
			FALSE, FALSE, 0);

	paned = gtk_hpaned_new();
	gtk_box_pack_start(GTK_BOX(mainbox), paned, TRUE, TRUE, 0);

	vbox = gtk_vbox_new(FALSE, 6);
	label = gtk_label_new_with_mnemonic(_("_Question:"));
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);

	pmdlg->question = gtk_text_view_new();
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(pmdlg->question), GTK_WRAP_WORD);
	gtk_label_set_mnemonic_widget(GTK_LABEL(label), pmdlg->question);
	gtk_box_pack_start(GTK_BOX(vbox),
			scroll_wrap(pmdlg->question),
			TRUE, TRUE, 0);

	gtk_paned_pack1(GTK_PANED(paned), vbox, TRUE, FALSE);

	vbox = gtk_vbox_new(FALSE, 6);
	pollmulti_make_list(pmdlg);
	label = gtk_label_new_with_mnemonic(_("O_ptions:"));
	gtk_label_set_mnemonic_widget(GTK_LABEL(label), pmdlg->answers.view);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(vbox), pmdlg->answers.box, TRUE, TRUE, 0);

	gtk_paned_pack2(GTK_PANED(paned), vbox, TRUE, FALSE);

	jam_dialog_set_contents(GTK_DIALOG(pmdlg->dlg), mainbox);
}
Ejemplo n.º 17
0
/*
 * setup_reset_button() - enables the reset button if any of the current
 * settings are not the default.
 */
static void setup_reset_button(CtkDitheringControls *ctk_dithering_controls)
{
    gint history;
    gint val;

    if (!GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_controls_box)) {
        /* Nothing is available, don't bother enabling the reset button yet. */
        return;
    }

    /* The config menu is always available */
    history = gtk_option_menu_get_history
        (GTK_OPTION_MENU(ctk_dithering_controls->dithering_config_menu));
    val = map_dithering_config_menu_idx_to_nvctrl(history);
    if (val != NV_CTRL_DITHERING_AUTO) {
        goto enable;
    }

    if (GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_mode_box)) {
        history = gtk_option_menu_get_history
            (GTK_OPTION_MENU(ctk_dithering_controls->dithering_mode_menu));
        val = ctk_dithering_controls->dithering_mode_table[history];
        if (val != NV_CTRL_DITHERING_MODE_AUTO) {
            goto enable;
        }
    }

    if (GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_depth_box)) {
        history = gtk_option_menu_get_history
            (GTK_OPTION_MENU(ctk_dithering_controls->dithering_depth_menu));
        val = map_dithering_depth_menu_idx_to_nvctrl(history);
        if (val != NV_CTRL_DITHERING_DEPTH_AUTO) {
            goto enable;
        }
    }

    /* Don't disable reset button here, since other settings that are not
     * managed by the ctk_image_slider here may need it enabled
     */
    return;

 enable:
    gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE);
}
Ejemplo n.º 18
0
static void
game_preferences_callback (GtkWidget *widget, void *data)
{
	GtkWidget *menu, *omenu, *l, *hb, *cb, *f, *fv;
	GtkWidget *button;

	if (pref_dialog)
		return;
	
	pref_dialog = gnome_dialog_new (_("Preferences"),
			GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL,
			NULL);
	gnome_dialog_set_parent (GNOME_DIALOG (pref_dialog), GTK_WINDOW (app));
	gtk_signal_connect (GTK_OBJECT(pref_dialog), "delete_event",
			    GTK_SIGNAL_FUNC (cancel), NULL);

	omenu = gtk_option_menu_new ();
	menu = gtk_menu_new ();
	fill_menu (menu);
	gtk_widget_show (omenu);
	gtk_option_menu_set_menu (GTK_OPTION_MENU(omenu), menu);

	f = gtk_frame_new (_ ("Scenario"));
	gtk_container_border_width (GTK_CONTAINER (f), 5);

	hb = gtk_hbox_new (FALSE, FALSE);
	gtk_widget_show (hb);
	
	l = gtk_label_new (_("Select scenario:"));
	gtk_widget_show (l);
	    
	gtk_box_pack_start_defaults (GTK_BOX(hb), l);
	gtk_box_pack_start_defaults (GTK_BOX(hb), omenu);

	cb = gtk_check_button_new_with_label ( _("Make it the default scenario") );
	gtk_signal_connect (GTK_OBJECT(cb), "clicked", (GtkSignalFunc)set_selection_def, NULL);
	gtk_widget_show (cb);

	fv = gtk_vbox_new (0, 5);
	gtk_container_border_width (GTK_CONTAINER (fv), 5);
	gtk_widget_show (fv);
	
	gtk_box_pack_start_defaults (GTK_BOX(fv), hb);
	gtk_box_pack_start_defaults (GTK_BOX(fv), cb);
	gtk_box_pack_start_defaults (GTK_BOX(GNOME_DIALOG(pref_dialog)->vbox), f);
	gtk_container_add (GTK_CONTAINER (f), fv);
	
	gtk_widget_show (f);
	
	gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 0,
			GTK_SIGNAL_FUNC (load_scenario_callback), NULL);
	gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 1,
			GTK_SIGNAL_FUNC (cancel), (gpointer)1);

        gtk_widget_show (pref_dialog);
}
Ejemplo n.º 19
0
/// gtk add on to get the rank in a pull down menu
uint8_t getRangeInMenu(GtkWidget * Menu)
{
    GtkWidget *br, *active;
    int mode;

    br = gtk_option_menu_get_menu(GTK_OPTION_MENU(Menu));
    active = gtk_menu_get_active(GTK_MENU(br));
    mode = g_list_index(GTK_MENU_SHELL(br)->children, active);
    return (uint8_t) mode;
}
Ejemplo n.º 20
0
static void
fill_in_info(EContactEditorIm *editor)
{
	GtkWidget *optmenu;

	fill_in_field(editor, "entry-username",  editor->username);

	optmenu = glade_xml_get_widget(editor->gui, "optmenu-service");

	if (optmenu != NULL)
		gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), editor->service - FIRST_IM_TYPE);

	optmenu = glade_xml_get_widget(editor->gui, "optmenu-location");

	if (optmenu != NULL)
		gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu),
					    (editor->location == NULL ? 2 :
					     !strcmp(editor->location, "WORK") ? 1 : 0));
}
Ejemplo n.º 21
0
static void
property_dialog_setup_option_menu (GtkWidget     *option_menu,
				   GCallback      func,
				   gpointer       user_data,
				   gconstpointer  str1, ...)
{
	GtkWidget     *menu;
	GtkWidget     *menu_item;
	gint           i;
	va_list        args;
	gconstpointer  str;
	gint           type;

       	menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
	if (menu) {
		gtk_widget_destroy (menu);
	}

	menu = gtk_menu_new ();

	va_start (args, str1);
	for (str = str1, i = 0; str != NULL; str = va_arg (args, gpointer), i++) {
		menu_item = gtk_menu_item_new_with_label (str);
		gtk_widget_show (menu_item);
		gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);

		type = va_arg (args, gint);

		g_object_set_data (G_OBJECT (menu_item),
				   "data",
				   GINT_TO_POINTER (type));
		if (func) {
			g_signal_connect (menu_item,
					  "activate",
					  func,
					  user_data);
		}
	}
	va_end (args);

	gtk_widget_show (menu);
	gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
}
Ejemplo n.º 22
0
static void
on_table_editor_removed_entry (ScimAnthyTableEditor *editor, gpointer data)
{
    // change menu item to "User deined"
    gtk_option_menu_set_history (
        GTK_OPTION_MENU (__widget_romaji_theme_menu2),
        ROMAJI_THEME_INDEX_USER_DEFINED);

    __style_changed = true;
}
Ejemplo n.º 23
0
/*
	Change the text of the nth entry in the menu

*/
void changeTextInMenu(GtkWidget *menu,int range,const char *text)
{
    GtkWidget *br, *active;
    int mode;

    br = gtk_option_menu_get_menu(GTK_OPTION_MENU(menu));
        
    //gtk_label_set_text(GTK_LABEL(br),text);

}
Ejemplo n.º 24
0
void xvidFill(GtkWidget *dialog,xvidEncParam *myParam)
{

	 SPIN_SET(spinImin,imin);
	 SPIN_SET(spinImax,imax);
	 SPIN_SET(spinPmin,pmin);
	 SPIN_SET(spinPmax,pmax);

	 SPIN_SET(spinbuttonMaxIFrame,max_key_interval);
	 SPIN_SET(spinbuttonMinIFrame,min_key_interval);

	 if(myParam->quantizer==stQuant[0])
	 	gtk_option_menu_set_history (GTK_OPTION_MENU(WID(optionQzer)),0);
	else
		gtk_option_menu_set_history (GTK_OPTION_MENU(WID(optionQzer)),1);

	MENU_SET(optionME,gui_option);

}
Ejemplo n.º 25
0
static void qcad_clock_combo_instance_init (GObject *object, gpointer data)
  {
  GtkWidget *item = NULL, *mnu = NULL ;
  QCADClockCombo *qcc = QCAD_CLOCK_COMBO (object) ;
  DBG_OO (fprintf (stderr, "QCADClockCombo::instance_init:Entering\n")) ;

  qcc->widget = gtk_option_menu_new () ;
  gtk_box_pack_start (GTK_BOX (object), qcc->widget, FALSE, TRUE, 0) ;
  gtk_widget_show (qcc->widget) ;
  g_object_set_data (G_OBJECT (qcc->widget), "clock", (gpointer)-1) ;

  mnu = gtk_menu_new () ;
  gtk_widget_show (mnu) ;
  gtk_option_menu_set_menu (GTK_OPTION_MENU (qcc->widget), mnu) ;

  item = gtk_menu_item_new_with_label (_("Clock 0")) ;
  gtk_widget_show (item) ;
  gtk_container_add (GTK_CONTAINER (mnu), item) ;
  g_object_set_data (G_OBJECT (item), "clock", (gpointer)0) ;
  g_signal_connect (G_OBJECT (item), "activate", (GCallback)qcad_clock_combo_item_activate, qcc) ;

  item = gtk_menu_item_new_with_label (_("Clock 1")) ;
  gtk_widget_show (item) ;
  gtk_container_add (GTK_CONTAINER (mnu), item) ;
  g_object_set_data (G_OBJECT (item), "clock", (gpointer)1) ;
  g_signal_connect (G_OBJECT (item), "activate", (GCallback)qcad_clock_combo_item_activate, qcc) ;

  item = gtk_menu_item_new_with_label (_("Clock 2")) ;
  gtk_widget_show (item) ;
  gtk_container_add (GTK_CONTAINER (mnu), item) ;
  g_object_set_data (G_OBJECT (item), "clock", (gpointer)2) ;
  g_signal_connect (G_OBJECT (item), "activate", (GCallback)qcad_clock_combo_item_activate, qcc) ;

  item = gtk_menu_item_new_with_label (_("Clock 3")) ;
  gtk_widget_show (item) ;
  gtk_container_add (GTK_CONTAINER (mnu), item) ;
  g_object_set_data (G_OBJECT (item), "clock", (gpointer)3) ;
  g_signal_connect (G_OBJECT (item), "activate", (GCallback)qcad_clock_combo_item_activate, qcc) ;

  gtk_option_menu_set_history (GTK_OPTION_MENU (qcc->widget), 0) ;
  DBG_OO (fprintf (stderr, "QCADClockCombo::instance_init:Leaving\n")) ;
  }
Ejemplo n.º 26
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_option_menu_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gchar *items;
  GtkWidget *menu, *menuitem;
  gint choice;

  items = gb_widget_input_text (data, Items);
  if (data->apply)
    {
      gchar *pos = items;
      gchar *items_end = &items[strlen (items)];

      menu = gtk_menu_new ();
      gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
			  GTK_SIGNAL_FUNC (gb_option_menu_on_option_selected),
			  widget);

      while (pos < items_end)
	{
	  gchar *item_end = strchr (pos, '\n');
	  if (item_end == NULL)
	    item_end = items_end;
	  *item_end = '\0';

	  menuitem = gtk_menu_item_new_with_label (pos);
	  gtk_widget_show (menuitem);
	  gtk_menu_append (GTK_MENU (menu), menuitem);

	  pos = item_end + 1;
	}
      gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu);
    }
  if (data->action == GB_APPLYING)
    g_free (items);

  choice = gb_widget_input_int (data, Choice);
  if (data->apply)
    {
      gtk_option_menu_set_history (GTK_OPTION_MENU (widget), choice);
    }
}
Ejemplo n.º 27
0
static void
check_visible_sizes (const gchar *stock_id, gboolean show_all)
{
  GtkIconSet *icon_set;
  GtkIconSize *sizes;
  gint n_sizes, i, j;
  GtkWidget *option_menu, *menu;
  gboolean item_visible[G_N_ELEMENTS(GladeIconSizeValues)];
  GList *children;

  for (j = 0; j < GladeIconSizeChoicesSize; j++)
    item_visible[j] = show_all;

  if (!show_all)
    {
      icon_set = gtk_icon_factory_lookup_default (stock_id);
      if (icon_set)
	{
	  gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
	  /* Figure out which of our choices should be visible. */
	  for (i = 0; i < n_sizes; i++)
	    {
	      for (j = 0; j < GladeIconSizeChoicesSize; j++)
		{
		  if (sizes[i] == GladeIconSizeValues[j])
		    item_visible[j] = TRUE;
		}
	    }
	  g_free (sizes);
	}
    }

  /* Show or Hide the items as appropriate. */
  option_menu = property_get_value_widget (IconSize);
  g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));

  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
  g_return_if_fail (GTK_IS_MENU (menu));

  children = GTK_MENU_SHELL (menu)->children;
  for (j = 0; j < GladeIconSizeChoicesSize; j++)
    {
      GtkWidget *item;

      item = children->data;

      if (item_visible[j])
	gtk_widget_show (item);
      else
	gtk_widget_hide (item);

      children = children->next;
    }
}
Ejemplo n.º 28
0
static void
picture_store(JamView *view) {
	int sel = gtk_option_menu_get_history(GTK_OPTION_MENU(view->pic));
	LJUser *user = jam_account_lj_get_user(JAM_ACCOUNT_LJ(view->account));
	const char *pickw = NULL;

	if (sel > 0)
		pickw = g_slist_nth(user->pickws, sel-1)->data;

	jam_doc_set_picture(view->doc, pickw);
}
Ejemplo n.º 29
0
static void
gb_option_menu_add_child (GtkWidget *widget,
			  GtkWidget *child,
			  GbWidgetSetArgData *data)
{
  if (GTK_IS_MENU (child))
    gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), child);
  else
    g_warning (_("Cannot add a %s to a GtkOptionMenu."),
	       g_type_name (G_OBJECT_TYPE (child)));
}
Ejemplo n.º 30
0
void ctk_drop_down_menu_set_current_value(CtkDropDownMenu *d, gint value)
{
    gint i;
    
    for (i = 0; i < d->num_entries; i++) {
        if (d->values[i].value == value) {
            gtk_option_menu_set_history(GTK_OPTION_MENU(d->option_menu), i);
            return;
        }
    }
} /* ctk_drop_down_menu_set_current_value() */