[Xfce4-commits] <ristretto:stephan/properties-dialog> cleanup set_property function
Stephan Arts
noreply at xfce.org
Sun Sep 25 09:12:01 CEST 2011
Updating branch refs/heads/stephan/properties-dialog
to 040bad4a9156dca43a1278a0d02f6117269ca9d8 (commit)
from 1d2c01fb5b3afea16fced5053c0614eb4a9416d3 (commit)
commit 040bad4a9156dca43a1278a0d02f6117269ca9d8
Author: Stephan Arts <stephan at xfce.org>
Date: Sun Sep 25 09:10:54 2011 +0200
cleanup set_property function
src/properties_dialog.c | 63 ++++++++++++++++++++++++++++++++---------------
1 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/src/properties_dialog.c b/src/properties_dialog.c
index 1021f7b..72eec38 100644
--- a/src/properties_dialog.c
+++ b/src/properties_dialog.c
@@ -44,6 +44,10 @@ rstto_properties_dialog_get_property (
guint property_id,
GValue *value,
GParamSpec *pspec);
+static void
+properties_dialog_set_file (
+ RsttoPropertiesDialog *dialog,
+ GFile *file);
static GtkWidgetClass *parent_class = NULL;
@@ -326,30 +330,11 @@ rstto_properties_dialog_set_property (
GParamSpec *pspec)
{
RsttoPropertiesDialog *dialog = RSTTO_PROPERTIES_DIALOG (object);
- GFileInfo *file_info = NULL;
switch (property_id)
{
case PROP_FILE:
- dialog->priv->file = g_value_get_object (value);
- file_info = g_file_query_info (
- dialog->priv->file,
- "standard::content-type,standard::edit-name,standard::size,time::modified,time_accessed",
- 0,
- NULL,
- NULL);
- gtk_label_set_text (
- GTK_LABEL (dialog->priv->mime_content_label),
- g_file_info_get_attribute_string (
- file_info,
- "standard::content-type")
- );
- gtk_entry_set_text (
- GTK_ENTRY (dialog->priv->name_entry),
- g_file_info_get_attribute_string (
- file_info,
- "standard::edit-name")
- );
+ properties_dialog_set_file (dialog, g_value_get_object (value));
break;
default:
break;
@@ -366,6 +351,43 @@ rstto_properties_dialog_get_property (
{
}
+static void
+properties_dialog_set_file (
+ RsttoPropertiesDialog *dialog,
+ GFile *file)
+{
+ GFileInfo *file_info = NULL;
+ gchar *description;
+
+ dialog->priv->file = file;
+
+ if (dialog->priv->file)
+ {
+ file_info = g_file_query_info (
+ dialog->priv->file,
+ "standard::content-type,standard::edit-name,standard::size,time::modified,time_accessed",
+ 0,
+ NULL,
+ NULL);
+ description = g_content_type_get_description (
+ g_file_info_get_attribute_string (
+ file_info,
+ "standard::content-type")
+ );
+ gtk_label_set_text (
+ GTK_LABEL (dialog->priv->mime_content_label),
+ description
+ );
+ gtk_entry_set_text (
+ GTK_ENTRY (dialog->priv->name_entry),
+ g_file_info_get_attribute_string (
+ file_info,
+ "standard::edit-name")
+ );
+ g_free (description);
+ }
+}
+
/********************/
/* Public functions */
/********************/
@@ -386,3 +408,4 @@ rstto_properties_dialog_new (
return dialog;
}
+
More information about the Xfce4-commits
mailing list