[Player-dev] CN-Client: RealPlayer's First Run druid displayed as "Helix Player".
Daniel Yek dyek at real.comThis is now in HEAD. -- Daniel Yek At 03:44 PM 10/30/2006, Bob Clark wrote: >Looks good, Daniel. > >--Bob > > >At 02:08 PM 10/30/2006, Daniel Yek wrote: > >>Modified by: dyek at real.com >>Date: 10/30/2006 >>Project: RealPlayer >>Bug #: 5482 >> >>Synopsis: Fix a small branding problem that was left broken in the HEAD >>branch. >> >>Overview: >> This is a simple branding fit that allows a RealPlayer build to continue >> to display as "RealPlayer" rather than "Helix Player", :-) >> In the release branch, this was simple "#ifdef"s. >> Here, Helix Player development is made easier by keeping the generated >> *_interface.c code free of manual "#ifdef"s. >> >>Files Modified: >>player/app/gtk/setup.cpp >>player/app/gtk/commonapp.cpp >>player/app/gtk/commonapp.h >>player/app/gtk/ict.cpp - Use Macro for color. >> >>player/app/gtk/setup_interface.c - Generated code. >>player/app/gtk/res/setup.glade >> >> >>Platforms and Profiles Build Verified: >>Profile: helix_client_all_define >>Platform: Fedora Core 5 >> >>Platforms and Profiles Functionality verified: >>Profile: helix_client_all_define >>Platform: Fedora Core 5 >> >>Branch: HEAD >> >>Copyright assignment: I am a RealNetworks employee. >> >> >>Index: commonapp.cpp >>=================================================================== >>RCS file: /cvsroot/player/app/gtk/commonapp.cpp,v >>retrieving revision 1.85 >>diff -u -w -r1.85 commonapp.cpp >>--- commonapp.cpp 20 Oct 2006 19:50:23 -0000 1.85 >>+++ commonapp.cpp 30 Oct 2006 21:02:52 -0000 >>@@ -66,6 +66,8 @@ >> #include "hlxclib/getopt.h" >> #include "hlxclib/ctype.h" >> #include "hlxclib/time.h" >>+#include <gtk/gtk.h> >>+ >> >> #ifdef G_OS_UNIX >> #include <libgen.h> >>@@ -2194,3 +2196,58 @@ >> >> return lang; >> } >>+ >>+ >>+ >>+ >>+// Replaces substring with newsubstring, globally. >>+// Need to free the returned string. >>+gchar* >>+replace_substring_dup(const gchar *source, >>+ const gchar *substring, >>+ const gchar *newsubstring) >>+{ >>+ GString *string = g_string_new(source); >>+ >>+ gchar *psub; >>+ >>+ while ( (psub = g_strstr_len(string->str, string->len, substring)) ) >>+ { >>+ string = g_string_erase(string, psub - string->str, >>strlen(substring)); >>+ string = g_string_insert(string, psub - string->str, newsubstring); >>+ } >>+ return g_string_free(string, FALSE); >>+} >>+ >>+ >>+ >>+#ifdef HELIX_FEATURE_REAL_BRANDING >>+ >>+void set_fg_color_in_label(GladeXML *xml, gchar *label_name) >>+{ >>+ GtkLabel *label; >>+ const gchar *sz; >>+ gchar *snew; >>+ >>+ label = GTK_LABEL(glade_xml_get_widget(xml, label_name)); >>+ sz = gtk_label_get_label(label); >>+ >>+ // Can't use a better place holder (pango doesn't like place holder >>that it can't understand.) >>+ snew = replace_substring_dup(sz, "#003300", APP_FG_COLOR); >>+ >>+ gtk_label_set_markup(label, snew); >>+ g_free(snew); >>+ return; >>+} >>+ >>+#else >>+ >>+void set_fg_color_in_label(GladeXML* /* xml */, gchar* /* label_name */) >>+{ >>+ return; >>+} >>+ >>+#endif // HELIX_FEATURE_REAL_BRANDING >>+ >>+ >>+ >> >> >> >> >>Index: commonapp.h >>=================================================================== >>RCS file: /cvsroot/player/app/gtk/commonapp.h,v >>retrieving revision 1.29 >>diff -u -w -r1.29 commonapp.h >>--- commonapp.h 20 Oct 2006 19:50:23 -0000 1.29 >>+++ commonapp.h 30 Oct 2006 21:03:04 -0000 >>@@ -198,6 +198,13 @@ >> void hxcommon_title_encoded_clip_info_free >> (HXTitleEncodedClipInfo* info); >> >> >>+// Replaces substring with newsubstring, globally. >>+// Need to free the returned string. >>+gchar* >>+replace_substring_dup(const gchar *source, const gchar *substring, const >>gchar *newsubstring); >>+ >>+void set_fg_color_in_label(GladeXML *xml, gchar *label_name); >>+ >> G_END_DECLS >> >> #endif >> >> >>Index: setup.cpp >>=================================================================== >>RCS file: /cvsroot/player/app/gtk/setup.cpp,v >>retrieving revision 1.27 >>diff -u -w -r1.27 setup.cpp >>--- setup.cpp 17 Oct 2006 02:46:50 -0000 1.27 >>+++ setup.cpp 30 Oct 2006 20:59:17 -0000 >>@@ -459,6 +459,52 @@ >> >> } >> >>+ >>+ >>+ >>+// Branding: Replaces place-holders with actual strings. >>+void establish_branding(GladeXML *xml) >>+{ >>+ GtkWindow *hxplayer_setup_assistant_window; >>+ GtkLabel *hsa_welcome_title_label; >>+ gchar *snew; >>+ const gchar *sz_window_title, *sz_welcome_title; >>+ >>+ // Setup Assistant Window Title >>+ hxplayer_setup_assistant_window = >>GTK_WINDOW(glade_xml_get_widget(xml, "hxplayer_setup_assistant")); >>+ sz_window_title = gtk_window_get_title(hxplayer_setup_assistant_window); >>+ snew = replace_substring_dup(sz_window_title, "[APP_NAME_LONG]", >>APP_NAME_LONG); >>+ gtk_window_set_title(hxplayer_setup_assistant_window, snew); >>+ g_free(snew); >>+ >>+ // Welcome Title >>+ set_fg_color_in_label(xml, "hsa_welcome_title"); >>+ >>+ hsa_welcome_title_label = GTK_LABEL(glade_xml_get_widget(xml, >>"hsa_welcome_title")); >>+ sz_welcome_title = gtk_label_get_label(hsa_welcome_title_label); >>+ snew = replace_substring_dup(sz_welcome_title, "[APP_NAME_LONG]", >>APP_NAME_LONG); >>+ gtk_label_set_markup(hsa_welcome_title_label, snew); >>+ g_free(snew); >>+ >>+ // Notes Title >>+ set_fg_color_in_label(xml, "notes_title"); >>+ >>+ // EULA Title >>+ set_fg_color_in_label(xml, "eula_title"); >>+ >>+ // ICT >>+ set_fg_color_in_label(xml, "hsa_internet_connection_test"); >>+ >>+ // Manual Internet Connection Setting >>+ set_fg_color_in_label(xml, "hsa_manual_label"); >>+ >>+ // Almost Finished >>+ set_fg_color_in_label(xml, "hsa_almost_finished_label"); >>+ >>+ return; >>+} >>+ >>+ >> GtkWidget* >> hxplay_setup_assistant_new(HXMainWindow* /* main_window_struct */ ) >> { >>@@ -478,6 +524,9 @@ >> populate_textview(GTK_WIDGET(glade_xml_get_widget(xml, >> "hsad_notes_textview")), "README"); >> populate_textview(GTK_WIDGET(glade_xml_get_widget(xml, >> "hsad_eula_textview")), "LICENSE"); >> >>+ establish_branding(xml); >>+ >>+ >> /* Setup the notebook */ >> guint num_pages; >> GtkNotebook *notebook; >> >> >> >> >> >>Index: ict.cpp >>=================================================================== >>RCS file: /cvsroot/player/app/gtk/ict.cpp,v >>retrieving revision 1.2 >>diff -u -w -r1.2 ict.cpp >>--- ict.cpp 17 Oct 2006 02:46:50 -0000 1.2 >>+++ ict.cpp 30 Oct 2006 21:52:46 -0000 >>@@ -55,11 +55,13 @@ >> #include "ict.h" >> #include "ict_callbacks.h" >> #include "ict_wget.h" >>+#include "hxbranding.h" >>+ >> >> // This label text needs to be in sync with the ict_update_label widget in >> // the Internet Connection Test Update page. >> static const gchar *label_text_fragment_0 = >>- "<span size=\"large\" weight=\"bold\" >>foreground=\"#003300\">Result:</span>\n\n" >>+ "<span size=\"large\" weight=\"bold\" foreground=\"" APP_FG_COLOR >>"\">Result:</span>\n\n" >> "Your available bandwidth at this time is in the <b>"; >> static const gchar *label_text_fragment_1 = >> "</b> range.\n\n" >>@@ -173,6 +175,7 @@ >> GtkWindow *ict_window = NULL; >> GtkWidget *ict_window_widget = NULL; >> GtkButton *update_button; >>+ GtkLabel *label; >> >> filename = hxcommon_locate_file("ict.glade"); >> xml = glade_xml_new(filename, NULL, NULL); >>@@ -186,6 +189,13 @@ >> >> gtk_window_set_transient_for(ict_window, parent_window); >> >>+ // Branding: Establish consistent color. >>+ // ICT Failed >>+ set_fg_color_in_label(xml, "ict_failed_label"); >>+ >>+ // ICT Update >>+ set_fg_color_in_label(xml, "ict_update_label"); >>+ >> gtk_widget_show(ict_window_widget); >> ict_update_buttons_state(xml, ICT_PAGE_INSTRUCTION); >> >> >> >>Index: res/setup.glade >>=================================================================== >>RCS file: /cvsroot/player/app/gtk/res/setup.glade,v >>retrieving revision 1.13 >>diff -u -w -r1.13 setup.glade >>--- res/setup.glade 29 Aug 2006 20:29:27 -0000 1.13 >>+++ res/setup.glade 30 Oct 2006 21:54:05 -0000 >>@@ -5,7 +5,7 @@ >> >> <widget class="GtkWindow" id="hxplayer_setup_assistant"> >> <property name="visible">True</property> >>- <property name="title" translatable="yes">Helix Player Setup >>Assistant</property> >>+ <property name="title" translatable="yes">[APP_NAME_LONG] Setup >>Assistant</property> >> <property name="type">GTK_WINDOW_TOPLEVEL</property> >> <property name="window_position">GTK_WIN_POS_NONE</property> >> <property name="modal">False</property> >>@@ -81,8 +81,8 @@ >> <child> >> <widget class="GtkLabel" id="hsa_welcome_title"> >> <property name="visible">True</property> >>- <property name="label" translatable="yes"><span >>size="large" weight="bold" >>foreground="#003300">Welcome to Helix Player</span> >>-Click "next" to set up Helix Player.</property> >>+ <property name="label" translatable="yes"><span >>size="large" weight="bold" >>foreground="#003300">Welcome to [APP_NAME_LONG]</span> >>+Click "next" to set up [APP_NAME_LONG].</property> >> <property name="use_underline">False</property> >> <property name="use_markup">True</property> >> <property name="justify">GTK_JUSTIFY_LEFT</property> >>@@ -136,7 +136,7 @@ >> <child> >> <widget class="GtkLabel" id="notes_title"> >> <property name="visible">True</property> >>- <property name="label" >>translatable="yes"><span foreground="#003300" >>size="medium" weight="bold">Release >>Notes</span></property> >>+ <property name="label" >>translatable="yes"><span size="medium" >>weight="bold" foreground="#003300">Release >>Notes</span></property> >> <property name="use_underline">False</property> >> <property name="use_markup">True</property> >> <property >> name="justify">GTK_JUSTIFY_LEFT</property> >>@@ -258,7 +258,7 @@ >> <child> >> <widget class="GtkLabel" id="eula_title"> >> <property name="visible">True</property> >>- <property name="label" >>translatable="yes"><span foreground="#003300" >>size="medium" weight="bold">License >>Agreement</span></property> >>+ <property name="label" >>translatable="yes"><span size="medium" >>weight="bold" foreground="#003300">License >>Agreement</span></property> >> <property name="use_underline">False</property> >> <property name="use_markup">True</property> >> <property >> name="justify">GTK_JUSTIFY_LEFT</property> >>@@ -437,7 +437,7 @@ >> <widget class="GtkLabel" >> id="hsa_internet_connection_test"> >> <property name="visible">True</property> >> <property name="can_focus">True</property> >>- <property name="label" translatable="yes"><span >>size="large" weight="bold" >>foreground="#003300">Internet Connection Test</span> >>+ <property name="label" translatable="yes"><span >>size="medium" weight="bold" >>foreground="#003300">Internet Connection Test</span> >> >> We will now test your connection speed. >> >>@@ -499,7 +499,7 @@ >> <widget class="GtkLabel" id="hsa_manual_label"> >> <property name="visible">True</property> >> <property name="can_focus">True</property> >>- <property name="label" >>translatable="yes"><span size="large" >>foreground="#003300">Setting up Internet connection >>bandwidth manually.</span></property> >>+ <property name="label" >>translatable="yes"><span size="medium" >>weight="bold" foreground="#003300">Setting up >>Internet connection bandwidth manually.</span></property> >> <property name="use_underline">False</property> >> <property name="use_markup">True</property> >> <property >> name="justify">GTK_JUSTIFY_LEFT</property> >>@@ -669,7 +669,7 @@ >> <widget class="GtkLabel" >> id="hsa_almost_finished_label"> >> <property name="visible">True</property> >> <property name="can_focus">True</property> >>- <property name="label" >>translatable="yes"><span size="large" >>foreground="#003300" weight="bold">Almost >>Finished</span></property> >>+ <property name="label" >>translatable="yes"><span size="medium" >>weight="bold" foreground="#003300">Almost >>Finished</span></property> >> <property name="use_underline">False</property> >> <property name="use_markup">True</property> >> <property >> name="justify">GTK_JUSTIFY_LEFT</property> >> >> >> >> >> >>Index: setup_interface.c >>=================================================================== >>RCS file: /cvsroot/player/app/gtk/setup_interface.c,v >>retrieving revision 1.25 >>diff -u -w -r1.25 setup_interface.c >>--- setup_interface.c 29 Aug 2006 20:29:26 -0000 1.25 >>+++ setup_interface.c 30 Oct 2006 21:55:34 -0000 >>@@ -92,7 +92,7 @@ >> >> hxplayer_setup_assistant = gtk_window_new (GTK_WINDOW_TOPLEVEL); >> gtk_widget_set_name (hxplayer_setup_assistant, >> "hxplayer_setup_assistant"); >>- gtk_window_set_title (GTK_WINDOW (hxplayer_setup_assistant), _("Helix >>Player Setup Assistant")); >>+ gtk_window_set_title (GTK_WINDOW (hxplayer_setup_assistant), >>_("[APP_NAME_LONG] Setup Assistant")); >> >> setup_vbox = gtk_vbox_new (FALSE, 0); >> gtk_widget_set_name (setup_vbox, "setup_vbox"); >>@@ -129,7 +129,7 @@ >> gtk_notebook_set_show_tabs (GTK_NOTEBOOK (hsad_notebook), FALSE); >> gtk_notebook_set_show_border (GTK_NOTEBOOK (hsad_notebook), FALSE); >> >>- hsa_welcome_title = gtk_label_new (_("<span size=\"large\" >>weight=\"bold\" foreground=\"#003300\">Welcome to Helix >>Player</span>\nClick \"next\" to set up Helix Player.")); >>+ hsa_welcome_title = gtk_label_new (_("<span size=\"large\" >>weight=\"bold\" foreground=\"#003300\">Welcome to >>[APP_NAME_LONG]</span>\nClick \"next\" to set up [APP_NAME_LONG].")); >> gtk_widget_set_name (hsa_welcome_title, "hsa_welcome_title"); >> gtk_widget_show (hsa_welcome_title); >> gtk_container_add (GTK_CONTAINER (hsad_notebook), hsa_welcome_title); >>@@ -149,7 +149,7 @@ >> gtk_container_add (GTK_CONTAINER (hsad_notebook), notes_vbox); >> gtk_container_set_border_width (GTK_CONTAINER (notes_vbox), 3); >> >>- notes_title = gtk_label_new (_("<span foreground=\"#003300\" >>size=\"medium\" weight=\"bold\">Release Notes</span>")); >>+ notes_title = gtk_label_new (_("<span size=\"medium\" weight=\"bold\" >>foreground=\"#003300\">Release Notes</span>")); >> gtk_widget_set_name (notes_title, "notes_title"); >> gtk_widget_show (notes_title); >> gtk_box_pack_start (GTK_BOX (notes_vbox), notes_title, FALSE, FALSE, 0); >>@@ -188,7 +188,7 @@ >> gtk_container_add (GTK_CONTAINER (hsad_notebook), eula_vbox); >> gtk_container_set_border_width (GTK_CONTAINER (eula_vbox), 3); >> >>- eula_title = gtk_label_new (_("<span foreground=\"#003300\" >>size=\"medium\" weight=\"bold\">License Agreement</span>")); >>+ eula_title = gtk_label_new (_("<span size=\"medium\" weight=\"bold\" >>foreground=\"#003300\">License Agreement</span>")); >> gtk_widget_set_name (eula_title, "eula_title"); >> gtk_widget_show (eula_title); >> gtk_box_pack_start (GTK_BOX (eula_vbox), eula_title, FALSE, FALSE, 0); >>@@ -245,7 +245,7 @@ >> gtk_widget_show (hsa_license_label_tab_label); >> gtk_notebook_set_tab_label (GTK_NOTEBOOK (hsad_notebook), >> gtk_notebook_get_nth_page (GTK_NOTEBOOK (hsad_notebook), 2), >> hsa_license_label_tab_label); >> >>- hsa_internet_connection_test = gtk_label_new (_("<span size=\"large\" >>weight=\"bold\" foreground=\"#003300\">Internet Connection >>Test</span>\n\nWe will now test your connection speed.\n\nFor best >>results, it is recommended that you do not download files or run >>additional programs during the test.\n\nIf you do not wish to run the >>test now, click Skip to choose your connection speed manually.\n")); >>+ hsa_internet_connection_test = gtk_label_new (_("<span size=\"medium\" >>weight=\"bold\" foreground=\"#003300\">Internet Connection >>Test</span>\n\nWe will now test your connection speed.\n\nFor best >>results, it is recommended that you do not download files or run >>additional programs during the test.\n\nIf you do not wish to run the >>test now, click Skip to choose your connection speed manually.\n")); >> gtk_widget_set_name (hsa_internet_connection_test, >> "hsa_internet_connection_test"); >> gtk_widget_show (hsa_internet_connection_test); >> gtk_container_add (GTK_CONTAINER (hsad_notebook), >> hsa_internet_connection_test); >>@@ -269,7 +269,7 @@ >> TRUE, TRUE, GTK_PACK_START); >> gtk_container_set_border_width (GTK_CONTAINER (hsa_manual_vbox), 3); >> >>- hsa_manual_label = gtk_label_new (_("<span size=\"large\" >>foreground=\"#003300\">Setting up Internet connection bandwidth >>manually.</span>")); >>+ hsa_manual_label = gtk_label_new (_("<span size=\"medium\" >>weight=\"bold\" foreground=\"#003300\">Setting up Internet connection >>bandwidth manually.</span>")); >> gtk_widget_set_name (hsa_manual_label, "hsa_manual_label"); >> gtk_widget_show (hsa_manual_label); >> gtk_box_pack_start (GTK_BOX (hsa_manual_vbox), hsa_manual_label, >> FALSE, FALSE, 0); >>@@ -342,7 +342,7 @@ >> gtk_container_add (GTK_CONTAINER (hsad_notebook), >> hsa_almost_finished_vbox); >> gtk_container_set_border_width (GTK_CONTAINER >> (hsa_almost_finished_vbox), 3); >> >>- hsa_almost_finished_label = gtk_label_new (_("<span size=\"large\" >>foreground=\"#003300\" weight=\"bold\">Almost Finished</span>")); >>+ hsa_almost_finished_label = gtk_label_new (_("<span size=\"medium\" >>weight=\"bold\" foreground=\"#003300\">Almost Finished</span>")); >> gtk_widget_set_name (hsa_almost_finished_label, >> "hsa_almost_finished_label"); >> gtk_widget_show (hsa_almost_finished_label); >> gtk_box_pack_start (GTK_BOX (hsa_almost_finished_vbox), >> hsa_almost_finished_label, FALSE, FALSE, 0); >> >> >> >>-- >>Daniel Yek