From 56f1889c7c2831fb1ae1eb6087134bfb7ab48ebe Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sat, 25 Oct 2014 08:56:22 -0400 Subject: [PATCH 01/18] With WITH_GETTEXT, detect if libintl is required to prevent underlinking error. --- cmake/FindLibintl.cmake | 67 +++++++++++++++++++++++++++++++++++++++++ cmake/GETTEXT.cmake | 3 ++ remmina/CMakeLists.txt | 3 ++ 3 files changed, 73 insertions(+) create mode 100644 cmake/FindLibintl.cmake diff --git a/cmake/FindLibintl.cmake b/cmake/FindLibintl.cmake new file mode 100644 index 0000000000..8c4cd8b150 --- /dev/null +++ b/cmake/FindLibintl.cmake @@ -0,0 +1,67 @@ +# Try to find Libintl functionality +# Once done this will define +# +# LIBINTL_FOUND - system has Libintl +# LIBINTL_INCLUDE_DIR - Libintl include directory +# LIBINTL_LIBRARIES - Libraries needed to use Libintl +# +# TODO: This will enable translations only if Gettext functionality is +# present in libc. Must have more robust system for release, where Gettext +# functionality can also reside in standalone Gettext library, or the one +# embedded within kdelibs (cf. gettext.m4 from Gettext source). + +# Copyright (c) 2006, Chusslove Illich, +# Copyright (c) 2007, Alexander Neundorf, +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +if(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND) + set(Libintl_FIND_QUIETLY TRUE) +endif(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND) + +find_path(LIBINTL_INCLUDE_DIR libintl.h) + +set(LIBINTL_LIB_FOUND FALSE) + +if(LIBINTL_INCLUDE_DIR) + include(CheckFunctionExists) + check_function_exists(dgettext LIBINTL_LIBC_HAS_DGETTEXT) + + if (LIBINTL_LIBC_HAS_DGETTEXT) + set(LIBINTL_LIBRARIES) + set(LIBINTL_LIB_FOUND TRUE) + else (LIBINTL_LIBC_HAS_DGETTEXT) + find_library(LIBINTL_LIBRARIES NAMES intl libintl ) + if(LIBINTL_LIBRARIES) + set(LIBINTL_LIB_FOUND TRUE) + endif(LIBINTL_LIBRARIES) + endif (LIBINTL_LIBC_HAS_DGETTEXT) + +endif(LIBINTL_INCLUDE_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libintl DEFAULT_MSG LIBINTL_LIBRARIES LIBINTL_LIB_FOUND) + +mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARIES LIBINTL_LIBC_HAS_DGETTEXT LIBINTL_LIB_FOUND) + diff --git a/cmake/GETTEXT.cmake b/cmake/GETTEXT.cmake index d920a45b15..e140dc4bb8 100644 --- a/cmake/GETTEXT.cmake +++ b/cmake/GETTEXT.cmake @@ -18,6 +18,9 @@ # Boston, MA 02111-1307, USA. find_suggested_package(Gettext) +if (GETTEXT_FOUND) + find_package(Libintl) +endif() function(gettext po_dir package_name) set(mo_files) diff --git a/remmina/CMakeLists.txt b/remmina/CMakeLists.txt index 42f516acc8..8ad01063ce 100644 --- a/remmina/CMakeLists.txt +++ b/remmina/CMakeLists.txt @@ -110,6 +110,9 @@ add_executable(remmina ${REMMINA_SRCS}) include_directories(${GTK_INCLUDE_DIRS}) target_link_libraries(remmina ${GTK_LIBRARIES}) +if(NOT LIBINTL_LIBC_HAS_DGETTEXT) + target_link_libraries(remmina -lintl) +endif() find_package(X11) include_directories(${X11_INCLUDE_DIR}) From d5643c4229c2d86ef5d1e32755b343dbb693b155 Mon Sep 17 00:00:00 2001 From: Giovanni Panozzo Date: Wed, 20 Aug 2014 20:35:46 +0200 Subject: [PATCH 02/18] GTK+ < 3.8 compatibility, fixes #299 --- remmina/src/remmina_connection_window.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_connection_window.c b/remmina/src/remmina_connection_window.c index 464bb3a029..52d01c52ef 100644 --- a/remmina/src/remmina_connection_window.c +++ b/remmina/src/remmina_connection_window.c @@ -291,7 +291,11 @@ static void remmina_connection_holder_update_toolbar_opacity(RemminaConnectionHo if (priv->floating_toolbar) { +#if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_set_opacity(GTK_WIDGET(priv->floating_toolbar), priv->floating_toolbar_opacity); +#else + gtk_window_set_opacity(GTK_WINDOW(priv->floating_toolbar), priv->floating_toolbar_opacity); +#endif } } @@ -329,8 +333,13 @@ static gboolean remmina_connection_holder_floating_toolbar_motion(RemminaConnect gtk_window_move(GTK_WINDOW(priv->floating_toolbar), x, y); if (remmina_pref.invisible_toolbar && !priv->pin_down) { +#if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_set_opacity(GTK_WIDGET(priv->floating_toolbar), - (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); + (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); +#else + gtk_window_set_opacity(GTK_WINDOW(priv->floating_toolbar), + (gdouble)(y - t) / (gdouble)(-t) * priv->floating_toolbar_opacity); +#endif } if ((priv->floating_toolbar_motion_show && y >= 0) || (!priv->floating_toolbar_motion_show && y <= t)) { @@ -1748,13 +1757,18 @@ static void remmina_connection_holder_create_floating_toolbar(RemminaConnectionH remmina_connection_holder_update_toolbar_opacity(cnnhld); if (remmina_pref.invisible_toolbar && !priv->pin_down) { +#if GTK_CHECK_VERSION(3, 8, 0) gtk_widget_set_opacity(GTK_WIDGET(window), 0.0); +#else + gtk_window_set_opacity(GTK_WINDOW(window), 0.0); +#endif } else { g_signal_connect(G_OBJECT(window), "enter-notify-event", G_CALLBACK(remmina_connection_holder_toolbar_enter), cnnhld); g_signal_connect(G_OBJECT(window), "leave-notify-event", G_CALLBACK(remmina_connection_holder_toolbar_leave), cnnhld); g_signal_connect(G_OBJECT(window), "scroll-event", G_CALLBACK(remmina_connection_holder_toolbar_scroll), cnnhld); + gtk_widget_add_events(GTK_WIDGET(window), GDK_SCROLL_MASK); } if (cnnobj->connected) From 9334ce253e1f634e5b7ca14a6f4a4832dd15bbad Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 26 Oct 2014 09:31:37 -0500 Subject: [PATCH 03/18] Ignore build directory --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 722c54cdae..4aeb7c432d 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ remmina/src/remmina remmina/desktop/remmina.desktop remmina-plugins/libvncserver/rfb/rfbconfig.h remmina-plugins/telepathy/org.freedesktop.Telepathy.Client.Remmina.service + +build From c8aa143d9b6925fc1f452d0dacf4c45e4c42541b Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 2 Nov 2014 09:08:22 -0500 Subject: [PATCH 04/18] Removed deprecation warning with a version check --- remmina/src/remmina.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/remmina/src/remmina.c b/remmina/src/remmina.c index c327f662ad..bbe76fce81 100644 --- a/remmina/src/remmina.c +++ b/remmina/src/remmina.c @@ -216,7 +216,9 @@ int main(int argc, char* argv[]) textdomain(GETTEXT_PACKAGE); #ifdef HAVE_PTHREAD +#if !GLIB_CHECK_VERSION(2,36,0) g_type_init (); +#endif gdk_threads_init (); #endif From 241ffd69b9184110078e726f30b90b5c23889382 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 2 Nov 2014 09:12:13 -0500 Subject: [PATCH 05/18] Compatibility with FreeRDP 1.1.0-beta+2013071101 --- remmina-plugins/rdp/rdp_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remmina-plugins/rdp/rdp_plugin.c b/remmina-plugins/rdp/rdp_plugin.c index b3418f4aae..25709fc0d8 100644 --- a/remmina-plugins/rdp/rdp_plugin.c +++ b/remmina-plugins/rdp/rdp_plugin.c @@ -251,7 +251,7 @@ static BOOL remmina_rdp_pre_connect(freerdp* instance) settings->LargePointerFlag = True; settings->PerformanceFlags = PERF_FLAG_NONE; - rfi->rfx_context = rfx_context_new(FALSE); + rfi->rfx_context = rfx_context_new(); } freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0); From 77d73914e517c1830f5b280bf1915a6fa6c9fa38 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 2 Nov 2014 09:12:51 -0500 Subject: [PATCH 06/18] Compatibility with GTK+2 (use GtkGrid on GTK+3 and GtkTable on GTK+2) --- remmina-plugins/rdp/rdp_settings.c | 58 ++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/remmina-plugins/rdp/rdp_settings.c b/remmina-plugins/rdp/rdp_settings.c index 9d36b86048..ecf9ebbbd6 100644 --- a/remmina-plugins/rdp/rdp_settings.c +++ b/remmina-plugins/rdp/rdp_settings.c @@ -72,7 +72,11 @@ guint remmina_rdp_settings_get_keyboard_layout(void) typedef struct _RemminaPluginRdpsetGrid { +#if GTK_VERSION == 3 GtkGrid grid; +#else + GtkTable grid; +#endif GtkWidget* keyboard_layout_label; GtkWidget* keyboard_layout_combo; @@ -95,12 +99,20 @@ typedef struct _RemminaPluginRdpsetGrid typedef struct _RemminaPluginRdpsetGridClass { +#if GTK_VERSION == 3 GtkGridClass parent_class; +#else + GtkTableClass parent_class; +#endif } RemminaPluginRdpsetGridClass; GType remmina_rdp_settings_grid_get_type(void) G_GNUC_CONST; +#if GTK_VERSION == 3 G_DEFINE_TYPE(RemminaPluginRdpsetGrid, remmina_rdp_settings_grid, GTK_TYPE_GRID) +#else +G_DEFINE_TYPE(RemminaPluginRdpsetGrid, remmina_rdp_settings_grid, GTK_TYPE_TABLE) +#endif static void remmina_rdp_settings_grid_class_init(RemminaPluginRdpsetGridClass* klass) { @@ -261,6 +273,15 @@ static void remmina_rdp_settings_quality_option_on_toggled(GtkToggleButton* togg } } +static inline void remmina_rdp_settings_grid_attach(RemminaPluginRdpsetGrid *grid, GtkWidget *child, gint left, gint top, gint width, gint height) +{ +#if GTK_VERSION == 3 + gtk_grid_attach(GTK_GRID(grid), child, left, top, width, height); +#else + gtk_table_attach_defaults(GTK_TABLE(grid), child, left, top, width, height); +#endif +} + static void remmina_rdp_settings_grid_init(RemminaPluginRdpsetGrid *grid) { gchar* s; @@ -269,22 +290,30 @@ static void remmina_rdp_settings_grid_init(RemminaPluginRdpsetGrid *grid) /* Create the grid */ g_signal_connect(G_OBJECT(grid), "destroy", G_CALLBACK(remmina_rdp_settings_grid_destroy), NULL); +#if GTK_VERSION == 3 gtk_grid_set_row_homogeneous(GTK_GRID(grid), FALSE); gtk_grid_set_column_homogeneous(GTK_GRID(grid), FALSE); gtk_container_set_border_width(GTK_CONTAINER(grid), 8); gtk_grid_set_row_spacing(GTK_GRID(grid), 4); gtk_grid_set_column_spacing(GTK_GRID(grid), 4); +#else + gtk_table_resize(GTK_TABLE(grid), 8, 3); + gtk_table_set_homogeneous(GTK_TABLE(grid), FALSE); + gtk_container_set_border_width(GTK_CONTAINER(grid), 8); + gtk_table_set_row_spacings(GTK_TABLE(grid), 4); + gtk_table_set_col_spacings(GTK_TABLE(grid), 4); +#endif /* Create the content */ widget = gtk_label_new(_("Keyboard layout")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(grid), widget, 0, 1, 0, 1); + remmina_rdp_settings_grid_attach(grid, widget, 0, 1, 0, 1); grid->keyboard_layout_store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); widget = gtk_combo_box_new_with_model(GTK_TREE_MODEL(grid->keyboard_layout_store)); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 4, 0, 1); + remmina_rdp_settings_grid_attach(grid, widget, 1, 4, 0, 1); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE); @@ -294,14 +323,14 @@ static void remmina_rdp_settings_grid_init(RemminaPluginRdpsetGrid *grid) widget = gtk_label_new("-"); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 4, 1, 2); + remmina_rdp_settings_grid_attach(grid, widget, 1, 4, 1, 2); grid->keyboard_layout_label = widget; remmina_rdp_settings_grid_load_layout(grid); widget = gtk_check_button_new_with_label(_("Use client keyboard mapping")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 3, 2, 3); + remmina_rdp_settings_grid_attach(grid, widget, 1, 3, 2, 3); grid->use_client_keymap_check = widget; s = remmina_plugin_service->pref_get_value("rdp_use_client_keymap"); @@ -312,12 +341,12 @@ static void remmina_rdp_settings_grid_init(RemminaPluginRdpsetGrid *grid) widget = gtk_label_new(_("Quality option")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(grid), widget, 0, 1, 3, 4); + remmina_rdp_settings_grid_attach(grid, widget, 0, 1, 3, 4); grid->quality_store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); widget = gtk_combo_box_new_with_model(GTK_TREE_MODEL(grid->quality_store)); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 4, 3, 4); + remmina_rdp_settings_grid_attach(grid, widget, 1, 4, 3, 4); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE); @@ -330,56 +359,56 @@ static void remmina_rdp_settings_grid_init(RemminaPluginRdpsetGrid *grid) widget = gtk_check_button_new_with_label(_("Wallpaper")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 2, 4, 5); + remmina_rdp_settings_grid_attach(grid, widget, 1, 2, 4, 5); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->wallpaper_check = widget; widget = gtk_check_button_new_with_label(_("Window drag")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 2, 3, 4, 5); + remmina_rdp_settings_grid_attach(grid, widget, 2, 3, 4, 5); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->windowdrag_check = widget; widget = gtk_check_button_new_with_label(_("Menu animation")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 2, 5, 6); + remmina_rdp_settings_grid_attach(grid, widget, 1, 2, 5, 6); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->menuanimation_check = widget; widget = gtk_check_button_new_with_label(_("Theme")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 2, 3, 5, 6); + remmina_rdp_settings_grid_attach(grid, widget, 2, 3, 5, 6); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->theme_check = widget; widget = gtk_check_button_new_with_label(_("Cursor shadow")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 2, 6, 7); + remmina_rdp_settings_grid_attach(grid, widget, 1, 2, 6, 7); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->cursorshadow_check = widget; widget = gtk_check_button_new_with_label(_("Cursor blinking")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 2, 3, 6, 7); + remmina_rdp_settings_grid_attach(grid, widget, 2, 3, 6, 7); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->cursorblinking_check = widget; widget = gtk_check_button_new_with_label(_("Font smoothing")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 2, 7, 8); + remmina_rdp_settings_grid_attach(grid, widget, 1, 2, 7, 8); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->fontsmoothing_check = widget; widget = gtk_check_button_new_with_label(_("Composition")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(grid), widget, 2, 3, 7, 8); + remmina_rdp_settings_grid_attach(grid, widget, 2, 3, 7, 8); g_signal_connect(G_OBJECT(widget), "toggled", G_CALLBACK(remmina_rdp_settings_quality_option_on_toggled), grid); grid->composition_check = widget; @@ -396,4 +425,3 @@ GtkWidget* remmina_rdp_settings_new(void) return widget; } - From a22b1f613174f65ee1df8fee5d1974eb74bd3b3c Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 2 Nov 2014 09:48:01 -0500 Subject: [PATCH 07/18] Reverted part of commit 7226c8f73d12c3aa8b9372158b2505c7c0d8117a not compatible with FreeRDP 1.1 second tech preview --- remmina-plugins/rdp/rdp_plugin.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/remmina-plugins/rdp/rdp_plugin.c b/remmina-plugins/rdp/rdp_plugin.c index ea4f34d72a..b4a80f9e16 100644 --- a/remmina-plugins/rdp/rdp_plugin.c +++ b/remmina-plugins/rdp/rdp_plugin.c @@ -886,30 +886,10 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp) { if (!rfi->user_cancelled) { - UINT32 e; - - e = freerdp_get_last_error(rfi->instance->context); - switch(e) { - case FREERDP_ERROR_AUTHENTICATION_FAILED: - remmina_plugin_service->protocol_plugin_set_error(gp, _("Authentication to RDP server %s failed.\nCheck username, password and domain."), - rfi->settings->ServerHostname ); - // Invalidate the saved password, so the user will be re-asked at next logon - remmina_plugin_service->file_unsave_password(remminafile); - break; - case FREERDP_ERROR_CONNECT_FAILED: - remmina_plugin_service->protocol_plugin_set_error(gp, _("Connection to RDP server %s failed."), rfi->settings->ServerHostname ); - break; - default: - remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to connect to RDP server %s"), rfi->settings->ServerHostname); - break; - } - + remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to connect to RDP server %s"), rfi->settings->ServerHostname); } - return FALSE; } - - remmina_rdp_main_loop(gp); From 6b9b6d53023d7bad5014a952e048d9407219bb07 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 2 Nov 2014 11:11:26 -0500 Subject: [PATCH 08/18] Revert "GTK3 migration - gtk_image_menu_item_set_image deprecated" This reverts commit bf8fe11f9e7db51080d92980b2ed57340af941ae. --- remmina/src/remmina_applet_menu.c | 4 +++- remmina/src/remmina_applet_menu_item.c | 2 ++ remmina/src/remmina_connection_window.c | 6 ++++-- remmina/src/remmina_ftp_client.c | 6 ++++-- remmina/src/remmina_icon.c | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/remmina/src/remmina_applet_menu.c b/remmina/src/remmina_applet_menu.c index ad5ddafd1c..9e2cc4c45e 100644 --- a/remmina/src/remmina_applet_menu.c +++ b/remmina/src/remmina_applet_menu.c @@ -88,7 +88,7 @@ remmina_applet_menu_add_group(GtkWidget *menu, const gchar *group, gint position GtkWidget *image; GtkWidget *submenu; - widget = gtk_menu_item_new_with_label(group); + widget = gtk_image_menu_item_new_with_label(group); gtk_widget_show(widget); image = @@ -96,6 +96,8 @@ remmina_applet_menu_add_group(GtkWidget *menu, const gchar *group, gint position (menuitem->item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED ? "folder-remote" : "folder"), GTK_ICON_SIZE_MENU); gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), image); + gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(widget), TRUE); g_object_set_data_full(G_OBJECT(widget), "group", g_strdup(group), g_free); g_object_set_data(G_OBJECT(widget), "count", GINT_TO_POINTER(0)); diff --git a/remmina/src/remmina_applet_menu_item.c b/remmina/src/remmina_applet_menu_item.c index 5a161fdd48..ccea908a40 100644 --- a/remmina/src/remmina_applet_menu_item.c +++ b/remmina/src/remmina_applet_menu_item.c @@ -158,6 +158,8 @@ GtkWidget* remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ... } gtk_widget_show(widget); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), widget); + gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(item), TRUE); if (item->server) { diff --git a/remmina/src/remmina_connection_window.c b/remmina/src/remmina_connection_window.c index 6beb282007..0bd9d94be6 100644 --- a/remmina/src/remmina_connection_window.c +++ b/remmina/src/remmina_connection_window.c @@ -775,12 +775,13 @@ static void remmina_connection_holder_toolbar_switch_page(GtkWidget* widget, Rem break; cnnobj = (RemminaConnectionObject*) g_object_get_data(G_OBJECT(page), "cnnobj"); - menuitem = gtk_menu_item_new_with_label(remmina_file_get_string(cnnobj->remmina_file, "name")); + menuitem = gtk_image_menu_item_new_with_label(remmina_file_get_string(cnnobj->remmina_file, "name")); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); image = gtk_image_new_from_icon_name(remmina_file_get_icon_name(cnnobj->remmina_file), GTK_ICON_SIZE_MENU); gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); g_object_set_data(G_OBJECT(menuitem), "new-page-num", GINT_TO_POINTER(i)); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_connection_holder_switch_page_activate), @@ -1176,11 +1177,12 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo if (feature->opt1) { - menuitem = gtk_menu_item_new_with_label(g_dgettext(domain, (const gchar*) feature->opt1)); + menuitem = gtk_image_menu_item_new_with_label(g_dgettext(domain, (const gchar*) feature->opt1)); if (feature->opt2) { image = gtk_image_new_from_icon_name((const gchar*) feature->opt2, GTK_ICON_SIZE_MENU); gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); } } else diff --git a/remmina/src/remmina_ftp_client.c b/remmina/src/remmina_ftp_client.c index 95f4003602..db2a21d160 100644 --- a/remmina/src/remmina_ftp_client.c +++ b/remmina/src/remmina_ftp_client.c @@ -665,17 +665,19 @@ static void remmina_ftp_client_popup_menu(RemminaFTPClient *client, GdkEventButt menu = gtk_menu_new(); - menuitem = gtk_menu_item_new_with_label(_("Download")); + menuitem = gtk_image_menu_item_new_with_label(_("Download")); gtk_widget_show(menuitem); image = gtk_image_new_from_icon_name("document-save", GTK_ICON_SIZE_MENU); gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_ftp_client_action_download), client); - menuitem = gtk_menu_item_new_with_label(_("Upload")); + menuitem = gtk_image_menu_item_new_with_label(_("Upload")); gtk_widget_show(menuitem); image = gtk_image_new_from_icon_name("document-send", GTK_ICON_SIZE_MENU); gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_ftp_client_action_upload), client); diff --git a/remmina/src/remmina_icon.c b/remmina/src/remmina_icon.c index 23b528a41c..2113fa3219 100644 --- a/remmina/src/remmina_icon.c +++ b/remmina/src/remmina_icon.c @@ -124,8 +124,10 @@ static void remmina_icon_populate_additional_menu_item(GtkWidget *menu) { GtkWidget *menuitem; - menuitem = gtk_menu_item_new_with_label(_("Open Main Window")); + menuitem = gtk_image_menu_item_new_with_label(_("Open Main Window")); gtk_widget_show(menuitem); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), + gtk_image_new_from_icon_name("remmina", GTK_ICON_SIZE_MENU)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_main), NULL); From 664c44b9047c425eda098b67c9de359f4fc294aa Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 2 Nov 2014 12:31:04 -0500 Subject: [PATCH 09/18] For GTK+2, keep icons in menus --- remmina/src/remmina_applet_menu.c | 7 +++++++ remmina/src/remmina_applet_menu_item.c | 3 +++ remmina/src/remmina_connection_window.c | 12 ++++++++++++ remmina/src/remmina_ftp_client.c | 17 ++++++++++++++++- remmina/src/remmina_icon.c | 21 ++++++++++++++++++--- 5 files changed, 56 insertions(+), 4 deletions(-) diff --git a/remmina/src/remmina_applet_menu.c b/remmina/src/remmina_applet_menu.c index 9e2cc4c45e..cdaf54ab8c 100644 --- a/remmina/src/remmina_applet_menu.c +++ b/remmina/src/remmina_applet_menu.c @@ -32,6 +32,7 @@ * */ +#include "config.h" #include #include #include @@ -88,7 +89,11 @@ remmina_applet_menu_add_group(GtkWidget *menu, const gchar *group, gint position GtkWidget *image; GtkWidget *submenu; +#if GTK_VERSION == 3 + widget = gtk_menu_item_new_with_label(group); +#else widget = gtk_image_menu_item_new_with_label(group); +#endif gtk_widget_show(widget); image = @@ -96,8 +101,10 @@ remmina_applet_menu_add_group(GtkWidget *menu, const gchar *group, gint position (menuitem->item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED ? "folder-remote" : "folder"), GTK_ICON_SIZE_MENU); gtk_widget_show(image); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), image); gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(widget), TRUE); +#endif g_object_set_data_full(G_OBJECT(widget), "group", g_strdup(group), g_free); g_object_set_data(G_OBJECT(widget), "count", GINT_TO_POINTER(0)); diff --git a/remmina/src/remmina_applet_menu_item.c b/remmina/src/remmina_applet_menu_item.c index ccea908a40..d95abdd47c 100644 --- a/remmina/src/remmina_applet_menu_item.c +++ b/remmina/src/remmina_applet_menu_item.c @@ -32,6 +32,7 @@ * */ +#include "config.h" #include #include #include @@ -158,8 +159,10 @@ GtkWidget* remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ... } gtk_widget_show(widget); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), widget); gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(item), TRUE); +#endif if (item->server) { diff --git a/remmina/src/remmina_connection_window.c b/remmina/src/remmina_connection_window.c index 0bd9d94be6..51565d3d42 100644 --- a/remmina/src/remmina_connection_window.c +++ b/remmina/src/remmina_connection_window.c @@ -775,13 +775,19 @@ static void remmina_connection_holder_toolbar_switch_page(GtkWidget* widget, Rem break; cnnobj = (RemminaConnectionObject*) g_object_get_data(G_OBJECT(page), "cnnobj"); +#if GTK_VERSION == 3 + menuitem = gtk_menu_item_new_with_label(remmina_file_get_string(cnnobj->remmina_file, "name")); +#else menuitem = gtk_image_menu_item_new_with_label(remmina_file_get_string(cnnobj->remmina_file, "name")); +#endif gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); image = gtk_image_new_from_icon_name(remmina_file_get_icon_name(cnnobj->remmina_file), GTK_ICON_SIZE_MENU); gtk_widget_show(image); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); +#endif g_object_set_data(G_OBJECT(menuitem), "new-page-num", GINT_TO_POINTER(i)); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_connection_holder_switch_page_activate), @@ -1177,12 +1183,18 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo if (feature->opt1) { +#if GTK_VERSION == 3 + menuitem = gtk_menu_item_new_with_label(g_dgettext(domain, (const gchar*) feature->opt1)); +#else menuitem = gtk_image_menu_item_new_with_label(g_dgettext(domain, (const gchar*) feature->opt1)); +#endif if (feature->opt2) { image = gtk_image_new_from_icon_name((const gchar*) feature->opt2, GTK_ICON_SIZE_MENU); gtk_widget_show(image); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); +#endif } } else diff --git a/remmina/src/remmina_ftp_client.c b/remmina/src/remmina_ftp_client.c index db2a21d160..b5c014b6db 100644 --- a/remmina/src/remmina_ftp_client.c +++ b/remmina/src/remmina_ftp_client.c @@ -665,24 +665,39 @@ static void remmina_ftp_client_popup_menu(RemminaFTPClient *client, GdkEventButt menu = gtk_menu_new(); +#if GTK_VERSION == 3 + menuitem = gtk_menu_item_new_with_label(_("Download")); +#else menuitem = gtk_image_menu_item_new_with_label(_("Download")); +#endif gtk_widget_show(menuitem); image = gtk_image_new_from_icon_name("document-save", GTK_ICON_SIZE_MENU); gtk_widget_show(image); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); +#endif gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_ftp_client_action_download), client); +#if GTK_VERSION == 3 + menuitem = gtk_menu_item_new_with_label(_("Upload")); +#else menuitem = gtk_image_menu_item_new_with_label(_("Upload")); +#endif gtk_widget_show(menuitem); image = gtk_image_new_from_icon_name("document-send", GTK_ICON_SIZE_MENU); gtk_widget_show(image); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); +#endif gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_ftp_client_action_upload), client); - //menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_DELETE, NULL); +#if GTK_VERSION == 2 + menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_DELETE, NULL); +#else menuitem = gtk_menu_item_new_with_mnemonic(_("_Delete")); +#endif gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_ftp_client_action_delete), client); diff --git a/remmina/src/remmina_icon.c b/remmina/src/remmina_icon.c index 2113fa3219..4fb6820e63 100644 --- a/remmina/src/remmina_icon.c +++ b/remmina/src/remmina_icon.c @@ -124,21 +124,33 @@ static void remmina_icon_populate_additional_menu_item(GtkWidget *menu) { GtkWidget *menuitem; +#if GTK_VERSION == 3 + menuitem = gtk_menu_item_new_with_label(_("Open Main Window")); +#else menuitem = gtk_image_menu_item_new_with_label(_("Open Main Window")); +#endif gtk_widget_show(menuitem); +#if GTK_VERSION == 2 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), gtk_image_new_from_icon_name("remmina", GTK_ICON_SIZE_MENU)); +#endif gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_main), NULL); - //menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL); +#if GTK_VERSION == 2 + menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL); +#else menuitem = gtk_menu_item_new_with_mnemonic(_("_Preferences")); +#endif gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_preferences), NULL); - //menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL); +#if GTK_VERSION == 2 + menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL); +#else menuitem = gtk_menu_item_new_with_mnemonic(_("_About")); +#endif gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_about), NULL); @@ -162,8 +174,11 @@ static void remmina_icon_populate_additional_menu_item(GtkWidget *menu) gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); #endif - //menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL); +#if GTK_VERSION == 2 + menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL); +#else menuitem = gtk_menu_item_new_with_mnemonic(_("_Quit")); +#endif gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_destroy), NULL); From 1ed7d3c8196810c024568ff2b991c1bc85877e72 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 16 Nov 2014 12:18:31 -0500 Subject: [PATCH 10/18] Build fixes for GTK+ 2 --- remmina/src/remmina_file_editor.c | 2 +- remmina/src/remmina_public.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/remmina/src/remmina_file_editor.c b/remmina/src/remmina_file_editor.c index fd8958bcb1..c4eb9717e6 100644 --- a/remmina/src/remmina_file_editor.c +++ b/remmina/src/remmina_file_editor.c @@ -549,9 +549,9 @@ static GtkWidget* remmina_file_editor_create_text(RemminaFileEditor* gfe, GtkWid widget = gtk_label_new(label); gtk_widget_show(widget); - gtk_widget_set_margin_right (GTK_MISC(widget), 40); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); #if GTK_VERSION == 3 + gtk_widget_set_margin_right (GTK_MISC(widget), 40); gtk_grid_attach(GTK_GRID(table), widget, 0, row, 1, 1); #elif GTK_VERSION == 2 gtk_table_attach(GTK_TABLE(table), widget, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); diff --git a/remmina/src/remmina_public.c b/remmina/src/remmina_public.c index feb07c8d88..d242ee51af 100644 --- a/remmina/src/remmina_public.c +++ b/remmina/src/remmina_public.c @@ -192,7 +192,9 @@ remmina_public_create_combo(gboolean use_icon) store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); } combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(combo, TRUE); +#endif if (use_icon) { From d2fd972a86db70f057c4eb65e81ef88e943b2111 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sat, 22 Nov 2014 18:38:07 -0500 Subject: [PATCH 11/18] Use GtkTable on GTK+2 and GtkGrid on GTK+3, based on conditional compilation. --- remmina/src/remmina_init_dialog.c | 125 +++++++++++++++++------------- 1 file changed, 69 insertions(+), 56 deletions(-) diff --git a/remmina/src/remmina_init_dialog.c b/remmina/src/remmina_init_dialog.c index d6d88b10a6..4c98bc66c7 100644 --- a/remmina/src/remmina_init_dialog.c +++ b/remmina/src/remmina_init_dialog.c @@ -184,9 +184,36 @@ void remmina_init_dialog_set_status_temp(RemminaInitDialog *dialog, const gchar } } +static GtkWidget* remmina_init_dialog_container_new(guint table_rows, guint table_columns) +{ + GtkWidget *table; +#if GTK_VERSION == 3 + table = gtk_grid_new(); + gtk_widget_show(table); + gtk_grid_set_row_spacing(GTK_GRID(table), 8); + gtk_grid_set_column_spacing(GTK_GRID(table), 8); +#elif GTK_VERSION == 2 + table = gtk_table_new(table_rows, table_columns, FALSE); + gtk_widget_show(table); + gtk_table_set_row_spacings(GTK_TABLE(table), 8); + gtk_table_set_col_spacings(GTK_TABLE(table), 8); +#endif + return table; +} + +static void remmina_init_dialog_attach(GtkWidget *table, GtkWidget *widget, gint left, gint top, gint width, gint height) +{ +#if GTK_VERSION == 3 + gtk_grid_attach(GTK_GRID(table), widget, left, top, width, height); +#elif GTK_VERSION == 2 + // guint left_attach, guint right_attach, guint top_attach,guint bottom_attach + gtk_table_attach_defaults(GTK_TABLE(table), widget, left, left+width, top, top+height); +#endif +} + gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, gboolean allow_save) { - GtkGrid *table; + GtkWidget *table; GtkWidget *password_entry; GtkWidget *save_password_check; GtkWidget *widget; @@ -196,10 +223,7 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, gtk_label_set_text(GTK_LABEL(dialog->status_label), (dialog->status ? dialog->status : dialog->title)); /* Create table */ - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 8); - gtk_grid_set_column_spacing(GTK_GRID(table), 8); + table = remmina_init_dialog_container_new(2, 2); /* Icon */ gtk_image_set_from_stock(GTK_IMAGE(dialog->image), GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); @@ -208,11 +232,11 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, widget = gtk_label_new(label); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 1, 1); + remmina_init_dialog_attach(table, widget, 0, 0, 1, 1); password_entry = gtk_entry_new(); gtk_widget_show(password_entry); - gtk_grid_attach(GTK_GRID(table), password_entry, 1, 0, 2, 1); + remmina_init_dialog_attach(table, password_entry, 1, 0, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(password_entry), 100); gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE); gtk_entry_set_activates_default(GTK_ENTRY(password_entry), TRUE); @@ -221,7 +245,7 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, save_password_check = gtk_check_button_new_with_label(s); g_free(s); gtk_widget_show(save_password_check); - gtk_grid_attach(GTK_GRID(table), save_password_check, 0, 1, 2, 2); + remmina_init_dialog_attach(table, save_password_check, 0, 1, 2, 2); if (allow_save) { if (dialog->save_password) @@ -260,7 +284,7 @@ gint remmina_init_dialog_authpwd(RemminaInitDialog *dialog, const gchar *label, gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_domain, const gchar *default_username, const gchar *default_domain, gboolean allow_save) { - GtkGrid *table; + GtkWidget *table; GtkWidget *username_entry; GtkWidget *password_entry; GtkWidget *domain_entry = NULL; @@ -271,10 +295,7 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do gtk_label_set_text(GTK_LABEL(dialog->status_label), (dialog->status ? dialog->status : dialog->title)); /* Create table */ - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 8); - gtk_grid_set_column_spacing(GTK_GRID(table), 8); + table = remmina_init_dialog_container_new(4, 2); /* Icon */ gtk_image_set_from_stock(GTK_IMAGE(dialog->image), GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); @@ -283,11 +304,11 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do widget = gtk_label_new(_("User name")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 1, 1); + remmina_init_dialog_attach(table, widget, 0, 0, 1, 1); username_entry = gtk_entry_new(); gtk_widget_show(username_entry); - gtk_grid_attach(GTK_GRID(table), username_entry, 1, 0, 2, 1); + remmina_init_dialog_attach(table, username_entry, 1, 0, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(username_entry), 100); if (default_username && default_username[0] != '\0') { @@ -297,18 +318,18 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do widget = gtk_label_new(_("Password")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 1, 2); + remmina_init_dialog_attach(table, widget, 0, 1, 1, 2); password_entry = gtk_entry_new(); gtk_widget_show(password_entry); - gtk_grid_attach(GTK_GRID(table), password_entry, 1, 1, 2, 2); + remmina_init_dialog_attach(table, password_entry, 1, 1, 2, 2); gtk_entry_set_max_length(GTK_ENTRY(password_entry), 100); gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE); gtk_entry_set_activates_default(GTK_ENTRY(password_entry), TRUE); save_password_check = gtk_check_button_new_with_label(_("Save password")); gtk_widget_show(save_password_check); - gtk_grid_attach(GTK_GRID(table), save_password_check, 0, 2, 2, 3); + remmina_init_dialog_attach(table, save_password_check,0, 2, 2, 3); if (allow_save) { if (dialog->save_password) @@ -324,11 +345,11 @@ gint remmina_init_dialog_authuserpwd(RemminaInitDialog *dialog, gboolean want_do widget = gtk_label_new(_("Domain")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 1, 4); + remmina_init_dialog_attach(table, widget, 0, 3, 1, 4); domain_entry = gtk_entry_new(); gtk_widget_show(domain_entry); - gtk_grid_attach(GTK_GRID(table), domain_entry, 1, 3, 2, 4); + remmina_init_dialog_attach(table, domain_entry, 1, 3, 2, 4); gtk_entry_set_max_length(GTK_ENTRY(domain_entry), 100); if (default_domain && default_domain[0] != '\0') { @@ -380,10 +401,7 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub gtk_label_set_text(GTK_LABEL(dialog->status_label), "Certificate Details:"); /* Create table */ - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 8); - gtk_grid_set_column_spacing(GTK_GRID(table), 8); + table = remmina_init_dialog_container_new(5, 2); /* Icon */ gtk_image_set_from_stock(GTK_IMAGE(dialog->image), GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); @@ -392,37 +410,37 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub widget = gtk_label_new(_("Subject:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 1, 1); + remmina_init_dialog_attach(table, widget, 0, 1, 1, 1); widget = gtk_label_new(subject); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 0, 2, 1); + remmina_init_dialog_attach(table, widget, 1, 0, 2, 1); widget = gtk_label_new(_("Issuer:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 1, 2); + remmina_init_dialog_attach(table, widget, 0, 1, 1, 2); widget = gtk_label_new(issuer); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 2, 3); + remmina_init_dialog_attach(table, widget, 0, 1, 2, 3); widget = gtk_label_new(_("Fingerprint:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 2, 1, 2); + remmina_init_dialog_attach(table, widget, 1, 2, 1, 2); widget = gtk_label_new(fingerprint); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 2, 2, 3); + remmina_init_dialog_attach(table, widget, 1, 2, 2, 3); widget = gtk_label_new(_("Accept Certificate?")); gtk_misc_set_alignment(GTK_MISC(widget), 1.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 2, 4); + remmina_init_dialog_attach(table, widget, 0, 3, 2, 4); /* Pack it into the dialog */ gtk_box_pack_start(GTK_BOX(dialog->content_vbox), table, TRUE, TRUE, 4); @@ -443,6 +461,7 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub return status; } + gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gchar* subject, const gchar* issuer, const gchar* new_fingerprint, const gchar* old_fingerprint) { gint status; @@ -452,10 +471,7 @@ gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gc gtk_label_set_text(GTK_LABEL(dialog->status_label), _("Certificate Changed! Details:")); /* Create table */ - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 8); - gtk_grid_set_column_spacing(GTK_GRID(table), 8); + table = remmina_init_dialog_container_new(6, 2); /* Icon */ gtk_image_set_from_stock(GTK_IMAGE(dialog->image), GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); @@ -464,47 +480,47 @@ gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gc widget = gtk_label_new(_("Subject:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 1, 1); + remmina_init_dialog_attach(table, widget, 0, 0, 1, 1); widget = gtk_label_new(subject); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 0, 2, 1); + remmina_init_dialog_attach(table, widget, 1, 0, 2, 1); widget = gtk_label_new(_("Issuer:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 1, 2); + remmina_init_dialog_attach(table, widget, 0, 1, 1, 2); widget = gtk_label_new(issuer); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 1, 2, 2); + remmina_init_dialog_attach(table, widget, 1, 1, 2, 2); widget = gtk_label_new(_("Old Fingerprint:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 2, 1, 3); + remmina_init_dialog_attach(table, widget, 0, 2, 1, 3); widget = gtk_label_new(old_fingerprint); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 2, 2, 3); + remmina_init_dialog_attach(table, widget, 1, 2, 2, 3); widget = gtk_label_new(_("New Fingerprint:")); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 1, 4); + remmina_init_dialog_attach(table, widget, 0, 3, 1, 4); widget = gtk_label_new(new_fingerprint); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 3, 2, 4); + remmina_init_dialog_attach(table, widget, 1, 3, 2, 4); widget = gtk_label_new(_("Accept Changed Certificate?")); gtk_misc_set_alignment(GTK_MISC(widget), 1.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 4, 2, 5); + remmina_init_dialog_attach(table, widget, 0, 4, 2, 5); /* Pack it into the dialog */ gtk_box_pack_start(GTK_BOX(dialog->content_vbox), table, TRUE, TRUE, 4); @@ -526,7 +542,7 @@ gint remmina_init_dialog_certificate_changed(RemminaInitDialog* dialog, const gc return status; } -static GtkWidget* remmina_init_dialog_create_file_button(GtkTable *table, const gchar *label, gint row, const gchar *filename) +static GtkWidget* remmina_init_dialog_create_file_button(GtkWidget *table, const gchar *label, gint row, const gchar *filename) { GtkWidget *widget; gchar *pkidir; @@ -534,12 +550,12 @@ static GtkWidget* remmina_init_dialog_create_file_button(GtkTable *table, const widget = gtk_label_new(label); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); gtk_widget_show(widget); - gtk_grid_attach(table, widget, 0, row, 1, row + 1); + remmina_init_dialog_attach(table, widget, 0, row, 1, row + 1); widget = gtk_file_chooser_button_new(label, GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_button_set_width_chars(GTK_FILE_CHOOSER_BUTTON(widget), 25); gtk_widget_show(widget); - gtk_grid_attach(table, widget, 1, row, 2, row + 1); + remmina_init_dialog_attach(table, widget, 1, row, 2, row + 1); if (filename && filename[0] != '\0') { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(widget), filename); @@ -560,7 +576,7 @@ static GtkWidget* remmina_init_dialog_create_file_button(GtkTable *table, const gint remmina_init_dialog_authx509(RemminaInitDialog *dialog, const gchar *cacert, const gchar *cacrl, const gchar *clientcert, const gchar *clientkey) { - GtkGrid *table; + GtkWidget *table; GtkWidget *cacert_button; GtkWidget *cacrl_button; GtkWidget *clientcert_button; @@ -570,19 +586,16 @@ gint remmina_init_dialog_authx509(RemminaInitDialog *dialog, const gchar *cacert gtk_label_set_text(GTK_LABEL(dialog->status_label), (dialog->status ? dialog->status : dialog->title)); /* Create table */ - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 8); - gtk_grid_set_column_spacing(GTK_GRID(table), 8); + table = remmina_init_dialog_container_new(4, 2); /* Icon */ gtk_image_set_from_stock(GTK_IMAGE(dialog->image), GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); /* Buttons for choosing the certificates */ - cacert_button = remmina_init_dialog_create_file_button(GTK_GRID(table), _("CA certificate"), 0, cacert); - cacrl_button = remmina_init_dialog_create_file_button(GTK_GRID(table), _("CA CRL"), 1, cacrl); - clientcert_button = remmina_init_dialog_create_file_button(GTK_GRID(table), _("Client certificate"), 2, clientcert); - clientkey_button = remmina_init_dialog_create_file_button(GTK_GRID(table), _("Client key"), 3, clientkey); + cacert_button = remmina_init_dialog_create_file_button(table, _("CA certificate"), 0, cacert); + cacrl_button = remmina_init_dialog_create_file_button(table, _("CA CRL"), 1, cacrl); + clientcert_button = remmina_init_dialog_create_file_button(table, _("Client certificate"), 2, clientcert); + clientkey_button = remmina_init_dialog_create_file_button(table, _("Client key"), 3, clientkey); /* Pack it into the dialog */ gtk_box_pack_start(GTK_BOX(dialog->content_vbox), table, TRUE, TRUE, 4); From 132c5d2fff2ff33cca262f8b855a1e27446b5a74 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sat, 22 Nov 2014 23:43:48 -0500 Subject: [PATCH 12/18] Use GtkGrid on GTK+3 and GtkTable on GTK+2 for the chat window. --- remmina/src/remmina_chat_window.c | 45 +++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/remmina/src/remmina_chat_window.c b/remmina/src/remmina_chat_window.c index 6d176262f5..506e331161 100644 --- a/remmina/src/remmina_chat_window.c +++ b/remmina/src/remmina_chat_window.c @@ -161,7 +161,7 @@ remmina_chat_window_new(GtkWindow* parent, const gchar* chat_with) { RemminaChatWindow* window; gchar buf[100]; - GtkGrid* grid; + GtkWidget* table; GtkWidget* scrolledwindow; GtkWidget* widget; GtkWidget* image; @@ -180,18 +180,29 @@ remmina_chat_window_new(GtkWindow* parent, const gchar* chat_with) gtk_window_set_default_size(GTK_WINDOW(window), 450, 300); /* Main container */ - grid = gtk_grid_new(); - gtk_widget_show(grid); - gtk_grid_set_row_spacing(GTK_GRID(grid), 4); - gtk_grid_set_column_spacing(GTK_GRID(grid), 4); - gtk_container_set_border_width(GTK_CONTAINER(grid), 8); - gtk_container_add(GTK_CONTAINER(window), grid); +#if GTK_VERSION == 3 + table = gtk_grid_new(); + gtk_widget_show(table); + gtk_grid_set_row_spacing(GTK_GRID(table), 4); + gtk_grid_set_column_spacing(GTK_GRID(table), 4); +#else + table = gtk_table_new(3, 2, FALSE); + gtk_widget_show(table); + gtk_table_set_row_spacings(GTK_TABLE(table), 4); + gtk_table_set_col_spacings(GTK_TABLE(table), 4); +#endif + gtk_container_set_border_width(GTK_CONTAINER(table), 8); + gtk_container_add(GTK_CONTAINER(window), table); /* Chat history */ scrolledwindow = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_grid_attach(GTK_GRID(grid), scrolledwindow, 0, 0, 2, 1); +#if GTK_VERSION == 3 + gtk_grid_attach(GTK_GRID(table), scrolledwindow, 0, 0, 2, 1); +#elif GTK_VERSION == 2 + gtk_table_attach_defaults(GTK_TABLE(table), scrolledwindow, 0, 2, 0, 1); +#endif widget = gtk_text_view_new(); gtk_widget_show(widget); @@ -209,7 +220,11 @@ remmina_chat_window_new(GtkWindow* parent, const gchar* chat_with) scrolledwindow = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwindow); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_grid_attach(GTK_GRID(grid), scrolledwindow, 0, 1, 1, 3); +#if GTK_VERSION == 3 + gtk_grid_attach(GTK_GRID(table), scrolledwindow, 0, 1, 1, 3); +#elif GTK_VERSION == 2 + gtk_table_attach(GTK_TABLE(table), scrolledwindow, 0, 1, 1, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); +#endif widget = gtk_text_view_new(); gtk_widget_show(widget); @@ -226,7 +241,11 @@ remmina_chat_window_new(GtkWindow* parent, const gchar* chat_with) widget = gtk_button_new_with_mnemonic(_("_Send")); gtk_widget_show(widget); gtk_button_set_image(GTK_BUTTON(widget), image); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 1, 2, 1); +#if GTK_VERSION == 3 + gtk_grid_attach(GTK_GRID(table), widget, 1, 1, 2, 1); +#elif GTK_VERSION == 2 + gtk_table_attach(GTK_TABLE(table), widget, 1, 2, 1, 2, 0, 0, 0, 0); +#endif g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_chat_window_send), window); /* Clear button */ @@ -236,7 +255,11 @@ remmina_chat_window_new(GtkWindow* parent, const gchar* chat_with) widget = gtk_button_new_with_mnemonic(_("_Clear")); gtk_widget_show(widget); gtk_button_set_image(GTK_BUTTON(widget), image); - gtk_grid_attach(GTK_GRID(grid), widget, 1, 2, 2, 1); +#if GTK_VERSION == 3 + gtk_grid_attach(GTK_GRID(table), widget, 1, 2, 2, 1); +#elif GTK_VERSION == 2 + gtk_table_attach(GTK_TABLE(table), widget, 1, 2, 2, 3, 0, 0, 0, 0); +#endif g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_chat_window_clear_send_text), window); gtk_widget_grab_focus(window->send_text); From 09b4971884bac2b40b8aacced5ef90e8762b4113 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 23 Nov 2014 13:27:02 -0500 Subject: [PATCH 13/18] Use GtkGrid on GTK+3 and GtkTable on GTK+2 for the preferences dialog. --- remmina/src/remmina_pref_dialog.c | 205 ++++++++++++++++++++---------- 1 file changed, 137 insertions(+), 68 deletions(-) diff --git a/remmina/src/remmina_pref_dialog.c b/remmina/src/remmina_pref_dialog.c index 482ef53d95..e7ee5798a1 100644 --- a/remmina/src/remmina_pref_dialog.c +++ b/remmina/src/remmina_pref_dialog.c @@ -312,6 +312,33 @@ static void remmina_pref_dialog_disable_tray_icon_on_toggled(GtkWidget *widget, #endif } +static GtkWidget* remmina_pref_dialog_container_new(guint table_rows, guint table_columns) +{ + GtkWidget *table; +#if GTK_VERSION == 3 + table = gtk_grid_new(); + gtk_widget_show(table); + gtk_grid_set_row_spacing(GTK_GRID(table), 4); + gtk_grid_set_column_spacing(GTK_GRID(table), 4); +#elif GTK_VERSION == 2 + table = gtk_table_new(table_rows, table_columns, FALSE); + gtk_widget_show(table); + gtk_table_set_row_spacings(GTK_TABLE(table), 4); + gtk_table_set_col_spacings(GTK_TABLE(table), 4); +#endif + return table; +} + +static void remmina_pref_dialog_attach(GtkWidget *table, GtkWidget *widget, gint left, gint top, gint width, gint height) +{ +#if GTK_VERSION == 3 + remmina_pref_dialog_attach(table, widget, left, top, width, height); +#elif GTK_VERSION == 2 + // guint left_attach, guint right_attach, guint top_attach,guint bottom_attach + gtk_table_attach_defaults(GTK_TABLE(table), widget, left, left+width, top, top+height); +#endif +} + static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) { RemminaPrefDialogPriv *priv; @@ -319,7 +346,7 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) GtkWidget *tablabel; GtkWidget *vbox; GtkWidget *hbox; - GtkGrid *table; + GtkWidget *table; GtkWidget *widget; gchar buf[100]; @@ -355,28 +382,25 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) gtk_widget_show(vbox); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, tablabel); - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 4); - gtk_grid_set_column_spacing(GTK_GRID(table), 4); + table = remmina_pref_dialog_container_new(12, 2); gtk_container_set_border_width(GTK_CONTAINER(table), 8); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); widget = gtk_check_button_new_with_label(_("Remember last view mode for each connection")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 0, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.save_view_mode); priv->save_view_mode_check = widget; widget = gtk_check_button_new_with_label(_("Save settings when starting the connection")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 1, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.save_when_connect); priv->save_when_connect_check = widget; widget = gtk_check_button_new_with_label(_("Invisible toolbar in fullscreen mode")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 2, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 2, 2, 1); if (gtk_widget_is_composited(GTK_WIDGET(dialog))) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.invisible_toolbar); @@ -389,64 +413,64 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_check_button_new_with_label(_("Always show tabs")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 3, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.always_show_tab); priv->always_show_tab_check = widget; widget = gtk_check_button_new_with_label(_("Hide toolbar in tabbed interface")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 4, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 4, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.hide_connection_toolbar); priv->hide_connection_toolbar_check = widget; widget = gtk_label_new(_("Double-click action")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 5, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 5, 1, 1); widget = remmina_public_create_combo_mapint(default_action_list, remmina_pref.default_action, FALSE, NULL); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 5, 2, 1); + remmina_pref_dialog_attach(table, widget, 1, 5, 2, 1); priv->default_action_combo = widget; widget = gtk_label_new(_("Default view mode")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 6, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 6, 1, 1); widget = remmina_public_create_combo_mapint(default_mode_list, remmina_pref.default_mode, FALSE, NULL); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 6, 2, 1); + remmina_pref_dialog_attach(table, widget, 1, 6, 2, 1); priv->default_mode_combo = widget; widget = gtk_label_new(_("Tab interface")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 7, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 7, 1, 1); widget = remmina_public_create_combo_mapint(tab_mode_list, remmina_pref.tab_mode, FALSE, NULL); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 7, 2, 1); + remmina_pref_dialog_attach(table, widget, 1, 7, 2, 1); priv->tab_mode_combo = widget; widget = gtk_label_new(_("Scale quality")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 8, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 8, 1, 1); widget = remmina_public_create_combo_mapint(scale_quality_list, remmina_pref.scale_quality, FALSE, NULL); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 8, 2, 1); + remmina_pref_dialog_attach(table, widget, 1, 8, 2, 1); priv->scale_quality_combo = widget; widget = gtk_label_new(_("SSH tunnel local port")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 9, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 9, 1, 1); widget = gtk_entry_new(); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 9, 2, 1); + remmina_pref_dialog_attach(table, widget, 1, 9, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(widget), 5); g_snprintf(buf, sizeof(buf), "%i", remmina_pref.sshtunnel_port); gtk_entry_set_text(GTK_ENTRY(widget), buf); @@ -455,11 +479,11 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_label_new(_("Auto scroll step size")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 10, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 10, 1, 1); widget = gtk_entry_new(); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 1, 10, 2, 1); + remmina_pref_dialog_attach(table, widget, 1, 10, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(widget), 3); g_snprintf(buf, sizeof(buf), "%i", remmina_pref.auto_scroll_step); gtk_entry_set_text(GTK_ENTRY(widget), buf); @@ -468,7 +492,7 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_label_new(_("Maximum recent items")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 11, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 11, 1, 1); #if GTK_VERSION == 3 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); @@ -476,7 +500,7 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) hbox = gtk_hbox_new(FALSE, 2); #endif gtk_widget_show(hbox); - gtk_grid_attach(GTK_GRID(table), hbox, 1, 11, 2, 1); + remmina_pref_dialog_attach(table, hbox, 1, 11, 2, 1); widget = gtk_entry_new(); gtk_widget_show(widget); @@ -527,34 +551,31 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) gtk_widget_show(vbox); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, tablabel); - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 4); - gtk_grid_set_column_spacing(GTK_GRID(table), 4); + table = remmina_pref_dialog_container_new(5, 2); gtk_container_set_border_width(GTK_CONTAINER(table), 8); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); widget = gtk_check_button_new_with_label(_("Show new connection on top of the menu")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 0, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.applet_new_ontop); priv->applet_new_ontop_check = widget; widget = gtk_check_button_new_with_label(_("Hide total count in group menu")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 1, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.applet_hide_count); priv->applet_hide_count_check = widget; widget = gtk_check_button_new_with_label(_("Disable tray icon")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 2, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 2, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.disable_tray_icon); priv->disable_tray_icon_check = widget; widget = gtk_check_button_new_with_label(_("Start Remmina in tray icon at user logon")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 3, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_icon_is_autostart()); gtk_widget_set_sensitive(widget, !remmina_pref.disable_tray_icon); priv->autostart_tray_icon_check = widget; @@ -562,7 +583,7 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) #ifdef ENABLE_MINIMIZE_TO_TRAY widget = gtk_check_button_new_with_label(_("Minimize windows to tray")); gtk_widget_show(widget); - gtk_grid_attach(GTK_GRID(table), widget, 0, 4, 2, 1); + remmina_pref_dialog_attach(table, widget, 0, 4, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.minimize_to_tray); gtk_widget_set_sensitive(widget, !remmina_pref.disable_tray_icon); priv->minimize_to_tray_check = widget; @@ -585,70 +606,81 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) gtk_widget_show(vbox); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, tablabel); - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 4); - gtk_grid_set_column_spacing(GTK_GRID(table), 4); + table = remmina_pref_dialog_container_new(9, 2); gtk_container_set_border_width(GTK_CONTAINER(table), 8); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); widget = gtk_label_new(_("Host key")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 0, 1, 1); widget = remmina_key_chooser_new(remmina_pref.hostkey); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 0, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 0, 2, 1); priv->hostkey_chooser = widget; widget = gtk_label_new(_("Toggle fullscreen mode")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 1, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 1, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_fullscreen); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 1, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 1, 2, 1); priv->shortcutkey_fullscreen_chooser = widget; widget = gtk_label_new(_("Auto-fit window")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 2, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 2, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_autofit); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 2, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 2, 2, 1); priv->shortcutkey_autofit_chooser = widget; widget = gtk_label_new(_("Switch tab pages")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 3, 1, 1); #if GTK_VERSION == 3 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); @@ -656,8 +688,10 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) hbox = gtk_hbox_new(TRUE, 2); #endif gtk_widget_show(hbox); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(hbox, TRUE); - gtk_grid_attach(GTK_GRID(table), hbox, 1, 3, 2, 1); +#endif + remmina_pref_dialog_attach(table, hbox, 1, 3, 2, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_prevtab); gtk_widget_show(widget); @@ -672,81 +706,101 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_label_new(_("Toggle scaled mode")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 4, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 4, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_scale); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 4, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 4, 2, 1); priv->shortcutkey_scale_chooser = widget; widget = gtk_label_new(_("Grab keyboard")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 5, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 5, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_grab); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 5, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 5, 2, 1); priv->shortcutkey_grab_chooser = widget; widget = gtk_label_new(_("Minimize window")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 6, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 6, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_minimize); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 6, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 6, 2, 1); priv->shortcutkey_minimize_chooser = widget; widget = gtk_label_new(_("Disconnect")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 7, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 7, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_disconnect); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 7, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 7, 2, 1); priv->shortcutkey_disconnect_chooser = widget; widget = gtk_label_new(_("Show / hide toolbar")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 8, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 8, 1, 1); widget = remmina_key_chooser_new(remmina_pref.shortcutkey_toolbar); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); - gtk_grid_attach(GTK_GRID(table), widget, 1, 8, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 8, 2, 1); priv->shortcutkey_toolbar_chooser = widget; /* Terminal tab */ @@ -762,28 +816,29 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) gtk_widget_show(vbox); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, tablabel); - table = gtk_grid_new(); - gtk_widget_show(table); - gtk_grid_set_row_spacing(GTK_GRID(table), 4); - gtk_grid_set_column_spacing(GTK_GRID(table), 4); + table = remmina_pref_dialog_container_new(6, 2); gtk_container_set_border_width(GTK_CONTAINER(table), 8); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); widget = gtk_label_new(_("Font")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 0, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 0, 1, 1); widget = gtk_check_button_new_with_label(_("Use system default font")); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); gtk_widget_set_margin_right (GTK_MISC(widget), 40); - gtk_grid_attach(GTK_GRID(table), widget, 1, 0, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 0, 2, 1); priv->vte_font_check = widget; if (!(remmina_pref.vte_font && remmina_pref.vte_font[0])) { @@ -792,13 +847,15 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_font_button_new(); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 1, 1, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 1, 2, 1); priv->vte_font_button = widget; if (remmina_pref.vte_font && remmina_pref.vte_font[0]) { @@ -814,35 +871,41 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_check_button_new_with_label(_("Allow bold text")); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 1, 2, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 2, 2, 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), remmina_pref.vte_allow_bold_text); priv->vte_allow_bold_text_check = widget; widget = gtk_label_new(_("Scrollback lines")); gtk_widget_show(widget); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); +#endif #endif gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); - gtk_grid_attach(GTK_GRID(table), widget, 0, 3, 1, 1); + remmina_pref_dialog_attach(table, widget, 0, 3, 1, 1); widget = gtk_entry_new(); gtk_widget_show(widget); +#if GTK_VERSION == 3 gtk_widget_set_hexpand(widget, TRUE); #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 1, 3, 2, 1); +#endif + remmina_pref_dialog_attach(table, widget, 1, 3, 2, 1); gtk_entry_set_max_length(GTK_ENTRY(widget), 5); g_snprintf(buf, sizeof(buf), "%i", remmina_pref.vte_lines); gtk_entry_set_text(GTK_ENTRY(widget), buf); @@ -851,12 +914,14 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = gtk_label_new(_("Keyboard")); gtk_widget_show(widget); gtk_misc_set_alignment(GTK_MISC(widget), 0.0, 0.5); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); #endif - gtk_grid_attach(GTK_GRID(table), widget, 0, 4, 1, 1); +#endif + remmina_pref_dialog_attach(table, widget, 0, 4, 1, 1); #if GTK_VERSION == 3 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); @@ -864,7 +929,7 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) hbox = gtk_hbox_new(FALSE, 2); #endif gtk_widget_show(hbox); - gtk_grid_attach(GTK_GRID(table), hbox, 1, 4, 2, 1); + remmina_pref_dialog_attach(table, hbox, 1, 4, 2, 1); widget = gtk_label_new(_("Copy")); gtk_widget_show(widget); @@ -880,10 +945,12 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = remmina_key_chooser_new(remmina_pref.vte_shortcutkey_copy); gtk_widget_show(widget); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); +#endif #endif gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); priv->vte_shortcutkey_copy_chooser = widget; @@ -894,7 +961,7 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) hbox = gtk_hbox_new(FALSE, 2); #endif gtk_widget_show(hbox); - gtk_grid_attach(GTK_GRID(table), hbox, 1, 5, 2, 1); + remmina_pref_dialog_attach(table, hbox, 1, 5, 2, 1); widget = gtk_label_new(_("Paste")); gtk_widget_show(widget); @@ -909,10 +976,12 @@ static void remmina_pref_dialog_init(RemminaPrefDialog *dialog) widget = remmina_key_chooser_new(remmina_pref.vte_shortcutkey_paste); gtk_widget_show(widget); +#if GTK_VERSION == 3 #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_end (GTK_MISC(widget), 40); #else gtk_widget_set_margin_right (GTK_MISC(widget), 40); +#endif #endif gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); priv->vte_shortcutkey_paste_chooser = widget; From 16fb24672efe5f43c6bd8786e357baf40ca6f06d Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 13 Sep 2014 00:13:23 +0200 Subject: [PATCH 14/18] Removed HTML tags to avoid gettext conflicts --- remmina/src/remmina_init_dialog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remmina/src/remmina_init_dialog.c b/remmina/src/remmina_init_dialog.c index 53a23039ba..fb440e9849 100644 --- a/remmina/src/remmina_init_dialog.c +++ b/remmina/src/remmina_init_dialog.c @@ -399,7 +399,7 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub GtkWidget* table; GtkWidget* widget; - gtk_label_set_text(GTK_LABEL(dialog->status_label), "Certificate Details:"); + gtk_label_set_text(GTK_LABEL(dialog->status_label), _("Certificate Details:")); /* Create table */ table = remmina_init_dialog_container_new(5, 2, FALSE); @@ -439,7 +439,7 @@ gint remmina_init_dialog_certificate(RemminaInitDialog* dialog, const gchar* sub remmina_init_dialog_attach(table, widget, 1, 2, 2, 1); widget = gtk_label_new (NULL); - gtk_label_set_markup(GTK_LABEL (widget), "Accept Certificate?"); + gtk_label_set_markup(GTK_LABEL (widget), _("Accept Certificate?")); gtk_misc_set_alignment(GTK_MISC(widget), 0.5, 0.5); gtk_widget_show(widget); remmina_init_dialog_attach(table, widget, 0, 3, 3, 1); From 5646b5431ab7670b98bbd44220fb722288726d38 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Sat, 13 Sep 2014 22:14:12 +0200 Subject: [PATCH 15/18] GTK3 migration - remmina_chain_button to grid layout --- remmina/src/remmina_chain_button.c | 10 ++++------ remmina/src/remmina_chain_button.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/remmina/src/remmina_chain_button.c b/remmina/src/remmina_chain_button.c index e3cf7e1525..d65dab8ec3 100644 --- a/remmina/src/remmina_chain_button.c +++ b/remmina/src/remmina_chain_button.c @@ -35,7 +35,7 @@ #include #include "remmina_chain_button.h" -G_DEFINE_TYPE (RemminaChainButton, remmina_chain_button, GTK_TYPE_TABLE) +G_DEFINE_TYPE (RemminaChainButton, remmina_chain_button, GTK_TYPE_GRID) static const gchar* line_up_xpm[] = { @@ -189,18 +189,16 @@ static void remmina_chain_button_init(RemminaChainButton* cb) GtkWidget* image; GdkPixbuf* pixbuf; - gtk_table_resize(GTK_TABLE(cb), 3, 1); - pixbuf = gdk_pixbuf_new_from_xpm_data(line_up_xpm); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_show(image); - gtk_table_attach_defaults(GTK_TABLE(cb), image, 0, 1, 0, 1); + gtk_grid_attach(GTK_GRID(cb), image, 0, 0, 1, 1); widget = gtk_button_new(); gtk_widget_show(widget); gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NONE); - gtk_table_attach_defaults(GTK_TABLE(cb), widget, 0, 1, 1, 2); + gtk_grid_attach(GTK_GRID(cb), widget, 0, 1, 1, 1); g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_chain_button_on_clicked), cb); image = gtk_image_new(); @@ -212,7 +210,7 @@ static void remmina_chain_button_init(RemminaChainButton* cb) image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_show(image); - gtk_table_attach_defaults(GTK_TABLE(cb), image, 0, 1, 2, 3); + gtk_grid_attach(GTK_GRID(cb), image, 0, 2, 1, 1); cb->chained = FALSE; } diff --git a/remmina/src/remmina_chain_button.h b/remmina/src/remmina_chain_button.h index 4106de4fdd..e022a1d570 100644 --- a/remmina/src/remmina_chain_button.h +++ b/remmina/src/remmina_chain_button.h @@ -47,7 +47,7 @@ G_BEGIN_DECLS typedef struct _RemminaChainButton { - GtkTable table; + GtkGrid table; gboolean chained; GtkWidget* chain_image; @@ -55,7 +55,7 @@ typedef struct _RemminaChainButton typedef struct _RemminaChainButtonClass { - GtkTableClass parent_class; + GtkGridClass parent_class; void (* chain_toggled) (RemminaChainButton* cb); } RemminaChainButtonClass; From 6a13014a7fa51ff33a16862b0711860abc5770c0 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 30 Nov 2014 05:48:14 -0500 Subject: [PATCH 16/18] For RemminaChainButton, use GtkGrid on GTK+3 and GtkTable on GTK+2 --- remmina/src/remmina_chain_button.c | 20 ++++++++++++++++++++ remmina/src/remmina_chain_button.h | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/remmina/src/remmina_chain_button.c b/remmina/src/remmina_chain_button.c index d65dab8ec3..7275caa2f9 100644 --- a/remmina/src/remmina_chain_button.c +++ b/remmina/src/remmina_chain_button.c @@ -35,7 +35,11 @@ #include #include "remmina_chain_button.h" +#if GTK_VERSION == 3 G_DEFINE_TYPE (RemminaChainButton, remmina_chain_button, GTK_TYPE_GRID) +#elif GTK_VERSION == 2 +G_DEFINE_TYPE (RemminaChainButton, remmina_chain_button, GTK_TYPE_TABLE) +#endif static const gchar* line_up_xpm[] = { @@ -189,16 +193,28 @@ static void remmina_chain_button_init(RemminaChainButton* cb) GtkWidget* image; GdkPixbuf* pixbuf; +#if GTK_VERSION == 2 + gtk_table_resize(GTK_TABLE(cb), 3, 1); +#endif + pixbuf = gdk_pixbuf_new_from_xpm_data(line_up_xpm); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_show(image); +#if GTK_VERSION == 3 gtk_grid_attach(GTK_GRID(cb), image, 0, 0, 1, 1); +#elif GTK_VERSION == 2 + gtk_table_attach_defaults(GTK_TABLE(cb), image, 0, 1, 0, 1); +#endif widget = gtk_button_new(); gtk_widget_show(widget); gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NONE); +#if GTK_VERSION == 3 gtk_grid_attach(GTK_GRID(cb), widget, 0, 1, 1, 1); +#elif GTK_VERSION == 2 + gtk_table_attach_defaults(GTK_TABLE(cb), widget, 0, 1, 1, 2); +#endif g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(remmina_chain_button_on_clicked), cb); image = gtk_image_new(); @@ -210,7 +226,11 @@ static void remmina_chain_button_init(RemminaChainButton* cb) image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_show(image); +#if GTK_VERSION == 3 gtk_grid_attach(GTK_GRID(cb), image, 0, 2, 1, 1); +#elif GTK_VERSION == 2 + gtk_table_attach_defaults(GTK_TABLE(cb), image, 0, 1, 2, 3); +#endif cb->chained = FALSE; } diff --git a/remmina/src/remmina_chain_button.h b/remmina/src/remmina_chain_button.h index e022a1d570..359f079982 100644 --- a/remmina/src/remmina_chain_button.h +++ b/remmina/src/remmina_chain_button.h @@ -36,6 +36,8 @@ #ifndef __REMMINACHAINBUTTON_H__ #define __REMMINACHAINBUTTON_H__ +#include "config.h" + G_BEGIN_DECLS #define REMMINA_TYPE_CHAIN_BUTTON (remmina_chain_button_get_type ()) @@ -47,7 +49,11 @@ G_BEGIN_DECLS typedef struct _RemminaChainButton { +#if GTK_VERSION == 3 GtkGrid table; +#elif GTK_VERSION == 2 + GtkTable table; +#endif gboolean chained; GtkWidget* chain_image; @@ -55,7 +61,11 @@ typedef struct _RemminaChainButton typedef struct _RemminaChainButtonClass { +#if GTK_VERSION == 3 GtkGridClass parent_class; +#elif GTK_VERSION == 2 + GtkTableClass parent_class; +#endif void (* chain_toggled) (RemminaChainButton* cb); } RemminaChainButtonClass; From 01f8d7c77de7c92d8d5420201081701e7b7abab6 Mon Sep 17 00:00:00 2001 From: Giovanni Panozzo Date: Sun, 14 Sep 2014 17:17:53 +0200 Subject: [PATCH 17/18] Update README --- README | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/README b/README index 1c24eee420..ab7a80024a 100644 --- a/README +++ b/README @@ -13,47 +13,11 @@ Remmina is released in separated source packages: Remmina is free and open-source software, released under GNU GPL license. + Resources --------- -Website: http://remmina.sourceforge.net -Wiki: http://sourceforge.net/apps/mediawiki/remmina/ -Forums: http://sourceforge.net/apps/phpbb/remmina/ +Wiki and compilation instructions: https://github.com/FreeRDP/Remmina/wiki Mailing List: https://lists.sourceforge.net/mailman/listinfo/remmina-common -Prerequisites -------------- - -On Ubuntu 12.04 or later, install the following packages to compile Remmina: - -cmake (>= 2.6) -libgtk-2-dev -libgcrypt11-dev -libssh-dev (>= 0.4) -libvte-2.90-dev -libxkbfile-dev -libfreerdp-dev (>= 1.1) -libtelepathy-glib-dev -libjpeg-dev -libgnutls-dev -libgnome-keyring-dev -libavahi-ui-gtk2-dev (>= 0.6.0) -libvncserver-dev - -Or be lazy and execute this: - -apt-get install cmake libgtk-3-dev libgcrypt11-dev libssh-dev libvte-2.90-dev libxkbfile-dev libfreerdp-dev libtelepathy-glib-dev libjpeg-dev libgnutls-dev libgnome-keyring-dev libavahi-ui-gtk3-dev libvncserver-dev libappindicator3-dev intltool - -If libfreerdb-dev is not available in the required version, you'll have to -compile and install it from source. Follow instructions at: -https://github.com/FreeRDP/FreeRDP/wiki/Compilation - -Compilation ------------ - -To compile and install, perform the following for all of the three main packages: -mkdir build -cmake --build=build -DGTK_VERSION=3 -DWITHOUT_GETTEXT -DWITHOUT_TRANSLATIONS . -make -sudo make install From c710d941a665710e57047b5fbd627e7fa24a9824 Mon Sep 17 00:00:00 2001 From: Rene Rheaume Date: Sun, 30 Nov 2014 11:29:35 -0500 Subject: [PATCH 18/18] * Corrected g_io_channel_* deprecation warnings * Corrected an unused variable * Corrected implicity used function strndup (might be uclibc specific) --- remmina-plugins/rdp/rdp_file.c | 4 ++-- remmina-plugins/rdp/rdp_plugin.c | 2 +- remmina/src/remmina_external_tools.c | 10 ++++++---- remmina/src/remmina_main.c | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/remmina-plugins/rdp/rdp_file.c b/remmina-plugins/rdp/rdp_file.c index 4ee497c033..d519bed16b 100644 --- a/remmina-plugins/rdp/rdp_file.c +++ b/remmina-plugins/rdp/rdp_file.c @@ -163,7 +163,7 @@ static RemminaFile* remmina_rdp_file_import_channel(GIOChannel* channel) else { enc = "UTF-8"; - if (g_io_channel_seek(channel, 0, G_SEEK_SET) != G_IO_ERROR_NONE) + if (g_io_channel_seek_position(channel, 0, G_SEEK_SET, &error) != G_IO_STATUS_NORMAL) { g_print("g_io_channel_seek: failed\n"); return NULL; @@ -233,7 +233,7 @@ RemminaFile* remmina_rdp_file_import(const gchar* from_file) } remminafile = remmina_rdp_file_import_channel(channel); - g_io_channel_close(channel); + g_io_channel_shutdown(channel, FALSE, &error); return remminafile; } diff --git a/remmina-plugins/rdp/rdp_plugin.c b/remmina-plugins/rdp/rdp_plugin.c index 8432a6b399..c1ced5f059 100644 --- a/remmina-plugins/rdp/rdp_plugin.c +++ b/remmina-plugins/rdp/rdp_plugin.c @@ -883,7 +883,7 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp) { if (!rfi->user_cancelled) { - UINT32 e = freerdp_get_last_error(rfi->instance->context); + //UINT32 e = freerdp_get_last_error(rfi->instance->context); remmina_plugin_service->protocol_plugin_set_error(gp, _("Unable to connect to RDP server %s"), rfi->settings->ServerHostname); } return FALSE; diff --git a/remmina/src/remmina_external_tools.c b/remmina/src/remmina_external_tools.c index 87cefe199c..7abe38f60d 100644 --- a/remmina/src/remmina_external_tools.c +++ b/remmina/src/remmina_external_tools.c @@ -30,6 +30,8 @@ gboolean remmina_external_tools_from_filename(RemminaMain *remminamain,gchar* re gchar filename[MAX_PATH_LEN]; GDir* dir; const gchar* name; + size_t noprefixlen; + gchar* unprefixed; GNode* root; root = g_node_new(NULL); @@ -48,12 +50,12 @@ gboolean remmina_external_tools_from_filename(RemminaMain *remminamain,gchar* re ret = (RemminaExternalTools *)malloc(sizeof(RemminaExternalTools)); strcpy(ret->remminafilename,remminafilename); strcpy(ret->scriptfilename,filename); - menuitem = gtk_menu_item_new_with_label(strndup(name + 8, strlen(name) -8)); + noprefixlen = strlen(name) - 8; + unprefixed = malloc(noprefixlen + 1); + strncpy(unprefixed, name + 8, noprefixlen); + menuitem = gtk_menu_item_new_with_label(unprefixed); g_signal_connect(menuitem, "activate", (GCallback) view_popup_menu_onDoSomething, ret); - //g_signal_connect(menuitem, "activate", - // (GCallback) view_popup_menu_onDoSomething, treeview); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); } g_dir_close(dir); diff --git a/remmina/src/remmina_main.c b/remmina/src/remmina_main.c index 92e23c8351..e4ae7af485 100644 --- a/remmina/src/remmina_main.c +++ b/remmina/src/remmina_main.c @@ -767,7 +767,7 @@ static void remmina_main_action_tools_addition(GtkAction *action, RemminaMain *r { RemminaToolPlugin *plugin; - plugin = (RemminaToolPlugin *) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_TOOL, g_action_get_name(action)); + plugin = (RemminaToolPlugin *) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_TOOL, gtk_action_get_name(action)); if (plugin) { plugin->exec_func(); @@ -1122,8 +1122,8 @@ static gboolean remmina_main_on_window_state_event(GtkWidget *widget, GdkEventWi gtk_widget_hide(widget); return TRUE; } - return FALSE; #endif + return FALSE; }