[totem] main: Remove recent menu entries



commit 5cf4f4b78038a22eb5e287699adeabdf27afd096
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Apr 3 20:53:14 2013 +0200

    main: Remove recent menu entries
    
    They're now in the browse section of the Grilo plugin.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697237

 src/totem-menu.c    |  173 ---------------------------------------------------
 src/totem-menu.h    |    2 -
 src/totem-private.h |    5 --
 src/totem.c         |    2 -
 4 files changed, 0 insertions(+), 182 deletions(-)
---
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 3a94790..1c045ed 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -444,179 +444,6 @@ totem_sublang_exit (Totem *totem)
        g_list_free_full (totem->language_list, g_free);
 }
 
-/* Recent files */
-static void
-connect_proxy_cb (GtkActionGroup *action_group,
-                  GtkAction *action,
-                  GtkWidget *proxy,
-                  gpointer data)
-{
-        GtkLabel *label;
-
-        if (!GTK_IS_MENU_ITEM (proxy))
-                return;
-
-        label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (proxy)));
-
-        gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_MIDDLE);
-        gtk_label_set_max_width_chars (label,TOTEM_MAX_RECENT_ITEM_LEN);
-}
-
-static void
-on_recent_file_item_activated (GtkAction *action,
-                               Totem *totem)
-{
-       GtkRecentInfo *recent_info;
-       const gchar *uri, *display_name;
-
-       recent_info = g_object_get_data (G_OBJECT (action), "recent-info");
-       uri = gtk_recent_info_get_uri (recent_info);
-       display_name = gtk_recent_info_get_display_name (recent_info);
-
-       totem_object_add_to_playlist_and_play (totem, uri, display_name);
-}
-
-static gint
-totem_compare_recent_items (GtkRecentInfo *a, GtkRecentInfo *b)
-{
-       gboolean has_totem_a, has_totem_b;
-
-       has_totem_a = gtk_recent_info_has_group (a, "Totem");
-       has_totem_b = gtk_recent_info_has_group (b, "Totem");
-
-       if (has_totem_a && has_totem_b) {
-               time_t time_a, time_b;
-
-               time_a = gtk_recent_info_get_modified (a);
-               time_b = gtk_recent_info_get_modified (b);
-
-               return (time_b - time_a);
-       } else if (has_totem_a) {
-               return -1;
-       } else if (has_totem_b) {
-               return 1;
-       }
-
-       return 0;
-}
-
-static void
-totem_recent_manager_changed_callback (GtkRecentManager *recent_manager, Totem *totem)
-{
-        GList *items, *totem_items, *l;
-        guint n_items = 0;
-
-        if (totem->recent_ui_id != 0) {
-                gtk_ui_manager_remove_ui (totem->ui_manager, totem->recent_ui_id);
-                gtk_ui_manager_ensure_update (totem->ui_manager);
-        }
-
-        if (totem->recent_action_group) {
-                gtk_ui_manager_remove_action_group (totem->ui_manager,
-                                totem->recent_action_group);
-        }
-
-        totem->recent_action_group = gtk_action_group_new ("recent-action-group");
-        g_signal_connect (totem->recent_action_group, "connect-proxy",
-                          G_CALLBACK (connect_proxy_cb), NULL);
-        gtk_ui_manager_insert_action_group (totem->ui_manager,
-                        totem->recent_action_group, -1);
-        g_object_unref (totem->recent_action_group);
-
-        totem->recent_ui_id = gtk_ui_manager_new_merge_id (totem->ui_manager);
-        items = gtk_recent_manager_get_items (recent_manager);
-
-       /* Remove the non-Totem items */
-       totem_items = NULL;
-        for (l = items; l && l->data; l = l->next) {
-                GtkRecentInfo *info;
-
-                info = (GtkRecentInfo *) l->data;
-
-                if (gtk_recent_info_has_group (info, "Totem")) {
-                       gtk_recent_info_ref (info);
-                       totem_items = g_list_prepend (totem_items, info);
-               }
-       }
-       g_list_free_full (items, (GDestroyNotify) gtk_recent_info_unref);
-
-        totem_items = g_list_sort (totem_items, (GCompareFunc) totem_compare_recent_items);
-
-        for (l = totem_items; l && l->data; l = l->next) {
-                GtkRecentInfo *info;
-                GtkAction     *action;
-                char           action_name[32];
-                const char    *display_name;
-                char          *label;
-                char          *escaped_label;
-                const gchar   *mime_type;
-                gchar         *content_type;
-                GIcon         *icon = NULL;
-
-                info = (GtkRecentInfo *) l->data;
-
-                if (!gtk_recent_info_has_group (info, "Totem"))
-                        continue;
-
-                g_snprintf (action_name, sizeof (action_name), "RecentFile%u", n_items);
-
-                display_name = gtk_recent_info_get_display_name (info);
-                escaped_label = escape_label_for_menu (display_name);
-
-                label = g_strdup_printf ("_%d.  %s", n_items + 1, escaped_label);
-                g_free (escaped_label);
-
-                action = gtk_action_new (action_name, label, NULL, NULL);
-                g_object_set_data_full (G_OBJECT (action), "recent-info",
-                                        gtk_recent_info_ref (info),
-                                        (GDestroyNotify) gtk_recent_info_unref);
-                g_signal_connect (G_OBJECT (action), "activate",
-                                  G_CALLBACK (on_recent_file_item_activated),
-                                  totem);
-
-                mime_type = gtk_recent_info_get_mime_type (info);
-                content_type = g_content_type_from_mime_type (mime_type);
-                if (content_type != NULL) {
-                        icon = g_content_type_get_icon (content_type);
-                        g_free (content_type);
-                }
-                if (icon != NULL) {
-                        gtk_action_set_gicon (action, icon);
-                        gtk_action_set_always_show_image (action, TRUE);
-                        g_object_unref (icon);
-                }
-
-                gtk_action_group_add_action (totem->recent_action_group,
-                                            action);
-                g_object_unref (action);
-
-                gtk_ui_manager_add_ui (totem->ui_manager, totem->recent_ui_id,
-                                      "/tmw-menubar/movie/recent-placeholder",
-                                      label, action_name, GTK_UI_MANAGER_MENUITEM,
-                                      FALSE);
-                g_free (label);
-
-                if (++n_items == 5)
-                        break;
-        }
-
-       g_list_free_full (totem_items, (GDestroyNotify) gtk_recent_info_unref);
-}
-
-void
-totem_setup_recent (Totem *totem)
-{
-       totem->recent_manager = gtk_recent_manager_get_default ();
-       totem->recent_action_group = NULL;
-       totem->recent_ui_id = 0;
-
-       g_signal_connect (G_OBJECT (totem->recent_manager), "changed",
-                       G_CALLBACK (totem_recent_manager_changed_callback),
-                       totem);
-
-       totem_recent_manager_changed_callback (totem->recent_manager, totem);
-}
-
 void
 eject_action_callback (GtkAction *action, Totem *totem)
 {
diff --git a/src/totem-menu.h b/src/totem-menu.h
index da40fd7..d9fb1fd 100644
--- a/src/totem-menu.h
+++ b/src/totem-menu.h
@@ -34,8 +34,6 @@ void totem_ui_manager_setup (Totem *totem);
 void totem_sublang_update (Totem *totem);
 void totem_sublang_exit (Totem *totem);
 
-void totem_setup_recent (Totem *totem);
-
 G_END_DECLS
 
 #endif /* TOTEM_MENU_H */
diff --git a/src/totem-private.h b/src/totem-private.h
index aca1954..0952052 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -127,11 +127,6 @@ struct _TotemObject {
        /* Stream info */
        gint64 stream_length;
 
-       /* recent file stuff */
-       GtkRecentManager *recent_manager;
-       GtkActionGroup *recent_action_group;
-       guint recent_ui_id;
-
        /* Monitor for playlist unmounts and drives/volumes monitoring */
        GVolumeMonitor *monitor;
        gboolean drives_changed;
diff --git a/src/totem.c b/src/totem.c
index 8a4201b..72300e9 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -147,8 +147,6 @@ app_init (Totem *totem, char **argv)
 
        totem_setup_preferences (totem);
 
-       totem_setup_recent (totem);
-
        /* Initialise all the plugins, and set the default page, in case
         * it comes from a plugin */
        totem_object_plugins_init (totem);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]