dia r4226 - in trunk: . app plug-ins/cairo plug-ins/postscript plug-ins/wmf
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4226 - in trunk: . app plug-ins/cairo plug-ins/postscript plug-ins/wmf
- Date: Sat, 24 Jan 2009 21:35:56 +0000 (UTC)
Author: hans
Date: Sat Jan 24 21:35:56 2009
New Revision: 4226
URL: http://svn.gnome.org/viewvc/dia?rev=4226&view=rev
Log:
2009-01-24 Hans Breuer <hans breuer org>
[
One menu entry File/Print is enough. The not any longer experimental
cairo plug-in together with GtkPrint from gtk+-2-12 and cairo-1- or
above superseds both former print facilities.
]
* app/menus.[ch] : introduce /InvisibleMenu as target for known actions
registered from plug-ins supposed to be available only once. Currently
there is just one of these actions "FilePrint" which gets routed to
FilePrintGTK, FilePrintGDI or FilePrintPS in that order, i.e. depending
on the plug-ins being loaded
* plug-ins/cairo/diacairo.c plug-ins/postscript/postscript.c
plug-ins/wmf/wmf.cpp : register print actions to invisible menu
Modified:
trunk/ChangeLog
trunk/app/menus.c
trunk/app/menus.h
trunk/plug-ins/cairo/diacairo.c
trunk/plug-ins/postscript/postscript.c
trunk/plug-ins/wmf/wmf.cpp
Modified: trunk/app/menus.c
==============================================================================
--- trunk/app/menus.c (original)
+++ trunk/app/menus.c Sat Jan 24 21:35:56 2009
@@ -510,8 +510,7 @@
sep = strrchr (subpath, '/');
*sep = '\0'; /* cut subpath */
action_name = sep + 1;
-
-
+
ensure_menu_path (ui_manager, actions, subpath, FALSE);
action = gtk_action_new (action_name, sep + 1, NULL, NULL);
@@ -809,6 +808,18 @@
}
}
+/* Very minimal fallback menu info for ui-files missing
+ * as well as to register the InvisibleMenu */
+static const gchar *ui_info =
+"<ui>\n"
+" <popup name=\"InvisibleMenu\">\n"
+" <menu name=\"File\" action=\"File\">\n"
+" <menuitem name=\"FilePrint\" action=\"FilePrint\" />\n"
+" <menuitem name=\"FileQuit\" action=\"FileQuit\" />\n"
+" </menu>\n"
+" </popup>\n"
+"</ui>";
+
static void
menus_init(void)
{
@@ -851,8 +862,7 @@
g_free (uifile);
toolbox_accels = gtk_ui_manager_get_accel_group (toolbox_ui_manager);
- toolbox_menubar = gtk_ui_manager_get_widget (toolbox_ui_manager, "/ToolboxMenu");
-
+ toolbox_menubar = gtk_ui_manager_get_widget (toolbox_ui_manager, TOOLBOX_MENU);
/* the display menu */
display_actions = gtk_action_group_new ("display-actions");
@@ -882,6 +892,12 @@
gtk_ui_manager_set_add_tearoffs (display_ui_manager, DIA_SHOW_TEAROFFS);
gtk_ui_manager_insert_action_group (display_ui_manager, display_actions, 0);
gtk_ui_manager_insert_action_group (display_ui_manager, display_tool_actions, 0);
+ if (!gtk_ui_manager_add_ui_from_string (display_ui_manager, ui_info, -1, &error)) {
+ g_warning ("built-in menus failed: %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+
uifile = build_ui_filename ("ui/popup-ui.xml");
/* TODO it would be more elegant if we had only one definition of the
* menu hierarchy and merge it into a popup somehow. */
@@ -893,12 +909,12 @@
g_free (uifile);
display_accels = gtk_ui_manager_get_accel_group (display_ui_manager);
- display_menubar = gtk_ui_manager_get_widget (display_ui_manager, "/DisplayMenu");
+ display_menubar = gtk_ui_manager_get_widget (display_ui_manager, DISPLAY_MENU);
g_assert (display_menubar);
-
add_plugin_actions (toolbox_ui_manager, TOOLBOX_MENU);
add_plugin_actions (display_ui_manager, DISPLAY_MENU);
+ add_plugin_actions (display_ui_manager, INVISIBLE_MENU);
/* load accelerators and prepare to later save them */
accelfilename = dia_config_filename("menurc");
Modified: trunk/app/menus.h
==============================================================================
--- trunk/app/menus.h (original)
+++ trunk/app/menus.h Sat Jan 24 21:35:56 2009
@@ -23,6 +23,7 @@
#define TOOLBOX_MENU "/ToolboxMenu"
#define DISPLAY_MENU "/DisplayMenu"
#define INTEGRATED_MENU "/IntegratedUIMenu"
+#define INVISIBLE_MENU "/InvisibleMenu"
struct zoom_pair { const gchar *string; const gint value; };
Modified: trunk/plug-ins/cairo/diacairo.c
==============================================================================
--- trunk/plug-ins/cairo/diacairo.c (original)
+++ trunk/plug-ins/cairo/diacairo.c Sat Jan 24 21:35:56 2009
@@ -424,7 +424,7 @@
static DiaCallbackFilter cb_gtk_print = {
"FilePrintGTK",
N_("Print (GTK) ..."),
- "/DisplayMenu/File/FilePrint",
+ "/InvisibleMenu/File/FilePrint",
cairo_print_callback,
(void*)OUTPUT_PDF
};
Modified: trunk/plug-ins/postscript/postscript.c
==============================================================================
--- trunk/plug-ins/postscript/postscript.c (original)
+++ trunk/plug-ins/postscript/postscript.c Sat Jan 24 21:35:56 2009
@@ -44,7 +44,7 @@
static DiaCallbackFilter cb_ps_print = {
"FilePrintPS",
N_("Print (PS)"),
- "/DisplayMenu/File/FilePrint",
+ "/InvisibleMenu/File/FilePrint",
print_callback,
NULL
};
Modified: trunk/plug-ins/wmf/wmf.cpp
==============================================================================
--- trunk/plug-ins/wmf/wmf.cpp (original)
+++ trunk/plug-ins/wmf/wmf.cpp Sat Jan 24 21:35:56 2009
@@ -1393,7 +1393,7 @@
static DiaCallbackFilter cb_gdi_print = {
"FilePrintGDI",
N_("Print (GDI) ..."),
- "/DisplayMenu/File/FilePrint",
+ "/InvisibleMenu/File/FilePrint",
print_callback,
NULL
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]