vinagre r259 - in trunk: . data src



Author: jwendell
Date: Fri Mar 14 18:19:42 2008
New Revision: 259
URL: http://svn.gnome.org/viewvc/vinagre?rev=259&view=rev

Log:
2008-03-14  Jonh Wendell <jwendell gnome org>

	Initial support for scaling. Closes #476942.

	* configure.ac: Bump gtk-vnc version to 0.3.4
	* README: Brief explanation on how to enable scaling
	* src/vinagre-tab.c,
	* src/vinagre-commands.h,
	* src/vinagre-window.c,
	* src/vinagre-tab.h,
	* src/vinagre-ui.h,
	* src/vinagre-window-private.h,
	* src/vinagre-commands.c,
	* data/vinagre-ui.xml: Implement scaling



Modified:
   trunk/ChangeLog
   trunk/README
   trunk/configure.ac
   trunk/data/vinagre-ui.xml
   trunk/src/vinagre-commands.c
   trunk/src/vinagre-commands.h
   trunk/src/vinagre-tab.c
   trunk/src/vinagre-tab.h
   trunk/src/vinagre-ui.h
   trunk/src/vinagre-window-private.h
   trunk/src/vinagre-window.c

Modified: trunk/README
==============================================================================
--- trunk/README	(original)
+++ trunk/README	Fri Mar 14 18:19:42 2008
@@ -23,3 +23,12 @@
 ======================
 
   - See the file 'AUTHORS'
+
+
+Enabling scaling
+================
+
+  - In order to enable scaling in Vinagre, gtk-vnc widget must have been
+  compiled with this feature enabled.
+    Simply build gtk-vnc with the flag '--with-gtkglext=yes', in the
+    configure stage.

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Mar 14 18:19:42 2008
@@ -38,7 +38,7 @@
 LIBGLADE_REQUIRED=2.6.0
 GCONF_REQUIRED=2.16.0
 GTHREAD_REQUIRED=2.0.0
-GTK_VNC_REQUIRED=0.3.3
+GTK_VNC_REQUIRED=0.3.4
 
 PKG_CHECK_MODULES(VINAGRE, \ 
   glib-2.0 >= $GLIB_REQUIRED \

Modified: trunk/data/vinagre-ui.xml
==============================================================================
--- trunk/data/vinagre-ui.xml	(original)
+++ trunk/data/vinagre-ui.xml	Fri Mar 14 18:19:42 2008
@@ -2,7 +2,7 @@
  * vinagre-ui.xml
  * This file is part of vinagre
  *
- * Copyright (C) 2007 - Jonh Wendell <wendell bani com br>
+ * Copyright (C) 2007,2008 - Jonh Wendell <wendell bani com br>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -41,6 +41,7 @@
       <menuitem name="ViewBookmarksMenu" action="ViewBookmarks"/>
       <separator/>
       <menuitem name="ViewFullScreenMenu" action="ViewFullScreen"/>
+      <menuitem name="ViewScalingMenu" action="ViewScaling"/>
     </menu>
 
     <menu name="BookmarksMenu" action="Bookmarks">

Modified: trunk/src/vinagre-commands.c
==============================================================================
--- trunk/src/vinagre-commands.c	(original)
+++ trunk/src/vinagre-commands.c	Fri Mar 14 18:19:42 2008
@@ -204,6 +204,23 @@
   vinagre_window_toggle_fullscreen (window);
 }
 
+void
+vinagre_cmd_view_scaling (GtkAction     *action,
+			  VinagreWindow *window)
+{
+  gboolean active;
+
+  g_return_if_fail (VINAGRE_IS_WINDOW (window));
+
+  active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+  if (!vinagre_tab_set_scaling (vinagre_window_get_active_tab (window), active))
+    {
+      gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
+      vinagre_utils_show_error (_("Scaling is not supported on this installation.\n\nRead the README file (shipped with Vinagre) in order to know how to enable this feature."),
+				GTK_WINDOW (window));
+    }
+}
+
 /* Bookmarks Menu */
 void
 vinagre_cmd_open_bookmark (VinagreWindow     *window,

Modified: trunk/src/vinagre-commands.h
==============================================================================
--- trunk/src/vinagre-commands.h	(original)
+++ trunk/src/vinagre-commands.h	Fri Mar 14 18:19:42 2008
@@ -2,7 +2,7 @@
  * vinagre-commands.h
  * This file is part of vinagre
  *
- * Copyright (C) 2007 - Jonh Wendell <wendell bani com br>
+ * Copyright (C) 2007,2008 - Jonh Wendell <wendell bani com br>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,6 +48,8 @@
 						 VinagreWindow *window);
 void		vinagre_cmd_view_show_fav_panel	(GtkAction     *action,
 						 VinagreWindow *window);
+void		vinagre_cmd_view_scaling	(GtkAction     *action,
+						 VinagreWindow *window);
 void		vinagre_cmd_view_fullscreen	(GtkAction     *action,
 						 VinagreWindow *window);
 

Modified: trunk/src/vinagre-tab.c
==============================================================================
--- trunk/src/vinagre-tab.c	(original)
+++ trunk/src/vinagre-tab.c	Fri Mar 14 18:19:42 2008
@@ -572,16 +572,12 @@
 static void
 vinagre_tab_init (VinagreTab *tab)
 {
-  GtkWidget *align;
   GtkWidget *viewport;
 
   tab->priv = VINAGRE_TAB_GET_PRIVATE (tab);
   tab->priv->save_password = FALSE;
   tab->priv->keyring_item_id = 0;
 
-  /* Create the alignment */
-  align = gtk_alignment_new (0.5, 0.5, 0, 0);
-
   /* Create the scrolled window */
   tab->priv->scroll = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tab->priv->scroll),
@@ -594,10 +590,9 @@
 
   /* Create the vnc widget */
   tab->priv->vnc = vnc_display_new ();
-  gtk_container_add (GTK_CONTAINER (align), tab->priv->vnc);
 
   gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (tab->priv->scroll),
-					 align);
+					 tab->priv->vnc);
   viewport = gtk_bin_get_child (GTK_BIN (tab->priv->scroll));
   gtk_viewport_set_shadow_type(GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
 
@@ -795,4 +790,21 @@
     }
 }
 
+gboolean
+vinagre_tab_set_scaling (VinagreTab *tab, gboolean active) {
+  g_return_if_fail (VINAGRE_IS_TAB (tab));
+
+  if (vnc_display_get_scaling (VNC_DISPLAY (tab->priv->vnc)) == active)
+    return TRUE;
+
+  return vnc_display_set_scaling (VNC_DISPLAY (tab->priv->vnc), active);
+}
+
+gboolean
+vinagre_tab_get_scaling (VinagreTab *tab) {
+  g_return_if_fail (VINAGRE_IS_TAB (tab));
+
+  return vnc_display_get_scaling (VNC_DISPLAY (tab->priv->vnc));
+}
+
 /* vim: ts=8 */

Modified: trunk/src/vinagre-tab.h
==============================================================================
--- trunk/src/vinagre-tab.h	(original)
+++ trunk/src/vinagre-tab.h	Fri Mar 14 18:19:42 2008
@@ -2,7 +2,7 @@
  * vinagre-tab.h
  * This file is part of vinagre
  *
- * Copyright (C) 2007 - Jonh Wendell <wendell bani com br>
+ * Copyright (C) 2007,2008 - Jonh Wendell <wendell bani com br>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -78,6 +78,10 @@
 void		  vinagre_tab_take_screenshot	(VinagreTab *tab);
 void		  vinagre_tab_paste_text	(VinagreTab *tab,
 						 const gchar *text);
+
+gboolean	  vinagre_tab_set_scaling	(VinagreTab *tab, gboolean active);
+gboolean	  vinagre_tab_get_scaling	(VinagreTab *tab);
 G_END_DECLS
 
 #endif  /* __VINAGRE_TAB_H__  */
+/* vim: ts=8 */

Modified: trunk/src/vinagre-ui.h
==============================================================================
--- trunk/src/vinagre-ui.h	(original)
+++ trunk/src/vinagre-ui.h	Fri Mar 14 18:19:42 2008
@@ -2,7 +2,7 @@
  * vinagre-ui.h
  * This file is part of vinagre
  *
- * Copyright (C) 2007 - Jonh Wendell <wendell bani com br>
+ * Copyright (C) 2007,2008 - Jonh Wendell <wendell bani com br>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -84,6 +84,13 @@
     N_("View the current machine in full screen"), G_CALLBACK (vinagre_cmd_view_fullscreen) },
 };
 
+static const GtkToggleActionEntry vinagre_machine_connected_toggle_menu_entries[] =
+{
+  { "ViewScaling", NULL, N_("S_caling"), NULL,
+    N_("Fit the remote screen into the current window size"),
+    G_CALLBACK (vinagre_cmd_view_scaling), FALSE }
+};
+
 static const GtkToggleActionEntry vinagre_always_sensitive_toggle_menu_entries[] =
 {
   { "ViewToolbar", NULL, N_("_Toolbar"), NULL,

Modified: trunk/src/vinagre-window-private.h
==============================================================================
--- trunk/src/vinagre-window-private.h	(original)
+++ trunk/src/vinagre-window-private.h	Fri Mar 14 18:19:42 2008
@@ -46,6 +46,7 @@
   GtkActionGroup *bookmarks_list_action_group;
   GtkActionGroup *recent_action_group;
   GtkAction      *recent_action;
+  GtkAction      *scaling_action;
   guint           bookmarks_list_menu_ui_id;
   guint           recents_menu_ui_id;
 

Modified: trunk/src/vinagre-window.c
==============================================================================
--- trunk/src/vinagre-window.c	(original)
+++ trunk/src/vinagre-window.c	Fri Mar 14 18:19:42 2008
@@ -384,10 +384,15 @@
 				vinagre_machine_connected_menu_entries,
 				G_N_ELEMENTS (vinagre_machine_connected_menu_entries),
 				window);
+  gtk_action_group_add_toggle_actions  (action_group,
+					vinagre_machine_connected_toggle_menu_entries,
+					G_N_ELEMENTS (vinagre_machine_connected_toggle_menu_entries),
+					window);
 
   gtk_ui_manager_insert_action_group (manager, action_group, 0);
   g_object_unref (action_group);
   window->priv->machine_connected_action_group = action_group;
+  window->priv->scaling_action = gtk_action_group_get_action (action_group, "ViewScaling");
 
   action = gtk_action_group_get_action (action_group, "ViewFullScreen");
   g_object_set (action, "is_important", TRUE, NULL);
@@ -768,6 +773,20 @@
 }
 
 static void
+update_toggle_machine_items (VinagreWindow *window) {
+  g_return_if_fail (VINAGRE_IS_WINDOW (window));
+
+  if (window->priv->active_tab == NULL)
+    {
+      gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (window->priv->scaling_action), FALSE);
+      return;
+    }
+
+  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (window->priv->scaling_action),
+				vinagre_tab_get_scaling (VINAGRE_TAB (window->priv->active_tab)));
+}
+
+static void
 vinagre_window_page_removed (GtkNotebook   *notebook,
 			     GtkWidget     *child,
 			     guint         page_num,
@@ -781,6 +800,7 @@
     vinagre_window_toggle_fullscreen (window);
 
   vinagre_window_set_title (window);
+  update_toggle_machine_items (window);
   _vinagre_window_del_machine_connected (window);
 }
 
@@ -795,6 +815,7 @@
   window->priv->active_tab = child;
 
   vinagre_window_set_title (window);
+  update_toggle_machine_items (window);
 }
 
 static void 
@@ -814,6 +835,7 @@
   window->priv->active_tab = tab;
 
   vinagre_window_set_title (window);
+  update_toggle_machine_items (window);
 }
 
 static void



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