Beispiel #1
0
GtkWidget*
bst_choice_menu_createv (const gchar *menu_path,
			 BstChoice *first_choice,
			 ...)
{
  BstChoice *choice;
  GtkWidget *menu;
  va_list args;
  
  va_start (args, first_choice);
  
  menu = g_object_connect (gtk_widget_new (GTK_TYPE_MENU,
					   NULL),
			   "signal::selection-done", check_modal_quit, NULL,
			   NULL);
  gtk_menu_set_accel_path (GTK_MENU (menu), menu_path);
  gtk_widget_ref (menu);
  gtk_object_sink (GTK_OBJECT (menu));
  
  choice = first_choice;
  while (choice)
    {
      bst_choice_menu_add_choice_and_free (menu, choice);
      choice = va_arg (args, BstChoice*);
    }
  
  va_end (args);
  
  return menu;
}
Beispiel #2
0
static void
toolkitview_refresh( vObject *vobject )
{
	Toolkitview *kview = TOOLKITVIEW( vobject );
	Toolkit *kit = TOOLKIT( VOBJECT( kview )->iobject );
	Toolkitgroupview *kitgview = kview->kitgview;
	GtkWidget *menu = kitgview->menu;
	gboolean changed = FALSE;

#ifdef DEBUG
	printf( "toolkitview_refresh: " );
	iobject_print( VOBJECT( kview )->iobject );
#endif /*DEBUG*/

	/* Make a button ready for the sub-menu. 
	 */
	if( !kview->item ) {
                kview->item = gtk_menu_item_new_with_label( 
			IOBJECT( kit )->name );

                gtk_menu_shell_insert( GTK_MENU_SHELL( menu ),
			kview->item, 
			ICONTAINER( kit )->pos + TOOLKITVIEW_MENU_OFFSET );
                gtk_widget_show( kview->item );
		kview->destroy_sid = g_signal_connect( kview->item, 
			"destroy",
			G_CALLBACK( toolkitview_destroy_cb ), kview );

		changed = TRUE;
	}
	if( !kview->menu ) {
		iWindow *iwnd = IWINDOW( iwindow_get_root( menu ) );
		char path[256];

		kview->menu = gtk_menu_new();
		gtk_menu_set_accel_group( GTK_MENU( kview->menu ),
			iwnd->accel_group );
		im_snprintf( path, 256, 
			"<mainw>/Toolkits/%s", IOBJECT( kit )->name );
		gtk_menu_set_accel_path( GTK_MENU( kview->menu ), path );

		changed = TRUE;
	}

	if( changed )
		gtk_menu_item_set_submenu( GTK_MENU_ITEM( kview->item ), 
			kview->menu );

	widget_visible( kview->item, ICONTAINER( kit )->children != NULL );

	VOBJECT_CLASS( parent_class )->refresh( vobject );
}
Beispiel #3
0
int
clip_GTK_MENUSETACCELPATH(ClipMachine * ClipMachineMemory)
{
   C_widget *cmnu = _fetch_cw_arg(ClipMachineMemory);

   const gchar *path = _clip_parc(ClipMachineMemory, 2);

   CHECKCWID(cmnu, GTK_IS_MENU);
   CHECKARG(2, CHARACTER_type_of_ClipVarType);

   gtk_menu_set_accel_path(GTK_MENU(cmnu->widget), path);
   return 0;
 err:
   return 1;
}