cheese r597 - in trunk: . src



Author: jhaitsma
Date: Fri Mar 14 13:43:37 2008
New Revision: 597
URL: http://svn.gnome.org/viewvc/cheese?rev=597&view=rev

Log:
2008-03-14  Jaap Haitsma <jaap haitsma org>
 
 	* configure.ac,
 	  src/cheese-fileutil.c,
 	  src/cheese-thumb-view.c,
 	  src/cheese-window.c,
 	  src/Makefile.am: 
 	  Add a patch of Matthew Garret <mjg59-gnomebugzilla 40srcf ucam org>
 	  to add support for building cheese on the hildon desktop. Fixes 
 	  bug #519548


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/cheese-fileutil.c
   trunk/src/cheese-thumb-view.c
   trunk/src/cheese-window.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Mar 14 13:43:37 2008
@@ -95,6 +95,16 @@
 
 AC_SUBST(CHEESE_LIBS)
 
+AC_ARG_ENABLE(hildon, AS_HELP_STRING([--enable-hildon],[compile for Hildon environment (default=no)]),,enable_hildon=no)
+
+if test "x$enable_hildon" = "xyes"; then
+   PKG_CHECK_MODULES([HILDON], hildon-1 >= 1.0.5,enable_hildon=yes,enable_hildon=no)
+else
+   enable_hildon=no
+fi
+
+AM_CONDITIONAL(WITH_HILDON, test "x$enable_hildon" = "xyes")
+
 AC_PATH_PROG(GCONFTOOL, gconftool-2)
 AM_GCONF_SOURCE_2
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Fri Mar 14 13:43:37 2008
@@ -34,5 +34,10 @@
 	gst-audio-play.h 
 
 cheese_LDADD = \
-	$(CHEESE_LIBS)		
+	$(CHEESE_LIBS)
+
+if WITH_HILDON
+  INCLUDES += $(HILDON_CFLAGS) -DHILDON
+  cheese_LDADD += $(HILDON_LIBS)
+endif
 

Modified: trunk/src/cheese-fileutil.c
==============================================================================
--- trunk/src/cheese-fileutil.c	(original)
+++ trunk/src/cheese-fileutil.c	Fri Mar 14 13:43:37 2008
@@ -31,8 +31,11 @@
 cheese_fileutil_get_path ()
 {
   char *path;
-
+#ifdef HILDON
+  path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir(), "Mydocs", ".images", NULL);
+#else
   path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir(), ".gnome2", "cheese", NULL);
+#endif
   return path;
 }
 

Modified: trunk/src/cheese-thumb-view.c
==============================================================================
--- trunk/src/cheese-thumb-view.c	(original)
+++ trunk/src/cheese-thumb-view.c	Fri Mar 14 13:43:37 2008
@@ -372,7 +372,11 @@
   g_free (path);
 
   gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (thumb_view), 0);
+#ifdef HILDON
+  gtk_icon_view_set_columns (GTK_ICON_VIEW (thumb_view), -1);
+#else
   gtk_icon_view_set_columns (GTK_ICON_VIEW (thumb_view), G_MAXINT);
+#endif
 
   gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (thumb_view), GDK_BUTTON1_MASK,
                                           target_table, G_N_ELEMENTS (target_table),

Modified: trunk/src/cheese-window.c
==============================================================================
--- trunk/src/cheese-window.c	(original)
+++ trunk/src/cheese-window.c	Fri Mar 14 13:43:37 2008
@@ -35,6 +35,10 @@
 #include <gtk/gtk.h>
 #include <libebook/e-book.h>
 
+#ifdef HILDON
+#include <hildon/hildon-program.h>
+#endif
+
 #include "cheese-countdown.h"
 #include "cheese-effect-chooser.h"
 #include "cheese-fileutil.h"
@@ -44,7 +48,6 @@
 #include "ephy-spinner.h"
 #include "gst-audio-play.h"
 
-
 #define SHUTTER_SOUNDS 5
 
 typedef enum
@@ -72,6 +75,7 @@
   GtkWidget *notebook_bar;
 
   GtkWidget *main_vbox;
+  GtkWidget *video_vbox;
 
   GtkWidget *effect_frame;
   GtkWidget *effect_chooser;
@@ -97,6 +101,12 @@
   GtkWidget *screen;
   GtkWidget *take_picture;
 
+#ifdef HILDON
+   d
+   GtkWidget *main_hbox;
+   GtkWidget *subwindow;
+#endif      
+
   GtkActionGroup *actions_account_photo;
   GtkActionGroup *actions_countdown;
   GtkActionGroup *actions_effects;
@@ -1019,11 +1029,18 @@
 static void
 cheese_window_create_window (CheeseWindow *cheese_window)
 {
-  GtkWidget *menubar;
   GError *error=NULL;
   char *path;
   GtkBuilder* builder;
 
+#ifdef HILDON
+  HildonProgram *program = hildon_program_get_instance();
+  GtkWidget *menu;
+  GtkWidget *menuitem;
+#else
+  GtkWidget *menubar;
+#endif
+
   builder = gtk_builder_new ();
   gtk_builder_add_from_file (builder, PACKAGE_DATADIR"/cheese.ui", &error);
 
@@ -1043,6 +1060,7 @@
   cheese_window->label_take_photo   = GTK_WIDGET (gtk_builder_get_object (builder, "label_take_photo"));
   cheese_window->label_video        = GTK_WIDGET (gtk_builder_get_object (builder, "label_video"));
   cheese_window->main_vbox          = GTK_WIDGET (gtk_builder_get_object (builder, "main_vbox"));
+  cheese_window->video_vbox         = GTK_WIDGET (gtk_builder_get_object (builder, "video_vbox"));
   cheese_window->notebook           = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
   cheese_window->notebook_bar       = GTK_WIDGET (gtk_builder_get_object (builder, "notebook_bar"));
   cheese_window->screen             = GTK_WIDGET (gtk_builder_get_object (builder, "video_screen"));
@@ -1052,6 +1070,26 @@
   cheese_window->countdown_frame    = GTK_WIDGET (gtk_builder_get_object (builder, "countdown_frame"));
   cheese_window->effect_frame       = GTK_WIDGET (gtk_builder_get_object (builder, "effect_frame"));
 
+#ifdef HILDON
+  /* Reparent widgets in case we use hildon. This saves us maintaining two
+     GtkBuilder ui files
+  */
+  cheese_window->window = hildon_window_new();
+  cheese_window->main_hbox = gtk_hbox_new(FALSE, 0);
+  hildon_program_add_window (program, HILDON_WINDOW(cheese_window->window));
+  gtk_container_add (GTK_CONTAINER(cheese_window->window), cheese_window->main_hbox);  
+  gtk_widget_ref(cheese_window->thumb_scrollwindow);
+  gtk_widget_ref(cheese_window->video_vbox);
+  gtk_container_remove(GTK_CONTAINER(cheese_window->video_vbox), cheese_window->thumb_scrollwindow);
+  gtk_container_remove(GTK_CONTAINER(cheese_window->main_vbox),cheese_window->video_vbox);
+  gtk_box_pack_start (GTK_BOX(cheese_window->main_hbox), cheese_window->video_vbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX(cheese_window->main_hbox), GTK_WIDGET(cheese_window->thumb_scrollwindow), FALSE, FALSE, 0);
+  gtk_widget_destroy(cheese_window->main_vbox);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(cheese_window->thumb_scrollwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  gtk_widget_unref(cheese_window->thumb_scrollwindow);
+  gtk_widget_unref(cheese_window->video_vbox);
+#endif
+
   g_object_unref (builder);
 
   char *str = g_strconcat ("<b>", _("_Take a photo"), "</b>", NULL);
@@ -1163,8 +1201,25 @@
     gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
   }
 
+#ifdef HILDON
+  menu = gtk_menu_new();
+  menuitem = gtk_menu_item_new_with_label(_("Quit"));
+  g_signal_connect_swapped(menuitem,"activate",
+			   GTK_SIGNAL_FUNC(cheese_window_cmd_close),
+			   NULL);
+  gtk_menu_append(menu, menuitem);
+  
+  menuitem = gtk_menu_item_new_with_label(_("About"));
+  g_signal_connect_swapped(menuitem,"activate",
+			   GTK_SIGNAL_FUNC(cheese_window_cmd_about), 
+			   cheese_window->window);
+  gtk_menu_append(menu, menuitem);
+  
+  hildon_window_set_menu (HILDON_WINDOW(cheese_window->window),GTK_MENU(menu));
+#else
   menubar = gtk_ui_manager_get_widget (cheese_window->ui_manager, "/MainMenu");
   gtk_box_pack_start (GTK_BOX (cheese_window->main_vbox), menubar, FALSE, FALSE, 0);
+#endif
 
   cheese_window->thumb_view_popup_menu = gtk_ui_manager_get_widget (cheese_window->ui_manager, 
                                                                     "/ThumbnailPopup");



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