[gnac/devel] Cleaned up the code



commit c2e9ae216adf6d0f4eb51a6da1900c30b68df510
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Sun Jul 11 12:18:09 2010 +0100

    Cleaned up the code

 src/gnac-properties.c |   57 +++++++++++++++++-------------------------------
 1 files changed, 20 insertions(+), 37 deletions(-)
---
diff --git a/src/gnac-properties.c b/src/gnac-properties.c
index 70163d5..9d0e730 100644
--- a/src/gnac-properties.c
+++ b/src/gnac-properties.c
@@ -84,40 +84,23 @@ static const gchar *displayed_tags[] = {
   NULL
 };
 
-static const gchar *displayed_properties[] = {
-  GNAC_TAG_FILENAME,
-  GST_TAG_LOCATION,
-  GST_TAG_DURATION,
-  GNAC_TAG_FILE_SIZE,
-  GNAC_TAG_CHANNELS,
-  GNAC_TAG_MODE,
-  GNAC_TAG_RATE,
-  GST_TAG_AUDIO_CODEC,
-  GST_TAG_VIDEO_CODEC,
-  GST_TAG_BITRATE,
-  GST_TAG_TRACK_GAIN,
-  GST_TAG_TRACK_PEAK,
-  GNAC_TAG_FRAMERATE,
-  NULL
-};
-
-static const gchar *nice_properties[] = {
-  N_("Filename"),
-  N_("Location"),
-  N_("Duration"),
-  N_("File size"),
-  N_("Channels"),
+static const gchar *displayed_properties[][2] = {
+  { GNAC_TAG_FILENAME,   N_("Filename")    },
+  { GST_TAG_LOCATION,    N_("Location")    },
+  { GST_TAG_DURATION,    N_("Duration")    },
+  { GNAC_TAG_FILE_SIZE,  N_("File size")   },
+  { GNAC_TAG_CHANNELS,   N_("Channels")    },
   /* Translators: Audio mode, e.g.,  mono or stereo */
-  N_("Mode"),
+  { GNAC_TAG_MODE,       N_("Mode")        },
   /* Translators: sample rate */
-  N_("Rate"),
-  N_("Audio codec"),
-  N_("Video codec"),
-  N_("Bitrate"),
-  N_("Track gain"),
-  N_("Track peak"),
-  N_("Framerate"),
-  NULL
+  { GNAC_TAG_RATE,       N_("Rate")        },
+  { GST_TAG_AUDIO_CODEC, N_("Audio codec") },
+  { GST_TAG_VIDEO_CODEC, N_("Video codec") },
+  { GST_TAG_BITRATE,     N_("Bitrate")     },
+  { GST_TAG_TRACK_GAIN,  N_("Track gain")  },
+  { GST_TAG_TRACK_PEAK,  N_("Track peak")  },
+  { GNAC_TAG_FRAMERATE,  N_("Framerate")   },
+  { NULL, NULL }
 };
 
 
@@ -191,20 +174,20 @@ gnac_properties_build_table(void)
                                                 g_free, 
                 (GDestroyNotify)gtk_tree_row_reference_free);
   
-  for (i = 0; displayed_properties[i]; i++) 
+  for (i = 0; displayed_properties[i][0]; i++)
   {
     GtkTreePath *path;
 
     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-                    PROPERTY_NAME, gettext(nice_properties[i]),
+                    PROPERTY_NAME, gettext(displayed_properties[i][1]),
                     PROPERTY_VISIBLE, TRUE, -1);
 
     path = gtk_tree_model_get_path(model, &iter);
     ref = gtk_tree_row_reference_new(model, path);
 
     g_hash_table_insert(gnac_properties_table, 
-                    g_strdup(displayed_properties[i]), ref);
+                    g_strdup(displayed_properties[i][0]), ref);
 
     gtk_tree_path_free(path);
   }
@@ -221,8 +204,8 @@ gnac_properties_reset_properties(void)
     gnac_properties_set_entry(displayed_tags[i], NULL);
   }
 
-  for (i = 0; displayed_properties[i]; i++) {
-    gnac_properties_set_property(displayed_properties[i], NULL);
+  for (i = 0; displayed_properties[i][0]; i++) {
+    gnac_properties_set_property(displayed_properties[i][0], NULL);
   }
 
   gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(properties_filter));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]