[gthumb: 11/22] [picasaweb] added a preview of the images to upload
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb: 11/22] [picasaweb] added a preview of the images to upload
- Date: Sat, 30 Jan 2010 23:20:11 +0000 (UTC)
commit dfc6a79d2564015bbd93b81ec10db444dfb850a7
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Jan 26 23:42:04 2010 +0100
[picasaweb] added a preview of the images to upload
extensions/picasaweb/actions.c | 12 +-
.../picasaweb/data/ui/export-to-picasaweb.ui | 347 +++++++++++---------
.../data/ui/picasa-web-album-properties.ui | 2 +-
extensions/picasaweb/dlg-export-to-picasaweb.c | 60 ++++-
extensions/picasaweb/dlg-export-to-picasaweb.h | 3 +-
gthumb/gth-file-list.c | 6 +-
gthumb/gth-file-list.h | 3 +-
gthumb/gth-file-view.c | 8 +
gthumb/gth-file-view.h | 4 +
gthumb/gth-icon-view.c | 19 +-
10 files changed, 294 insertions(+), 170 deletions(-)
---
diff --git a/extensions/picasaweb/actions.c b/extensions/picasaweb/actions.c
index 98489e9..bb3e40b 100644
--- a/extensions/picasaweb/actions.c
+++ b/extensions/picasaweb/actions.c
@@ -31,5 +31,15 @@ void
gth_browser_activate_action_export_picasaweb (GtkAction *action,
GthBrowser *browser)
{
- dlg_export_to_picasaweb (browser);
+ GList *items;
+ GList *file_list;
+
+ items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
+ file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
+ if (file_list == NULL)
+ file_list = gth_file_store_get_visibles (gth_browser_get_file_store (browser));
+ dlg_export_to_picasaweb (browser, file_list);
+
+ _g_object_list_unref (file_list);
+ _gtk_tree_path_list_free (items);
}
diff --git a/extensions/picasaweb/data/ui/export-to-picasaweb.ui b/extensions/picasaweb/data/ui/export-to-picasaweb.ui
index 9f2972c..c76507a 100644
--- a/extensions/picasaweb/data/ui/export-to-picasaweb.ui
+++ b/extensions/picasaweb/data/ui/export-to-picasaweb.ui
@@ -36,113 +36,145 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkVBox" id="images_box">
+ <property name="width_request">166</property>
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkLabel" id="images_info_label">
<property name="visible">True</property>
- <property name="top_padding">6</property>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">A_ccount:</property>
- <property name="use_underline">True</property>
- </object>
- </child>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkVBox" id="vbox4">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">5</property>
<child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkComboBox" id="account_combobox">
- <property name="width_request">300</property>
- <property name="visible">True</property>
- <property name="model">account_liststore</property>
- <child>
- <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
- <attributes>
- <attribute name="icon-name">2</attribute>
- </attributes>
- </child>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext3"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="top_padding">6</property>
<child>
- <object class="GtkButton" id="edit_accounts_button">
+ <object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Edit accounts</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-edit</property>
- </object>
- </child>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">A_ccount:</property>
+ <property name="use_underline">True</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
- <property name="position">0</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">3</property>
<child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
- <property name="label" translatable="yes">Free space:</property>
- <attributes>
- <attribute name="absolute-size" value="10000"/>
- </attributes>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="account_combobox">
+ <property name="width_request">300</property>
+ <property name="visible">True</property>
+ <property name="model">account_liststore</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="icon-name">2</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="edit_accounts_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Edit accounts</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-edit</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="free_space_label">
+ <object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.51999998092651367</property>
- <attributes>
- <attribute name="absolute-size" value="10000"/>
- </attributes>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Free space:</property>
+ <attributes>
+ <attribute name="absolute-size" value="10000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="free_space_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.51999998092651367</property>
+ <attributes>
+ <attribute name="absolute-size" value="10000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">1</property>
@@ -150,131 +182,132 @@
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
</object>
<packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Albums:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Albums:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="width_request">370</property>
- <property name="height_request">170</property>
+ <object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkTreeView" id="albums_treeview">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="width_request">370</property>
+ <property name="height_request">170</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="model">album_liststore</property>
- <property name="headers_clickable">False</property>
- <property name="rules_hint">True</property>
- <property name="search_column">1</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn1">
- <property name="title">Name</property>
- <property name="expand">True</property>
- <child>
- <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
- <attributes>
- <attribute name="icon-name">2</attribute>
- </attributes>
- </child>
+ <object class="GtkTreeView" id="albums_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">album_liststore</property>
+ <property name="headers_clickable">False</property>
+ <property name="rules_hint">True</property>
+ <property name="search_column">1</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderertext5"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="title">Name</property>
+ <property name="expand">True</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
+ <attributes>
+ <attribute name="icon-name">2</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext5"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn3">
- <property name="title">Used</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderertext4"/>
- <attributes>
- <attribute name="text">4</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="title">Used</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext4"/>
+ <attributes>
+ <attribute name="text">4</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn2">
- <property name="title">Remaining photos</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderertext2"/>
- <attributes>
- <attribute name="text">3</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <property name="title">Remaining photos</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox3">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkButton" id="add_album_button">
+ <object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Add a new album</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkImage" id="image1">
+ <object class="GtkButton" id="add_album_button">
<property name="visible">True</property>
- <property name="stock">gtk-add</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Add a new album</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
diff --git a/extensions/picasaweb/data/ui/picasa-web-album-properties.ui b/extensions/picasaweb/data/ui/picasa-web-album-properties.ui
index 9393a02..03c04bf 100644
--- a/extensions/picasaweb/data/ui/picasa-web-album-properties.ui
+++ b/extensions/picasaweb/data/ui/picasa-web-album-properties.ui
@@ -94,7 +94,7 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Description:</property>
+ <property name="label" translatable="yes">D_escription:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">description_entry</property>
</object>
diff --git a/extensions/picasaweb/dlg-export-to-picasaweb.c b/extensions/picasaweb/dlg-export-to-picasaweb.c
index 55d57b0..f4d054e 100644
--- a/extensions/picasaweb/dlg-export-to-picasaweb.c
+++ b/extensions/picasaweb/dlg-export-to-picasaweb.c
@@ -57,6 +57,7 @@ enum {
typedef struct {
GthBrowser *browser;
+ GList *file_list;
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *progress_dialog;
@@ -89,6 +90,7 @@ export_dialog_destroy_cb (GtkWidget *widget,
_g_object_unref (data->user);
_g_string_list_free (data->accounts);
_g_object_unref (data->builder);
+ _g_object_list_unref (data->file_list);
g_free (data);
}
@@ -112,6 +114,7 @@ export_dialog_response_cb (GtkDialog *dialog,
break;
case GTK_RESPONSE_OK:
+ /* FIXME */
break;
default:
@@ -711,10 +714,17 @@ albums_treeview_selection_changed_cb (GtkTreeSelection *treeselection,
void
-dlg_export_to_picasaweb (GthBrowser *browser)
+dlg_export_to_picasaweb (GthBrowser *browser,
+ GList *file_list)
{
DialogData *data;
+ GtkWidget *list_view;
GtkTreeSelection *selection;
+ GList *scan;
+ int n_total;
+ goffset total_size;
+ char *total_size_formatted;
+ char *text;
data = g_new0 (DialogData, 1);
data->browser = browser;
@@ -722,8 +732,56 @@ dlg_export_to_picasaweb (GthBrowser *browser)
data->dialog = _gtk_builder_get_widget (data->builder, "export_dialog");
data->cancellable = g_cancellable_new ();
+ data->file_list = NULL;
+ n_total = 0;
+ total_size = 0;
+ for (scan = file_list; scan; scan = scan->next) {
+ GthFileData *file_data = scan->data;
+ const char *mime_type;
+
+ mime_type = gth_file_data_get_mime_type (file_data);
+ if (g_content_type_equals (mime_type, "image/bmp")
+ || g_content_type_equals (mime_type, "image/gif")
+ || g_content_type_equals (mime_type, "image/jpeg")
+ || g_content_type_equals (mime_type, "image/png"))
+ {
+ GthFileData *new_file_data;
+
+ new_file_data = gth_file_data_dup (file_data);
+ new_file_data->thumb_loaded = FALSE;
+ total_size += g_file_info_get_size (new_file_data->info);
+ n_total++;
+ data->file_list = g_list_prepend (data->file_list, new_file_data);
+ }
+ }
+
+ if (data->file_list == NULL) {
+ GError *error;
+
+ error = g_error_new_literal (GTH_ERROR, GTH_ERROR_GENERIC, _("No valid file selected."));
+ _gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), &error);
+ export_dialog_destroy_cb (NULL, data);
+ return;
+ }
+
+ total_size_formatted = g_format_size_for_display (total_size);
+ text = g_strdup_printf (g_dngettext (NULL, "%d file (%s)", "%d files (%s)", n_total), n_total, total_size_formatted);
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET ("images_info_label")), text);
+ g_free (text);
+ g_free (total_size_formatted);
+
/* Set the widget data */
+ list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION);
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (list_view), 112);
+ gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (list_view))), 0);
+ gth_file_list_enable_thumbs (GTH_FILE_LIST (list_view), TRUE);
+ gth_file_list_set_caption (GTH_FILE_LIST (list_view), "none");
+ gth_file_list_set_sort_func (GTH_FILE_LIST (list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
+ gtk_widget_show (list_view);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), list_view, TRUE, TRUE, 0);
+ gth_file_list_set_files (GTH_FILE_LIST (list_view), data->file_list);
+
gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE);
/* Set the signals handlers. */
diff --git a/extensions/picasaweb/dlg-export-to-picasaweb.h b/extensions/picasaweb/dlg-export-to-picasaweb.h
index dabc0bd..d9a4230 100644
--- a/extensions/picasaweb/dlg-export-to-picasaweb.h
+++ b/extensions/picasaweb/dlg-export-to-picasaweb.h
@@ -25,6 +25,7 @@
#include <gthumb.h>
-void dlg_export_to_picasaweb (GthBrowser *browser);
+void dlg_export_to_picasaweb (GthBrowser *browser,
+ GList *file_list);
#endif /* DLG_EXPORT_TO_PICASAWEB_H */
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index bd3457b..5d0c359 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -253,8 +253,8 @@ gth_file_list_class_init (GthFileListClass *class)
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
- object_class = (GObjectClass*) class;
+ object_class = (GObjectClass*) class;
object_class->finalize = gth_file_list_finalize;
}
@@ -528,7 +528,7 @@ gth_file_list_construct (GthFileList *file_list,
file_list->priv->view = gth_icon_view_new_with_model (GTK_TREE_MODEL (model));
g_object_unref (model);
- if (file_list->priv->type == GTH_FILE_LIST_TYPE_SELECTOR)
+ if ((file_list->priv->type == GTH_FILE_LIST_TYPE_SELECTOR) || (file_list->priv->type == GTH_FILE_LIST_TYPE_NO_SELECTION))
gth_file_selection_set_selection_mode (GTH_FILE_SELECTION (file_list->priv->view), GTK_SELECTION_NONE);
else
gth_file_selection_set_selection_mode (GTH_FILE_SELECTION (file_list->priv->view), GTK_SELECTION_MULTIPLE);
@@ -560,7 +560,7 @@ gth_file_list_construct (GthFileList *file_list,
"active", GTH_FILE_STORE_CHECKED_COLUMN,
NULL);
g_object_set (file_list->priv->checkbox_renderer,
- "visible", (file_list->priv->type != GTH_FILE_LIST_TYPE_NORMAL),
+ "visible", ((file_list->priv->type == GTH_FILE_LIST_TYPE_BROWSER) || (file_list->priv->type == GTH_FILE_LIST_TYPE_SELECTOR)),
NULL);
g_signal_connect (file_list->priv->checkbox_renderer,
"toggled",
diff --git a/gthumb/gth-file-list.h b/gthumb/gth-file-list.h
index 3b171c9..d176166 100644
--- a/gthumb/gth-file-list.h
+++ b/gthumb/gth-file-list.h
@@ -34,7 +34,8 @@ G_BEGIN_DECLS
typedef enum {
GTH_FILE_LIST_TYPE_NORMAL,
GTH_FILE_LIST_TYPE_BROWSER,
- GTH_FILE_LIST_TYPE_SELECTOR
+ GTH_FILE_LIST_TYPE_SELECTOR,
+ GTH_FILE_LIST_TYPE_NO_SELECTION
} GthFileListType;
#define GTH_TYPE_FILE_LIST (gth_file_list_get_type ())
diff --git a/gthumb/gth-file-view.c b/gthumb/gth-file-view.c
index b9e6125..40a8b61 100644
--- a/gthumb/gth-file-view.c
+++ b/gthumb/gth-file-view.c
@@ -102,6 +102,14 @@ gth_file_view_get_cursor (GthFileView *self)
void
+gth_file_view_set_spacing (GthFileView *self,
+ int spacing)
+{
+ GTH_FILE_VIEW_GET_INTERFACE (self)->set_spacing (self, spacing);
+}
+
+
+void
gth_file_view_enable_drag_source (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
diff --git a/gthumb/gth-file-view.h b/gthumb/gth-file-view.h
index 5baeaa6..a2f459f 100644
--- a/gthumb/gth-file-view.h
+++ b/gthumb/gth-file-view.h
@@ -68,6 +68,8 @@ struct _GthFileViewIface {
void (*set_cursor) (GthFileView *self,
int pos);
int (*get_cursor) (GthFileView *self);
+ void (*set_spacing) (GthFileView *self,
+ int spacing);
void (*enable_drag_source) (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
@@ -106,6 +108,8 @@ void gth_file_view_activated (GthFileView *self,
void gth_file_view_set_cursor (GthFileView *self,
int pos);
int gth_file_view_get_cursor (GthFileView *self);
+void gth_file_view_set_spacing (GthFileView *self,
+ int spacing);
void gth_file_view_enable_drag_source (GthFileView *self,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
diff --git a/gthumb/gth-icon-view.c b/gthumb/gth-icon-view.c
index f35e0eb..1067f62 100644
--- a/gthumb/gth-icon-view.c
+++ b/gthumb/gth-icon-view.c
@@ -25,8 +25,8 @@
#include "gth-icon-view.h"
-#define IMAGE_TEXT_SPACING 5
-#define ICON_SPACING 12
+#define IMAGE_TEXT_SPACING 0
+#define DEFAULT_ICON_SPACING 12
#define SIZE_REQUEST 50
@@ -182,6 +182,16 @@ gth_icon_view_real_get_cursor (GthFileView *base)
}
+void
+gth_icon_view_real_set_spacing (GthFileView *self,
+ int spacing)
+{
+ gtk_icon_view_set_margin (GTK_ICON_VIEW (self), spacing);
+ gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (self), spacing);
+ gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (self), spacing);
+}
+
+
static void
gth_icon_view_enable_drag_source (GthFileView *self,
GdkModifierType start_button_mask,
@@ -460,9 +470,7 @@ static void
gth_icon_view_init (GthIconView *icon_view)
{
gtk_icon_view_set_spacing (GTK_ICON_VIEW (icon_view), IMAGE_TEXT_SPACING);
- gtk_icon_view_set_margin (GTK_ICON_VIEW (icon_view), ICON_SPACING);
- gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (icon_view), ICON_SPACING);
- gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (icon_view), ICON_SPACING);
+ gth_icon_view_real_set_spacing (GTH_FILE_VIEW (icon_view), DEFAULT_ICON_SPACING);
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view), GTK_SELECTION_MULTIPLE);
gtk_widget_set_size_request (GTK_WIDGET (icon_view), SIZE_REQUEST, SIZE_REQUEST);
}
@@ -482,6 +490,7 @@ gth_icon_view_gth_file_view_interface_init (GthFileViewIface *iface)
iface->activated = gth_icon_view_real_activated;
iface->set_cursor = gth_icon_view_real_set_cursor;
iface->get_cursor = gth_icon_view_real_get_cursor;
+ iface->set_spacing = gth_icon_view_real_set_spacing;
iface->enable_drag_source = gth_icon_view_enable_drag_source;
iface->unset_drag_source = gth_icon_view_unset_drag_source;
iface->enable_drag_dest = gth_icon_view_enable_drag_dest;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]