[Goodies-commits] r5872 - xfce4-screenshooter-plugin/trunk/lib

Jerome Guelfucci jeromeg at xfce.org
Thu Oct 30 11:21:26 CET 2008


Author: jeromeg
Date: 2008-10-30 10:21:26 +0000 (Thu, 30 Oct 2008)
New Revision: 5872

Added:
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.h
Log:
Add missing files

Added: xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c	                        (rev 0)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c	2008-10-30 10:21:26 UTC (rev 5872)
@@ -0,0 +1,77 @@
+/*  $Id$
+ *
+ *  Copyright © 2008 Jérôme Guelfucci <jerome.guelfucci at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+ 
+static void populate_liststore (GtkListStore* liststore);
+ 
+/* Internals */
+
+static void populate_liststore (GtkListStore* liststore)
+{
+  const gchar *content_type;
+  GList	*list_app;
+  GtkTreeIter iter;
+  gpointer data;
+  gint n = 0;
+  
+  #if GIO_CHECK_VERSION(2,18,0)
+  content_type = g_content_type_from_mime_type ("image/png");
+  #else
+  content_type = "image/png";
+  #endif
+  
+  list_app = g_app_info_get_all_for_type (content_type);
+  
+  if (list_app != NULL)
+    {
+      while (( data = g_list_nth_data (list_app, n)) != NULL)
+        {
+          gchar *command = g_app_info_get_executable (G_APP_INFO (data));
+                   
+          gtk_list_store_append (liststore, &iter);
+          
+          gtk_list_store_set (liststore, &iter, 0, command, -1);
+          
+          g_free (command);
+          n++;
+        }
+      
+      g_list_free (list_app);
+    }
+  
+  if (content_type != NULL)
+    g_free (content_type);
+}
+
+
+
+/* Public */
+
+
+
+GtkWidget *screenshooter_open_with_combo_box ()
+{
+  GtkListStore *liststore = gtk_list_store_new (1, G_TYPE_STRING);
+  GtkComboBox *combobox;
+  
+  populate_liststore (liststore);
+  
+  combobox = gtk_combo_box_new_with_model (GTK_TREE_MODEL (liststore));
+  
+  return combobox;
+}


Property changes on: xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c
___________________________________________________________________
Name: svn:executable
   + *

Added: xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.h
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.h	                        (rev 0)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.h	2008-10-30 10:21:26 UTC (rev 5872)
@@ -0,0 +1,23 @@
+/*  $Id$
+ *
+ *  Copyright © 2008 Jérôme Guelfucci <jerome.guelfucci at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <gio/gio.h>
+
+GtkWidget *screenshooter_open_with_combo_box ();




More information about the Goodies-commits mailing list