label->private->untitled_instance = ++untitled;
}
- return g_strdup_printf ( _("%s %d"), _("Untitled"),
+ return g_strdup_printf ( "%s %d", _("Untitled"),
label->private->untitled_instance );
} else {
+ gchar *temp_name, *short_name;
- return g_path_get_basename ( label->private->filename );
+ temp_name = g_path_get_basename ( label->private->filename );
+ short_name = gl_util_remove_extension (temp_name);
+ g_free (temp_name);
+ return short_name;
}
}
#include "glabels.h"
#include "ui.h"
#include "prefs.h"
-#include "recent.h"
#include "file.h"
#include "view.h"
#include "debug.h"
-#include "gnome-recent-view.h"
#include "alert.h"
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-control.h>
-#include <gconf/gconf-client.h>
-
/*========================================================*/
/* Private macros and constants. */
/*========================================================*/
static void gl_mdi_finalize (GObject *object);
static void gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win);
-static void gl_mdi_set_app_main_toolbar_style (BonoboWindow *win);
-static void gl_mdi_set_app_drawing_toolbar_style (BonoboWindow *win);
-static void gl_mdi_set_app_statusbar_style (BonoboWindow *win);
static gint gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child);
static gint gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view);
static void gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi);
static void gl_mdi_set_active_window_selection_verbs_sensitivity (BonoboMDI *mdi);
-static void gl_mdi_view_menu_item_toggled_cb (
- BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- BonoboWindow *win);
\f
/*****************************************************************************/
GtkWidget *widget;
BonoboControl *control;
BonoboUIComponent *ui_component;
- GnomeRecentView *view;
- GnomeRecentModel *model;
-
- static GtkTargetEntry drag_types[] =
- {
- { "text/uri-list", 0, 0 },
- };
-
- static gint n_drag_types =
- sizeof (drag_types) / sizeof (drag_types [0]);
gl_debug (DEBUG_MDI, "START");
ui_component = bonobo_mdi_get_ui_component_from_window (win);
g_return_if_fail (ui_component != NULL);
-
- /* Set the toolbar style according to prefs */
- gl_mdi_set_app_main_toolbar_style (win);
-
- /* Add listener fo the view menu */
- bonobo_ui_component_add_listener (ui_component, "ViewMainToolbar",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
-
- bonobo_ui_component_add_listener (ui_component, "MainToolbarSystem",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "MainToolbarIcon",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "MainToolbarIconText",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "MainToolbarTooltips",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
-
- /* Set the toolbar style according to prefs */
- gl_mdi_set_app_drawing_toolbar_style (win);
-
- /* Add listener fo the view menu */
- bonobo_ui_component_add_listener (ui_component, "ViewDrawingToolbar",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
-
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarSystem",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIcon",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIconText",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
- bonobo_ui_component_add_listener (ui_component, "DrawingToolbarTooltips",
- (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb,
- (gpointer)win);
-
-
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_no_docs_sensible_verbs,
- FALSE);
-
- /* add a GeditRecentView object */
- model = gl_recent_get_model ();
- view = GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component,
- "/menu/File/Recents"));
- gnome_recent_view_set_model (view, model);
-
- g_signal_connect (G_OBJECT (view), "activate",
- G_CALLBACK (gl_file_open_recent), win);
-
- gl_debug (DEBUG_MDI, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* Menu item togglded callback. */
-/*---------------------------------------------------------------------------*/
-static void
-gl_mdi_view_menu_item_toggled_cb (
- BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- BonoboWindow *win)
-{
- gboolean s;
-
- gl_debug (DEBUG_MDI, "%s toggled to '%s'", path, state);
-
- s = (strcmp (state, "1") == 0);
-
- if ((strcmp (path, "ViewMainToolbar") == 0) &&
- (s != gl_prefs->main_toolbar_visible))
- {
- gl_prefs->main_toolbar_visible = s;
- gl_mdi_set_app_main_toolbar_style (win);
-
- return;
- }
-
- if (s && (strcmp (path, "MainToolbarSystem") == 0) &&
- (gl_prefs->main_toolbar_buttons_style != GL_TOOLBAR_SYSTEM))
- {
- gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
- gl_mdi_set_app_main_toolbar_style (win);
-
- return;
- }
-
- if (s && (strcmp (path, "MainToolbarIcon") == 0) &&
- (gl_prefs->main_toolbar_buttons_style != GL_TOOLBAR_ICONS))
- {
- gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS;
- gl_mdi_set_app_main_toolbar_style (win);
-
- return;
- }
-
- if (s && (strcmp (path, "MainToolbarIconText") == 0) &&
- (gl_prefs->main_toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT))
- {
- gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
- gl_mdi_set_app_main_toolbar_style (win);
-
- return;
- }
-
- if ((strcmp (path, "MainToolbarTooltips") == 0) &&
- (s != gl_prefs->main_toolbar_view_tooltips))
- {
- gl_prefs->main_toolbar_view_tooltips = s;
- gl_mdi_set_app_main_toolbar_style (win);
-
- return;
- }
-
- if ((strcmp (path, "ViewDrawingToolbar") == 0) &&
- (s != gl_prefs->drawing_toolbar_visible))
- {
- gl_prefs->drawing_toolbar_visible = s;
- gl_mdi_set_app_drawing_toolbar_style (win);
-
- return;
- }
-
- if (s && (strcmp (path, "DrawingToolbarSystem") == 0) &&
- (gl_prefs->drawing_toolbar_buttons_style != GL_TOOLBAR_SYSTEM))
- {
- gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
- gl_mdi_set_app_drawing_toolbar_style (win);
-
- return;
- }
-
- if (s && (strcmp (path, "DrawingToolbarIcon") == 0) &&
- (gl_prefs->drawing_toolbar_buttons_style != GL_TOOLBAR_ICONS))
- {
- gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS;
- gl_mdi_set_app_drawing_toolbar_style (win);
-
- return;
- }
-
- if (s && (strcmp (path, "DrawingToolbarIconText") == 0) &&
- (gl_prefs->drawing_toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT))
- {
- gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
- gl_mdi_set_app_drawing_toolbar_style (win);
-
- return;
- }
-
- if ((strcmp (path, "DrawingToolbarTooltips") == 0) &&
- (s != gl_prefs->drawing_toolbar_view_tooltips))
- {
- gl_prefs->drawing_toolbar_view_tooltips = s;
- gl_mdi_set_app_drawing_toolbar_style (win);
- return;
- }
-
-}
-
-/*---------------------------------------------------------------------------*/
-/* Set main toolbar style. */
-/*---------------------------------------------------------------------------*/
-static void
-gl_mdi_set_app_main_toolbar_style (BonoboWindow *win)
-{
- BonoboUIComponent *ui_component;
- GConfClient *client;
- gboolean labels;
-
- gl_debug (DEBUG_MDI, "START");
-
- g_return_if_fail (BONOBO_IS_WINDOW (win));
-
- ui_component = bonobo_mdi_get_ui_component_from_window (win);
- g_return_if_fail (ui_component != NULL);
-
- bonobo_ui_component_freeze (ui_component, NULL);
-
- /* Updated view menu */
- gl_ui_set_verb_state (ui_component,
- "/commands/ViewMainToolbar",
- gl_prefs->main_toolbar_visible);
-
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/MainToolbarSystem",
- gl_prefs->main_toolbar_visible);
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/MainToolbarIcon",
- gl_prefs->main_toolbar_visible);
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/MainToolbarIconText",
- gl_prefs->main_toolbar_visible);
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/MainToolbarTooltips",
- gl_prefs->main_toolbar_visible);
-
- gl_ui_set_verb_state (ui_component,
- "/commands/MainToolbarSystem",
- gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
-
- gl_ui_set_verb_state (ui_component,
- "/commands/MainToolbarIcon",
- gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS);
-
- gl_ui_set_verb_state (ui_component,
- "/commands/MainToolbarIconText",
- gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
-
- gl_ui_set_verb_state (ui_component,
- "/commands/MainToolbarTooltips",
- gl_prefs->main_toolbar_view_tooltips);
-
-
- /* Actually update main_toolbar style */
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar",
- "tips", gl_prefs->main_toolbar_view_tooltips ? "1" : "0",
- NULL);
-
- switch (gl_prefs->main_toolbar_buttons_style)
- {
- case GL_TOOLBAR_SYSTEM:
-
- client = gconf_client_get_default ();
- if (client == NULL)
- goto error;
-
- labels = gconf_client_get_bool (client,
- "/desktop/gnome/interface/toolbar-labels", NULL);
-
- g_object_unref (G_OBJECT (client));
-
- if (labels)
- {
- gl_debug (DEBUG_MDI, "SYSTEM: BOTH");
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "both", NULL);
-
- }
- else
- {
- gl_debug (DEBUG_MDI, "SYSTEM: ICONS");
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "icons", NULL);
- }
-
- break;
-
- case GL_TOOLBAR_ICONS:
- gl_debug (DEBUG_MDI, "GLABELS: ICONS");
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "icon", NULL);
-
- break;
-
- case GL_TOOLBAR_ICONS_AND_TEXT:
- gl_debug (DEBUG_MDI, "GLABELS: ICONS_AND_TEXT");
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar", "look", "both", NULL);
-
- break;
- default:
- goto error;
- break;
- }
-
- bonobo_ui_component_set_prop (
- ui_component, "/MainToolbar",
- "hidden", gl_prefs->main_toolbar_visible ? "0":"1", NULL);
-
- error:
- bonobo_ui_component_thaw (ui_component, NULL);
+ gl_ui_init (ui_component, win);
gl_debug (DEBUG_MDI, "END");
}
-
-/*---------------------------------------------------------------------------*/
-/* Set drawing toolbar style. */
-/*---------------------------------------------------------------------------*/
-static void
-gl_mdi_set_app_drawing_toolbar_style (BonoboWindow *win)
-{
- BonoboUIComponent *ui_component;
- GConfClient *client;
- gboolean labels;
-
- gl_debug (DEBUG_MDI, "START");
-
- g_return_if_fail (BONOBO_IS_WINDOW (win));
-
- ui_component = bonobo_mdi_get_ui_component_from_window (win);
- g_return_if_fail (ui_component != NULL);
-
- bonobo_ui_component_freeze (ui_component, NULL);
-
- /* Updated view menu */
- gl_ui_set_verb_state (ui_component,
- "/commands/ViewDrawingToolbar",
- gl_prefs->drawing_toolbar_visible);
-
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarSystem",
- gl_prefs->drawing_toolbar_visible);
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarIcon",
- gl_prefs->drawing_toolbar_visible);
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarIconText",
- gl_prefs->drawing_toolbar_visible);
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/DrawingToolbarTooltips",
- gl_prefs->drawing_toolbar_visible);
-
- gl_ui_set_verb_state (
- ui_component,
- "/commands/DrawingToolbarSystem",
- gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
-
- gl_ui_set_verb_state (
- ui_component,
- "/commands/DrawingToolbarIcon",
- gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS);
-
- gl_ui_set_verb_state (
- ui_component,
- "/commands/DrawingToolbarIconText",
- gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
-
- gl_ui_set_verb_state (ui_component,
- "/commands/DrawingToolbarTooltips",
- gl_prefs->drawing_toolbar_view_tooltips);
-
-
- /* Actually update drawing_toolbar style */
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar",
- "tips", gl_prefs->drawing_toolbar_view_tooltips ? "1" : "0",
- NULL);
-
- switch (gl_prefs->drawing_toolbar_buttons_style)
- {
- case GL_TOOLBAR_SYSTEM:
-
- client = gconf_client_get_default ();
- if (client == NULL)
- goto error;
-
- labels = gconf_client_get_bool (client,
- "/desktop/gnome/interface/toolbar-labels", NULL);
-
- g_object_unref (G_OBJECT (client));
-
- if (labels)
- {
- gl_debug (DEBUG_MDI, "SYSTEM: BOTH");
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar", "look", "both", NULL);
-
- }
- else
- {
- gl_debug (DEBUG_MDI, "SYSTEM: ICONS");
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar", "look", "icons", NULL);
- }
-
- break;
-
- case GL_TOOLBAR_ICONS:
- gl_debug (DEBUG_MDI, "GLABELS: ICONS");
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar", "look", "icon", NULL);
-
- break;
-
- case GL_TOOLBAR_ICONS_AND_TEXT:
- gl_debug (DEBUG_MDI, "GLABELS: ICONS_AND_TEXT");
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar", "look", "both", NULL);
-
- break;
- default:
- goto error;
- break;
- }
-
- bonobo_ui_component_set_prop (
- ui_component, "/DrawingToolbar",
- "hidden", gl_prefs->drawing_toolbar_visible ? "0":"1", NULL);
-
- error:
- bonobo_ui_component_thaw (ui_component, NULL);
-
- gl_debug (DEBUG_MDI, "END");
-}
-
-
/*---------------------------------------------------------------------------*/
/* Child state changed callback. */
/*---------------------------------------------------------------------------*/
}
- gtk_dialog_add_button (GTK_DIALOG (msgbox), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (msgbox),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (msgbox),
- GTK_STOCK_SAVE,
- GTK_RESPONSE_YES);
+ GTK_STOCK_SAVE, GTK_RESPONSE_YES);
gtk_dialog_set_default_response (GTK_DIALOG (msgbox), GTK_RESPONSE_YES);
gl_debug (DEBUG_MDI, "CLOSE: %s", close ? "TRUE" : "FALSE");
}
- /* FIXME: there is a bug if you "close all" >1 docs, don't save the document
- * and then don't close the last one.
- */
- /* Disable to avoid the bug */
- /*
- if (close)
- {
- g_signal_handlers_disconnect_by_func (child,
- G_CALLBACK (gl_mdi_child_state_changed_cb),
- NULL);
- g_signal_handlers_disconnect_by_func (GTK_OBJECT (child),
- G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb),
- NULL);
- }
- */
-
gl_debug (DEBUG_MDI, "END");
return close;
}
void
gl_mdi_set_active_window_verbs_sensitivity (BonoboMDI *mdi)
{
- /* FIXME: it is too slooooooow! - Paolo */
-
BonoboWindow *active_window = NULL;
BonoboMDIChild *active_child = NULL;
glView *view = NULL;
- glLabel *doc = NULL;
BonoboUIComponent *ui_component;
gl_debug (DEBUG_MDI, "START");
g_return_if_fail (ui_component != NULL);
active_child = bonobo_mdi_get_active_child (mdi);
-
- bonobo_ui_component_freeze (ui_component, NULL);
-
+
if (active_child == NULL)
{
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_no_docs_sensible_verbs,
- FALSE);
- goto end;
- }
- else
- {
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_all_sensible_verbs,
- TRUE);
+ gl_ui_update_nodoc (ui_component);
+ return;
}
- doc = GL_MDI_CHILD (active_child)->label;
- g_return_if_fail (doc != NULL);
-
- if (!gl_label_can_undo (doc))
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/EditUndo",
- FALSE);
-
- if (!gl_label_can_redo (doc))
- gl_ui_set_verb_sensitive (ui_component,
- "/commands/EditRedo",
- FALSE);
-
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_not_modified_doc_sensible_verbs,
- gl_label_is_modified (doc));
-
view = GL_VIEW (bonobo_mdi_get_active_view (mdi));
- g_return_if_fail (view != NULL);
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_selection_sensible_verbs,
- !gl_view_is_selection_empty (view));
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_atomic_selection_sensible_verbs,
- gl_view_is_selection_atomic (view));
-
-end:
- bonobo_ui_component_thaw (ui_component, NULL);
+ gl_ui_update_all (ui_component, view);
gl_debug (DEBUG_MDI, "END");
}
doc = GL_MDI_CHILD (active_child)->label;
g_return_if_fail (doc != NULL);
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_set_verb_sensitive (ui_component, "/commands/EditUndo",
- gl_label_can_undo (doc));
-
- gl_ui_set_verb_sensitive (ui_component, "/commands/EditRedo",
- gl_label_can_redo (doc));
-
- bonobo_ui_component_thaw (ui_component, NULL);
+ gl_ui_update_undo_redo_verbs (ui_component, doc);
gl_debug (DEBUG_MDI, "END");
}
view = GL_VIEW (bonobo_mdi_get_active_view (mdi));
g_return_if_fail (view != NULL);
- bonobo_ui_component_freeze (ui_component, NULL);
-
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_selection_sensible_verbs,
- !gl_view_is_selection_empty (view));
- gl_ui_set_verb_list_sensitive (ui_component,
- gl_ui_atomic_selection_sensible_verbs,
- gl_view_is_selection_atomic (view));
-
- bonobo_ui_component_thaw (ui_component, NULL);
+ gl_ui_update_selection_verbs (ui_component, view);
gl_debug (DEBUG_MDI, "END");
}
*/
#include <config.h>
+#include "gnome-recent-view.h"
+#include <gconf/gconf-client.h>
+
#include "ui.h"
#include "commands.h"
#include "tools.h"
#include "glabels.h"
+#include "recent.h"
+#include "file.h"
+#include "prefs.h"
+/*===========================================*/
+/* Public globals */
+/*===========================================*/
BonoboUIVerb gl_ui_verbs [] = {
BONOBO_UI_VERB ("FileNew", gl_cmd_file_new),
BONOBO_UI_VERB ("FileOpen", gl_cmd_file_open),
BONOBO_UI_VERB_END
};
-gchar* gl_ui_no_docs_sensible_verbs [] = {
+/*========================================================*/
+/* Private macros and constants. */
+/*========================================================*/
+
+
+/*========================================================*/
+/* Private types. */
+/*========================================================*/
+
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+static gchar* doc_verbs [] = {
"/commands/FileSave",
"/commands/FileSaveAs",
"/commands/FilePrint",
NULL
};
-gchar* gl_ui_not_modified_doc_sensible_verbs [] = {
+static gchar* doc_modified_verbs [] = {
"/commands/FileSave",
NULL
};
-gchar* gl_ui_selection_sensible_verbs [] = {
+static gchar* selection_verbs [] = {
"/commands/EditCut",
"/commands/EditCopy",
"/commands/EditDelete",
NULL
};
-gchar* gl_ui_atomic_selection_sensible_verbs [] = {
+static gchar* atomic_selection_verbs [] = {
"/commands/ToolsObjectProperties",
NULL
};
-void
-gl_ui_set_verb_sensitive (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean sensitive)
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void view_menu_item_toggled_cb (
+ BonoboUIComponent *ui_component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ BonoboWindow *win);
+
+static void set_app_main_toolbar_style (BonoboWindow *win);
+static void set_app_drawing_toolbar_style (BonoboWindow *win);
+
+static void
+set_verb_sensitive (BonoboUIComponent *ui_component,
+ gchar *cname,
+ gboolean sensitive);
+static void
+set_verb_list_sensitive (BonoboUIComponent *ui_component,
+ gchar **vlist,
+ gboolean sensitive);
+static void
+set_verb_state (BonoboUIComponent *ui_component,
+ gchar *cname,
+ gboolean state);
+
+
+\f
+/*****************************************************************************/
+/* Initialize UI component for given window. */
+/*****************************************************************************/
+void gl_ui_init (BonoboUIComponent *ui_component,
+ BonoboWindow *win)
{
- g_return_if_fail (cname != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ GnomeRecentView *recent_view;
+ GnomeRecentModel *recent_model;
+
+ g_return_if_fail (ui_component != NULL);
+
+ /* Set the toolbar style according to prefs */
+ set_app_main_toolbar_style (win);
+
+ /* Add listener fo the view menu */
+ bonobo_ui_component_add_listener (ui_component, "ViewMainToolbar",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+
+ bonobo_ui_component_add_listener (ui_component, "MainToolbarSystem",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+ bonobo_ui_component_add_listener (ui_component, "MainToolbarIcon",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+ bonobo_ui_component_add_listener (ui_component, "MainToolbarIconText",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+ bonobo_ui_component_add_listener (ui_component, "MainToolbarTooltips",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+
+ /* Set the toolbar style according to prefs */
+ set_app_drawing_toolbar_style (win);
+
+ /* Add listener fo the view menu */
+ bonobo_ui_component_add_listener (ui_component, "ViewDrawingToolbar",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+
+ bonobo_ui_component_add_listener (ui_component, "DrawingToolbarSystem",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+ bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIcon",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+ bonobo_ui_component_add_listener (ui_component, "DrawingToolbarIconText",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+ bonobo_ui_component_add_listener (ui_component, "DrawingToolbarTooltips",
+ (BonoboUIListenerFn)view_menu_item_toggled_cb,
+ (gpointer)win);
+
+
+ set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
+
+ /* add a GeditRecentView object */
+ recent_model = gl_recent_get_model ();
+ recent_view =
+ GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component,
+ "/menu/File/Recents"));
+ gnome_recent_view_set_model (recent_view, recent_model);
+
+ g_signal_connect (G_OBJECT (recent_view), "activate",
+ G_CALLBACK (gl_file_open_recent), win);
- bonobo_ui_component_set_prop (ui_component,
- cname,
- "sensitive",
- sensitive ? "1" : "0",
- NULL);
}
-void
-gl_ui_set_verb_list_sensitive (BonoboUIComponent *ui_component,
- gchar **vlist,
- gboolean sensitive)
+/*****************************************************************************/
+/* Update all verbs of given UI component. */
+/*****************************************************************************/
+void gl_ui_update_all (BonoboUIComponent *ui_component,
+ glView *view)
{
- g_return_if_fail (vlist != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ glLabel *label;
- for ( ; *vlist; ++vlist)
- {
- bonobo_ui_component_set_prop (ui_component,
- *vlist,
- "sensitive",
- sensitive ? "1" : "0",
- NULL);
- }
+ bonobo_ui_component_freeze (ui_component, NULL);
+
+ set_verb_list_sensitive (ui_component, doc_verbs, TRUE);
+
+ label = view->label;
+ g_return_if_fail (label != NULL);
+
+ set_verb_sensitive (ui_component,
+ "/commands/EditUndo", gl_label_can_undo (label));
+
+ set_verb_sensitive (ui_component,
+ "/commands/EditRedo", gl_label_can_redo (label));
+
+ set_verb_list_sensitive (ui_component,
+ doc_modified_verbs,
+ gl_label_is_modified (label));
+
+ set_verb_list_sensitive (ui_component,
+ selection_verbs,
+ !gl_view_is_selection_empty (view));
+
+ set_verb_list_sensitive (ui_component,
+ atomic_selection_verbs,
+ gl_view_is_selection_atomic (view));
+
+ bonobo_ui_component_thaw (ui_component, NULL);
}
-void
-gl_ui_set_verb_state (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean state)
+/*****************************************************************************/
+/* Update all verbs of given UI component to "no document" state. */
+/*****************************************************************************/
+void gl_ui_update_nodoc (BonoboUIComponent *ui_component)
{
- g_return_if_fail (cname != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+ bonobo_ui_component_freeze (ui_component, NULL);
+
+ set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
- bonobo_ui_component_set_prop (ui_component,
- cname,
- "state",
- state ? "1" : "0",
- NULL);
+ bonobo_ui_component_thaw (ui_component, NULL);
}
-void
-gl_ui_add_menu_item (BonoboWindow *window,
- const gchar *path,
- const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *stock_pixmap,
- BonoboUIVerbFn cb)
+/*****************************************************************************/
+/* Update undo/redo verbs of given UI component. */
+/*****************************************************************************/
+void gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
+ glLabel *label)
{
- BonoboUIComponent *ui_component;
- gchar *item_path;
- gchar *cmd;
+ bonobo_ui_component_freeze (ui_component, NULL);
- g_return_if_fail (window != NULL);
- g_return_if_fail (path != NULL);
- g_return_if_fail (label != NULL);
- g_return_if_fail (cb != NULL);
-
- item_path = g_strconcat (path, name, NULL);
- ui_component =
- bonobo_mdi_get_ui_component_from_window (BONOBO_WINDOW (window));
- if (!bonobo_ui_component_path_exists (ui_component, item_path, NULL)) {
- gchar *xml;
-
- xml = g_strdup_printf ("<menuitem name=\"%s\" verb=\"\""
- " _label=\"%s\""
- " _tip=\"%s\" hident=\"0\" />", name,
- label, tooltip);
-
-
- if (stock_pixmap != NULL) {
- cmd = g_strdup_printf ("<cmd name=\"%s\""
- " pixtype=\"stock\" pixname=\"%s\" />",
- name, stock_pixmap);
- }
- else {
- cmd = g_strdup_printf ("<cmd name=\"%s\" />", name);
- }
-
-
- bonobo_ui_component_set_translate (ui_component,
- path,
- xml,
- NULL);
-
- bonobo_ui_component_set_translate (ui_component,
- "/commands/",
- cmd,
- NULL);
-
- bonobo_ui_component_add_verb (ui_component, name, cb, NULL);
-
- g_free (xml);
- g_free (cmd);
- }
+ set_verb_sensitive (ui_component,
+ "/commands/EditUndo", gl_label_can_undo (label));
- g_free (item_path);
+ set_verb_sensitive (ui_component,
+ "/commands/EditRedo", gl_label_can_redo (label));
+
+ bonobo_ui_component_thaw (ui_component, NULL);
}
-void
-gl_ui_remove_menu_item (BonoboWindow *window,
- const gchar *path,
- const gchar *name)
+/*****************************************************************************/
+/* Update verbs associated with selection state of given UI component. */
+/*****************************************************************************/
+void gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
+ glView *view)
{
- BonoboUIComponent *ui_component;
- gchar *item_path;
+ bonobo_ui_component_freeze (ui_component, NULL);
- g_return_if_fail (window != NULL);
- g_return_if_fail (path != NULL);
- g_return_if_fail (name != NULL);
+ set_verb_list_sensitive (ui_component,
+ selection_verbs,
+ !gl_view_is_selection_empty (view));
- item_path = g_strconcat (path, name, NULL);
- ui_component =
- bonobo_mdi_get_ui_component_from_window (BONOBO_WINDOW (window));
+ set_verb_list_sensitive (ui_component,
+ atomic_selection_verbs,
+ gl_view_is_selection_atomic (view));
- if (bonobo_ui_component_path_exists (ui_component, item_path, NULL)) {
- gchar *cmd;
+ bonobo_ui_component_thaw (ui_component, NULL);
+}
- cmd = g_strdup_printf ("/commands/%s", name);
-
- bonobo_ui_component_rm (ui_component, item_path, NULL);
- bonobo_ui_component_rm (ui_component, cmd, NULL);
-
- g_free (cmd);
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. View menu item toggled callback. */
+/*---------------------------------------------------------------------------*/
+static void
+view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ BonoboWindow *win)
+{
+ gboolean s;
+
+ s = (strcmp (state, "1") == 0);
+
+ if ((strcmp (path, "ViewMainToolbar") == 0) &&
+ (s != gl_prefs->main_toolbar_visible))
+ {
+ gl_prefs->main_toolbar_visible = s;
+ set_app_main_toolbar_style (win);
+
+ return;
+ }
+
+ if (s && (strcmp (path, "MainToolbarSystem") == 0) &&
+ (gl_prefs->main_toolbar_buttons_style != GL_TOOLBAR_SYSTEM))
+ {
+ gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
+ set_app_main_toolbar_style (win);
+
+ return;
+ }
+
+ if (s && (strcmp (path, "MainToolbarIcon") == 0) &&
+ (gl_prefs->main_toolbar_buttons_style != GL_TOOLBAR_ICONS))
+ {
+ gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS;
+ set_app_main_toolbar_style (win);
+
+ return;
+ }
+
+ if (s && (strcmp (path, "MainToolbarIconText") == 0) &&
+ (gl_prefs->main_toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT))
+ {
+ gl_prefs->main_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
+ set_app_main_toolbar_style (win);
+
+ return;
+ }
+
+ if ((strcmp (path, "MainToolbarTooltips") == 0) &&
+ (s != gl_prefs->main_toolbar_view_tooltips))
+ {
+ gl_prefs->main_toolbar_view_tooltips = s;
+ set_app_main_toolbar_style (win);
+
+ return;
+ }
+
+ if ((strcmp (path, "ViewDrawingToolbar") == 0) &&
+ (s != gl_prefs->drawing_toolbar_visible))
+ {
+ gl_prefs->drawing_toolbar_visible = s;
+ set_app_drawing_toolbar_style (win);
+
+ return;
+ }
+
+ if (s && (strcmp (path, "DrawingToolbarSystem") == 0) &&
+ (gl_prefs->drawing_toolbar_buttons_style != GL_TOOLBAR_SYSTEM))
+ {
+ gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_SYSTEM;
+ set_app_drawing_toolbar_style (win);
+
+ return;
+ }
+
+ if (s && (strcmp (path, "DrawingToolbarIcon") == 0) &&
+ (gl_prefs->drawing_toolbar_buttons_style != GL_TOOLBAR_ICONS))
+ {
+ gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS;
+ set_app_drawing_toolbar_style (win);
+
+ return;
+ }
+
+ if (s && (strcmp (path, "DrawingToolbarIconText") == 0) &&
+ (gl_prefs->drawing_toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT))
+ {
+ gl_prefs->drawing_toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT;
+ set_app_drawing_toolbar_style (win);
+
+ return;
+ }
+
+ if ((strcmp (path, "DrawingToolbarTooltips") == 0) &&
+ (s != gl_prefs->drawing_toolbar_view_tooltips))
+ {
+ gl_prefs->drawing_toolbar_view_tooltips = s;
+ set_app_drawing_toolbar_style (win);
+
+ return;
}
- g_free (item_path);
}
-void
-gl_ui_add_menu_item_all (const gchar *path,
- const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *stock_pixmap,
- BonoboUIVerbFn cb)
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set main toolbar style. */
+/*---------------------------------------------------------------------------*/
+static void
+set_app_main_toolbar_style (BonoboWindow *win)
{
- GList* top_windows;
+ BonoboUIComponent *ui_component;
+ GConfClient *client;
+ gboolean labels;
+
+ g_return_if_fail (BONOBO_IS_WINDOW (win));
+
+ ui_component = bonobo_mdi_get_ui_component_from_window (win);
+ g_return_if_fail (ui_component != NULL);
+
+ bonobo_ui_component_freeze (ui_component, NULL);
+
+ /* Updated view menu */
+ set_verb_state (ui_component,
+ "/commands/ViewMainToolbar",
+ gl_prefs->main_toolbar_visible);
+
+ set_verb_sensitive (ui_component,
+ "/commands/MainToolbarSystem",
+ gl_prefs->main_toolbar_visible);
+ set_verb_sensitive (ui_component,
+ "/commands/MainToolbarIcon",
+ gl_prefs->main_toolbar_visible);
+ set_verb_sensitive (ui_component,
+ "/commands/MainToolbarIconText",
+ gl_prefs->main_toolbar_visible);
+ set_verb_sensitive (ui_component,
+ "/commands/MainToolbarTooltips",
+ gl_prefs->main_toolbar_visible);
+
+ set_verb_state (ui_component,
+ "/commands/MainToolbarSystem",
+ gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
+
+ set_verb_state (ui_component,
+ "/commands/MainToolbarIcon",
+ gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS);
+
+ set_verb_state (ui_component,
+ "/commands/MainToolbarIconText",
+ gl_prefs->main_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
+
+ set_verb_state (ui_component,
+ "/commands/MainToolbarTooltips",
+ gl_prefs->main_toolbar_view_tooltips);
+
+
+ /* Actually update main_toolbar style */
+ bonobo_ui_component_set_prop (
+ ui_component, "/MainToolbar",
+ "tips", gl_prefs->main_toolbar_view_tooltips ? "1" : "0",
+ NULL);
- top_windows = glabels_get_top_windows ();
- g_return_if_fail (top_windows != NULL);
-
- while (top_windows)
+ switch (gl_prefs->main_toolbar_buttons_style)
{
- BonoboWindow* window = BONOBO_WINDOW (top_windows->data);
+ case GL_TOOLBAR_SYSTEM:
+
+ client = gconf_client_get_default ();
+ if (client == NULL)
+ goto error;
+
+ labels = gconf_client_get_bool (client,
+ "/desktop/gnome/interface/toolbar-labels", NULL);
+
+ g_object_unref (G_OBJECT (client));
+
+ if (labels)
+ {
+ bonobo_ui_component_set_prop (
+ ui_component, "/MainToolbar", "look", "both", NULL);
+
+ }
+ else
+ {
+ bonobo_ui_component_set_prop (
+ ui_component, "/MainToolbar", "look", "icons", NULL);
+ }
+
+ break;
+
+ case GL_TOOLBAR_ICONS:
+ bonobo_ui_component_set_prop (
+ ui_component, "/MainToolbar", "look", "icon", NULL);
+
+ break;
+
+ case GL_TOOLBAR_ICONS_AND_TEXT:
+ bonobo_ui_component_set_prop (
+ ui_component, "/MainToolbar", "look", "both", NULL);
+
+ break;
+ default:
+ goto error;
+ break;
+ }
+
+ bonobo_ui_component_set_prop (
+ ui_component, "/MainToolbar",
+ "hidden", gl_prefs->main_toolbar_visible ? "0":"1", NULL);
+ error:
+ bonobo_ui_component_thaw (ui_component, NULL);
- gl_ui_add_menu_item (window,
- path,
- name,
- label,
- tooltip,
- stock_pixmap,
- cb);
-
- top_windows = g_list_next (top_windows);
- }
}
-void
-gl_ui_remove_menu_item_all (const gchar *path,
- const gchar *name)
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Set drawing toolbar style. */
+/*---------------------------------------------------------------------------*/
+static void
+set_app_drawing_toolbar_style (BonoboWindow *win)
{
- GList* top_windows;
+ BonoboUIComponent *ui_component;
+ GConfClient *client;
+ gboolean labels;
+
+
+ g_return_if_fail (BONOBO_IS_WINDOW (win));
+
+ ui_component = bonobo_mdi_get_ui_component_from_window (win);
+ g_return_if_fail (ui_component != NULL);
+
+ bonobo_ui_component_freeze (ui_component, NULL);
+
+ /* Updated view menu */
+ set_verb_state (ui_component,
+ "/commands/ViewDrawingToolbar",
+ gl_prefs->drawing_toolbar_visible);
+
+ set_verb_sensitive (ui_component,
+ "/commands/DrawingToolbarSystem",
+ gl_prefs->drawing_toolbar_visible);
+ set_verb_sensitive (ui_component,
+ "/commands/DrawingToolbarIcon",
+ gl_prefs->drawing_toolbar_visible);
+ set_verb_sensitive (ui_component,
+ "/commands/DrawingToolbarIconText",
+ gl_prefs->drawing_toolbar_visible);
+ set_verb_sensitive (ui_component,
+ "/commands/DrawingToolbarTooltips",
+ gl_prefs->drawing_toolbar_visible);
+
+ set_verb_state (
+ ui_component,
+ "/commands/DrawingToolbarSystem",
+ gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_SYSTEM);
+
+ set_verb_state (
+ ui_component,
+ "/commands/DrawingToolbarIcon",
+ gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS);
+
+ set_verb_state (
+ ui_component,
+ "/commands/DrawingToolbarIconText",
+ gl_prefs->drawing_toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT);
+
+ set_verb_state (ui_component,
+ "/commands/DrawingToolbarTooltips",
+ gl_prefs->drawing_toolbar_view_tooltips);
+
- top_windows = glabels_get_top_windows ();
- g_return_if_fail (top_windows != NULL);
-
- while (top_windows)
+ /* Actually update drawing_toolbar style */
+ bonobo_ui_component_set_prop (
+ ui_component, "/DrawingToolbar",
+ "tips", gl_prefs->drawing_toolbar_view_tooltips ? "1" : "0",
+ NULL);
+
+ switch (gl_prefs->drawing_toolbar_buttons_style)
{
- BonoboWindow* window = BONOBO_WINDOW (top_windows->data);
+ case GL_TOOLBAR_SYSTEM:
+
+ client = gconf_client_get_default ();
+ if (client == NULL)
+ goto error;
+
+ labels = gconf_client_get_bool (client,
+ "/desktop/gnome/interface/toolbar-labels", NULL);
+
+ g_object_unref (G_OBJECT (client));
+
+ if (labels)
+ {
+ bonobo_ui_component_set_prop (
+ ui_component, "/DrawingToolbar", "look", "both", NULL);
+
+ }
+ else
+ {
+ bonobo_ui_component_set_prop (
+ ui_component, "/DrawingToolbar", "look", "icons", NULL);
+ }
+
+ break;
+
+ case GL_TOOLBAR_ICONS:
+ bonobo_ui_component_set_prop (
+ ui_component, "/DrawingToolbar", "look", "icon", NULL);
+
+ break;
+
+ case GL_TOOLBAR_ICONS_AND_TEXT:
+ bonobo_ui_component_set_prop (
+ ui_component, "/DrawingToolbar", "look", "both", NULL);
+
+ break;
+ default:
+ goto error;
+ break;
+ }
+
+ bonobo_ui_component_set_prop (
+ ui_component, "/DrawingToolbar",
+ "hidden", gl_prefs->drawing_toolbar_visible ? "0":"1", NULL);
+ error:
+ bonobo_ui_component_thaw (ui_component, NULL);
- gl_ui_remove_menu_item (window, path, name);
+}
-
- top_windows = g_list_next (top_windows);
+
+/*---------------------------------------------------------------------------*/
+/* Set sensitivity of verb. */
+/*---------------------------------------------------------------------------*/
+static void
+set_verb_sensitive (BonoboUIComponent *ui_component,
+ gchar *cname,
+ gboolean sensitive)
+{
+ g_return_if_fail (cname != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+
+ bonobo_ui_component_set_prop (ui_component,
+ cname,
+ "sensitive",
+ sensitive ? "1" : "0",
+ NULL);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Set sensitivity of a list of verbs. */
+/*---------------------------------------------------------------------------*/
+static void
+set_verb_list_sensitive (BonoboUIComponent *ui_component,
+ gchar **vlist,
+ gboolean sensitive)
+{
+ g_return_if_fail (vlist != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+
+ for ( ; *vlist; ++vlist)
+ {
+ bonobo_ui_component_set_prop (ui_component,
+ *vlist,
+ "sensitive",
+ sensitive ? "1" : "0",
+ NULL);
}
}
+
+/*---------------------------------------------------------------------------*/
+/* Set state of a verb. */
+/*---------------------------------------------------------------------------*/
+static void
+set_verb_state (BonoboUIComponent *ui_component,
+ gchar *cname,
+ gboolean state)
+{
+ g_return_if_fail (cname != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
+
+ bonobo_ui_component_set_prop (ui_component,
+ cname,
+ "state",
+ state ? "1" : "0",
+ NULL);
+}
+
#include <bonobo/bonobo-ui-engine.h>
#include <bonobo/bonobo-window.h>
-extern BonoboUIVerb gl_ui_verbs [];
-
-extern gchar *gl_ui_no_docs_sensible_verbs [];
-extern gchar *gl_ui_not_modified_doc_sensible_verbs [];
-extern gchar *gl_ui_selection_sensible_verbs [];
-extern gchar *gl_ui_atomic_selection_sensible_verbs [];
-
-#define gl_ui_all_sensible_verbs gl_ui_no_docs_sensible_verbs
-
-void gl_ui_set_verb_sensitive (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean sensitive);
-void gl_ui_set_verb_list_sensitive (BonoboUIComponent *ui_component,
- gchar **vlist,
- gboolean sensitive);
-void gl_ui_set_verb_state (BonoboUIComponent *ui_component,
- gchar* cname,
- gboolean state);
-
-/* convenience functions for plugins */
+#include "view.h"
-void gl_ui_add_menu_item (BonoboWindow *window,
- const gchar *path,
- const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *stock_pixmap,
- BonoboUIVerbFn cb);
-
-void gl_ui_remove_menu_item (BonoboWindow *window,
- const gchar *path,
- const gchar *name);
-
-
-void gl_ui_add_menu_item_all (const gchar *path,
- const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *stock_pixmap,
- BonoboUIVerbFn cb);
+extern BonoboUIVerb gl_ui_verbs [];
-void gl_ui_remove_menu_item_all (const gchar *path,
- const gchar *name);
+extern void gl_ui_init (BonoboUIComponent *ui_component,
+ BonoboWindow *win);
+extern void gl_ui_update_all (BonoboUIComponent *ui_component,
+ glView *view);
+extern void gl_ui_update_nodoc (BonoboUIComponent *ui_component);
+extern void gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
+ glLabel *label);
+extern void gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
+ glView *view);
#endif /* __GL_UI_H__ */
return new_filename;
}
+/****************************************************************************/
+/* Remove ".glabels" extension from filename if needed. */
+/****************************************************************************/
+gchar *
+gl_util_remove_extension (const gchar * orig_filename)
+{
+ gchar *new_filename, *extension;
+
+ new_filename = g_strdup (orig_filename);
+
+ extension = strrchr (new_filename, '.');
+ if (extension != NULL) {
+ if (g_strcasecmp (extension, ".glabels") == 0) {
+ *extension = 0; /* truncate string, rm extension */
+ }
+ }
+
+ return new_filename;
+}
+
/****************************************************************************/
/* Make sure we have an absolute path to filename. */
/****************************************************************************/
#include <libgnomeprint/gnome-font.h>
extern gchar *gl_util_add_extension (const gchar * orig_filename);
+extern gchar *gl_util_remove_extension (const gchar * orig_filename);
extern gchar *gl_util_make_absolute (const gchar * filename);