~ubuntu-branches/ubuntu/maverick/conglomerate/maverick

« back to all changes in this revision

Viewing changes to src/cong-menus.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2005-11-08 05:07:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051108050706-bcg60nwqf1z3w0d6
Tags: 0.9.1-1ubuntu1
* Resynchronise with Debian (Closes: #4397).
  - Thanks, Jordan Mantha.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1601
1601
"      <separator name='FileSep5'/>"
1602
1602
"      <menuitem action='Properties'/>"
1603
1603
"      <separator name='FileSep6'/>"
 
1604
"      <placeholder name='FileRecentsPlaceholder'>"
 
1605
"        <separator/>"
 
1606
"      </placeholder>"
 
1607
"      <separator name='FileSep7'/>"
1604
1608
"      <menuitem action='Close'/>"
1605
1609
"      <menuitem action='Quit'/>"
1606
1610
"    </menu>"
1940
1944
 
1941
1945
        return merge_id;
1942
1946
}
 
1947
 
 
1948
static void
 
1949
recent_open_cb (GtkAction *action, CongPrimaryWindow *primary_window)
 
1950
{
 
1951
        EggRecentItem *item;
 
1952
        gchar *uri;
 
1953
 
 
1954
        item = egg_recent_view_uimanager_get_item (primary_window->recent_view,
 
1955
                                                   action);
 
1956
        g_return_if_fail (item != NULL);
 
1957
 
 
1958
        uri = egg_recent_item_get_uri (item);
 
1959
        open_document_do (uri, GTK_WINDOW (primary_window->window));
 
1960
        g_free (uri);
 
1961
}
 
1962
 
 
1963
static gchar *
 
1964
recent_tooltip_func (EggRecentItem *item, gpointer user_data)
 
1965
{
 
1966
        char *tip;
 
1967
        char *uri_for_display;
 
1968
 
 
1969
        uri_for_display = egg_recent_item_get_uri_for_display (item);
 
1970
        g_return_val_if_fail (uri_for_display != NULL, NULL);
 
1971
 
 
1972
        tip = g_strdup_printf (_("Open '%s'"), uri_for_display);
 
1973
 
 
1974
        g_free (uri_for_display);
 
1975
 
 
1976
        return tip;
 
1977
}
 
1978
 
 
1979
/**
 
1980
 * cong_menus_setup_recent_files:
 
1981
 * @primary_window: Primary window to use
 
1982
 *
 
1983
 * With this function we perform recent files initialization
 
1984
 */
 
1985
void
 
1986
cong_menus_setup_recent_files (CongPrimaryWindow *primary_window)
 
1987
{
 
1988
       EggRecentModel *model;
 
1989
       EggRecentViewUIManager *view;
 
1990
 
 
1991
        model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
 
1992
 
 
1993
        egg_recent_model_set_limit (model, 5);
 
1994
        egg_recent_model_set_filter_groups (model, "Conglomerate", NULL);
 
1995
 
 
1996
        view = egg_recent_view_uimanager_new (primary_window->ui_manager,
 
1997
                                              "/MainMenuBar/FileMenu/FileRecentsPlaceholder",
 
1998
                                              G_CALLBACK (recent_open_cb),
 
1999
                                              primary_window);
 
2000
        egg_recent_view_uimanager_set_tooltip_func (view,
 
2001
                                                    recent_tooltip_func,
 
2002
                                                    NULL);
 
2003
       egg_recent_view_uimanager_show_icons (view, FALSE);
 
2004
        egg_recent_view_set_model (EGG_RECENT_VIEW (view), model);
 
2005
        primary_window->recent_view = view;
 
2006
        primary_window->recent_model = model;
 
2007
 
 
2008
        
 
2009
        return;
 
2010
}
 
2011