+2005-05-11 Jim Evins <evins@snaught.com>
+
+ * src/window.h:
+ * src/window.c: (gl_window_init), (gl_window_destroy):
+ * src/ui.c: (gl_ui_new), (gl_ui_unref), (recent_tooltip_func):
+ * src/ui-commands.c: (gl_ui_cmd_file_open_recent):
+ Moved management of recent_view back from window.c to ui.c -- it just feels
+ better there.
+
2005-05-10 Jim Evins <evins@snaught.com>
* src/window.h:
gl_ui_cmd_file_open_recent (GtkAction *action,
glWindow *window)
{
+ EggRecentViewUIManager *recent_view;
EggRecentItem *item;
gchar *utf8_filename;
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- item = egg_recent_view_uimanager_get_item (window->recent_view, action);
+ recent_view = g_object_get_data (G_OBJECT(window->ui), "recent-view");
+ g_return_if_fail (recent_view && EGG_IS_RECENT_VIEW_UIMANAGER (recent_view));
+
+ item = egg_recent_view_uimanager_get_item (recent_view, action);
utf8_filename = gl_recent_get_filename (item);
gl_file_open_recent (utf8_filename, window);
#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 "ui-util.h"
#include "ui-commands.h"
#include "prefs.h"
#include "stock.h"
#include "window.h"
+#include "recent.h"
#include "debug.h"
static void menu_item_deselect_cb (GtkMenuItem *proxy,
glWindow *window);
+static char *recent_tooltip_func (EggRecentItem *item,
+ gpointer user_data);
+
/*==========================================================================*/
GtkUIManager *ui;
GtkActionGroup *actions;
GError *error = NULL;
+ EggRecentViewUIManager *recent_view;
gl_debug (DEBUG_UI, "START");
/* 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);
+
gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
gl_debug (DEBUG_UI, "END");
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");
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;
+}
+
+
#include <gtk/gtkhbox.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
+#include <gtk/gtkstatusbar.h>
#include "ui.h"
#include "ui-commands.h"
#include "xml-label.h"
#include "prefs.h"
#include "file.h"
-#include "recent.h"
#include "debug.h"
static void modified_changed_cb (glLabel *label,
glWindow *window);
-static char *recent_tooltip_func (EggRecentItem *item,
- gpointer user_data);
-
\f
/****************************************************************************/
/* Boilerplate Object stuff. */
gtk_ui_manager_get_widget (ui, "/DrawingToolBar"),
FALSE, FALSE, 0);
- /* add an eggRecentView */
- window->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 (window->recent_view, FALSE);
- egg_recent_view_uimanager_set_tooltip_func (window->recent_view,
- recent_tooltip_func,
- NULL);
- egg_recent_view_set_model (EGG_RECENT_VIEW (window->recent_view),
- gl_recent_get_model ());
-
-
window->hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox1), window->hbox, TRUE, TRUE, 0);
window = GL_WINDOW (gtk_object);
window_list = g_list_remove (window_list, window);
- if (window->recent_view) {
- g_object_unref (window->recent_view);
- window->recent_view = NULL;
- }
-
if (window->ui) {
gl_ui_unref(window->ui);
window->ui = NULL;
gl_debug (DEBUG_WINDOW, "END");
}
-/*---------------------------------------------------------------------------*/
-/* 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;
-}
-
-
#include <gtk/gtkwindow.h>
#include <gtk/gtkuimanager.h>
-#include "recent-files/egg-recent-view.h"
-#include "recent-files/egg-recent-view-uimanager.h"
#include "view.h"
#include "label.h"
glUIPropertyBar *property_bar;
glUISidebar *sidebar;
- EggRecentViewUIManager *recent_view;
-
GtkWidget *status_bar;
GtkWidget *cursor_info;
GtkWidget *cursor_info_frame;