[Player-cvs] app/gtk mainapp.cpp, 1.141.2.4, 1.141.2.5 mainapp-private.h, 1.6.2.3, 1.6.2.4 contextmenu.cpp, 1.10.2.2, 1.10.2.3 commonapp.cpp, 1.95.2.5, 1.95.2.6

[Player-cvs] app/gtk mainapp.cpp, 1.141.2.4, 1.141.2.5 mainapp-private.h, 1.6.2.3, 1.6.2.4 contextmenu.cpp, 1.10.2.2, 1.10.2.3 commonapp.cpp, 1.95.2.5, 1.95.2.6

dyek at helixcommunity.org dyek at helixcommunity.org
Wed Sep 3 13:59:00 PDT 2008


Update of /cvsroot/player/app/gtk
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv17468/player/app/gtk

Modified Files:
      Tag: hxclient_3_1_0_atlas
	mainapp.cpp mainapp-private.h contextmenu.cpp commonapp.cpp 
Log Message:
Finished Media Library Category List / Focus & Default Glade Change / Fixed Context Menu Crash

The old Main Window is now not playing the clip supplied on the command line, to make it easier to test playback in the new Main Window.

This change adds Media Library category list on the left-hand column and makes it functional.

In the netbook.glade change, I went through all widgets and attempt to set the focus and default related properties correctly.
That should ensure that keyboard and mouse interaction is more transparent and intuitive to users.

A scrolled window is added for the playlist.

Added Window Role "realplay".

The new Main Window is now set to the default size of 700 x 515 in netbook.glade.
However, this is not yet apparent, because the old video content ideal size resize algoritm is still taking control of the Main Window size.

contextmenu.cpp is changed to use:
  window->controls_hbox
  window->menu_bar
  window->status_hbox
directly, instead of trying to query (glade_xml_get_widget()) for the widgets using either libgladeemu or the system libglade API.

It is best not to have HXContextMenu makes any assumption about the API it should be using to query for Main Window's widgets to minimize the impact of change.

This should fix the crash on my Ubuntu system -- which didn't repro.  on my Fedora box.

Files Added:
player/netbook/chrome/graphics/common/icon_music.png
player/netbook/chrome/graphics/common/icon_video.png
player/netbook/chrome/graphics/common/icon_photo_temp.png
player/netbook/chrome/graphics/common/gotostart_temp.png
player/netbook/chrome/graphics/common/gotoend_temp.png
player/netbook/chrome/graphics/common/rotate_left_temp.png
player/netbook/chrome/graphics/common/rotate_right_temp.png
player/netbook/chrome/graphics/common/mute_temp.png

Files Modified:
player/app/gtk/mainapp.cpp
player/app/gtk/mainapp-private.h
player/app/gtk/contextmenu.cpp
player/app/gtk/commonapp.cpp
player/netbook/chrome/netbook.glade
player/common/gtk/hxutil.cpp
player/common/gtk/pub/hxutil.h
player/installer/archive/make_tempdir

Refer to the following URL for more information:
http://lists.helixcommunity.org/pipermail/player-dev/2008-September/003833.html



Index: mainapp-private.h
===================================================================
RCS file: /cvsroot/player/app/gtk/mainapp-private.h,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.4
diff -u -d -r1.6.2.3 -r1.6.2.4
--- mainapp-private.h	22 Aug 2008 21:01:53 -0000	1.6.2.3
+++ mainapp-private.h	3 Sep 2008 20:58:56 -0000	1.6.2.4
@@ -215,6 +215,8 @@
     GtkWidget* sign_in_menu_item;
     GtkWidget* sign_out_menu_item;
 
+    GtkWidget* media_lib_category_notebook;  
+
 // END Cache Widget Pointers
 
 

Index: contextmenu.cpp
===================================================================
RCS file: /cvsroot/player/app/gtk/contextmenu.cpp,v
retrieving revision 1.10.2.2
retrieving revision 1.10.2.3
diff -u -d -r1.10.2.2 -r1.10.2.3
--- contextmenu.cpp	22 Aug 2008 21:01:53 -0000	1.10.2.2
+++ contextmenu.cpp	3 Sep 2008 20:58:56 -0000	1.10.2.3
@@ -51,6 +51,9 @@
 
 #include "contextmenu.h"
 
+// Include the mainapp private struct to have access to controls_hbox, menu_bar, and status_hbox.
+#include "mainapp-private.h"
+
 /* right-click context menu */
 typedef struct _HXContextMenu
 {
@@ -78,9 +81,6 @@
     HXMainWindow* main_window;
     HXBasicPlayback* player;
 
-    GtkWidget* main_window_controls;
-    GtkWidget* main_window_menu_bar;
-    GtkWidget* main_window_status;
     GtkWidget *play_in_external_player_menu_item;    
 } HXContextMenu;
 
@@ -283,11 +283,6 @@
 
     menu->main_window = window;
 
-    GladeemuXML* xml = hxwindow_get_glade_xml(menu->main_window);
-    menu->main_window_controls = gladeemu_xml_get_widget(xml, "hmw_controls_hbox");
-    menu->main_window_menu_bar = gladeemu_xml_get_widget(xml, "hmw_menu_bar");
-    menu->main_window_status = gladeemu_xml_get_widget(xml, "hmw_status_hbox");
-
     gtk_widget_hide(menu->play_in_external_player_menu_item);
 
     g_signal_connect_swapped(G_OBJECT(menu->fullscreen_menu_item), "activate",
@@ -339,7 +334,8 @@
 hx_context_menu_popup(HXContextMenu* menu, GdkEventButton* event_button)
 {
     HXContentStateType state;
-    
+    HXMainWindow* window = menu->main_window;
+
     /* Disable play/pause/stop as appropriate */
     state = hx_player_get_content_state(HX_PLAYER(menu->player));
     switch(state)
@@ -421,22 +417,22 @@
 
             /* Enable/disable as appropriate */
 
-            if(menu->main_window_controls)
+            if(window->controls_hbox)
             {
                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu->show_controls_menu_item),
-                                               GTK_WIDGET_VISIBLE(menu->main_window_controls));
+                                               GTK_WIDGET_VISIBLE(window->controls_hbox));
             }
 
-            if(menu->main_window_menu_bar)
+            if(window->menu_bar)
             {
                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu->show_menu_and_caption_menu_item),
-                                               GTK_WIDGET_VISIBLE(menu->main_window_menu_bar));
+                                               GTK_WIDGET_VISIBLE(window->menu_bar));
             }
 
-            if(menu->main_window_status)
+            if(window->status_hbox)
             {
                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu->show_status_bar_menu_item),
-                                               GTK_WIDGET_VISIBLE(menu->main_window_status));
+                                               GTK_WIDGET_VISIBLE(window->status_hbox));
             }
         }
     }

Index: commonapp.cpp
===================================================================
RCS file: /cvsroot/player/app/gtk/commonapp.cpp,v
retrieving revision 1.95.2.5
retrieving revision 1.95.2.6
diff -u -d -r1.95.2.5 -r1.95.2.6
--- commonapp.cpp	29 Aug 2008 05:43:31 -0000	1.95.2.5
+++ commonapp.cpp	3 Sep 2008 20:58:56 -0000	1.95.2.6
@@ -2096,7 +2096,7 @@
                 hxwindow_fullscreen(main_window);
             }
 
-            hxwindow_open(main_window, url);
+            //hxwindow_open(main_window, url);
             hxwindow_open(app_main_window, url);
         }
         

Index: mainapp.cpp
===================================================================
RCS file: /cvsroot/player/app/gtk/mainapp.cpp,v
retrieving revision 1.141.2.4
retrieving revision 1.141.2.5
diff -u -d -r1.141.2.4 -r1.141.2.5
--- mainapp.cpp	29 Aug 2008 00:27:35 -0000	1.141.2.4
+++ mainapp.cpp	3 Sep 2008 20:58:56 -0000	1.141.2.5
@@ -5285,9 +5285,143 @@
     }
 }
 
+
+// My Library category list.
+static void
+hx_media_lib_category_row_selected(GtkTreeView       *media_lib_cat_tree_view,
+                                   gpointer          user_data)
+{
+    gint notebook_page = 0;
+    GtkTreePath *treepath = NULL;
+    GtkNotebook *media_lib_category_notebook = GTK_NOTEBOOK(user_data);
+    g_return_if_fail(media_lib_category_notebook);
+
+    gtk_tree_view_get_cursor(media_lib_cat_tree_view, &treepath, NULL);
+    notebook_page = hx_util_tree_path_to_index(treepath);
+    gtk_tree_path_free(treepath);
+    treepath = NULL;
+    if (notebook_page >= 0)
+    {
+        gtk_notebook_set_current_page(media_lib_category_notebook, notebook_page);
+    }
+
+    g_return_if_fail(notebook_page <= gtk_notebook_get_n_pages(media_lib_category_notebook));
+
+    return;
+}
+
+// Create My Library category list store.
+GtkListStore* 
+hx_media_lib_create_category_list_store()
+{
+    const gchar *iconfilename = NULL;
+    gchar *iconfilepath = NULL;
+    GdkPixbuf *pixbuf = NULL;
+
+    GtkListStore *media_lib_cat_list_store = gtk_list_store_new(3,                  // n_columns
+                                                                GDK_TYPE_PIXBUF,    // Icons.
+                                                                G_TYPE_STRING,      // Media Library Categories.
+                                                                G_TYPE_STRING);     // Tips.
+
+    iconfilename = "icon_music.png";
+    iconfilepath = hxcommon_locate_file(iconfilename);
+    if (!iconfilepath)
+    {
+        g_warning("Cannot find %s\n", iconfilename);
+    }
+    pixbuf = gdk_pixbuf_new_from_file(iconfilepath, NULL);      // Handle errors by doing nothing.
+    HX_G_FREE(iconfilepath);
+
+    gtk_list_store_insert_with_values(media_lib_cat_list_store, 
+                                      NULL,         // iter.
+                                      0,            // Row 0.
+                                      0, pixbuf,    // Col 0.
+                                      1, "Music",   // Col 1.
+                                      2, "Music Library",   // Col 2, tooltips.
+                                      -1);
+
+    iconfilename = "icon_video.png";
+    iconfilepath = hxcommon_locate_file(iconfilename);
+    if (!iconfilepath)
+    {
+        g_warning("Cannot find %s\n", iconfilename);
+    }
+    pixbuf = gdk_pixbuf_new_from_file(iconfilepath, NULL);      // Handle errors by doing nothing.
+    HX_G_FREE(iconfilepath);
+
+    gtk_list_store_insert_with_values(media_lib_cat_list_store, 
+                                      NULL,         // iter.
+                                      1,            // Row 1.
+                                      0, pixbuf,    // Col 0.
+                                      1, "Videos",  // Col 1.
+                                      2, "Videos Library",  // Col 2, tooltips.
+                                      -1);
+
+    iconfilename = "icon_photo_temp.png";
+    iconfilepath = hxcommon_locate_file(iconfilename);
+    if (!iconfilepath)
+    {
+        g_warning("Cannot find %s\n", iconfilename);
+    }
+    pixbuf = gdk_pixbuf_new_from_file(iconfilepath, NULL);      // Handle errors by doing nothing.
+    HX_G_FREE(iconfilepath);
+
+    gtk_list_store_insert_with_values(media_lib_cat_list_store, 
+                                      NULL,         // iter.
+                                      2,            // Row 2.
+                                      0, pixbuf,    // Col 0.
+                                      1, "Photos",  // Col 1.
+                                      2, "Photos Library",  // Col 2, tooltips.
+                                      -1);
+
+    return media_lib_cat_list_store;
+}
+
+// Create My Library category list view.
+// This is the Music, Videos, and Photos rows.
+void
+hx_media_lib_category_view_populate(GtkWidget *tree_view_widget)
+{
+    GtkTreeView *media_lib_cat_tree_view = GTK_TREE_VIEW(tree_view_widget);
+    GtkTreeViewColumn *treeview_column = NULL;
+
+    // Column 0
+    GtkCellRenderer *pixbuf_renderer = gtk_cell_renderer_pixbuf_new();
+    treeview_column = GTK_TREE_VIEW_COLUMN(
+        gtk_tree_view_column_new_with_attributes("Icons",
+             pixbuf_renderer,
+             "pixbuf", 0,      // Mapping
+             NULL));
+    gtk_tree_view_column_set_resizable(treeview_column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+    gtk_tree_view_insert_column(media_lib_cat_tree_view, treeview_column, 0);
+
+
+    // Column 1
+    GtkCellRenderer *text_renderer = gtk_cell_renderer_text_new();
+    treeview_column = GTK_TREE_VIEW_COLUMN(
+        gtk_tree_view_column_new_with_attributes("Category",
+             text_renderer,
+             "text", 1,      // Mapping
+             NULL));
+    g_object_set(treeview_column,
+                 "expand", TRUE,
+                 NULL);
+    gtk_tree_view_column_set_resizable(treeview_column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+    gtk_tree_view_insert_column(media_lib_cat_tree_view, treeview_column, 1);
+
+    // Column 2 is the hidden tooltip!
+
+    // Create the list_store!
+    GtkListStore *media_lib_cat_list_store = hx_media_lib_create_category_list_store();
+
+    gtk_tree_view_set_model(media_lib_cat_tree_view, GTK_TREE_MODEL(media_lib_cat_list_store));
+
+    return;
+}
+
 HXMainWindow*
 hxwindow_new(const char *gladefile)
-{    
+{
     gchar* filename;
     GdkPixmap* pixmap;
     char distcode_suffix[DISTCODE_SUFFIX_MAX_CHARS + 1];
@@ -5320,7 +5454,21 @@
         {
             return FALSE;
         }
-        gtk_widget_show_all(window->window);
+
+        // Creating Media Library Category List.
+        GtkWidget *media_lib_cat_tree_view_widget = glade_xml_get_widget((GladeXML *)window->xml, 
+                                                                         "hmw_my_lib_category_treeview");
+        g_return_val_if_fail(media_lib_cat_tree_view_widget, FALSE);
+        hx_media_lib_category_view_populate(media_lib_cat_tree_view_widget);
+
+        // Callbacks.
+        window->media_lib_category_notebook = glade_xml_get_widget((GladeXML *)window->xml, 
+                                                                   "hmw_my_lib_category_notebook");
+        g_return_val_if_fail(window->media_lib_category_notebook, FALSE);
+
+        g_signal_connect(media_lib_cat_tree_view_widget, 
+            "cursor-changed", G_CALLBACK(hx_media_lib_category_row_selected),   // Take this as "single-click".
+            window->media_lib_category_notebook);
     }
     else
     {
@@ -5483,7 +5631,7 @@
     
     if(!setup_player(window))
     {
-    return FALSE;
+        return FALSE;
     }
 
     // Execute actions associated with Helix Preferences.




More information about the Player-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.