• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


コミットメタ情報

リビジョン21afdeaf027afe288fac157593683e01a71552c3 (tree)
日時2014-09-20 01:48:55
作者Hans Breuer <hans@breu...>
コミッターHans Breuer

ログメッセージ

[gtk-osx] Improve top menu integration for App part

Move some menu items to the MAC specific menu named 'dia'.
At least About and Preferences belong their, also hide the
File/Quit entry to avoid redundance.
For further application wide entries like 'Diagram Tree' and
'Sheets and Objects' the movement is prepared, but not done yet.

変更サマリ

差分

--- a/app/interface.c
+++ b/app/interface.c
@@ -910,35 +910,44 @@ app_set_icon (GtkWindow *window)
910910
911911 #ifdef HAVE_MAC_INTEGRATION
912912 static void
913-_create_mac_integration (void)
913+_create_mac_integration (GtkWidget *menubar)
914914 {
915915 GtkosxApplication *theOsxApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
916- GtkWidget *menubar = NULL;
917916
918917 /* from control-x to command-x in one call? Does _not_ work as advertized */
919918 gtkosx_application_set_use_quartz_accelerators (theOsxApp, TRUE);
920- /* might be too early ... */
921- menus_get_integrated_ui_menubar (&menubar, NULL, NULL);
919+
922920 if (menubar) {
923- gtk_widget_hide (menubar); /* not working, it's shown elsewhere */
924- /* move some items to the dia menu */
925- {
926- GSList *proxies, *proxy;
927- GtkAction *action;
928-
929- action = menus_get_action ("HelpAbout");
930- proxies = gtk_action_get_proxies (action);
931-
932- for (proxy = proxies; proxy != NULL; proxy = g_slist_next (proxy)) {
933- g_print ("XXX ");
934- if (1 || GTK_IS_MENU_ITEM (proxy->data)) {
935- gtkosx_application_insert_app_menu_item (theOsxApp, GTK_WIDGET (proxy->data), 0);
936- break;
937- }
938- }
939- }
940921 /* hijack the menubar */
941922 gtkosx_application_set_menu_bar(theOsxApp, GTK_MENU_SHELL(menubar));
923+ /* move some items to the dia menu - apparently must be _after_ hijack */
924+ {
925+ GtkWidget *item;
926+
927+ item = menus_get_widget (INTEGRATED_MENU "/Help/HelpAbout");
928+ if (GTK_IS_MENU_ITEM (item))
929+ gtkosx_application_insert_app_menu_item (theOsxApp, item, 0);
930+ gtkosx_application_insert_app_menu_item (theOsxApp, gtk_separator_menu_item_new (), 1);
931+ item = menus_get_widget (INTEGRATED_MENU "/File/FilePrefs");
932+ if (GTK_IS_MENU_ITEM (item))
933+ gtkosx_application_insert_app_menu_item (theOsxApp, item, 2);
934+ item = menus_get_widget (INTEGRATED_MENU "/File/FilePlugins");
935+ if (GTK_IS_MENU_ITEM (item))
936+ gtkosx_application_insert_app_menu_item (theOsxApp, item, 3);
937+#if 0 /* not sure if we should move these, too */
938+ item = menus_get_widget (INTEGRATED_MENU "/File/FileTree");
939+ if (GTK_IS_MENU_ITEM (item))
940+ gtkosx_application_insert_app_menu_item (theOsxApp, item, 4);
941+ item = menus_get_widget (INTEGRATED_MENU "/File/FileSheets");
942+ if (GTK_IS_MENU_ITEM (item))
943+ gtkosx_application_insert_app_menu_item (theOsxApp, item, 5);
944+#endif
945+ /* remove Quit from File menu */
946+ item = menus_get_widget (INTEGRATED_MENU "/File/FileQuit");
947+ if (GTK_IS_MENU_ITEM (item))
948+ gtk_widget_hide (item);
949+ }
950+ gtk_widget_hide (menubar); /* not working, it's shown elsewhere */
942951 /* setup the dock icon */
943952 gtkosx_application_set_dock_icon_pixbuf (theOsxApp,
944953 gdk_pixbuf_new_from_inline (-1, dia_app_icon, FALSE, NULL));
@@ -1034,14 +1043,14 @@ create_integrated_ui (void)
10341043 * uses the tool buttons*/
10351044 menus_get_integrated_ui_menubar(&menubar, &toolbar, &accel_group);
10361045 gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
1046+ gtk_widget_show (menubar);
10371047 #ifdef HAVE_GNOME
10381048 gnome_app_set_menus (GNOME_APP (window), GTK_MENU_BAR (menubar));
10391049 #else
10401050 # ifdef HAVE_MAC_INTEGRATION
1041- _create_mac_integration ();
1051+ _create_mac_integration (menubar);
10421052 # else
10431053 gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
1044- gtk_widget_show (menubar);
10451054 # endif
10461055 #endif
10471056
@@ -1119,14 +1128,14 @@ create_toolbox ()
11191128 * uses the tool buttons*/
11201129 menus_get_toolbox_menubar(&menubar, &accel_group);
11211130 gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
1131+ gtk_widget_show (menubar);
11221132 #ifdef HAVE_GNOME
11231133 gnome_app_set_menus(GNOME_APP(window), GTK_MENU_BAR(menubar));
11241134 #else
11251135 # ifdef HAVE_MAC_INTEGRATION
1126- _create_mac_integration ();
1136+ _create_mac_integration (menubar);
11271137 # else
11281138 gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
1129- gtk_widget_show (menubar);
11301139 # endif
11311140 #endif
11321141 persistence_register_window(GTK_WINDOW(window));
--- a/app/menus.c
+++ b/app/menus.c
@@ -1045,7 +1045,7 @@ menus_get_integrated_ui_menubar (GtkWidget **menubar,
10451045
10461046 /* maybe better to put this into toolbox_actions? */
10471047 gtk_action_group_add_toggle_actions (display_actions, integrated_ui_view_toggle_entries,
1048- G_N_ELEMENTS (integrated_ui_view_toggle_entries), NULL);
1048+ G_N_ELEMENTS (integrated_ui_view_toggle_entries), NULL);
10491049
10501050 /* for stand-alone they are per display */
10511051 gtk_ui_manager_insert_action_group (_ui_manager, display_actions, 0);
@@ -1177,6 +1177,14 @@ menus_get_action (const gchar *name)
11771177 return action;
11781178 }
11791179
1180+GtkWidget *
1181+menus_get_widget (const gchar *name)
1182+{
1183+ g_return_val_if_fail (_ui_manager != NULL, NULL);
1184+
1185+ return gtk_ui_manager_get_widget (_ui_manager, name);
1186+}
1187+
11801188 static int
11811189 cmp_action_names (const void *a, const void *b)
11821190 {
--- a/app/menus.h
+++ b/app/menus.h
@@ -48,6 +48,7 @@ GtkWidget * menus_create_display_menubar (GtkUIManager **ui_manager, Gtk
4848
4949 GtkActionGroup *menus_get_tool_actions (void);
5050 GtkAction * menus_get_action (const gchar *name);
51+GtkWidget * menus_get_widget (const gchar *name);
5152 void menus_set_recent (GtkActionGroup *actions);
5253 void menus_clear_recent (void);
5354