[almanah] Improve the Import/Export UI
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [almanah] Improve the Import/Export UI
- Date: Tue, 11 May 2010 12:35:49 +0000 (UTC)
commit 2c27e8c0324a9a293680db8131dd63bffa4be0c5
Author: Philip Withnall <philip tecnocode co uk>
Date: Tue May 11 13:35:09 2010 +0100
Improve the Import/Export UI
Use a GtkFileChooserButton instead of a GtkFileChooserWidget and change the
labels around slightly. Add mnemonics.
data/almanah.ui | 33 ++++++++++++++++++---------------
src/import-export-dialog.c | 25 ++++++++++++++-----------
2 files changed, 32 insertions(+), 26 deletions(-)
---
diff --git a/data/almanah.ui b/data/almanah.ui
index 553b669..c3fe756 100644
--- a/data/almanah.ui
+++ b/data/almanah.ui
@@ -958,6 +958,8 @@
<object class="GtkLabel" id="almanah_ied_mode_label">
<property name="xalign">0</property>
<property name="label"></property><!-- Set in import-export-dialog.c -->
+ <property name="mnemonic-widget">almanah_ied_mode_combo_box</property>
+ <property name="use-underline">True</property>
<accessibility>
<relation target="almanah_ied_mode_combo_box" type="label-for"/>
</accessibility>
@@ -987,28 +989,29 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="almanah_ied_description_label">
- <property name="wrap">True</property>
- <attributes>
- <attribute name="scale" value="0.83"/><!-- PANGO_SCALE_SMALL -->
- </attributes>
+ <object class="GtkAlignment" id="almanah_ied_alignment">
+ <property name="top-padding">12</property>
+ <child>
+ <object class="GtkLabel" id="almanah_ied_description_label">
+ <property name="wrap">True</property>
+ <property name="mnemonic-widget">almanah_ied_file_chooser</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="almanah_ied_alignment">
- <property name="top-padding">12</property>
- <child>
- <object class="GtkFileChooserWidget" id="almanah_ied_file_chooser">
- <signal name="selection-changed" handler="ied_file_chooser_selection_changed_cb"/>
- <signal name="file-activated" handler="ied_file_chooser_file_activated_cb"/>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="select-multiple">False</property>
- </object>
- </child>
+ <object class="GtkFileChooserButton" id="almanah_ied_file_chooser">
+ <signal name="selection-changed" handler="ied_file_chooser_selection_changed_cb"/>
+ <signal name="file-activated" handler="ied_file_chooser_file_activated_cb"/>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
</child>
</object>
</child>
diff --git a/src/import-export-dialog.c b/src/import-export-dialog.c
index b962207..48af0c9 100644
--- a/src/import-export-dialog.c
+++ b/src/import-export-dialog.c
@@ -35,6 +35,7 @@ typedef struct {
const gchar *import_description; /* translatable */
const gchar *export_description; /* translatable */
GtkFileChooserAction action;
+ const gchar *file_chooser_title; /* translatable */
ImportFunc import_func;
ExportFunc export_func;
} ImportExportModeDetails;
@@ -47,17 +48,19 @@ static gboolean export_database (AlmanahImportExportDialog *self, GError **error
static const ImportExportModeDetails import_export_modes[] = {
{ N_("Text Files"),
- N_("Select a folder containing text files, one per entry, with names in the format 'yyyy-mm-dd', and no extension. "
+ N_("Select a _folder containing text files, one per entry, with names in the format 'yyyy-mm-dd', and no extension. "
"Any and all such files will be imported."),
- N_("Select a folder to export the entries to as text files, one per entry, with names in the format 'yyyy-mm-dd', and no extension. "
+ N_("Select a _folder to export the entries to as text files, one per entry, with names in the format 'yyyy-mm-dd', and no extension. "
"All entries will be exported, unencrypted in plain text format."),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ N_("Select a Folder"),
import_text_files,
export_text_files },
{ N_("Database"),
- N_("Select a database file created by Almanah Diary to import."),
- N_("Select a filename for a complete copy of the unencrypted Almanah Diary database to be given."),
+ N_("Select a database _file created by Almanah Diary to import."),
+ N_("Select a _filename for a complete copy of the unencrypted Almanah Diary database to be given."),
GTK_FILE_CHOOSER_ACTION_OPEN,
+ N_("Select a File"),
import_database,
export_database }
};
@@ -98,9 +101,7 @@ almanah_import_export_dialog_init (AlmanahImportExportDialog *self)
g_signal_connect (self, "response", G_CALLBACK (response_cb), self);
g_signal_connect (self, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), self);
gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
- gtk_window_set_resizable (GTK_WINDOW (self), TRUE);
gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (almanah->main_window));
- gtk_window_set_default_size (GTK_WINDOW (self), 600, 400);
}
static void
@@ -175,8 +176,8 @@ almanah_import_export_dialog_new (gboolean import)
priv->description_label = GTK_LABEL (gtk_builder_get_object (builder, "almanah_ied_description_label"));
/* Set the mode label */
- gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "almanah_ied_mode_label")),
- (import == TRUE) ? _("Import mode: ") : _("Export mode: "));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (gtk_builder_get_object (builder, "almanah_ied_mode_label")),
+ (import == TRUE) ? _("Import _mode: ") : _("Export _mode: "));
/* Set the window title */
gtk_window_set_title (GTK_WINDOW (import_export_dialog), (import == TRUE) ? _("Import Entries") : _("Export Entries"));
@@ -651,9 +652,11 @@ ied_mode_combo_box_changed_cb (GtkComboBox *combo_box, AlmanahImportExportDialog
/* Change the dialogue */
gtk_file_chooser_set_action (priv->file_chooser, import_export_modes[priv->current_mode].action);
- gtk_label_set_text (priv->description_label,
- (priv->import == TRUE) ? _(import_export_modes[priv->current_mode].import_description)
- : _(import_export_modes[priv->current_mode].export_description));
+ gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (priv->file_chooser),
+ _(import_export_modes[priv->current_mode].file_chooser_title));
+ gtk_label_set_text_with_mnemonic (priv->description_label,
+ (priv->import == TRUE) ? _(import_export_modes[priv->current_mode].import_description)
+ : _(import_export_modes[priv->current_mode].export_description));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]