gnome-scan r653 - in trunk: . modules
- From: bersace svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-scan r653 - in trunk: . modules
- Date: Thu, 11 Dec 2008 20:44:02 +0000 (UTC)
Author: bersace
Date: Thu Dec 11 20:44:02 2008
New Revision: 653
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=653&view=rev
Log:
Populate filename widget upon construction.
Modified:
trunk/ChangeLog
trunk/modules/gsfile-backend.c
trunk/modules/gsfile-filenames-widget.c
Modified: trunk/modules/gsfile-backend.c
==============================================================================
--- trunk/modules/gsfile-backend.c (original)
+++ trunk/modules/gsfile-backend.c Thu Dec 11 20:44:02 2008
@@ -27,10 +27,19 @@
static GnomeScanBackendClass* parent_class = NULL;
-void* gsfb_probe_scanners (GnomeScanBackend *backend);
-
GS_DEFINE_MODULE_TYPE (GSFileBackend, gsfile_backend, GNOME_SCAN_TYPE_BACKEND);
+void*
+gsfile_backend_probe_scanners (GnomeScanBackend *self)
+{
+ GnomeScanScanner *scanner;
+ scanner = gsfile_scanner_new ();
+ g_signal_emit_by_name(self, "scanner-added", scanner);
+ g_object_unref (scanner);
+ g_signal_emit_by_name(self, "probe-done");
+ return NULL;
+}
+
static void
gsfile_backend_init (GSFileBackend *object)
{
@@ -52,18 +61,6 @@
GnomeScanBackendClass *backend_class = GNOME_SCAN_BACKEND_CLASS (klass);
parent_class = GNOME_SCAN_BACKEND_CLASS (g_type_class_peek_parent (klass));
- backend_class->probe_scanners = gsfb_probe_scanners;
-
object_class->finalize = gsfile_backend_finalize;
-}
-
-void*
-gsfb_probe_scanners (GnomeScanBackend *self)
-{
- GnomeScanScanner *scanner;
- scanner = gsfile_scanner_new ();
- g_signal_emit_by_name(self, "scanner-added", scanner);
- g_object_unref (scanner);
- g_signal_emit_by_name(self, "probe-done");
- return NULL;
+ backend_class->probe_scanners = gsfile_backend_probe_scanners;
}
Modified: trunk/modules/gsfile-filenames-widget.c
==============================================================================
--- trunk/modules/gsfile-filenames-widget.c (original)
+++ trunk/modules/gsfile-filenames-widget.c Thu Dec 11 20:44:02 2008
@@ -53,6 +53,8 @@
FILENAMES_N_COLUMNS
};
+static void gsffw_populate(GSFileFilenamesWidget *self,
+ GSList* filenames);
static void gsffw_filenames_add (GtkButton *button,
GSFileFilenamesWidget *self);
static void gsffw_filenames_remove (GtkButton *button,
@@ -83,6 +85,8 @@
GtkWidget *scrolled, *tree_view, *box, *button;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
+ GnomeScanOption *option;
+ GSList *filenames;
gtk_box_set_spacing (GTK_BOX (self), 6);
g_object_set(self, "no_label", TRUE, "expand", TRUE, NULL);
@@ -148,6 +152,11 @@
(GCallback) gsffw_filenames_clear, self);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
+ /* populate */
+ g_object_get(self, "option", &option, NULL);
+ g_object_get(option, "value", &filenames, NULL);
+ gsffw_populate(self, filenames);
+
return object;
}
@@ -225,11 +234,28 @@
}
static void
-gsffw_filenames_add (GtkButton *button, GSFileFilenamesWidget *self)
+gsffw_populate(GSFileFilenamesWidget *self, GSList *filenames)
{
+ GError *error = NULL;
+ GSList* node;
GtkTreeIter iter;
+
+ /* first populate list store */
+ for (node = filenames; node ; node = node->next) {
+ gtk_list_store_insert_with_values (self->priv->liststore, &iter, G_MAXINT,
+ FILENAMES_BASENAME, g_path_get_basename (node->data),
+ FILENAMES_PATHNAME, node->data,
+ -1);
+ }
+ /* delegate populate creation in a thread */
+ g_thread_create ((GThreadFunc) gsffw_filenames_preview,
+ self, FALSE, &error);
+}
+
+static void
+gsffw_filenames_add (GtkButton *button, GSFileFilenamesWidget *self)
+{
GSList *node;
- GError *error = NULL;
/* filechooser */
if (!self->priv->filechooser) {
@@ -240,18 +266,8 @@
if (gtk_dialog_run (GTK_DIALOG (self->priv->filechooser)) == GTK_RESPONSE_ACCEPT) {
gtk_widget_hide (self->priv->filechooser);
node = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (self->priv->filechooser));
- /* first populate list store */
- for (; node ; node = node->next) {
- gtk_list_store_insert_with_values (self->priv->liststore, &iter, G_MAXINT,
- FILENAMES_BASENAME, g_path_get_basename (node->data),
- FILENAMES_PATHNAME, node->data,
- -1);
- }
+ gsffw_populate(self, node);
gsffw_filenames_update(self);
-
- /* delegate populate creation in a thread */
- g_thread_create ((GThreadFunc) gsffw_filenames_preview,
- self, FALSE, &error);
}
gtk_widget_hide (self->priv->filechooser);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]