-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * ui.c: GLabels ui module
+ * ui.c
+ * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * This file is part of gLabels.
*
- * This program is free software; you can redistribute it and/or modify
+ * gLabels is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * gLabels is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <config.h>
#include "ui.h"
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
-#include "recent-files/egg-recent-view.h"
-#include "recent-files/egg-recent-view-uimanager.h"
+#include <gtk/gtk.h>
+#include <string.h>
#include "ui-util.h"
#include "ui-commands.h"
#include "debug.h"
+
/*==========================================================================*/
/* Private macros and constants. */
/*==========================================================================*/
+
/*==========================================================================*/
/* Private types. */
/*==========================================================================*/
static void menu_item_deselect_cb (GtkMenuItem *proxy,
glWindow *window);
-static char *recent_tooltip_func (EggRecentItem *item,
- gpointer user_data);
-
-
/*==========================================================================*/
/* Private globals */
/* Menu entries. */
{ "FileMenu", NULL, N_("_File") },
- { "FileRecentsMenu", NULL, N_("Recent _Files") },
+ { "FileRecentsMenu", NULL, N_("Open Recent _Files") },
{ "EditMenu", NULL, N_("_Edit") },
{ "ViewMenu", NULL, N_("_View") },
{ "ViewMainToolBarMenu", NULL, N_("Customize Main Toolbar") },
G_CALLBACK (gl_ui_cmd_view_property_bar_toggle),
TRUE },
- { "ViewPropertyToolBarToolTips",
- NULL,
- N_("Show tooltips"),
- NULL,
- N_("Show tooltips for property toolbar"),
- G_CALLBACK (gl_ui_cmd_view_property_bar_tips_toggle),
- TRUE },
-
{ "ViewGrid",
NULL,
N_("Grid"),
G_CALLBACK (view_ui_item_toggled_cb),
TRUE },
- { "ViewMainToolBarToolTips",
- NULL,
- N_("Show tooltips"),
- NULL,
- N_("Show tooltips for main toolbar"),
- G_CALLBACK (view_ui_item_toggled_cb),
- TRUE },
-
- { "ViewDrawingToolBarToolTips",
- NULL,
- N_("Show tooltips"),
- NULL,
- N_("Show tooltips for drawing toolbar"),
- G_CALLBACK (view_ui_item_toggled_cb),
- TRUE },
-
};
static guint n_ui_toggle_entries = G_N_ELEMENTS (ui_toggle_entries);
" <menu action='FileMenu'>"
" <menuitem action='FileNew' />"
" <menuitem action='FileOpen' />"
-" <menu action='FileRecentsMenu'>"
-" <placeholder name='FileRecentsPlaceHolder' />"
-" </menu>"
+" <menuitem action='FileRecentsMenu' />"
" <separator />"
" <menuitem action='FileSave' />"
" <menuitem action='FileSaveAs' />"
" <menuitem action='ViewDrawingToolBar' />"
" <menuitem action='ViewPropertyToolBar' />"
" <separator />"
-" <menu action='ViewMainToolBarMenu'>"
-" <menuitem action='ViewMainToolBarToolTips' />"
-" </menu>"
-" <menu action='ViewDrawingToolBarMenu'>"
-" <menuitem action='ViewDrawingToolBarToolTips' />"
-" </menu>"
-" <menu action='ViewPropertyToolBarMenu'>"
-" <menuitem action='ViewPropertyToolBarToolTips' />"
-" </menu>"
-" <separator />"
" <menuitem action='ViewGrid' />"
" <menuitem action='ViewMarkup' />"
" <separator />"
};
static gchar* doc_modified_verbs [] = {
- "/ui/MenuBar/FileMenu/Save",
+ "/ui/MenuBar/FileMenu/FileSave",
NULL
};
GtkUIManager *ui;
GtkActionGroup *actions;
GError *error = NULL;
- EggRecentViewUIManager *recent_view;
+ GtkWidget *recent_menu;
gl_debug (DEBUG_UI, "START");
G_CALLBACK (disconnect_proxy_cb), window);
actions = gtk_action_group_new ("Actions");
+ gtk_action_group_set_translation_domain (actions, NULL);
gtk_action_group_add_actions (actions, entries, n_entries, GTK_WINDOW (window));
gtk_action_group_add_toggle_actions (actions,
toggle_entries, n_toggle_entries,
/* Set view grid and markup visibility according to prefs */
set_view_style (ui);
- /* add an eggRecentView */
- recent_view =
- egg_recent_view_uimanager_new (ui,
- "/ui/MenuBar/FileMenu/FileRecentsMenu/FileRecentsPlaceHolder",
- G_CALLBACK (gl_ui_cmd_file_open_recent),
- window);
- egg_recent_view_uimanager_show_icons (recent_view, FALSE);
- egg_recent_view_uimanager_set_tooltip_func (recent_view, recent_tooltip_func, NULL);
- egg_recent_view_set_model (EGG_RECENT_VIEW (recent_view), gl_recent_get_model ());
- g_object_set_data (G_OBJECT (ui), "recent-view", recent_view);
+ /* add an Open Recents Submenu */
+ recent_menu = gl_recent_create_menu ();
+ g_signal_connect (G_OBJECT (recent_menu), "item-activated",
+ G_CALLBACK (gl_ui_cmd_file_open_recent), window);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget (ui, "/MenuBar/FileMenu/FileRecentsMenu")),
+ recent_menu);
+
gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
return ui;
}
+
/*****************************************************************************/
/** Unref wrapper. */
/*****************************************************************************/
void
gl_ui_unref (GtkUIManager *ui)
{
- GObject *recent_view;
-
gl_debug (DEBUG_UI, "START");
- /* Pull out recent view to unreference. */
- recent_view = g_object_get_data (G_OBJECT(ui), "recent-view");
- if (recent_view) {
- g_object_unref (recent_view);
- }
-
g_object_unref(ui);
gl_debug (DEBUG_UI, "END");
}
+
/*****************************************************************************/
/** Update all verbs of given UI component. */
/*****************************************************************************/
gl_debug (DEBUG_UI, "END");
}
+
/*****************************************************************************/
/** Update all verbs of given UI component to "no document" state. */
/*****************************************************************************/
gl_debug (DEBUG_UI, "END");
}
+
/*****************************************************************************/
/** Update label modified verbs of given UI component. */
/*****************************************************************************/
gl_debug (DEBUG_UI, "END");
}
+
/*****************************************************************************/
/** Update verbs associated with selection state of given UI component. */
/*****************************************************************************/
gl_debug (DEBUG_UI, "END");
}
+
/*****************************************************************************/
/** Update verbs associated with zoom level of given UI component. */
/*****************************************************************************/
gl_debug (DEBUG_UI, "END");
}
+
/*****************************************************************************/
/** Update undo/redo verbs of given UI component. */
/*****************************************************************************/
gl_debug (DEBUG_UI, "END");
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. View menu item toggled callback. */
/*---------------------------------------------------------------------------*/
gl_prefs_model_save_settings (gl_prefs);
}
- if (strcmp (name, "ViewMainToolBarToolTips") == 0)
- {
- gl_prefs->main_toolbar_view_tooltips = state;
- set_app_main_toolbar_style (ui);
- gl_prefs_model_save_settings (gl_prefs);
- }
-
if (strcmp (name, "ViewDrawingToolBar") == 0)
{
gl_prefs->drawing_toolbar_visible = state;
gl_prefs_model_save_settings (gl_prefs);
}
- if (strcmp (name, "ViewDrawingToolBarToolTips") == 0)
- {
- gl_prefs->drawing_toolbar_view_tooltips = state;
- set_app_drawing_toolbar_style (ui);
- gl_prefs_model_save_settings (gl_prefs);
- }
-
gl_debug (DEBUG_UI, "");
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Set main toolbar style. */
/*---------------------------------------------------------------------------*/
gl_ui_util_set_verb_state (ui, "/ui/ViewMenu/ViewMainToolBar",
gl_prefs->main_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui, "/ui/ViewMenu/ViewMainToolBarToolTips",
- gl_prefs->main_toolbar_visible);
-
- gl_ui_util_set_verb_state (ui, "/ui/ViewMenu/ViewMainToolBarToolTips",
- gl_prefs->main_toolbar_view_tooltips);
-
-
toolbar = gtk_ui_manager_get_widget (ui, "/MainToolBar");
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (toolbar),
- gl_prefs->main_toolbar_view_tooltips);
-
if (gl_prefs->main_toolbar_visible) {
gtk_widget_show_all (toolbar);
} else {
gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenu/ViewDrawingToolBar",
gl_prefs->drawing_toolbar_visible);
- gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/ViewMenu/ViewDrawingToolBarToolTips",
- gl_prefs->drawing_toolbar_visible);
-
- gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenuDrawingToolBarToolTips",
- gl_prefs->drawing_toolbar_view_tooltips);
-
-
toolbar = gtk_ui_manager_get_widget (ui, "/DrawingToolBar");
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (toolbar),
- gl_prefs->drawing_toolbar_view_tooltips);
-
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
if (gl_prefs->drawing_toolbar_visible) {
gl_debug (DEBUG_UI, "END");
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Set visibility of grid and markup. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_UI, "END");
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Connect proxy callback. */
/*---------------------------------------------------------------------------*/
}
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Disconnect proxy callback. */
/*---------------------------------------------------------------------------*/
}
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Menu item select callback. */
/*---------------------------------------------------------------------------*/
}
}
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Menu item deselect callback. */
/*---------------------------------------------------------------------------*/
window->menu_tips_context_id);
}
-/*---------------------------------------------------------------------------*/
-/** PRIVATE. Tooltip function for recent file menu items. */
-/*---------------------------------------------------------------------------*/
-static char *
-recent_tooltip_func (EggRecentItem *item, gpointer user_data)
-{
- char *tip;
- char *uri_for_display;
-
- uri_for_display = egg_recent_item_get_uri_for_display (item);
- g_return_val_if_fail (uri_for_display != NULL, NULL);
-
- tip = g_strdup_printf (_("Open '%s'"), uri_for_display);
-
- g_free (uri_for_display);
-
- return tip;
-}
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */