[frogr] New option in 'Misc' tab in settings: 'Use date taken as date posted'
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] New option in 'Misc' tab in settings: 'Use date taken as date posted'
- Date: Sat, 13 Sep 2014 16:37:01 +0000 (UTC)
commit ce693c1a23843aff982fe9f6c9100f73f55eef10
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Sat Sep 13 16:11:00 2014 +0100
New option in 'Misc' tab in settings: 'Use date taken as date posted'
https://bugzilla.gnome.org/show_bug.cgi?id=734193
src/frogr-config.c | 35 +++++++++++++++++++++++++++++++++++
src/frogr-config.h | 4 ++++
src/frogr-settings-dialog.c | 18 ++++++++++++++++++
3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/src/frogr-config.c b/src/frogr-config.c
index 94b7918..d06bbda 100644
--- a/src/frogr-config.c
+++ b/src/frogr-config.c
@@ -69,6 +69,7 @@ struct _FrogrConfigPrivate
gboolean mainview_sorting_reversed;
gboolean mainview_enable_tooltips;
gboolean use_dark_theme;
+ gboolean date_taken_as_posted;
gboolean use_proxy;
gchar *proxy_host;
@@ -306,6 +307,16 @@ _load_settings (FrogrConfig *self)
xmlFree (content);
}
+
+ if (!xmlStrcmp (node->name, (const xmlChar*) "date-taken-as-posted"))
+ {
+ xmlChar *content = NULL;
+
+ content = xmlNodeGetContent (node);
+ priv->date_taken_as_posted = !xmlStrcmp (content, (const xmlChar*) "1");
+
+ xmlFree (content);
+ }
}
}
else if (node && node->name)
@@ -706,6 +717,7 @@ _save_settings (FrogrConfig *self)
_xml_add_bool_child (root, "keep-file-extensions", priv->keep_file_extensions);
_xml_add_bool_child (root, "import-tags-from-metadata", priv->import_tags_from_metadata);
_xml_add_bool_child (root, "use-dark-theme", priv->use_dark_theme);
+ _xml_add_bool_child (root, "date-taken-as-posted", priv->date_taken_as_posted);
node = xmlNewNode (NULL, (const xmlChar*) "mainview-options");
_xml_add_bool_child (node, "enable-tooltips", priv->mainview_enable_tooltips);
_xml_add_int_child (node, "sorting-criteria", priv->mainview_sorting_criteria);
@@ -981,6 +993,7 @@ frogr_config_init (FrogrConfig *self)
priv->mainview_sorting_reversed = FALSE;
priv->mainview_enable_tooltips = TRUE;
priv->use_dark_theme = TRUE;
+ priv->date_taken_as_posted = FALSE;
priv->use_proxy = FALSE;
priv->proxy_host = NULL;
priv->proxy_port = NULL;
@@ -1442,6 +1455,28 @@ frogr_config_get_use_dark_theme (FrogrConfig *self)
}
void
+frogr_config_set_date_taken_as_posted (FrogrConfig *self, gboolean value)
+{
+ FrogrConfigPrivate * priv = NULL;
+
+ g_return_if_fail (FROGR_IS_CONFIG (self));
+
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
+ priv->date_taken_as_posted = value;
+}
+
+gboolean
+frogr_config_get_date_taken_as_posted (FrogrConfig *self)
+{
+ FrogrConfigPrivate *priv = NULL;
+
+ g_return_val_if_fail (FROGR_IS_CONFIG (self), FALSE);
+
+ priv = FROGR_CONFIG_GET_PRIVATE (self);
+ return priv->date_taken_as_posted;
+}
+
+void
frogr_config_set_mainview_sorting_criteria (FrogrConfig *self,
SortingCriteria criteria)
{
diff --git a/src/frogr-config.h b/src/frogr-config.h
index 6949722..bd3ab9e 100644
--- a/src/frogr-config.h
+++ b/src/frogr-config.h
@@ -141,6 +141,10 @@ void frogr_config_set_use_dark_theme (FrogrConfig *self, gboolean value);
gboolean frogr_config_get_use_dark_theme (FrogrConfig *self);
+void frogr_config_set_date_taken_as_posted (FrogrConfig *self, gboolean value);
+
+gboolean frogr_config_get_date_taken_as_posted (FrogrConfig *self);
+
void frogr_config_set_mainview_sorting_criteria (FrogrConfig *self,
SortingCriteria criteria);
diff --git a/src/frogr-settings-dialog.c b/src/frogr-settings-dialog.c
index 40cba4f..b5a16c8 100644
--- a/src/frogr-settings-dialog.c
+++ b/src/frogr-settings-dialog.c
@@ -68,6 +68,7 @@ typedef struct _FrogrSettingsDialogPrivate {
GtkWidget *keep_file_extensions_cb;
GtkWidget *import_tags_cb;
GtkWidget *use_dark_theme_cb;
+ GtkWidget *date_taken_as_posted_cb;
gboolean public_visibility;
gboolean family_visibility;
@@ -77,6 +78,7 @@ typedef struct _FrogrSettingsDialogPrivate {
gboolean enable_tags_autocompletion;
gboolean keep_file_extensions;
gboolean import_tags;
+ gboolean date_taken_as_posted;
gboolean use_dark_theme;
FspLicense license;
@@ -484,6 +486,10 @@ _add_misc_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
_("_Keep File Extensions in Titles when Loading"),
&priv->keep_file_extensions_cb);
+ _add_toggleable_item (self, GTK_BOX (box), NULL, FALSE,
+ _("Set '_Taken Date' as 'Posted Date' when Uploading"),
+ &priv->date_taken_as_posted_cb);
+
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
@@ -509,6 +515,7 @@ _fill_dialog_with_data (FrogrSettingsDialog *self)
priv->keep_file_extensions = frogr_config_get_keep_file_extensions (priv->config);
priv->import_tags = frogr_config_get_import_tags_from_metadata (priv->config);
priv->use_dark_theme = frogr_config_get_use_dark_theme (priv->config);
+ priv->date_taken_as_posted = frogr_config_get_date_taken_as_posted (priv->config);
priv->use_proxy = frogr_config_get_use_proxy (priv->config);
g_free (priv->proxy_host);
@@ -573,6 +580,8 @@ _fill_dialog_with_data (FrogrSettingsDialog *self)
priv->import_tags);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_dark_theme_cb),
priv->use_dark_theme);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->date_taken_as_posted_cb),
+ priv->date_taken_as_posted);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_proxy_cb),
priv->use_proxy);
@@ -613,6 +622,7 @@ _save_data (FrogrSettingsDialog *self)
frogr_config_set_keep_file_extensions (priv->config, priv->keep_file_extensions);
frogr_config_set_import_tags_from_metadata (priv->config, priv->import_tags);
frogr_config_set_use_dark_theme (priv->config, priv->use_dark_theme);
+ frogr_config_set_date_taken_as_posted (priv->config, priv->date_taken_as_posted);
frogr_config_set_use_proxy (priv->config, priv->use_proxy);
@@ -772,6 +782,12 @@ _on_button_toggled (GtkToggleButton *button, gpointer data)
DEBUG ("Use Dark Theme set to %s", active ? "TRUE" : "FALSE");
}
+ if (GTK_WIDGET (button) == priv->date_taken_as_posted_cb)
+ {
+ priv->date_taken_as_posted = active;
+ DEBUG ("Set '_Taken Date' as 'Posted Date' set to %s", active ? "TRUE" : "FALSE");
+ }
+
if (GTK_WIDGET (button) == priv->use_proxy_cb)
{
priv->use_proxy = active;
@@ -925,6 +941,7 @@ frogr_settings_dialog_init (FrogrSettingsDialog *self)
priv->keep_file_extensions_cb = NULL;
priv->import_tags_cb = NULL;
priv->use_dark_theme_cb = NULL;
+ priv->date_taken_as_posted_cb = NULL;
priv->use_proxy_cb = NULL;
priv->proxy_host_label = NULL;
priv->proxy_host_entry = NULL;
@@ -946,6 +963,7 @@ frogr_settings_dialog_init (FrogrSettingsDialog *self)
priv->keep_file_extensions = FALSE;
priv->import_tags = TRUE;
priv->use_dark_theme = TRUE;
+ priv->date_taken_as_posted = TRUE;
priv->use_proxy = FALSE;
priv->proxy_host = NULL;
priv->proxy_port = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]