gnome-media r3914 - in trunk: . grecord grecord/src grecord/src/recent-files
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-media r3914 - in trunk: . grecord grecord/src grecord/src/recent-files
- Date: Fri, 29 Aug 2008 14:03:13 +0000 (UTC)
Author: hadess
Date: Fri Aug 29 14:03:13 2008
New Revision: 3914
URL: http://svn.gnome.org/viewvc/gnome-media?rev=3914&view=rev
Log:
2008-08-29 Bastien Nocera <hadess hadess net>
* configure.in: Remove recent-files sub-directory
2008-08-29 Bastien Nocera <hadess hadess net>
* src/Makefile.am:
* src/gnome-recorder.c (gsr_add_recent), (main):
* src/gsr-window.c (file_open_recent_cb), (gsr_window_init),
(gsr_window_set_property):
Port gnome-sound-recorder to using GtkRecent (Closes: #404877)
* src/recent-files/*: Remove
Removed:
trunk/grecord/src/recent-files/
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/grecord/ChangeLog
trunk/grecord/src/Makefile.am
trunk/grecord/src/gnome-recorder.c
trunk/grecord/src/gsr-window.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Fri Aug 29 14:03:13 2008
@@ -476,7 +476,6 @@
grecord/Makefile
grecord/gnome-sound-recorder.schemas.in
grecord/src/Makefile
-grecord/src/recent-files/Makefile
grecord/doc/Makefile
grecord/icons/Makefile
grecord/icons/16x16/Makefile
Modified: trunk/grecord/src/Makefile.am
==============================================================================
--- trunk/grecord/src/Makefile.am (original)
+++ trunk/grecord/src/Makefile.am Fri Aug 29 14:03:13 2008
@@ -1,7 +1,5 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = recent-files
-
INCLUDES = \
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-I$(top_srcdir) \
@@ -24,6 +22,5 @@
EXTRA_DIST = $(ui_DATA)
gnome_sound_recorder_LDADD = \
- recent-files/librecent.la \
$(GSR_LIBS) -lgstinterfaces- GST_MAJORMINOR@ \
$(top_builddir)/profiles/libgnome-media-profiles.la
Modified: trunk/grecord/src/gnome-recorder.c
==============================================================================
--- trunk/grecord/src/gnome-recorder.c (original)
+++ trunk/grecord/src/gnome-recorder.c Fri Aug 29 14:03:13 2008
@@ -28,12 +28,12 @@
#endif
#include <gconf/gconf-client.h>
+#include <libgnomevfs/gnome-vfs.h>
#include <gnome.h>
#include <gst/gst.h>
#include "gsr-window.h"
-#include "egg-recent-model.h"
extern void gnome_media_profiles_init (GConfClient *conf);
@@ -41,8 +41,6 @@
GConfClient *gconf_client = NULL;
-EggRecentModel *recent_model = NULL;
-
static gboolean
delete_event_cb (GSRWindow *window,
gpointer data)
@@ -86,43 +84,42 @@
}
}
-#define RECENT_HISTORY_LEN 5
-
-static void
-init_recent (void)
-{
- /* global recent model */
- recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
-
- egg_recent_model_set_filter_groups (recent_model,
- "gnome-sound-recorder",
- NULL);
-
- egg_recent_model_set_filter_uri_schemes (recent_model, "file", NULL);
- egg_recent_model_set_limit (recent_model, RECENT_HISTORY_LEN);
-}
-
void
gsr_add_recent (gchar *filename)
{
+ GtkRecentData data;
+ char *groups[] = { NULL, NULL };
char *uri;
- EggRecentItem *item;
- g_return_if_fail (filename != NULL);
+ memset (&data, 0, sizeof (data));
uri = g_filename_to_uri (filename, NULL, NULL);
+ if (uri == NULL)
+ return;
- if (uri) {
- item = egg_recent_item_new_from_uri (uri);
- g_return_if_fail (item != NULL);
-
- egg_recent_item_add_group (item, "gnome-sound-recorder");
- egg_recent_model_add_full (recent_model, item);
+ data.mime_type = gnome_vfs_get_mime_type (uri);
+ if (data.mime_type == NULL) {
+ /* No mime-type means warnings, and it breaks when adding
+ * non-gnome-vfs supported URI schemes */
+ g_free (uri);
+ return;
+ }
+
+ /* It's a local file */
+ data.display_name = g_filename_display_basename (data.display_name);
+ groups[0] = "Totem";
+
+ data.app_name = g_strdup (g_get_application_name ());
+ data.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL);
+ data.groups = groups;
+ gtk_recent_manager_add_full (gtk_recent_manager_get_default (),
+ uri, &data);
+
+ g_free (data.display_name);
+ g_free (data.mime_type);
+ g_free (data.app_name);
+ g_free (data.app_exec);
- egg_recent_item_unref (item);
- }
-
- g_free (uri);
}
gint gsr_sample_count = 1;
@@ -201,8 +198,6 @@
GNOME_PARAM_APP_DATADIR, DATADIR,
NULL);
- init_recent ();
-
gtk_window_set_default_icon_name ("gnome-sound-recorder");
/* use it like a singleton */
Modified: trunk/grecord/src/gsr-window.c
==============================================================================
--- trunk/grecord/src/gsr-window.c (original)
+++ trunk/grecord/src/gsr-window.c Fri Aug 29 14:03:13 2008
@@ -47,11 +47,6 @@
#include <profiles/gnome-media-profiles.h>
-#include "egg-recent-view.h"
-#include "egg-recent-view-gtk.h"
-#include "egg-recent-model.h"
-#include "egg-recent-util.h"
-
#include "gsr-window.h"
GST_DEBUG_CATEGORY_STATIC (gsr_debug);
@@ -62,7 +57,6 @@
extern GConfClient *gconf_client;
-extern EggRecentModel *recent_model;
extern void gsr_add_recent (gchar *filename);
#define GCONF_DIR "/apps/gnome-sound-recorder/"
@@ -106,7 +100,8 @@
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
- EggRecentViewGtk *recent_view;
+ GtkWidget *recent_view;
+ GtkRecentFilter *recent_filter;
/* statusbar */
GtkWidget *statusbar;
@@ -424,14 +419,13 @@
}
static void
-file_open_recent_cb (EggRecentViewGtk *view,
- EggRecentItem *item,
+file_open_recent_cb (GtkRecentChooser *chooser,
GSRWindow *window)
{
gchar *uri;
gchar *filename;
- uri = egg_recent_item_get_uri (item);
+ uri = gtk_recent_chooser_get_current_uri (chooser);
g_return_if_fail (uri != NULL);
if (!g_str_has_prefix (uri, "file://"))
@@ -456,7 +450,7 @@
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
- egg_recent_model_delete (recent_model, uri);
+ gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uri, NULL);
g_free (filename_utf8);
goto out;
@@ -2314,12 +2308,13 @@
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (file_menu));
rec_menu = gtk_ui_manager_get_widget (priv->ui_manager,
"/MenuBar/FileMenu/FileRecentMenu");
- priv->recent_view = egg_recent_view_gtk_new (submenu, rec_menu);
- egg_recent_view_gtk_show_icons (EGG_RECENT_VIEW_GTK (priv->recent_view),
- FALSE);
- egg_recent_view_gtk_set_trailing_sep (priv->recent_view, TRUE);
- egg_recent_view_set_model (EGG_RECENT_VIEW (priv->recent_view), recent_model);
- g_signal_connect (priv->recent_view, "activate",
+ priv->recent_view = gtk_recent_chooser_menu_new ();
+ gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (priv->recent_view), TRUE);
+ gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (priv->recent_view), 5);
+ priv->recent_filter = gtk_recent_filter_new ();
+ gtk_recent_filter_add_application (priv->recent_filter, g_get_application_name ());
+ gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (priv->recent_view), priv->recent_filter);
+ g_signal_connect (priv->recent_view, "item-activated",
G_CALLBACK (file_open_recent_cb), window);
/* window content: hscale, labels, etc */
@@ -2556,9 +2551,7 @@
gtk_label_set (GTK_LABEL (priv->name_label), utf8_name);
}
- if (recent_model) {
- gsr_add_recent (priv->filename);
- }
+ gsr_add_recent (priv->filename);
/*Translators: this is the window title, %s is the currently open file's name or Untitled*/
title = g_strdup_printf (_("%s - Sound Recorder"), utf8_name);
@@ -2571,7 +2564,7 @@
set_action_sensitive (window, "Stop", FALSE);
set_action_sensitive (window, "Record", TRUE);
set_action_sensitive (window, "FileSave", window->priv->has_file ? TRUE : FALSE);
- set_action_sensitive (window, "FileSaveAs", window->priv->has_file ? TRUE : FALSE);
+ set_action_sensitive (window, "FileSaveAs", TRUE);
break;
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]