[Goodies-commits] r5876 - xfce4-screenshooter-plugin/trunk/lib
Jerome Guelfucci
jeromeg at xfce.org
Thu Oct 30 17:47:00 CET 2008
Author: jeromeg
Date: 2008-10-30 16:47:00 +0000 (Thu, 30 Oct 2008)
New Revision: 5876
Removed:
xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c
xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.h
Modified:
xfce4-screenshooter-plugin/trunk/lib/Makefile.am
xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c
xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.h
Log:
* lib/: remove the screenshooter-open-with files, it will be handled in screenshooter-dialogs.c
* lib/screenshooter-dialogs.c: add the open with stuff and make it functionnal.
* Remove all screenshooter-open-with.{c,h} in makefiles.
Modified: xfce4-screenshooter-plugin/trunk/lib/Makefile.am
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/Makefile.am 2008-10-30 14:36:05 UTC (rev 5875)
+++ xfce4-screenshooter-plugin/trunk/lib/Makefile.am 2008-10-30 16:47:00 UTC (rev 5876)
@@ -21,9 +21,6 @@
@LIBXFCEGUI4_LIBS@
if HAVE_GIO
-
-libscreenshooter_la_SOURCES += \
- screenshooter-open-with.c screenshooter-open-with.h
libscreenshooter_la_CFLAGS += \
@GIO_CFLAGS@
Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c 2008-10-30 14:36:05 UTC (rev 5875)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c 2008-10-30 16:47:00 UTC (rev 5876)
@@ -107,6 +107,35 @@
sd->app = active_command;
}
+
+static void add_item (GAppInfo *app_info, GtkWidget *liststore)
+{
+ GtkTreeIter iter;
+ gchar *command = g_strdup (g_app_info_get_executable (app_info));
+
+ gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
+
+ gtk_list_store_set (GTK_LIST_STORE (liststore), &iter, 0, command, -1);
+
+ g_free (command);
+}
+
+static void populate_liststore (GtkListStore *liststore)
+{
+ const gchar *content_type;
+ GList *list_app;
+
+ content_type = "image/png";
+
+ list_app = g_app_info_get_all_for_type (content_type);
+
+ if (list_app != NULL)
+ {
+ g_list_foreach (list_app, (GFunc) add_item, liststore);
+
+ g_list_free (list_app);
+ }
+}
#endif
@@ -125,7 +154,10 @@
GtkWidget *default_save_label, *dir_chooser;
GtkWidget *delay_label, *delay_box, *delay_spinner, *label2;
#ifdef HAVE_GIO
- GtkWidget *combo_box, *open_with_label;
+ GtkWidget *open_with_label;
+ GtkListStore *liststore = gtk_list_store_new (1, G_TYPE_STRING);
+ GtkWidget *combobox;
+ GtkCellRenderer *renderer;
#endif
/* Create the dialog */
@@ -278,13 +310,22 @@
gtk_widget_show (open_with_label);
gtk_container_add (GTK_CONTAINER (options_box), open_with_label);
- combo_box = screenshooter_open_with_combo_box ();
- gtk_container_add (GTK_CONTAINER (options_box), combo_box);
+ combobox = gtk_combo_box_new_with_model (GTK_TREE_MODEL (liststore));
- g_signal_connect (G_OBJECT (combo_box), "changed",
+ renderer = gtk_cell_renderer_text_new ();
+
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox),
+ renderer, "text", 0, NULL);
+
+ populate_liststore (liststore);
+
+ gtk_container_add (GTK_CONTAINER (options_box), combobox);
+
+ g_signal_connect (G_OBJECT (combobox), "changed",
G_CALLBACK (cb_combo_active_item_changed), sd);
- gtk_widget_show (combo_box);
+ gtk_widget_show_all (combobox);
#endif
return dlg;
Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.h
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.h 2008-10-30 14:36:05 UTC (rev 5875)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.h 2008-10-30 16:47:00 UTC (rev 5876)
@@ -23,7 +23,7 @@
#include "screenshooter-utils.h"
#ifdef HAVE_GIO
-#include "screenshooter-open-with.h"
+#include <gio/gio.h>
#endif
#include <gtk/gtk.h>
Deleted: xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.c
Deleted: xfce4-screenshooter-plugin/trunk/lib/screenshooter-open-with.h
More information about the Goodies-commits
mailing list