gnome-utils r8376 - trunk/gnome-screenshot



Author: cosimoc
Date: Sat Jan 10 10:37:34 2009
New Revision: 8376
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=8376&view=rev

Log:
2009-01-10  Cosimo Cecchi  <cosimoc gnome org>

	* gnome-screenshot.c (set_recent_entry), (save_callback):
	Add newly saved files to GtkRecentManager (#567205).


Modified:
   trunk/gnome-screenshot/ChangeLog
   trunk/gnome-screenshot/gnome-screenshot.c

Modified: trunk/gnome-screenshot/gnome-screenshot.c
==============================================================================
--- trunk/gnome-screenshot/gnome-screenshot.c	(original)
+++ trunk/gnome-screenshot/gnome-screenshot.c	Sat Jan 10 10:37:34 2009
@@ -540,6 +540,44 @@
 }
 
 static void
+set_recent_entry (ScreenshotDialog *dialog)
+{
+  char *uri, *app_exec = NULL;
+  GtkRecentManager *recent;
+  GtkRecentData recent_data;
+  GAppInfo *app;
+  const char *exec_name = NULL;
+  static char * groups[2] = { "Graphics", NULL };
+
+  app = g_app_info_get_default_for_type ("image/png", TRUE);
+
+  if (!app) {
+    /* return early, as this would be an useless recent entry anyway. */
+    return;
+  }
+
+  uri = screenshot_dialog_get_uri (dialog);
+  recent = gtk_recent_manager_get_default ();
+  
+  exec_name = g_app_info_get_executable (app);
+  app_exec = g_strjoin (" ", exec_name, "%u", NULL);
+
+  recent_data.display_name = NULL;
+  recent_data.description = NULL;
+  recent_data.mime_type = "image/png";
+  recent_data.app_name = "GNOME Screenshot";
+  recent_data.app_exec = app_exec;
+  recent_data.groups = groups;
+  recent_data.is_private = FALSE;
+
+  gtk_recent_manager_add_full (recent, uri, &recent_data);
+
+  g_object_unref (app);
+  g_free (app_exec);
+  g_free (uri);
+}
+
+static void
 error_dialog_response_cb (GtkDialog *d,
                           gint response,
                           ScreenshotDialog *dialog)
@@ -563,6 +601,7 @@
   if (result == TRANSFER_OK)
     {
       save_folder_to_gconf (dialog);
+      set_recent_entry (dialog);
       gtk_widget_destroy (toplevel);
       
       /* we're done, stop the mainloop now */



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