]> www.fi.muni.cz Git - evince.git/blob - cut-n-paste/recent-files/egg-recent-view-uimanager.c
Removed EggRecentViewGtk
[evince.git] / cut-n-paste / recent-files / egg-recent-view-uimanager.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /**
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * Authors:
19  *   James Willcox <jwillcox@cs.indiana.edu>
20  *   Paolo Bacchilega <paobac@cvs.gnome.org>
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include <stdio.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include <gtk/gtk.h>
31 #include <libgnomevfs/gnome-vfs.h>
32 #ifndef USE_STABLE_LIBGNOMEUI
33 #include <libgnomeui/gnome-icon-theme.h>
34 #endif
35 #include <gconf/gconf-client.h>
36 #include "egg-recent-model.h"
37 #include "egg-recent-view.h"
38 #include "egg-recent-view-uimanager.h"
39 #include "egg-recent-util.h"
40 #include "egg-recent-item.h"
41
42 #define EGG_RECENT_NAME_PREFIX "EggRecentAction"
43 #define EGG_RECENT_ACTION "EggRecentFile"
44 #define EGG_RECENT_SEPARATOR (NULL)
45
46 struct _EggRecentViewUIManager {
47         GObject         parent_instance;
48
49         GCallback       action_callback;
50         gpointer        action_user_data;
51
52         gboolean        leading_sep;
53         gboolean        trailing_sep;
54
55         GtkUIManager   *uimanager;
56         GtkActionGroup *action_group;
57         guint           merge_id;
58         gulong          changed_cb_id;
59
60         gchar          *path;
61
62         gboolean        show_icons;
63         gboolean        show_numbers;
64 #ifndef USE_STABLE_LIBGNOMEUI
65         GnomeIconTheme *theme;
66 #endif
67
68         EggUIManagerTooltipFunc tooltip_func;
69         gpointer        tooltip_func_data;
70
71         EggRecentModel *model;
72         GConfClient    *client;
73         GtkIconSize     icon_size;
74 };
75
76
77 struct _EggRecentViewUIManagerMenuData {
78         EggRecentViewUIManager *view;
79         EggRecentItem *item;
80 };
81
82 typedef struct _EggRecentViewUIManagerMenuData EggRecentViewUIManagerMenuData;
83
84 enum {
85         ACTIVATE,
86         LAST_SIGNAL
87 };
88
89 /* GObject properties */
90 enum {
91         PROP_BOGUS,
92         PROP_UIMANAGER,
93         PROP_PATH,
94         PROP_SHOW_ICONS,
95         PROP_SHOW_NUMBERS
96 };
97
98 static guint view_signals[LAST_SIGNAL] = { 0 };
99
100 static void
101 egg_recent_view_uimanager_clear (EggRecentViewUIManager *view)
102 {
103         if (view->merge_id != 0) {
104                 gtk_ui_manager_remove_ui (view->uimanager, view->merge_id);
105                 view->merge_id = 0;
106         }
107
108         if (view->action_group != NULL) {
109                 gtk_ui_manager_remove_action_group (view->uimanager, view->action_group);
110                 g_object_unref (view->action_group);
111                 view->action_group = NULL;
112         }
113
114         gtk_ui_manager_ensure_update (view->uimanager);
115 }
116
117 static void
118 egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
119 {
120         GList  *scan;
121         guint   index = 1;
122
123         g_return_if_fail (view);
124
125         egg_recent_view_uimanager_clear (view);
126
127         if (view->merge_id == 0)
128                 view->merge_id = gtk_ui_manager_new_merge_id (view->uimanager);
129
130         if (view->action_group == NULL) {
131                 gchar *group = g_strdup_printf ("EggRecentActions%u", 
132                                                 view->merge_id);
133                 view->action_group = gtk_action_group_new (group);
134                 gtk_ui_manager_insert_action_group (view->uimanager, view->action_group, 0);
135                 g_free (group);
136         }
137
138         if (view->leading_sep) {
139                 gchar *action = g_strdup_printf ("EggRecentLeadingSeparator%u",
140                                                  view->merge_id);
141                 gtk_ui_manager_add_ui (view->uimanager, 
142                                        view->merge_id, 
143                                        view->path,
144                                        action,
145                                        EGG_RECENT_SEPARATOR,
146                                        GTK_UI_MANAGER_AUTO, 
147                                        FALSE);
148                 g_free (action);
149         }
150
151         for (scan = list; scan; scan = scan->next, index++) {
152                 EggRecentItem *item = scan->data;
153                 GtkAction     *action;
154                 gchar         *name;
155                 gchar         *uri;
156                 gchar         *basename;
157                 gchar         *escaped;
158                 gchar         *ellipsized;
159                 gchar         *label;
160                 gchar         *tooltip = NULL;
161
162                 uri = egg_recent_item_get_uri_for_display (item);
163                 if (uri == NULL)
164                         continue;
165
166                 name = g_strdup_printf (EGG_RECENT_NAME_PREFIX"%u-%u", 
167                                         view->merge_id,
168                                         index);
169
170                 if (view->tooltip_func != NULL)
171                         tooltip = (*view->tooltip_func) (item, view->tooltip_func_data);
172
173                 basename = g_path_get_basename (uri);
174                 escaped = egg_recent_util_escape_underlines (basename);
175                 g_free (basename);
176                 g_free (uri);
177             
178                 if (strlen (escaped) > 40) {
179                         ellipsized = g_strdup_printf ("%.40s...", escaped);
180                         g_free (escaped);
181                 } else {        
182                         ellipsized = escaped;
183                 }
184
185                 if (view->show_numbers) {
186                         if (index >= 10)
187                                 label = g_strdup_printf ("%d.  %s", 
188                                                          index, 
189                                                          ellipsized);
190                         else
191                                 label = g_strdup_printf ("_%d.  %s", 
192                                                          index, 
193                                                          ellipsized);
194                         g_free (ellipsized);
195                 } else 
196                         label = ellipsized;
197
198                 action = g_object_new (GTK_TYPE_ACTION,
199                                        "name", name,
200                                        "label", label,
201                                        (view->show_icons)? "stock_id": NULL, 
202                                        GTK_STOCK_OPEN,
203                                        NULL);
204                 if (tooltip != NULL) {
205                         g_object_set (action, "tooltip", tooltip, NULL);
206                         g_free (tooltip);
207                 }
208                 egg_recent_item_ref (item);
209                 g_object_set_data_full (G_OBJECT (action), 
210                                         "egg_recent_uri", 
211                                         item, 
212                                         (GFreeFunc) egg_recent_item_unref);
213
214                 if (view->action_callback != NULL) {
215                         GClosure *closure;
216                         closure = g_cclosure_new (view->action_callback, view->action_user_data, NULL);
217                         g_signal_connect_closure (action, "activate", closure, FALSE);
218                 }
219
220                 gtk_action_group_add_action (view->action_group, action);
221                 g_object_unref (action);
222
223                 gtk_ui_manager_add_ui (view->uimanager, 
224                                        view->merge_id, 
225                                        view->path,
226                                        name,
227                                        name,
228                                        GTK_UI_MANAGER_AUTO, 
229                                        FALSE);
230
231                 g_free (name);
232                 g_free (label);
233         }
234
235         if (view->trailing_sep) {
236                 gchar *action = g_strdup_printf ("EggRecentTrailingSeparator%u",
237                                                 view->merge_id);
238                 gtk_ui_manager_add_ui (view->uimanager, 
239                                        view->merge_id, 
240                                        view->path,
241                                        action,
242                                        EGG_RECENT_SEPARATOR,
243                                        GTK_UI_MANAGER_AUTO, 
244                                        FALSE);
245                 g_free (action);
246         }
247 }
248
249 static void
250 model_changed_cb (EggRecentModel         *model,  
251                   GList                  *list, 
252                   EggRecentViewUIManager *view)
253 {
254         if (list != NULL)
255                 egg_recent_view_uimanager_set_list (view, list);
256         else
257                 egg_recent_view_uimanager_clear (view);
258         gtk_ui_manager_ensure_update (view->uimanager);
259 }
260
261 static EggRecentModel *
262 egg_recent_view_uimanager_get_model (EggRecentView *view_parent)
263 {
264         EggRecentViewUIManager *view;
265         
266         g_return_val_if_fail (view_parent != NULL, NULL);
267         view = EGG_RECENT_VIEW_UIMANAGER (view_parent);
268         return view->model;
269 }
270
271 static void
272 egg_recent_view_uimanager_set_model (EggRecentView  *view_parent,
273                                      EggRecentModel *model)
274 {
275         EggRecentViewUIManager *view;
276         
277         g_return_if_fail (view_parent != NULL);
278         view = EGG_RECENT_VIEW_UIMANAGER (view_parent);
279
280         if (view->model != NULL) {
281                 if (view->changed_cb_id != 0)
282                         g_signal_handler_disconnect (G_OBJECT (view->model),
283                                                      view->changed_cb_id);
284                 g_object_unref (view->model);
285         }
286         
287         view->model = model;
288         g_object_ref (view->model);
289
290         view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
291                                                        "changed",
292                                                        G_CALLBACK (model_changed_cb),
293                                                        view, 0);
294
295         egg_recent_model_changed (view->model);
296 }
297
298 void
299 egg_recent_view_uimanager_set_leading_sep (EggRecentViewUIManager *view, 
300                                            gboolean                val)
301 {
302         view->leading_sep = val;
303         egg_recent_view_uimanager_clear (view);
304         if (view->model)
305                 egg_recent_model_changed (view->model);
306 }
307
308 void
309 egg_recent_view_uimanager_set_trailing_sep (EggRecentViewUIManager *view,
310                                             gboolean                val)
311 {
312         view->trailing_sep = val;
313         egg_recent_view_uimanager_clear (view);
314         if (view->model)
315                 egg_recent_model_changed (view->model);
316 }
317
318 static void
319 egg_recent_view_uimanager_set_property (GObject      *object,
320                                         guint         prop_id,
321                                         const GValue *value,
322                                         GParamSpec   *pspec)
323 {
324         EggRecentViewUIManager *view = EGG_RECENT_VIEW_UIMANAGER (object);
325
326         switch (prop_id) {
327         case PROP_UIMANAGER:
328                 egg_recent_view_uimanager_set_uimanager (view, (GtkUIManager*)g_value_get_object (value));
329                 break;
330         case PROP_PATH:
331                 egg_recent_view_uimanager_set_path (view, g_value_get_string (value));
332                 break;
333         case PROP_SHOW_ICONS:
334                 egg_recent_view_uimanager_show_icons (view, g_value_get_boolean (value));
335                 break;
336         case PROP_SHOW_NUMBERS:
337                 egg_recent_view_uimanager_show_numbers (view, g_value_get_boolean (value));
338                 break;
339         default:
340                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
341                 break;
342         }
343 }
344
345 static void
346 egg_recent_view_uimanager_get_property (GObject    *object,
347                                         guint       prop_id,
348                                         GValue     *value,
349                                         GParamSpec *pspec)
350 {
351         EggRecentViewUIManager *view = EGG_RECENT_VIEW_UIMANAGER (object);
352
353         switch (prop_id) {
354         case PROP_UIMANAGER:
355                 g_value_set_object (value, view->uimanager);
356                 break;
357         case PROP_PATH:
358                 g_value_set_string (value, view->path);
359                 break;
360         case PROP_SHOW_ICONS:
361                 g_value_set_boolean (value, view->show_icons);
362                 break;
363         case PROP_SHOW_NUMBERS:
364                 g_value_set_boolean (value, view->show_numbers);
365                 break;
366         default:
367                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
368                 break;
369         }
370 }
371
372 static void
373 egg_recent_view_uimanager_finalize (GObject *object)
374 {
375         EggRecentViewUIManager *view = EGG_RECENT_VIEW_UIMANAGER (object);
376
377         if (view->changed_cb_id != 0) {
378                 g_signal_handler_disconnect (G_OBJECT (view->model),
379                                              view->changed_cb_id);
380                 view->changed_cb_id = 0;
381         }
382
383         g_free (view->path);
384
385         egg_recent_view_uimanager_clear (view);
386
387         if (view->action_group != NULL) {
388                 g_object_unref (view->action_group);
389                 view->action_group = NULL;
390         }
391
392         if (view->uimanager != NULL) {
393                 g_object_unref (view->uimanager);
394                 view->uimanager = NULL;
395         }
396
397         if (view->model != NULL) {
398                 g_object_unref (view->model);
399                 view->model = NULL;
400         }
401
402 #ifndef USE_STABLE_LIBGNOMEUI
403         if (view->theme != NULL) {
404                 g_object_unref (view->theme);
405                 view->theme = NULL;
406         }
407 #endif
408
409         if (view->client != NULL) {
410                 g_object_unref (view->client);
411                 view->client = NULL;
412         }
413 }
414
415 static void
416 egg_recent_view_uimanager_class_init (EggRecentViewUIManagerClass * klass)
417 {
418         GObjectClass *object_class;
419
420         object_class = G_OBJECT_CLASS (klass);
421
422         object_class->set_property = egg_recent_view_uimanager_set_property;
423         object_class->get_property = egg_recent_view_uimanager_get_property;
424         object_class->finalize     = egg_recent_view_uimanager_finalize;
425
426         view_signals[ACTIVATE] = g_signal_new ("activate",
427                                                G_OBJECT_CLASS_TYPE (object_class),
428                                                G_SIGNAL_RUN_LAST,
429                                                G_STRUCT_OFFSET (EggRecentViewUIManagerClass, activate),
430                                                NULL, NULL,
431                                                g_cclosure_marshal_VOID__BOXED,
432                                                G_TYPE_NONE, 1,
433                                                EGG_TYPE_RECENT_ITEM);
434
435         g_object_class_install_property (object_class,
436                                          PROP_UIMANAGER,
437                                          g_param_spec_object ("uimanager",
438                                                               "UI Manager",
439                                                               "The UI manager this object will use to update.the UI",
440                                                               GTK_TYPE_UI_MANAGER,
441                                                               G_PARAM_READWRITE));
442         g_object_class_install_property (object_class,
443                                          PROP_PATH,
444                                          g_param_spec_string ("path",
445                                                               "Path",
446                                                               "The UI path this object will update.",
447                                                               NULL,
448                                                               G_PARAM_READWRITE));
449         g_object_class_install_property (object_class,
450                                          PROP_SHOW_ICONS,
451                                          g_param_spec_boolean ("show-icons",
452                                                                "Show Icons",
453                                                                "Whether or not to show icons",
454                                                                FALSE,
455                                                                G_PARAM_READWRITE));
456         
457         g_object_class_install_property (object_class,
458                                          PROP_SHOW_NUMBERS,
459                                          g_param_spec_boolean ("show-numbers",
460                                                                "Show Numbers",
461                                                                "Whether or not to show numbers",
462                                                                TRUE,
463                                                                G_PARAM_READWRITE));
464
465         klass->activate = NULL;
466 }
467
468 static void
469 egg_recent_view_init (EggRecentViewClass *iface)
470 {
471         iface->do_get_model = egg_recent_view_uimanager_get_model;
472         iface->do_set_model = egg_recent_view_uimanager_set_model;
473 }
474
475 static void
476 show_menus_changed_cb (GConfClient            *client,
477                        guint                   cnxn_id,
478                        GConfEntry             *entry,
479                        EggRecentViewUIManager *view)
480 {
481         GConfValue *value;
482
483         value = gconf_entry_get_value (entry);
484         g_return_if_fail (value->type == GCONF_VALUE_BOOL);
485
486         egg_recent_view_uimanager_show_icons (view, gconf_value_get_bool (value));
487 }
488
489 #ifndef USE_STABLE_LIBGNOMEUI
490 static void
491 theme_changed_cb (GnomeIconTheme         *theme, 
492                   EggRecentViewUIManager *view)
493 {
494         if (view->model != NULL)
495                 egg_recent_model_changed (view->model);
496 }
497 #endif
498
499 static void
500 egg_recent_view_uimanager_init (EggRecentViewUIManager * view)
501 {
502         view->client = gconf_client_get_default ();
503
504         view->show_icons = gconf_client_get_bool (view->client,
505                                                   "/desktop/gnome/interface/menus_have_icons",
506                                                   NULL);
507         
508         gconf_client_add_dir (view->client, "/desktop/gnome/interface",
509                               GCONF_CLIENT_PRELOAD_NONE,
510                               NULL);
511         gconf_client_notify_add (view->client,
512                                  "/desktop/gnome/interface/menus_have_icons",
513                                  (GConfClientNotifyFunc)show_menus_changed_cb,
514                                  view, NULL, NULL);
515
516
517         view->leading_sep = FALSE;
518         view->trailing_sep = FALSE;
519         view->show_numbers = TRUE;
520
521         view->uimanager = NULL;
522         view->action_group = NULL;
523         view->merge_id = 0;
524         view->changed_cb_id = 0;
525
526         view->path = NULL;
527
528 #ifndef USE_STABLE_LIBGNOMEUI
529         view->theme = gnome_icon_theme_new ();
530         gnome_icon_theme_set_allow_svg (view->theme, TRUE);
531         g_signal_connect_object (view->theme, "changed",
532                                  G_CALLBACK (theme_changed_cb), view, 0);
533 #endif
534
535         view->tooltip_func = NULL;
536         view->tooltip_func_data = NULL;
537
538         view->icon_size = GTK_ICON_SIZE_MENU;
539 }
540
541 void
542 egg_recent_view_uimanager_set_icon_size (EggRecentViewUIManager *view,
543                                          GtkIconSize             icon_size)
544 {
545         if (view->icon_size != icon_size) {
546                 view->icon_size = icon_size;
547                 egg_recent_model_changed (view->model);
548         } else {
549                 view->icon_size = icon_size;
550         }
551 }
552
553 GtkIconSize
554 egg_recent_view_uimanager_get_icon_size (EggRecentViewUIManager *view)
555 {
556         return view->icon_size;
557 }
558
559 void
560 egg_recent_view_uimanager_show_icons (EggRecentViewUIManager *view,
561                                       gboolean                show)
562 {
563         view->show_icons = show;
564         if (view->model != NULL)
565                 egg_recent_model_changed (view->model);
566 }
567
568 void
569 egg_recent_view_uimanager_show_numbers (EggRecentViewUIManager *view, 
570                                         gboolean                show)
571 {
572         view->show_numbers = show;
573         if (view->model != NULL)
574                 egg_recent_model_changed (view->model);
575 }
576
577 void
578 egg_recent_view_uimanager_set_tooltip_func (EggRecentViewUIManager   *view,
579                                             EggUIManagerTooltipFunc   func,
580                                             gpointer                  user_data)
581 {
582         view->tooltip_func = func;
583         view->tooltip_func_data = user_data;
584         if (view->model)
585                 egg_recent_model_changed (view->model);
586 }
587
588 /**
589  * egg_recent_view_uimanager_set_uimanager:
590  * @view: A EggRecentViewUIManager object.
591  * @uimanager: The ui manager used to put the menu items in.
592  *
593  * Use this function to change the ui manager used to update the menu.
594  *
595  */
596 void
597 egg_recent_view_uimanager_set_uimanager (EggRecentViewUIManager *view,
598                                          GtkUIManager           *uimanager)
599 {
600         g_return_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view));
601         g_return_if_fail (uimanager != NULL);
602
603         if (view->uimanager != NULL)
604                 g_object_unref (view->uimanager);
605         view->uimanager = uimanager;
606         g_object_ref (view->uimanager);
607 }
608
609 /**
610  * egg_recent_view_uimanager_get_uimanager:
611  * @view: A EggRecentViewUIManager object.
612  *
613  */
614 GtkUIManager*
615 egg_recent_view_uimanager_get_uimanager (EggRecentViewUIManager *view)
616 {
617         g_return_val_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view), NULL);
618         return view->uimanager;
619 }
620
621 /**
622  * egg_recent_view_uimanager_set_path:
623  * @view: A EggRecentViewUIManager object.
624  * @path: The path to put the menu items in.
625  *
626  * Use this function to change the path where the recent
627  * documents appear in.
628  *
629  */
630 void
631 egg_recent_view_uimanager_set_path (EggRecentViewUIManager *view,
632                                     const gchar            *path)
633 {
634         g_return_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view));
635         g_return_if_fail (path);
636
637         g_free (view->path);
638         view->path = g_strdup (path);
639 }
640
641 /**
642  * egg_recent_view_uimanager_get_path:
643  * @view: A EggRecentViewUIManager object.
644  *
645  */
646 G_CONST_RETURN gchar*
647 egg_recent_view_uimanager_get_path (EggRecentViewUIManager *view)
648 {
649         g_return_val_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view), NULL);
650         return view->path;
651 }
652
653 void
654 egg_recent_view_uimanager_set_action_func (EggRecentViewUIManager   *view,
655                                            GCallback                 callback,
656                                            gpointer                  user_data)
657 {
658         g_return_if_fail (EGG_IS_RECENT_VIEW_UIMANAGER (view));
659         view->action_callback = callback;
660         view->action_user_data = user_data;
661 }
662
663 /**
664  * egg_recent_view_uimanager_new:
665  * @appname: The name of your application.
666  * @limit:  The maximum number of items allowed.
667  *
668  * This creates a new EggRecentViewUIManager object.
669  *
670  * Returns: a EggRecentViewUIManager object
671  */
672 EggRecentViewUIManager *
673 egg_recent_view_uimanager_new (GtkUIManager  *uimanager,
674                                const gchar   *path,
675                                GCallback      callback,
676                                gpointer       user_data)
677 {
678         GObject *view;
679
680         g_return_val_if_fail (uimanager, NULL);
681         g_return_val_if_fail (path, NULL);
682
683         view = g_object_new (egg_recent_view_uimanager_get_type (),
684                              "uimanager", uimanager,
685                              "path", path,
686                              NULL);
687
688         g_return_val_if_fail (view, NULL);
689         
690         egg_recent_view_uimanager_set_action_func (EGG_RECENT_VIEW_UIMANAGER (view),
691                                                    callback,
692                                                    user_data);
693
694         return EGG_RECENT_VIEW_UIMANAGER (view);
695 }
696
697 /**
698  * egg_recent_view_uimanager_get_type:
699  * @:
700  *
701  * This returns a GType representing a EggRecentViewUIManager object.
702  *
703  * Returns: a GType
704  */
705 GType
706 egg_recent_view_uimanager_get_type (void)
707 {
708         static GType egg_recent_view_uimanager_type = 0;
709
710         if(!egg_recent_view_uimanager_type) {
711                 static const GTypeInfo egg_recent_view_uimanager_info = {
712                         sizeof (EggRecentViewUIManagerClass),
713                         NULL, /* base init */
714                         NULL, /* base finalize */
715                         (GClassInitFunc)egg_recent_view_uimanager_class_init, /* class init */
716                         NULL, /* class finalize */
717                         NULL, /* class data */
718                         sizeof (EggRecentViewUIManager),
719                         0,
720                         (GInstanceInitFunc) egg_recent_view_uimanager_init
721                 };
722
723                 static const GInterfaceInfo view_info =
724                 {
725                         (GInterfaceInitFunc) egg_recent_view_init,
726                         NULL,
727                         NULL
728                 };
729
730                 egg_recent_view_uimanager_type = g_type_register_static (G_TYPE_OBJECT,
731                                                                          "EggRecentViewUIManager",
732                                                                          &egg_recent_view_uimanager_info, 0);
733                 g_type_add_interface_static (egg_recent_view_uimanager_type,
734                                              EGG_TYPE_RECENT_VIEW,
735                                              &view_info);
736         }
737
738         return egg_recent_view_uimanager_type;
739 }
740
741 EggRecentItem*
742 egg_recent_view_uimanager_get_item (EggRecentViewUIManager   *view,
743                                     GtkAction                *action)
744 {
745         return g_object_get_data (G_OBJECT(action), "egg_recent_uri");
746 }