[gthumb] Fixed crash in the Flickr exporter dialog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] Fixed crash in the Flickr exporter dialog
- Date: Fri, 2 Sep 2011 13:36:26 +0000 (UTC)
commit 9605a9ac90639fe163ac4b158a35ca7345220f22
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Sep 2 15:09:50 2011 +0200
Fixed crash in the Flickr exporter dialog
Use a GtkComboBox with an entry instead of GtkComboBoxText
extensions/flicker/data/ui/export-to-flickr.ui | 263 ++++++++++++++----------
extensions/flicker/dlg-export-to-flickr.c | 42 ++++-
2 files changed, 189 insertions(+), 116 deletions(-)
---
diff --git a/extensions/flicker/data/ui/export-to-flickr.ui b/extensions/flicker/data/ui/export-to-flickr.ui
index c37eb90..efa52f3 100644
--- a/extensions/flicker/data/ui/export-to-flickr.ui
+++ b/extensions/flicker/data/ui/export-to-flickr.ui
@@ -1,17 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
+ <requires lib="gtk+" version="2.24"/>
+ <object class="GtkListStore" id="account_liststore">
+ <columns>
+ <!-- column-name account -->
+ <column type="GObject"/>
+ <!-- column-name username -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="export_dialog">
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox7">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="upload_button">
+ <property name="label" translatable="yes">_Upload</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="image">upload_image</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkVBox" id="hbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="spacing">12</property>
<child>
@@ -19,29 +89,36 @@
<property name="width_request">460</property>
<property name="height_request">340</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="images_info_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkTable" id="table2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
@@ -49,10 +126,12 @@
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="top_padding">6</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">_Account:</property>
@@ -68,15 +147,18 @@
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
+ <property name="can_focus">False</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="can_focus">False</property>
<property name="model">account_liststore</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext4"/>
@@ -86,6 +168,8 @@
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -95,30 +179,37 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Edit accounts</property>
+ <property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-edit</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Free space:</property>
<attributes>
<attribute name="absolute-size" value="10000"/>
@@ -126,12 +217,14 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="free_space_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0.51999998092651367</property>
<attributes>
@@ -139,11 +232,15 @@
</attributes>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -156,10 +253,10 @@
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Ph_otoset:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">photoset_comboboxentry</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -168,27 +265,9 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="photoset_comboboxentry">
- <property name="visible">True</property>
- <property name="model">photoset_liststore</property>
- <property name="text_column">2</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext2"/>
- <attributes>
- <attribute name="text">3</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Privacy:</property>
<property name="use_underline">True</property>
@@ -203,6 +282,7 @@
<child>
<object class="GtkComboBox" id="privacy_combobox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="model">privacy_liststore</property>
<property name="active">0</property>
<child>
@@ -225,7 +305,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -237,6 +319,7 @@
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Safety:</property>
<property name="use_underline">True</property>
@@ -251,6 +334,7 @@
<child>
<object class="GtkComboBox" id="safety_combobox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="model">safety_liststore</property>
<property name="active">0</property>
<child>
@@ -267,78 +351,42 @@
<property name="bottom_attach">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="photoset_combobox_container">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area7">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="close_button">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="upload_button">
- <property name="label" translatable="yes">_Upload</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="image">upload_image</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-help</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
@@ -347,19 +395,19 @@
<action-widget response="-11">button1</action-widget>
</action-widgets>
</object>
- <object class="GtkImage" id="upload_image">
- <property name="visible">True</property>
- <property name="stock">gtk-goto-top</property>
- </object>
- <object class="GtkListStore" id="account_liststore">
+ <object class="GtkListStore" id="photoset_liststore">
<columns>
- <!-- column-name account -->
+ <!-- column-name data -->
<column type="GObject"/>
- <!-- column-name username -->
+ <!-- column-name icon -->
+ <column type="gchararray"/>
+ <!-- column-name title -->
+ <column type="gchararray"/>
+ <!-- column-name n_photos -->
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="safety_liststore">
+ <object class="GtkListStore" id="privacy_liststore">
<columns>
<!-- column-name value -->
<column type="gint"/>
@@ -369,19 +417,27 @@
<data>
<row>
<col id="0">0</col>
- <col id="1" translatable="yes">Safe content</col>
+ <col id="1" translatable="yes">Public photos</col>
</row>
<row>
<col id="0">1</col>
- <col id="1" translatable="yes">Moderate content</col>
+ <col id="1" translatable="yes">Private photos, visible to family and friends</col>
</row>
<row>
<col id="0">2</col>
- <col id="1" translatable="yes">Restricted content</col>
+ <col id="1" translatable="yes">Private photos, visible to friends</col>
+ </row>
+ <row>
+ <col id="0">3</col>
+ <col id="1" translatable="yes">Private photos, visible to family</col>
+ </row>
+ <row>
+ <col id="0">4</col>
+ <col id="1" translatable="yes">Private photos</col>
</row>
</data>
</object>
- <object class="GtkListStore" id="privacy_liststore">
+ <object class="GtkListStore" id="safety_liststore">
<columns>
<!-- column-name value -->
<column type="gint"/>
@@ -391,36 +447,21 @@
<data>
<row>
<col id="0">0</col>
- <col id="1" translatable="yes">Public photos</col>
+ <col id="1" translatable="yes">Safe content</col>
</row>
<row>
<col id="0">1</col>
- <col id="1" translatable="yes">Private photos, visible to family and friends</col>
+ <col id="1" translatable="yes">Moderate content</col>
</row>
<row>
<col id="0">2</col>
- <col id="1" translatable="yes">Private photos, visible to friends</col>
- </row>
- <row>
- <col id="0">3</col>
- <col id="1" translatable="yes">Private photos, visible to family</col>
- </row>
- <row>
- <col id="0">4</col>
- <col id="1" translatable="yes">Private photos</col>
+ <col id="1" translatable="yes">Restricted content</col>
</row>
</data>
</object>
- <object class="GtkListStore" id="photoset_liststore">
- <columns>
- <!-- column-name data -->
- <column type="GObject"/>
- <!-- column-name icon -->
- <column type="gchararray"/>
- <!-- column-name title -->
- <column type="gchararray"/>
- <!-- column-name n_photos -->
- <column type="gchararray"/>
- </columns>
+ <object class="GtkImage" id="upload_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-goto-top</property>
</object>
</interface>
diff --git a/extensions/flicker/dlg-export-to-flickr.c b/extensions/flicker/dlg-export-to-flickr.c
index 6dafc0b..82079df 100644
--- a/extensions/flicker/dlg-export-to-flickr.c
+++ b/extensions/flicker/dlg-export-to-flickr.c
@@ -56,6 +56,7 @@ typedef struct {
GtkWidget *dialog;
GtkWidget *list_view;
GtkWidget *progress_dialog;
+ GtkWidget *photoset_combobox;
FlickrConnection *conn;
FlickrAuthentication *auth;
FlickrService *service;
@@ -298,14 +299,14 @@ export_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_OK:
{
- char *photoset_title;
- GList *file_list;
+ const char *photoset_title;
+ GList *file_list;
gtk_widget_hide (data->dialog);
gth_task_dialog (GTH_TASK (data->conn), FALSE, NULL);
data->photoset = NULL;
- photoset_title = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (GET_WIDGET ("photoset_comboboxentry")));
+ photoset_title = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (data->photoset_combobox))));
if ((photoset_title != NULL) && (g_strcmp0 (photoset_title, "") != 0)) {
GList *link;
@@ -330,7 +331,6 @@ export_dialog_response_cb (GtkDialog *dialog,
data);
_g_object_list_unref (file_list);
- g_free (photoset_title);
}
break;
@@ -500,6 +500,37 @@ dlg_export_to_flickr (FlickrServer *server,
data->dialog = _gtk_builder_get_widget (data->builder, "export_dialog");
data->cancellable = g_cancellable_new ();
+ {
+ GtkCellLayout *cell_layout;
+ GtkCellRenderer *renderer;
+
+ data->photoset_combobox = gtk_combo_box_new_with_model_and_entry (GTK_TREE_MODEL (GET_WIDGET ("photoset_liststore")));
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (data->photoset_combobox), PHOTOSET_TITLE_COLUMN);
+ gtk_widget_show (data->photoset_combobox);
+ gtk_container_add (GTK_CONTAINER (GET_WIDGET ("photoset_combobox_container")), data->photoset_combobox);
+
+ cell_layout = GTK_CELL_LAYOUT (data->photoset_combobox);
+ gtk_cell_layout_clear (cell_layout);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+ gtk_cell_layout_set_attributes (cell_layout, renderer,
+ "icon-name", PHOTOSET_ICON_COLUMN,
+ NULL);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
+ gtk_cell_layout_set_attributes (cell_layout, renderer,
+ "text", PHOTOSET_TITLE_COLUMN,
+ NULL);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+ gtk_cell_layout_set_attributes (cell_layout, renderer,
+ "text", PHOTOSET_N_PHOTOS_COLUMN,
+ NULL);
+ }
+
data->file_list = NULL;
n_total = 0;
total_size = 0;
@@ -552,7 +583,8 @@ dlg_export_to_flickr (FlickrServer *server,
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), data->list_view, TRUE, TRUE, 0);
gth_file_list_set_files (GTH_FILE_LIST (data->list_view), data->file_list);
- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (GET_WIDGET ("photoset_comboboxentry")))), g_file_info_get_edit_name (data->location->info));
+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (data->photoset_combobox))), g_file_info_get_edit_name (data->location->info));
+
gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE);
title = g_strdup_printf (_("Export to %s"), data->server->name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]