[maemo-commits] [maemo-commits] r16972 - projects/haf/trunk/hildon-control-panel/src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Dec 16 13:18:48 EET 2008
Author: paradi
Date: 2008-12-16 13:18:45 +0200 (Tue, 16 Dec 2008)
New Revision: 16972

Modified:
   projects/haf/trunk/hildon-control-panel/src/hcp-app-list.c
   projects/haf/trunk/hildon-control-panel/src/hcp-grid.c
   projects/haf/trunk/hildon-control-panel/src/hcp-main.c
Log:
* hardcoded UI strings for XMAS
* hardcoded icon names for XMAS
* correct icon initialization


Modified: projects/haf/trunk/hildon-control-panel/src/hcp-app-list.c
===================================================================
--- projects/haf/trunk/hildon-control-panel/src/hcp-app-list.c	2008-12-16 10:56:01 UTC (rev 16971)
+++ projects/haf/trunk/hildon-control-panel/src/hcp-app-list.c	2008-12-16 11:18:45 UTC (rev 16972)
@@ -74,6 +74,155 @@
 
 static int callback_pending = 0;
 
+#define XMAS 1
+
+#ifdef XMAS
+
+typedef enum {
+ NAMES,
+ ICONS
+}hcp_str_type;
+
+const char* hcp_logical_ids[] = {
+"conn_ti_bluetooth_cpa",
+"conn_set_ti_conn_set",
+"dati_ap_application_title",
+"devi_ap_application_title",
+"disp_ap_application_title",
+"cpal_ti_language_and_regional_title",
+"memo_ti_memory",
+"pers_ti_personalization",
+"ctrp_ti_screen_calibration",
+"secu_security_dialog_title",
+"tein_ti_text_input_title",
+"conn_ti_my_devices",
+"loca_ti_location_cpa",
+"share_cpa_ti",
+"fmtx_ti_fm_transmitter",
+"tvou_ap_cpa",
+"sync_ap_name",
+"cema_ap_application_title",
+"profi_ti_cpa_profiles",
+"Synchronization",
+"Sharing accounts",
+NULL
+};
+
+const char* hcp_ui_strings[] = {
+"Bluetooth",
+"Connectivity",
+"Date and time",
+"About product",
+"Display",
+"Language and region",
+"Memory",
+"Themes",
+"Screen calibration",
+"Device lock",
+"Text input settings",
+"Phone",
+"GPS location",
+"Sharing accounts",
+"FM transmitter",
+"TV Out",
+"Transfer & Sync",
+"Certificate manager",
+"Profiles",
+"Transfer & Sync",
+"Sharing Accounts",
+NULL
+};
+
+const char* hcp_icon_names_old[] = {
+"qgn_list_cp_accounts",
+"qgn_list_cpa_cert_manager",
+"qgn_list_synchronization",
+"qgn_list_cp_isetup",
+"qgn_list_cp_datetime",
+"qgn_list_cp_devicesetup",
+"qgn_stat_profile",
+"qgn_list_cp_disply", 
+"qgn_list_cp_memory",
+"qgn_list_cp_personal", 
+"qgn_list_cp_keyboard",
+"qgn_list_btno_gen_peripheral_keyboard",
+"qgn_list_cp_phone",
+"qgn_list_cp_presence",
+"qgn_list_cp_regional",
+"qgn_list_cp_calibration",
+"qgn_list_cp_security",
+"qgn_list_cp_soundset",
+"qgn_list_cp_tana",
+"qgn_stat_fm_transmitter",
+"qgn_list_cp_peninput",
+NULL
+};
+
+const char* hcp_icon_names_new[] = {
+ "control_accounts",	
+ "general_certificate",	
+ "general_synchronization",	
+ "control_internet_setup",	
+ "control_date_time",	
+ "control_device_setup",	
+ "general_profile",	
+ "general_brightness",	
+ "general_removable_memory_card",	
+ "control_personalization",	
+ "control_keyboard",	
+ "control_keyboard",
+ "general_call",	
+ "control_presence",	
+ "control_language",	
+ "control_calibration",	
+ "general_locked",	
+ "general_speaker",	
+ "control_tv_out",
+ "general_fm_transmitter",	
+ "control_pen_input",
+ NULL
+};
+
+static const gchar*
+hcp_translate (const gchar* name_read, hcp_str_type type)
+{
+  gint i;
+  const char** p = NULL;
+  const char** p_trans = NULL;
+  switch (type)
+  {
+    case NAMES:
+      p = hcp_logical_ids;
+      p_trans = hcp_ui_strings;
+      break;
+    case ICONS:
+      p = hcp_icon_names_old;
+      p_trans = hcp_icon_names_new;
+      break;
+    default:
+      return name_read;
+      break;
+  }
+/*
+    for(i=0; hcp_logical_ids[i]; i++)
+    {
+      if (!g_strcmp0 (name_read, hcp_logical_ids[i]))
+      {
+        return (hcp_ui_strings[i]);
+      }
+    }
+*/
+  for (i=0; p[i]; i++)
+  {
+      if (!g_strcmp0 (name_read, p[i]))
+      {
+        return (p_trans[i]);
+      }
+  }
+
+  return name_read;
+}
+#endif
 static gboolean 
 hcp_monitor_reread_desktop_entries (HCPAppList *al)
 {
@@ -415,11 +564,19 @@
       continue;
     }
 
+#ifdef XMAS
+    name =(gchar*) hcp_translate ((const char*)g_key_file_get_locale_string (keyfile,
+                                         HCP_DESKTOP_GROUP,
+                                         HCP_DESKTOP_KEY_NAME,
+                                         NULL /* current locale */,
+                                         &error), NAMES);
+#else
     name = g_key_file_get_locale_string (keyfile,
                                          HCP_DESKTOP_GROUP,
                                          HCP_DESKTOP_KEY_NAME,
                                          NULL /* current locale */,
                                          &error);
+#endif
 
     if (error)
     {
@@ -439,12 +596,17 @@
       g_error_free (error);
       continue;
     }
-
+#ifdef XMAS
+    icon = (gchar*) hcp_translate (g_key_file_get_string (keyfile,
+                                  HCP_DESKTOP_GROUP,
+                                  HCP_DESKTOP_KEY_ICON,
+                                  &error), ICONS);
+#else
     icon = g_key_file_get_string (keyfile,
                                   HCP_DESKTOP_GROUP,
                                   HCP_DESKTOP_KEY_ICON,
                                   &error);
-
+#endif
     if (error)
     {
       g_error_free (error);
@@ -495,9 +657,9 @@
   
     g_hash_table_insert (priv->apps, g_strdup (plugin), app);
 
-    g_free (name);
+/*    g_free (name); */
     g_free (plugin);
-    g_free (icon);
+/*    g_free (icon); */
     g_free (category);
     g_free (text_domain);
   }

Modified: projects/haf/trunk/hildon-control-panel/src/hcp-grid.c
===================================================================
--- projects/haf/trunk/hildon-control-panel/src/hcp-grid.c	2008-12-16 10:56:01 UTC (rev 16971)
+++ projects/haf/trunk/hildon-control-panel/src/hcp-grid.c	2008-12-16 11:18:45 UTC (rev 16972)
@@ -91,8 +91,11 @@
 
   if (icon_pixbuf == NULL) 
   {
-    g_warning ("Couldn't load icon \"%s\": %s", icon, error->message);
-    g_error_free (error);
+    if (error)
+    {
+      g_warning ("Couldn't load icon \"%s\": %s", icon, error->message);
+      g_error_free (error);
+    }
 
     error = NULL;
 

Modified: projects/haf/trunk/hildon-control-panel/src/hcp-main.c
===================================================================
--- projects/haf/trunk/hildon-control-panel/src/hcp-main.c	2008-12-16 10:56:01 UTC (rev 16971)
+++ projects/haf/trunk/hildon-control-panel/src/hcp-main.c	2008-12-16 11:18:45 UTC (rev 16972)
@@ -32,6 +32,7 @@
 #include <glib-object.h>
 #include <glib/gi18n.h>
 #include <libgnomevfs/gnome-vfs.h>
+#include <hildon/hildon.h>
 
 #include "hcp-program.h"
 
@@ -51,6 +52,7 @@
   if (!g_thread_supported ()) g_thread_init (NULL);
   
   gtk_init (&argc, &argv);
+  hildon_init();
   
   gnome_vfs_init ();
 


More information about the maemo-commits mailing list