Exemple #1
0
/*#
    @method remove_menu GtkOptionMenu
    @brief Removes the menu from the option menu.
 */
FALCON_FUNC OptionMenu::remove_menu( VMARG )
{
    NO_ARGS
    MYSELF;
    GET_OBJ( self );
    gtk_option_menu_remove_menu( (GtkOptionMenu*)_obj );
}
Exemple #2
0
void wxChoice::DoClear()
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );

    gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
    GtkWidget *menu = gtk_menu_new();
    gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );

    m_clientList.Clear();

    if ( m_strings )
        m_strings->Clear();

    // begin with no selection
    m_selection_hack = wxNOT_FOUND;
}
Exemple #3
0
void ACDSetInitial_Combo(void)
{
  GtkWidget* opts[4] = {optAC11, optAC12, optAC2, optAC3};

  int numact8 = actor->GetNumAction() / 8;
  if (actor->GetNumAction() % 8)  numact8++;

  char buf[20];
  GtkWidget *menu;
  GtkWidget *menui;
  for (int i=0; i<4; i++) {
    gtk_option_menu_remove_menu(GTK_OPTION_MENU(opts[i]));
    menu = gtk_menu_new();
    for (int j=0; j<numact8; j++) {
      SNPRINTF(buf, sizeof(buf), "act%02d", j);
      menui = gtk_menu_item_new_with_label(buf);
      gtk_widget_show(menui);
      gtk_container_add(GTK_CONTAINER(menu), menui);
    }
    gtk_option_menu_set_menu(GTK_OPTION_MENU(opts[i]), menu);
  }
}
Exemple #4
0
void
layer_dialog_update_diagram_list(void)
{
  GtkWidget *new_menu;
  GtkWidget *menu_item;
  GList *dia_list;
  Diagram *dia;
  char *filename;
  int i;
  int current_nr;

  if (layer_dialog == NULL || layer_dialog->dialog == NULL) {
    if (!dia_open_diagrams())
      return; /* shortcut; maybe session end w/o this dialog */
    else
      layer_dialog_create();
  }
  g_assert(layer_dialog != NULL); /* must be valid now */
  /* oh this options: here integrated UI ;( */
  if (!layer_dialog->diagram_omenu)
    return;
        
  new_menu = gtk_menu_new();

  current_nr = -1;
  
  i = 0;
  dia_list = dia_open_diagrams();
  while (dia_list != NULL) {
    dia = (Diagram *) dia_list->data;

    if (dia == layer_dialog->diagram) {
      current_nr = i;
    }
    
    filename = strrchr(dia->filename, G_DIR_SEPARATOR);
    if (filename==NULL) {
      filename = dia->filename;
    } else {
      filename++;
    }

    menu_item = gtk_menu_item_new_with_label(filename);

    g_signal_connect (G_OBJECT (menu_item), "activate",
		      G_CALLBACK (layer_dialog_select_diagram_callback), dia);

    gtk_menu_append( GTK_MENU(new_menu), menu_item);
    gtk_widget_show (menu_item);

    dia_list = g_list_next(dia_list);
    i++;
  }

  if (dia_open_diagrams()==NULL) {
    menu_item = gtk_menu_item_new_with_label (_("none"));
    g_signal_connect (G_OBJECT (menu_item), "activate",
		      G_CALLBACK (layer_dialog_select_diagram_callback), NULL);
    gtk_menu_append( GTK_MENU(new_menu), menu_item);
    gtk_widget_show (menu_item);
  }
  
  gtk_option_menu_remove_menu(GTK_OPTION_MENU(layer_dialog->diagram_omenu));

  gtk_option_menu_set_menu(GTK_OPTION_MENU(layer_dialog->diagram_omenu),
			   new_menu);

  gtk_option_menu_set_history(GTK_OPTION_MENU(layer_dialog->diagram_omenu),
			      current_nr);
  gtk_menu_set_active(GTK_MENU(new_menu), current_nr);

  if (current_nr == -1) {
    dia = NULL;
    if (dia_open_diagrams()!=NULL) {
      dia = (Diagram *) dia_open_diagrams()->data;
    }
    layer_dialog_set_diagram(dia);
  }
}
Exemple #5
0
static VALUE
rg_remove_menu(VALUE self)
{
    gtk_option_menu_remove_menu(GTK_OPTION_MENU(RVAL2GOBJ(self)));
    return self;
}
// Populate both the drop-down on the import tab and within the file browse dialog
void populate_polsarpro_classification_optionmenu()
{
  // Set up the menus (one on the import tab, the other on the input file browse dialog
  GtkWidget *browse_menu = NULL;
  GtkWidget *browse_option_menu = get_widget_checked("browse_select_colormap_optionmenu");
  if (browse_option_menu) {
    browse_menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(browse_option_menu));
    if (browse_menu) {
      gtk_option_menu_remove_menu(GTK_OPTION_MENU(browse_option_menu));
    }
  }
  browse_menu = gtk_menu_new();

  GtkWidget *browse_item = gtk_menu_item_new_with_label("None");
  gtk_menu_append(GTK_MENU(browse_menu), browse_item);
  gtk_widget_show(browse_item);

  browse_item = gtk_separator_menu_item_new();
  gtk_menu_append(GTK_MENU(browse_menu), browse_item);
  gtk_widget_show(browse_item);

  char lut_loc[1024];
  sprintf(lut_loc, "%s%clook_up_tables", get_asf_share_dir(), DIR_SEPARATOR);
  if (g_polsarpro_classification_optionmenu_ht == NULL) {
    g_polsarpro_classification_optionmenu_ht = g_hash_table_new(g_str_hash,g_str_equal);
  }

  // Open up the share dir's look up tables list, populate dropdown
  // from the files in that directory.
  GDir *lut_dir = g_dir_open(lut_loc, 0, NULL);
  if (lut_dir) {
    unsigned int i, n=0;
    char **names = (char**)MALLOC(sizeof(char*)*MAX_LUTS);

    while (1) {
      const char *name = (char*)g_dir_read_name(lut_dir);
      if (name) {
        char *name_dup = STRDUP(name);
        char *p = findExt(name_dup);
        if (p && strcmp(p, ".pal") == 0 && is_jasc_palette_lut(name)) {
          *p = '\0'; // don't show ".pal" extension in menu
          names[n++] = name_dup;
          // quit when we get too many
          if (n > MAX_LUTS)
            break;
        }
      } else
        break;
    }
    g_dir_close(lut_dir);

    // alphabetize
    qsort(names, n, sizeof(char*), my_strcmp);

    // now populate the menus
    for (i=0; i<n; ++i) {
      browse_item = gtk_menu_item_new_with_label(names[i]);
      g_object_set_data(G_OBJECT(browse_item), "file", (gpointer)names[i]);
      g_object_set_data(G_OBJECT(browse_item), "index", GUINT_TO_POINTER(i+2));
      gtk_menu_append(GTK_MENU(browse_menu), browse_item);
      gtk_widget_show(browse_item);
      g_hash_table_insert(g_polsarpro_classification_optionmenu_ht,
                          (gpointer)g_strdup(names[i]),
                           GUINT_TO_POINTER(i+2));
    }
  }

  browse_option_menu = get_widget_checked("browse_select_colormap_optionmenu");

  gtk_option_menu_set_menu(GTK_OPTION_MENU(browse_option_menu), browse_menu);
  gtk_option_menu_set_history(GTK_OPTION_MENU(browse_option_menu), 0);

  gtk_widget_show(browse_menu);
  gtk_widget_show(browse_option_menu);
}
static void
wireless_applet_properties_dialog (BonoboUIComponent *uic,
				  WirelessApplet *applet)
{
	static GtkWidget *global_property_box = NULL,
		*glade_property_box = NULL;
	GtkWidget *pct, *dialog, *device;

	g_return_if_fail (PANEL_IS_APPLET (PANEL_APPLET (applet)));

	if (applet->prefs != NULL)
	{
		gtk_widget_show (applet->prefs);
		gtk_window_present (GTK_WINDOW (applet->prefs));
		return;
	}

	if (global_property_box == NULL) {
		xml = glade_xml_new (glade_file, NULL, NULL);
		glade_property_box = glade_xml_get_widget (xml,"dialog1");
	}

	applet->prefs = glade_property_box;
	gtk_window_set_resizable (GTK_WINDOW (applet->prefs), FALSE);

	pct = glade_xml_get_widget (xml, "pct_check_button");
	dialog = glade_xml_get_widget (xml, "dialog_check_button");
	device = glade_xml_get_widget (xml, "device_menu");

	/* Set the show-percent thingy */
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pct),
			applet->show_percent);
	g_signal_connect (GTK_OBJECT (pct),
			"toggled",
			GTK_SIGNAL_FUNC (wireless_applet_option_change),
			applet);
	gtk_object_set_data (GTK_OBJECT (applet->prefs),
			"show-percent-button", pct);

        /* Set the device menu */
	gtk_option_menu_remove_menu (GTK_OPTION_MENU (device));
	{
		GtkWidget *menu;
		GtkWidget *item;
		GList *d;
		int idx = 0, choice = 0;

		menu = gtk_menu_new ();

		for (d = applet->devices; d != NULL; d = g_list_next (d)) {
			item = gtk_menu_item_new_with_label ((char*)d->data);
			gtk_menu_shell_append  (GTK_MENU_SHELL (menu),item);
			gtk_object_set_data_full (GTK_OBJECT (item), 
					"device-selected",
					g_strdup (d->data),
					g_free);
			g_signal_connect (GTK_OBJECT (item),
					"activate",
					GTK_SIGNAL_FUNC (wireless_applet_option_change),
					applet);

			if ((applet->device != NULL)
					&& (d->data != NULL)
					&& strcmp (applet->device, d->data)==0)
			{
				choice = idx;
			}
			idx++;
		}
		if (applet->devices == NULL) {
			char *markup;
			GtkWidget *label;
			
			label = gtk_label_new (NULL);
			markup = g_strdup_printf ("<i>%s</i>",
					_("No Wireless Devices"));
			gtk_label_set_markup (GTK_LABEL (label), markup);
			g_free (markup);

			item = gtk_menu_item_new ();
			gtk_container_add (GTK_CONTAINER (item), label);
			gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
		}
		gtk_option_menu_set_menu (GTK_OPTION_MENU (device), menu);
		gtk_option_menu_set_history (GTK_OPTION_MENU (device), choice);
	}
	gtk_object_set_data (GTK_OBJECT (applet->prefs), "device-menu", device);

	g_signal_connect (GTK_OBJECT (applet->prefs),
			"response", 
			G_CALLBACK (prefs_response_cb),
			NULL);
	g_signal_connect (GTK_OBJECT (applet->prefs),
			"destroy",
			GTK_SIGNAL_FUNC (gtk_widget_destroy),
			NULL);

	g_object_add_weak_pointer (G_OBJECT (applet->prefs),
			(void**)&(applet->prefs));
	gtk_window_set_screen (GTK_WINDOW (applet->prefs),
			       gtk_widget_get_screen (GTK_WIDGET (applet)));
	gtk_widget_show_all (applet->prefs);
}
Exemple #8
0
void
on_rule_list_select_row (GtkCList * clist,
    gint row, gint UNUSED(column), GdkEvent * UNUSED(event), gpointer UNUSED(user_data))
{
    rule *r;
    GtkCombo *c2;
    GtkOptionMenu *om;
    GtkMenu *menu;
    GtkWidget *mi;
    int x;

    rule_row_current = row;
    r = (rule *) gtk_clist_get_row_data (clist, row);
    gtk_entry_set_text (GTK_ENTRY
	(lookup_widget (GTK_WIDGET (clist), "entry8")), r->name);
    gtk_entry_set_text (GTK_ENTRY
	(lookup_widget (GTK_WIDGET (clist), "entry9")), r->regex);

    c2 = GTK_COMBO (lookup_widget (GTK_WIDGET (clist), "combo2"));
    gtk_entry_set_editable (GTK_ENTRY (c2->entry), FALSE);
    gtk_entry_set_text (GTK_ENTRY (c2->entry), r->mbox);

    om = GTK_OPTION_MENU (lookup_widget (GTK_WIDGET (clist), "optionmenu2"));
    gtk_option_menu_remove_menu (om);
    menu = GTK_MENU (gtk_menu_new ());

    if (!strcmp (r->piece, "Message"))
	x = 0;
    mi = gtk_menu_item_new_with_label ("Message");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "Message");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);
    if (!strcmp (r->piece, "Header"))
	x = 1;
    mi = gtk_menu_item_new_with_label ("Header");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "Header");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);
    if (!strcmp (r->piece, "Subject"))
	x = 2;
    mi = gtk_menu_item_new_with_label ("Subject");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "Subject");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);
    if (!strcmp (r->piece, "From"))
	x = 3;
    mi = gtk_menu_item_new_with_label ("From");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "From");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);
    if (!strcmp (r->piece, "Recipients"))
	x = 4;
    mi = gtk_menu_item_new_with_label ("Recipients");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "Recipients");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);
    if (!strcmp (r->piece, "Sender"))
	x = 5;
    mi = gtk_menu_item_new_with_label ("Sender");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "Sender");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);
    if (!strcmp (r->piece, "Body"))
	x = 6;
    mi = gtk_menu_item_new_with_label ("Body");
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (face_gnome_o_rule_setpiece), (gpointer) "Body");
    gtk_menu_append (menu, mi);
    gtk_widget_show (mi);

    gtk_option_menu_set_menu (om, GTK_WIDGET (menu));
    gtk_option_menu_set_history (om, x);
}