From 276eb145ce96d5f75f8d3901daf6310f60ddbb81 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Tue, 22 Nov 2016 15:02:51 -0500 Subject: move to GTK+3 (>= 3.14), drop libunique, GTK+2 code, and --with-gtk build option *Remove GTK_VERSION_CHECK (3, 0, 0) and libunique selectors *Remove GTK2 and libunique specific code. *Leaves selector for specific GTK3 versions. *Remove #DEFINES for vbox/hbox previously required for GTK2 compatability *Keep vbox in caja-spatial-window.c, it is necessary for the desktop to work *spatial-window vbox issue at https://github.com/mate-desktop/caja/issues/591 --- src/Makefile.am | 94 --- src/caja-application.c | 753 +------------------ src/caja-application.h | 47 +- src/caja-autorun-software.c | 5 - src/caja-bookmarks-window.c | 3 - src/caja-connect-server-dialog-main.c | 6 +- src/caja-connect-server-dialog-nonmain.c | 3 - src/caja-connect-server-dialog.c | 170 +---- src/caja-desktop-window.c | 6 - src/caja-emblem-sidebar.c | 14 +- src/caja-emblem-sidebar.h | 9 - src/caja-history-sidebar.c | 14 - src/caja-image-properties-page.c | 13 +- src/caja-image-properties-page.h | 8 - src/caja-information-panel.c | 82 --- src/caja-location-bar.c | 31 +- src/caja-location-dialog.c | 6 +- src/caja-location-entry.c | 15 - src/caja-main.c | 434 +---------- src/caja-main.h | 41 -- src/caja-navigation-window-menus.c | 13 +- src/caja-navigation-window-pane.c | 9 +- src/caja-navigation-window.c | 54 +- src/caja-navigation-window.h | 4 - src/caja-notebook.c | 24 +- src/caja-pathbar.c | 272 +------ src/caja-places-sidebar.c | 32 +- src/caja-property-browser.c | 94 +-- src/caja-query-editor.c | 25 +- src/caja-query-editor.h | 8 - src/caja-search-bar.c | 25 +- src/caja-side-pane.c | 26 +- src/caja-side-pane.h | 8 - src/caja-sidebar-title.c | 156 +--- src/caja-sidebar-title.h | 8 - src/caja-spatial-window.c | 50 +- src/caja-trash-bar.c | 8 +- src/caja-trash-bar.h | 10 +- src/caja-view-as-action.c | 6 +- src/caja-window-manage-views.c | 15 +- src/caja-window-private.h | 5 +- src/caja-window-slot.c | 15 +- src/caja-window.c | 112 +-- src/caja-x-content-bar.c | 8 +- src/caja-x-content-bar.h | 8 - src/caja-zoom-control.c | 95 +-- src/caja-zoom-control.h | 8 - src/file-manager/fm-desktop-icon-view.c | 16 +- src/file-manager/fm-directory-view.c | 93 +-- src/file-manager/fm-ditem-page.c | 68 +- src/file-manager/fm-icon-container.c | 2 - src/file-manager/fm-icon-view.c | 29 +- src/file-manager/fm-list-model.c | 8 - src/file-manager/fm-list-view.c | 79 +- src/file-manager/fm-properties-window.c | 1163 +----------------------------- src/file-manager/fm-tree-model.c | 8 - 56 files changed, 155 insertions(+), 4163 deletions(-) delete mode 100644 src/caja-main.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index ec3f575b..daeaa38b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,7 +26,6 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DVERSION="\"$(VERSION)\"" \ $(DISABLE_DEPRECATED_CFLAGS) \ - $(UNIQUE_CFLAGS) \ $(NULL) LDADD = \ @@ -66,7 +65,6 @@ BUILT_SOURCES = \ caja-src-marshal.h \ $(dbus_freedesktop_built_sources) \ $(NULL) -if ENABLE_LIBUNIQUE caja_SOURCES = \ caja-actions.h \ caja-application.c \ @@ -156,98 +154,6 @@ caja_SOURCES = \ caja-zoom-control.c \ caja-zoom-control.h \ $(NULL) -else -caja_SOURCES = \ - caja-actions.h \ - caja-application.c \ - caja-application.h \ - caja-bookmark-list.c \ - caja-bookmark-list.h \ - caja-bookmarks-window.c \ - caja-bookmarks-window.h \ - caja-connect-server-dialog.c \ - caja-connect-server-dialog.h \ - caja-connect-server-dialog-nonmain.c \ - caja-connect-server-operation.c \ - caja-connect-server-operation.h \ - caja-desktop-window.c \ - caja-desktop-window.h \ - caja-emblem-sidebar.c \ - caja-emblem-sidebar.h \ - caja-file-management-properties.c \ - caja-file-management-properties.h \ - caja-freedesktop-dbus.c \ - caja-freedesktop-dbus.h \ - caja-history-sidebar.c \ - caja-history-sidebar.h \ - caja-image-properties-page.c \ - caja-image-properties-page.h \ - caja-information-panel.c \ - caja-information-panel.h \ - caja-location-bar.c \ - caja-location-bar.h \ - caja-location-dialog.c \ - caja-location-dialog.h \ - caja-location-entry.c \ - caja-location-entry.h \ - caja-main.c \ - caja-main.h \ - caja-navigation-action.c \ - caja-navigation-action.h \ - caja-navigation-window-menus.c \ - caja-navigation-window.c \ - caja-navigation-window.h \ - caja-navigation-window-pane.c \ - caja-navigation-window-pane.h \ - caja-navigation-window-slot.c \ - caja-navigation-window-slot.h \ - caja-notebook.c \ - caja-notebook.h \ - caja-notes-viewer.c \ - caja-notes-viewer.h \ - caja-pathbar.c \ - caja-pathbar.h \ - caja-places-sidebar.c \ - caja-places-sidebar.h \ - caja-property-browser.c \ - caja-property-browser.h \ - caja-query-editor.c \ - caja-query-editor.h \ - caja-search-bar.c \ - caja-search-bar.h \ - caja-self-check-functions.c \ - caja-self-check-functions.h \ - caja-side-pane.c \ - caja-side-pane.h \ - caja-sidebar-title.c \ - caja-sidebar-title.h \ - caja-spatial-window.c \ - caja-spatial-window.h \ - caja-trash-bar.c \ - caja-trash-bar.h \ - caja-view-as-action.c \ - caja-view-as-action.h \ - caja-window-bookmarks.c \ - caja-window-bookmarks.h \ - caja-window-manage-views.c \ - caja-window-manage-views.h \ - caja-window-menus.c \ - caja-window-pane.c \ - caja-window-pane.h \ - caja-window-private.h \ - caja-window-slot.c \ - caja-window-slot.h \ - caja-window-toolbars.c \ - caja-window.c \ - caja-window.h \ - caja-x-content-bar.c \ - caja-x-content-bar.h \ - caja-zoom-action.c \ - caja-zoom-action.h \ - caja-zoom-control.c \ - caja-zoom-control.h \ - $(NULL) -endif nodist_caja_SOURCES = \ $(BUILT_SOURCES) \ diff --git a/src/caja-application.c b/src/caja-application.c index 83702a9f..49958d39 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -39,9 +39,7 @@ #include "caja-information-panel.h" #include "caja-history-sidebar.h" #include "caja-places-sidebar.h" -#if ENABLE_LIBUNIQUE == (FALSE) #include "caja-self-check-functions.h" -#endif #include "caja-notes-viewer.h" #include "caja-emblem-sidebar.h" #include "caja-image-properties-page.h" @@ -49,9 +47,6 @@ #include #include #include "caja-desktop-window.h" -#if ENABLE_LIBUNIQUE == (TRUE) -#include "caja-main.h" -#endif #include "caja-spatial-window.h" #include "caja-navigation-window.h" #include "caja-window-slot.h" @@ -74,9 +69,7 @@ #include #include #include -#if ENABLE_LIBUNIQUE == (FALSE) #include -#endif #include #include #include @@ -87,19 +80,10 @@ #define MATE_DESKTOP_USE_UNSTABLE_API #include -#if ENABLE_LIBUNIQUE == (FALSE) #include #include #include -#else -enum { - COMMAND_0, /* unused: 0 is an invalid command */ - COMMAND_START_DESKTOP, - COMMAND_STOP_DESKTOP, - COMMAND_OPEN_BROWSER, -}; -#endif /* Keep window from shrinking down ridiculously small; numbers are somewhat arbitrary */ #define APPLICATION_WINDOW_MIN_WIDTH 300 #define APPLICATION_WINDOW_MIN_HEIGHT 100 @@ -109,10 +93,6 @@ enum { /* Keeps track of all the desktop windows. */ static GList *caja_application_desktop_windows; -#if ENABLE_LIBUNIQUE == (TRUE) -/* Keeps track of all the caja windows. */ -static GList *caja_application_window_list; -#endif /* Keeps track of all the object windows */ static GList *caja_application_spatial_window_list; @@ -123,9 +103,7 @@ static gboolean save_of_accel_map_requested = FALSE; static CajaFreedesktopDBus *fdb_manager = NULL; static void desktop_changed_callback (gpointer user_data); -#if ENABLE_LIBUNIQUE == (TRUE) -static void desktop_location_changed_callback (gpointer user_data); -#endif + static void mount_removed_callback (GVolumeMonitor *monitor, GMount *mount, CajaApplication *application); @@ -143,15 +121,11 @@ static void volume_removed_callback (GVolumeMonitor *mo CajaApplication *application); static void drive_listen_for_eject_button (GDrive *drive, CajaApplication *application); -#if ENABLE_LIBUNIQUE == (FALSE) + static void caja_application_load_session (CajaApplication *application); static char * caja_application_get_session_data (CajaApplication *self); void caja_application_quit (CajaApplication *self); -#else -static void caja_application_load_session (CajaApplication *application); -static char * caja_application_get_session_data (void); -#endif -#if ENABLE_LIBUNIQUE == (FALSE) + G_DEFINE_TYPE (CajaApplication, caja_application, GTK_TYPE_APPLICATION); struct _CajaApplicationPriv { GVolumeMonitor *volume_monitor; @@ -161,90 +135,7 @@ struct _CajaApplicationPriv { gchar *geometry; }; -#else -G_DEFINE_TYPE (CajaApplication, caja_application, G_TYPE_OBJECT); - -static gboolean -_unique_message_data_set_geometry_and_uris (UniqueMessageData *message_data, - const char *geometry, - char **uris) -{ - GString *list; - gint i; - gchar *result; - gsize length; - - list = g_string_new (NULL); - if (geometry != NULL) - { - g_string_append (list, geometry); - } - g_string_append (list, "\r\n"); - - for (i = 0; uris != NULL && uris[i]; i++) - { - g_string_append (list, uris[i]); - g_string_append (list, "\r\n"); - } - - result = g_convert (list->str, list->len, - "ASCII", "UTF-8", - NULL, &length, NULL); - g_string_free (list, TRUE); - - if (result) - { - unique_message_data_set (message_data, (guchar *) result, length); - g_free (result); - return TRUE; - } - return FALSE; -} - -static gchar ** -_unique_message_data_get_geometry_and_uris (UniqueMessageData *message_data, - char **geometry) -{ - gchar **result = NULL; - - *geometry = NULL; - - gchar *text, *newline, *uris; - text = unique_message_data_get_text (message_data); - if (text) - { - newline = strchr (text, '\n'); - if (newline) - { - *geometry = g_strndup (text, newline-text); - uris = newline+1; - } - else - { - uris = text; - } - - result = g_uri_list_extract_uris (uris); - g_free (text); - } - - /* if the string is empty, make it NULL */ - if (*geometry && strlen (*geometry) == 0) - { - g_free (*geometry); - *geometry = NULL; - } - - return result; -} - -GList * -caja_application_get_window_list (void) -{ - return caja_application_window_list; -} -#endif GList * @@ -253,14 +144,6 @@ caja_application_get_spatial_window_list (void) return caja_application_spatial_window_list; } -#if ENABLE_LIBUNIQUE == (TRUE) -unsigned int -caja_application_get_n_windows (void) -{ - return g_list_length (caja_application_window_list) + - g_list_length (caja_application_desktop_windows); -} -#endif static void startup_volume_mount_cb (GObject *source_object, GAsyncResult *res, @@ -279,11 +162,9 @@ automount_all_volumes (CajaApplication *application) if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT)) { /* automount all mountable volumes at start-up */ -#if ENABLE_LIBUNIQUE == (FALSE) + volumes = g_volume_monitor_get_volumes (application->priv->volume_monitor); -#else - volumes = g_volume_monitor_get_volumes (application->volume_monitor); -#endif + for (l = volumes; l != NULL; l = l->next) { volume = l->data; @@ -315,15 +196,9 @@ smclient_save_state_cb (EggSMClient *client, CajaApplication *application) { char *data; -#if ENABLE_LIBUNIQUE == (FALSE) data = caja_application_get_session_data (application); - if (data != NULL) -#else - data = caja_application_get_session_data (); - - if (data) -#endif + if (data != NULL) { g_key_file_set_string (state_file, "Caja", @@ -337,15 +212,9 @@ static void smclient_quit_cb (EggSMClient *client, CajaApplication *application) { -#if ENABLE_LIBUNIQUE == (FALSE) caja_application_quit (application); -#else - caja_main_event_loop_quit (TRUE); -#endif } -#if ENABLE_LIBUNIQUE == (FALSE) - static void caja_application_smclient_initialize (CajaApplication *self) { @@ -419,7 +288,6 @@ open_window (CajaApplication *application, g_free (uri); } - static void open_windows (CajaApplication *application, GFile **files, @@ -532,56 +400,6 @@ caja_application_init (CajaApplication *application) g_object_unref (action); } -#else -static void -caja_application_init (CajaApplication *application) -{ - application->unique_app = unique_app_new_with_commands ("org.mate.Caja", NULL, - "start_desktop", COMMAND_START_DESKTOP, - "stop_desktop", COMMAND_STOP_DESKTOP, - "open_browser", COMMAND_OPEN_BROWSER, - NULL); - application->smclient = egg_sm_client_get (); - g_signal_connect (application->smclient, "save_state", - G_CALLBACK (smclient_save_state_cb), - application); - g_signal_connect (application->smclient, "quit", - G_CALLBACK (smclient_quit_cb), - application); - /* TODO: Should connect to quit_requested and block logout on active transfer? */ - - /* register views */ - fm_icon_view_register (); - fm_desktop_icon_view_register (); - fm_list_view_register (); - fm_compact_view_register (); -#if ENABLE_EMPTY_VIEW - fm_empty_view_register (); -#endif /* ENABLE_EMPTY_VIEW */ - - /* register sidebars */ - caja_places_sidebar_register (); - caja_information_panel_register (); - fm_tree_view_register (); - caja_history_sidebar_register (); - caja_notes_viewer_register (); /* also property page */ - caja_emblem_sidebar_register (); - - /* register property pages */ - caja_image_properties_page_register (); - - /* initialize search path for custom icons */ - gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), - CAJA_DATADIR G_DIR_SEPARATOR_S "icons"); -} - -CajaApplication * -caja_application_new (void) -{ - return g_object_new (CAJA_TYPE_APPLICATION, NULL); -} -#endif - static void caja_application_finalize (GObject *object) { @@ -590,7 +408,7 @@ caja_application_finalize (GObject *object) application = CAJA_APPLICATION (object); caja_bookmarks_exiting (); -#if ENABLE_LIBUNIQUE == (FALSE) + if (application->volume_monitor) { g_object_unref (application->priv->volume_monitor); @@ -599,15 +417,6 @@ caja_application_finalize (GObject *object) g_free (application->priv->geometry); -#else - if (application->volume_monitor) - { - g_object_unref (application->volume_monitor); - application->volume_monitor = NULL; - } - - g_object_unref (application->unique_app); -#endif if (application->ss_watch_id > 0) { g_bus_unwatch_name (application->ss_watch_id); @@ -636,9 +445,9 @@ caja_application_finalize (GObject *object) g_object_unref (application->ss_proxy); application->ss_proxy = NULL; } -#if ENABLE_LIBUNIQUE == (FALSE) + notify_uninit (); -#endif + G_OBJECT_CLASS (caja_application_parent_class)->finalize (object); } @@ -705,14 +514,9 @@ check_required_directories (CajaApplication *application) dialog = eel_show_error_dialog (error_string, detail_string, NULL); /* We need the main event loop so the user has a chance to see the dialog. */ -#if ENABLE_LIBUNIQUE == (FALSE) + gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (dialog)); -#elif GTK_CHECK_VERSION (3, 0, 0) - caja_main_event_loop_register (GTK_WIDGET (dialog)); -#else - caja_main_event_loop_register (GTK_OBJECT (dialog)); -#endif g_string_free (directories_as_string, TRUE); g_free (error_string); @@ -941,393 +745,6 @@ do_initialize_screensaver (CajaApplication *application) NULL); } -#if ENABLE_LIBUNIQUE == (TRUE) -#if GTK_CHECK_VERSION (3, 0, 0) - -static void -init_css (void) -{ - GtkCssProvider *provider; - GError *error = NULL; - - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_path (provider, - CAJA_DATADIR G_DIR_SEPARATOR_S "caja.css", &error); - - if (error != NULL) { - g_warning ("Failed to load application css file: %s", error->message); - g_error_free (error); - } else { - gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } - - g_object_unref (provider); -} -#endif - -static void -finish_startup (CajaApplication *application, - gboolean no_desktop) -{ - GList *drives; - - /* initialize caja modules */ - caja_module_setup (); - - /* attach menu-provider module callback */ - menu_provider_init_callback (); - - /* Initialize the desktop link monitor singleton */ - caja_desktop_link_monitor_get (); - - /* Initialize MATE screen saver listener to control automount - * permission */ - do_initialize_screensaver (application); - - /* Watch for mounts so we can restore open windows This used - * to be for showing new window on mount, but is not used - * anymore */ - - /* Watch for unmounts so we can close open windows */ - /* TODO-gio: This should be using the UNMOUNTED feature of GFileMonitor instead */ - - application->volume_monitor = g_volume_monitor_get (); - g_signal_connect_object (application->volume_monitor, "mount_removed", - G_CALLBACK (mount_removed_callback), application, 0); - g_signal_connect_object (application->volume_monitor, "mount_pre_unmount", - G_CALLBACK (mount_removed_callback), application, 0); - g_signal_connect_object (application->volume_monitor, "mount_added", - G_CALLBACK (mount_added_callback), application, 0); - g_signal_connect_object (application->volume_monitor, "volume_added", - G_CALLBACK (volume_added_callback), application, 0); - g_signal_connect_object (application->volume_monitor, "volume_removed", - G_CALLBACK (volume_removed_callback), application, 0); - g_signal_connect_object (application->volume_monitor, "drive_connected", - G_CALLBACK (drive_connected_callback), application, 0); - - /* listen for eject button presses */ - drives = g_volume_monitor_get_connected_drives (application->volume_monitor); - g_list_foreach (drives, (GFunc) drive_listen_for_eject_button, application); - g_list_free_full (drives, g_object_unref); - - application->automount_idle_id = - g_idle_add_full (G_PRIORITY_LOW, - automount_all_volumes_idle_cb, - application, NULL); -} - -static void -open_window (CajaApplication *application, - const char *startup_id, - const char *uri, GdkScreen *screen, const char *geometry, - gboolean browser_window) -{ - GFile *location; - CajaWindow *window; - - if (uri == NULL) { - location = g_file_new_for_path (g_get_home_dir ()); - } else { - location = g_file_new_for_uri (uri); - } - - if (browser_window || - g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { - window = caja_application_create_navigation_window (application, - startup_id, - screen); - } else { - window = caja_application_get_spatial_window (application, - NULL, - startup_id, - location, - screen, - NULL); - } - - caja_window_go_to (window, location); - - g_object_unref (location); - - if (geometry != NULL && !gtk_widget_get_visible (GTK_WIDGET (window))) - { - /* never maximize windows opened from shell if a - * custom geometry has been requested. - */ - gtk_window_unmaximize (GTK_WINDOW (window)); - eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window), - geometry, - APPLICATION_WINDOW_MIN_WIDTH, - APPLICATION_WINDOW_MIN_HEIGHT, - FALSE); - } -} - -static void -open_windows (CajaApplication *application, - const char *startup_id, - char **uris, - GdkScreen *screen, - const char *geometry, - gboolean browser_window) -{ - guint i; - - if (uris == NULL || uris[0] == NULL) - { - /* Open a window pointing at the default location. */ - open_window (application, startup_id, NULL, screen, geometry, browser_window); - } - else - { - /* Open windows at each requested location. */ - for (i = 0; uris[i] != NULL; i++) - { - open_window (application, startup_id, uris[i], screen, geometry, browser_window); - } - } -} - -void -caja_application_open_location (CajaApplication *application, - GFile *location, - GFile *selection, - const char *startup_id) -{ - CajaWindow *window; - GList *sel_list = NULL; - - window = caja_application_create_navigation_window (application, startup_id, gdk_screen_get_default ()); - - if (selection != NULL) { - sel_list = g_list_prepend (NULL, g_object_ref (selection)); - } - - caja_window_slot_open_location_full (caja_window_get_active_slot (window), location, - 0, CAJA_WINDOW_OPEN_FLAG_NEW_WINDOW, sel_list, NULL, NULL); - - if (sel_list != NULL) { - caja_file_list_free (sel_list); - } -} - -static UniqueResponse -message_received_cb (UniqueApp *unique_app, - gint command, - UniqueMessageData *message, - guint time_, - gpointer user_data) -{ - CajaApplication *application; - UniqueResponse res; - char **uris; - char *geometry; - GdkScreen *screen; - - application = user_data; - res = UNIQUE_RESPONSE_OK; - - switch (command) - { - case UNIQUE_CLOSE: - res = UNIQUE_RESPONSE_OK; - caja_main_event_loop_quit (TRUE); - - break; - case UNIQUE_OPEN: - case COMMAND_OPEN_BROWSER: - uris = _unique_message_data_get_geometry_and_uris (message, &geometry); - screen = unique_message_data_get_screen (message); - open_windows (application, - unique_message_data_get_startup_id (message), - uris, - screen, - geometry, - command == COMMAND_OPEN_BROWSER); - g_strfreev (uris); - g_free (geometry); - break; - case COMMAND_START_DESKTOP: - caja_application_open_desktop (application); - break; - case COMMAND_STOP_DESKTOP: - caja_application_close_desktop (); - break; - default: - res = UNIQUE_RESPONSE_PASSTHROUGH; - break; - } - - return res; -} - -gboolean -caja_application_save_accel_map (gpointer data) -{ - if (save_of_accel_map_requested) - { - char *accel_map_filename; - accel_map_filename = caja_get_accel_map_file (); - if (accel_map_filename) - { - gtk_accel_map_save (accel_map_filename); - g_free (accel_map_filename); - } - save_of_accel_map_requested = FALSE; - } - - return FALSE; -} - - -static void -queue_accel_map_save_callback (GtkAccelMap *object, gchar *accel_path, - guint accel_key, GdkModifierType accel_mods, - gpointer user_data) -{ - if (!save_of_accel_map_requested) - { - save_of_accel_map_requested = TRUE; - g_timeout_add_seconds (CAJA_ACCEL_MAP_SAVE_DELAY, - caja_application_save_accel_map, NULL); - } -} - -static gboolean -desktop_changed_callback_connect (CajaApplication *application) -{ - g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - G_CALLBACK(desktop_location_changed_callback), - G_OBJECT (application)); - return FALSE; -} - -void -caja_application_startup (CajaApplication *application, - gboolean kill_shell, - gboolean no_default_window, - gboolean no_desktop, - gboolean browser_window, - const char *geometry, - char **urls) -{ - UniqueMessageData *message; - - /* Check the user's ~/.config/caja directories and post warnings - * if there are problems. - */ - if (!kill_shell && !check_required_directories (application)) - { - return; - } - - if (kill_shell) - { - if (unique_app_is_running (application->unique_app)) - { - unique_app_send_message (application->unique_app, - UNIQUE_CLOSE, NULL); - - } - } - else - { - char *accel_map_filename; - - if (!no_desktop && - !g_settings_get_boolean (mate_background_preferences, MATE_BG_KEY_SHOW_DESKTOP)) - { - no_desktop = TRUE; - } - - if (!no_desktop) - { - if (unique_app_is_running (application->unique_app)) - { - unique_app_send_message (application->unique_app, - COMMAND_START_DESKTOP, NULL); - } - else - { - caja_application_open_desktop (application); - } - } - - if (!unique_app_is_running (application->unique_app)) - { - finish_startup (application, no_desktop); - g_signal_connect (application->unique_app, "message-received", G_CALLBACK (message_received_cb), application); - } - -#if GTK_CHECK_VERSION (3, 0, 0) - /* initialize CSS theming */ - init_css (); -#endif - - - /* Start the File Manager DBus Interface */ - fdb_manager = caja_freedesktop_dbus_new (application); - - /* Monitor the preference to show or hide the desktop */ - g_signal_connect_swapped (mate_background_preferences, - "changed::" MATE_BG_KEY_SHOW_DESKTOP, - G_CALLBACK(desktop_changed_callback), - G_OBJECT (application)); - - /* Monitor the preference to have the desktop */ - /* point to the Unix home folder */ - g_timeout_add_seconds (30, (GSourceFunc) desktop_changed_callback_connect, application); - - /* Create the other windows. */ - if (urls != NULL || !no_default_window) - { - if (unique_app_is_running (application->unique_app)) - { - message = unique_message_data_new (); - _unique_message_data_set_geometry_and_uris (message, geometry, urls); - if (browser_window) - { - unique_app_send_message (application->unique_app, - COMMAND_OPEN_BROWSER, message); - } - else - { - unique_app_send_message (application->unique_app, - UNIQUE_OPEN, message); - } - unique_message_data_free (message); - } - else - { - open_windows (application, NULL, - urls, - gdk_display_get_default_screen (gdk_display_get_default()), - // gdk_screen_get_default (), - geometry, - browser_window); - } - } - - /* Load session info if availible */ - caja_application_load_session (application); - - /* Initialize notifications for eject operations */ - notify_init (GETTEXT_PACKAGE); - - /* load accelerator map, and register save callback */ - accel_map_filename = caja_get_accel_map_file (); - if (accel_map_filename) - { - gtk_accel_map_load (accel_map_filename); - g_free (accel_map_filename); - } - g_signal_connect (gtk_accel_map_get (), "changed", G_CALLBACK (queue_accel_map_save_callback), NULL); - } -} -#endif - static void selection_get_cb (GtkWidget *widget, GtkSelectionData *selection_data, @@ -1399,22 +816,12 @@ selection_clear_event_cb (GtkWidget *widget, static void caja_application_create_desktop_windows (CajaApplication *application) { -#if ENABLE_LIBUNIQUE == (TRUE) - static gboolean create_in_progress = FALSE; -#endif GdkDisplay *display; CajaDesktopWindow *window; GtkWidget *selection_widget; g_return_if_fail (caja_application_desktop_windows == NULL); g_return_if_fail (CAJA_IS_APPLICATION (application)); -#if ENABLE_LIBUNIQUE == (TRUE) - if (create_in_progress) - { - return; - } - create_in_progress = TRUE; -#endif display = gdk_display_get_default (); selection_widget = get_desktop_manager_selection (display); @@ -1436,14 +843,9 @@ caja_application_create_desktop_windows (CajaApplication *application) caja_application_desktop_windows = g_list_prepend (caja_application_desktop_windows, window); -#if ENABLE_LIBUNIQUE == (FALSE) gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); } -#else - } - create_in_progress = FALSE; -#endif } void @@ -1454,11 +856,7 @@ caja_application_open_desktop (CajaApplication *application) caja_application_create_desktop_windows (application); } } -#if ENABLE_LIBUNIQUE == (FALSE) static void -#else -void -#endif caja_application_close_desktop (void) { if (caja_application_desktop_windows != NULL) @@ -1469,19 +867,11 @@ caja_application_close_desktop (void) } void -#if ENABLE_LIBUNIQUE == (FALSE) caja_application_close_all_navigation_windows (CajaApplication *self) { GList *list_copy; GList *l; list_copy = g_list_copy (gtk_application_get_windows (GTK_APPLICATION (self))); -#else -caja_application_close_all_navigation_windows (void) -{ - GList *list_copy; - GList *l; - list_copy = g_list_copy (caja_application_window_list); -#endif /* First hide all window to get the feeling of quick response */ for (l = list_copy; l != NULL; l = l->next) { @@ -1643,17 +1033,6 @@ caja_application_close_all_spatial_windows (void) g_list_free (list_copy); } -#if ENABLE_LIBUNIQUE == (TRUE) -static void -#if GTK_CHECK_VERSION (3, 0, 0) -caja_application_destroyed_window (GtkWidget *object, CajaApplication *application) -#else -caja_application_destroyed_window (GtkObject *object, CajaApplication *application) -#endif -{ - caja_application_window_list = g_list_remove (caja_application_window_list, object); -} -#endif static gboolean caja_window_delete_event_callback (GtkWidget *widget, GdkEvent *event, @@ -1671,9 +1050,6 @@ caja_window_delete_event_callback (GtkWidget *widget, static CajaWindow * create_window (CajaApplication *application, GType window_type, -#if ENABLE_LIBUNIQUE == (TRUE) - const char *startup_id, -#endif GdkScreen *screen) { CajaWindow *window; @@ -1684,23 +1060,13 @@ create_window (CajaApplication *application, "app", application, "screen", screen, NULL)); -#if ENABLE_LIBUNIQUE == (TRUE) - if (startup_id) - { - gtk_window_set_startup_id (GTK_WINDOW (window), startup_id); - } -#endif g_signal_connect_data (window, "delete_event", G_CALLBACK (caja_window_delete_event_callback), NULL, NULL, G_CONNECT_AFTER); -#if ENABLE_LIBUNIQUE == (FALSE) + gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); -#else - g_signal_connect_object (window, "destroy", - G_CALLBACK (caja_application_destroyed_window), application, 0); - caja_application_window_list = g_list_prepend (caja_application_window_list, window); -#endif + /* Do not yet show the window. It will be shown later on if it can * successfully display its initial URI. Otherwise it will be destroyed * without ever having seen the light of day. @@ -1742,11 +1108,8 @@ caja_application_get_spatial_window (CajaApplication *application, if (existing != NULL) { *existing = FALSE; } -#if ENABLE_LIBUNIQUE == (FALSE) window = create_window (application, CAJA_TYPE_SPATIAL_WINDOW, screen); -#else - window = create_window (application, CAJA_TYPE_SPATIAL_WINDOW, startup_id, screen); -#endif + if (requesting_window) { /* Center the window over the requesting window by default */ @@ -1787,9 +1150,6 @@ caja_application_get_spatial_window (CajaApplication *application, CajaWindow * caja_application_create_navigation_window (CajaApplication *application, -#if ENABLE_LIBUNIQUE == (TRUE) - const char *startup_id, -#endif GdkScreen *screen) { CajaWindow *window; @@ -1797,11 +1157,8 @@ caja_application_create_navigation_window (CajaApplication *application, gboolean maximized; g_return_val_if_fail (CAJA_IS_APPLICATION (application), NULL); -#if ENABLE_LIBUNIQUE == (FALSE) window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, screen); -#else - window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, startup_id, screen); -#endif + maximized = g_settings_get_boolean (caja_window_state, CAJA_WINDOW_STATE_MAXIMIZED); if (maximized) @@ -1833,18 +1190,7 @@ caja_application_create_navigation_window (CajaApplication *application, return window; } -#if ENABLE_LIBUNIQUE == (TRUE) -/* callback for changing the directory the desktop points to */ -static void -desktop_location_changed_callback (gpointer user_data) -{ - if (caja_application_desktop_windows != NULL) - { - g_list_foreach (caja_application_desktop_windows, - (GFunc) caja_desktop_window_update_directory, NULL); - } -} -#endif + /* callback for showing or hiding the desktop based on the user's preference */ static void desktop_changed_callback (gpointer user_data) @@ -1989,9 +1335,6 @@ autorun_show_window (GMount *mount, gpointer user_data) /* There should probably be an easier way to do this */ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif gdk_screen_get_default ()); } else @@ -2008,7 +1351,7 @@ autorun_show_window (GMount *mount, gpointer user_data) g_object_unref (location); } -#if ENABLE_LIBUNIQUE == (FALSE) + static void mount_added_callback (GVolumeMonitor *monitor, GMount *mount, @@ -2031,27 +1374,7 @@ mount_added_callback (GVolumeMonitor *monitor, caja_directory_unref (directory); } } -#else -static void -mount_added_callback (GVolumeMonitor *monitor, - GMount *mount, - CajaApplication *application) -{ - CajaDirectory *directory; - GFile *root; - - root = g_mount_get_root (mount); - directory = caja_directory_get_existing (root); - g_object_unref (root); - if (directory != NULL) - { - caja_directory_force_reload (directory); - caja_directory_unref (directory); - } - caja_autorun (mount, autorun_show_window, application); -} -#endif static CajaWindowSlot * get_first_navigation_slot (GList *slot_list) { @@ -2106,11 +1429,7 @@ mount_removed_callback (GVolumeMonitor *monitor, unclosed_slot = FALSE; /* Check and see if any of the open windows are displaying contents from the unmounted mount */ -#if ENABLE_LIBUNIQUE == (FALSE) window_list = gtk_application_get_windows (GTK_APPLICATION (application)); -#else - window_list = caja_application_get_window_list (); -#endif root = g_mount_get_root (mount); /* Construct a list of windows to be closed. Do not add the non-closable windows to the list. */ for (node = window_list; node != NULL; node = node->next) @@ -2225,21 +1544,14 @@ icon_from_string (const char *string) } return NULL; } -#if ENABLE_LIBUNIQUE == (FALSE) + static char * caja_application_get_session_data (CajaApplication *self) -#else -static char * -caja_application_get_session_data (void) -#endif { xmlDocPtr doc; xmlNodePtr root_node, history_node; -#if ENABLE_LIBUNIQUE == (FALSE) GList *l, *window_list; -#else - GList *l; -#endif + char *data; unsigned n_processed; xmlSaveCtxtPtr ctx; @@ -2268,11 +1580,8 @@ caja_application_get_session_data (void) g_free (tmp); icon = caja_bookmark_get_icon (bookmark); -#if ENABLE_LIBUNIQUE == (FALSE) + tmp = g_icon_to_string (icon); -#else - tmp = icon_to_string (icon); -#endif g_object_unref (icon); if (tmp) { xmlNewProp (bookmark_node, "icon", tmp); @@ -2291,12 +1600,8 @@ caja_application_get_session_data (void) break; } } -#if ENABLE_LIBUNIQUE == (FALSE) window_list = gtk_application_get_windows (GTK_APPLICATION (self)); for (l = window_list; l != NULL; l = l->next) { -#else - for (l = caja_application_window_list; l != NULL; l = l->next) { -#endif xmlNodePtr win_node, slot_node; CajaWindow *window; CajaWindowSlot *slot, *active_slot; @@ -2392,9 +1697,7 @@ caja_application_load_session (CajaApplication *application) xmlNodePtr root_node; GKeyFile *state_file; char *data; -#if ENABLE_LIBUNIQUE == (FALSE) caja_application_smclient_initialize (application); -#endif if (!egg_sm_client_is_resumed (application->smclient)) { return; @@ -2458,11 +1761,7 @@ caja_application_load_session (CajaApplication *application) icon = NULL; if (icon_str) { -#if ENABLE_LIBUNIQUE == (FALSE) icon = g_icon_new_for_string (icon_str, NULL); -#else - icon = icon_from_string (icon_str); -#endif } location = g_file_new_for_uri (uri); @@ -2521,11 +1820,7 @@ caja_application_load_session (CajaApplication *application) if (g_strcmp0 (type, "navigation") == 0) { xmlChar *geometry; -#if ENABLE_LIBUNIQUE == (FALSE) window = caja_application_create_navigation_window (application, gdk_screen_get_default ()); -#else - window = caja_application_create_navigation_window (application, NULL, gdk_screen_get_default ()); -#endif geometry = xmlGetProp (node, "geometry"); if (geometry != NULL) { @@ -2647,7 +1942,6 @@ caja_application_load_session (CajaApplication *application) } } -#if ENABLE_LIBUNIQUE == (FALSE) static gboolean do_cmdline_sanity_checks (CajaApplication *self, gboolean perform_self_check, @@ -3146,13 +2440,4 @@ caja_application_new (void) "flags", G_APPLICATION_HANDLES_OPEN, NULL); } -#else -static void -caja_application_class_init (CajaApplicationClass *class) -{ - GObjectClass *object_class; - object_class = G_OBJECT_CLASS (class); - object_class->finalize = caja_application_finalize; -} -#endif diff --git a/src/caja-application.h b/src/caja-application.h index 7aeaa8a4..e48b4ba1 100644 --- a/src/caja-application.h +++ b/src/caja-application.h @@ -31,9 +31,7 @@ #include #include #include -#if ENABLE_LIBUNIQUE == (TRUE) -#include -#endif + #include #define CAJA_DESKTOP_ICON_VIEW_IID "OAFIID:Caja_File_Manager_Desktop_Icon_View" @@ -61,21 +59,13 @@ typedef struct CajaWindow CajaWindow; typedef struct _CajaSpatialWindow CajaSpatialWindow; #endif -#if ENABLE_LIBUNIQUE == (FALSE) typedef struct _CajaApplicationPriv CajaApplicationPriv; -#else -typedef struct CajaShell CajaShell; -#endif typedef struct { -#if ENABLE_LIBUNIQUE == (FALSE) GtkApplication parent; CajaApplicationPriv *priv; -#else - GObject parent; - UniqueApp* unique_app; -#endif + EggSMClient* smclient; GVolumeMonitor* volume_monitor; unsigned int automount_idle_id; @@ -85,8 +75,6 @@ typedef struct GList *volume_queue; } CajaApplication; - -#if ENABLE_LIBUNIQUE == (FALSE) typedef struct { GtkApplicationClass parent_class; @@ -95,25 +83,7 @@ typedef struct GType caja_application_get_type (void); CajaApplication *caja_application_new (void); -#else -typedef struct -{ - GObjectClass parent_class; -} CajaApplicationClass; -GType caja_application_get_type (void); -CajaApplication *caja_application_new (void); -void caja_application_startup (CajaApplication *application, - gboolean kill_shell, - gboolean no_default_window, - gboolean no_desktop, - gboolean browser_window, - const char *default_geometry, - char **urls); -GList * caja_application_get_window_list (void); -GList * caja_application_get_spatial_window_list (void); -unsigned int caja_application_get_n_windows (void); -#endif CajaWindow * caja_application_get_spatial_window (CajaApplication *application, CajaWindow *requesting_window, const char *startup_id, @@ -122,22 +92,11 @@ CajaWindow * caja_application_get_spatial_window (CajaApplication *appli gboolean *existing); CajaWindow * caja_application_create_navigation_window (CajaApplication *application, -#if ENABLE_LIBUNIQUE == (TRUE) - const char *startup_id, -#endif GdkScreen *screen); -#if ENABLE_LIBUNIQUE == (FALSE) void caja_application_close_all_navigation_windows (CajaApplication *self); -#else -void caja_application_close_all_navigation_windows (void); -#endif void caja_application_close_parent_windows (CajaSpatialWindow *window); void caja_application_close_all_spatial_windows (void); -#if ENABLE_LIBUNIQUE == (TRUE) -void caja_application_open_desktop (CajaApplication *application); -void caja_application_close_desktop (void); -gboolean caja_application_save_accel_map (gpointer data); -#endif + void caja_application_open_location (CajaApplication *application, GFile *location, GFile *selection, diff --git a/src/caja-autorun-software.c b/src/caja-autorun-software.c index a2d6a94b..8bd4514d 100644 --- a/src/caja-autorun-software.c +++ b/src/caja-autorun-software.c @@ -233,13 +233,8 @@ present_autorun_for_software_dialog (GMount *mount) icon_info = caja_icon_info_lookup (icon, icon_size); pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size); image = gtk_image_new_from_pixbuf (pixbuf); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_START); -#else - gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); -#endif - gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image); gtk_window_set_title (GTK_WINDOW (dialog), mount_name); diff --git a/src/caja-bookmarks-window.c b/src/caja-bookmarks-window.c index 1f94cc4b..10eb8e88 100644 --- a/src/caja-bookmarks-window.c +++ b/src/caja-bookmarks-window.c @@ -595,9 +595,6 @@ open_selected_bookmark (gpointer user_data, GdkScreen *screen) } else { /* window that opened bookmarks window has been closed */ if (parent_is_browser_window || g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif screen); } else diff --git a/src/caja-connect-server-dialog-main.c b/src/caja-connect-server-dialog-main.c index 393cdc88..c2936747 100644 --- a/src/caja-connect-server-dialog-main.c +++ b/src/caja-connect-server-dialog-main.c @@ -82,11 +82,9 @@ caja_connect_server_dialog_display_location_async (CajaConnectServerDialog *self error = NULL; uri = g_file_get_uri (location); -#if GTK_CHECK_VERSION (3, 0, 0) + launch_context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (self))); -#else - launch_context = gdk_app_launch_context_new (); -#endif + gdk_app_launch_context_set_screen (launch_context, gtk_widget_get_screen (GTK_WIDGET (self))); diff --git a/src/caja-connect-server-dialog-nonmain.c b/src/caja-connect-server-dialog-nonmain.c index 72ce9a06..e57ce622 100644 --- a/src/caja-connect-server-dialog-nonmain.c +++ b/src/caja-connect-server-dialog-nonmain.c @@ -83,9 +83,6 @@ caja_connect_server_dialog_display_location_async (CajaConnectServerDialog *self if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif gtk_widget_get_screen (widget)); } else { window = caja_application_get_spatial_window (application, diff --git a/src/caja-connect-server-dialog.c b/src/caja-connect-server-dialog.c index 4d4a1a3a..6df18f66 100644 --- a/src/caja-connect-server-dialog.c +++ b/src/caja-connect-server-dialog.c @@ -40,11 +40,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - /* TODO: * - name entry + pre-fill * - NetworkManager integration @@ -54,11 +49,7 @@ struct _CajaConnectServerDialogDetails { CajaApplication *application; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *primary_grid; -#else - GtkWidget *primary_table; -#endif GtkWidget *user_details; GtkWidget *port_spinbutton; @@ -189,7 +180,7 @@ connect_dialog_set_connecting (CajaConnectServerDialog *dialog) content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar)); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show (hbox); @@ -218,7 +209,7 @@ connect_dialog_gvfs_error (CajaConnectServerDialog *dialog) content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->details->info_bar)); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show (hbox); @@ -232,11 +223,7 @@ connect_dialog_gvfs_error (CajaConnectServerDialog *dialog) gtk_widget_show (label); gtk_widget_set_sensitive (dialog->details->connect_button, FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_sensitive (dialog->details->primary_grid, FALSE); -#else - gtk_widget_set_sensitive (dialog->details->primary_table, FALSE); -#endif gtk_widget_show (dialog->details->info_bar); } @@ -334,7 +321,7 @@ connect_dialog_set_info_bar_error (CajaConnectServerDialog *dialog, gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_widget_show (dialog->details->info_bar); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 6); gtk_widget_show (hbox); @@ -410,7 +397,7 @@ connect_dialog_request_additional_details (CajaConnectServerDialog *self, content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (self->details->info_bar)); entry = NULL; - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 6); gtk_widget_show (hbox); @@ -857,11 +844,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) GtkWidget *label; GtkWidget *alignment; GtkWidget *content_area; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *combo, *grid; -#else - GtkWidget *combo, *table; -#endif GtkWidget *vbox, *hbox, *connect_button, *checkbox; GtkListStore *store; GtkCellRenderer *renderer; @@ -899,16 +882,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) gtk_box_pack_start (GTK_BOX (content_area), label, FALSE, FALSE, 6); gtk_widget_show (label); -#if !GTK_CHECK_VERSION (3, 0, 0) - /* server settings alignment */ - alignment = gtk_alignment_new (0, 0, 0, 0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), - 0, 0, 12, 0); - gtk_box_pack_start (GTK_BOX (content_area), alignment, TRUE, TRUE, 0); - gtk_widget_show (alignment); -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); @@ -936,29 +909,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) gtk_grid_attach_next_to (GTK_GRID (grid), hbox, label, GTK_POS_RIGHT, 1, 1); -#else - table = gtk_table_new (4, 2, FALSE); - gtk_container_add (GTK_CONTAINER (alignment), table); - gtk_widget_show (table); - - dialog->details->primary_table = table; - - /* first row: server entry + port spinbutton */ - label = gtk_label_new_with_mnemonic (_("_Server:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); - gtk_widget_show (label); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - gtk_table_attach (GTK_TABLE (table), hbox, - 1, 2, - 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif dialog->details->server_entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->server_entry), TRUE); @@ -995,14 +945,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif gtk_widget_show (label); dialog->details->type_combo = combo = gtk_combo_box_new (); @@ -1066,15 +1009,8 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) gtk_widget_show (combo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), combo, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), combo, - 1, 2, - 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND, 6, 3); -#endif g_signal_connect_swapped (combo, "changed", G_CALLBACK (connect_dialog_setup_for_type), dialog); @@ -1086,26 +1022,12 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 2, 3, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif dialog->details->share_entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->share_entry), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->share_entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), dialog->details->share_entry, - 1, 2, - 2, 3, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif bind_visibility (dialog, dialog->details->share_entry, label); @@ -1116,27 +1038,13 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 3, 4, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif gtk_widget_show (label); dialog->details->folder_entry = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (dialog->details->folder_entry), "/"); gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->folder_entry), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->folder_entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), dialog->details->folder_entry, - 1, 2, - 3, 4, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif gtk_widget_show (dialog->details->folder_entry); /* user details label */ @@ -1151,18 +1059,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #endif gtk_box_pack_start (GTK_BOX (content_area), label, FALSE, FALSE, 6); -#if !GTK_CHECK_VERSION (3, 0, 0) - /* user details alignment */ - alignment = gtk_alignment_new (0, 0, 0, 0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), - 0, 0, 12, 0); - gtk_box_pack_start (GTK_BOX (content_area), alignment, TRUE, TRUE, 0); - - bind_visibility (dialog, alignment, label); - dialog->details->user_details = alignment; -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 3); @@ -1175,11 +1071,6 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) bind_visibility (dialog, grid, label); dialog->details->user_details = grid; -#else - table = gtk_table_new (4, 2, FALSE); - gtk_container_add (GTK_CONTAINER (alignment), table); - gtk_widget_show (table); -#endif /* first row: domain entry */ label = gtk_label_new (_("Domain Name:")); @@ -1188,26 +1079,12 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif dialog->details->domain_entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->domain_entry), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->domain_entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), dialog->details->domain_entry, - 1, 2, - 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif bind_visibility (dialog, dialog->details->domain_entry, label); @@ -1218,26 +1095,12 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif dialog->details->user_entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->user_entry), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->user_entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), dialog->details->user_entry, - 1, 2, - 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif bind_visibility (dialog, dialog->details->user_entry, label); @@ -1248,54 +1111,33 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 2, 3, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif dialog->details->password_entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (dialog->details->password_entry), TRUE); gtk_entry_set_visibility (GTK_ENTRY (dialog->details->password_entry), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), dialog->details->password_entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), dialog->details->password_entry, - 1, 2, - 2, 3, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 3); -#endif bind_visibility (dialog, dialog->details->password_entry, label); /* fourth row: remember checkbox */ checkbox = gtk_check_button_new_with_label (_("Remember this password")); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (GTK_GRID (grid), checkbox, dialog->details->password_entry, GTK_POS_BOTTOM, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), checkbox, - 1, 2, - 3, 4, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 0); -#endif dialog->details->remember_checkbox = checkbox; bind_visibility (dialog, dialog->details->password_entry, checkbox); /* add as bookmark */ - vbox = gtk_vbox_new (FALSE, 12); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_box_pack_start (GTK_BOX (content_area), vbox, FALSE, FALSE, 6); dialog->details->bookmark_checkbox = gtk_check_button_new_with_mnemonic (_("Add _bookmark")); gtk_box_pack_start (GTK_BOX (vbox), dialog->details->bookmark_checkbox, TRUE, TRUE, 0); gtk_widget_show (dialog->details->bookmark_checkbox); - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); label = gtk_label_new (_("Bookmark Name:")); diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c index 1cc14348..1e453672 100644 --- a/src/caja-desktop-window.c +++ b/src/caja-desktop-window.c @@ -166,12 +166,10 @@ caja_desktop_window_init (CajaDesktopWindow *window) window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_DESKTOP_WINDOW, CajaDesktopWindowDetails); -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_add_class (context, "caja-desktop-window"); -#endif #if GTK_CHECK_VERSION(3, 21, 0) window->details->composited = TRUE; @@ -342,11 +340,7 @@ set_desktop_window_id (CajaDesktopWindow *window, root_window = gdk_screen_get_root_window ( gtk_window_get_screen (GTK_WINDOW (window))); -#if GTK_CHECK_VERSION (3, 0, 0) window_xid = GDK_WINDOW_XID (gdkwindow); -#else - window_xid = GDK_WINDOW_XWINDOW (gdkwindow); -#endif gdk_property_change (root_window, gdk_atom_intern ("CAJA_DESKTOP_WINDOW_ID", FALSE), diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c index 75e9f61f..0c5b0056 100644 --- a/src/caja-emblem-sidebar.c +++ b/src/caja-emblem-sidebar.c @@ -64,10 +64,6 @@ struct CajaEmblemSidebarDetails #define STANDARD_EMBLEM_HEIGHT 52 #define EMBLEM_LABEL_SPACING 2 -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static void caja_emblem_sidebar_populate (CajaEmblemSidebar *emblem_sidebar); static void caja_emblem_sidebar_refresh (CajaEmblemSidebar *emblem_sidebar); static void caja_emblem_sidebar_iface_init (CajaSidebarIface *iface); @@ -111,11 +107,7 @@ typedef struct GObjectClass parent; } CajaEmblemSidebarProviderClass; -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE_WITH_CODE (CajaEmblemSidebar, caja_emblem_sidebar, GTK_TYPE_BOX, -#else -G_DEFINE_TYPE_WITH_CODE (CajaEmblemSidebar, caja_emblem_sidebar, GTK_TYPE_VBOX, -#endif G_IMPLEMENT_INTERFACE (CAJA_TYPE_SIDEBAR, caja_emblem_sidebar_iface_init)); @@ -314,7 +306,7 @@ create_rename_emblem_dialog (CajaEmblemSidebar *emblem_sidebar, FALSE, FALSE, 8); - hbox = gtk_hbox_new (FALSE, 8); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 8); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); @@ -588,7 +580,7 @@ create_add_emblems_dialog (CajaEmblemSidebar *emblem_sidebar, image = gtk_image_new_from_pixbuf (emblem->pixbuf); - hbox = gtk_hbox_new (TRUE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); entry = gtk_entry_new (); @@ -1047,9 +1039,7 @@ caja_emblem_sidebar_init (CajaEmblemSidebar *emblem_sidebar) "emblems_changed", G_CALLBACK (emblems_changed_callback), emblem_sidebar, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_orientable_set_orientation (GTK_ORIENTABLE (emblem_sidebar), GTK_ORIENTATION_VERTICAL); -#endif gtk_box_pack_start (GTK_BOX (emblem_sidebar), widget, TRUE, TRUE, 0); } diff --git a/src/caja-emblem-sidebar.h b/src/caja-emblem-sidebar.h index 6435ef53..3053ac7d 100644 --- a/src/caja-emblem-sidebar.h +++ b/src/caja-emblem-sidebar.h @@ -47,22 +47,13 @@ typedef struct CajaEmblemSidebarDetails CajaEmblemSidebarDetails; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox parent_slot; -#else - GtkVBox parent_slot; -#endif CajaEmblemSidebarDetails *details; } CajaEmblemSidebar; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_slot; -#else - GtkVBoxClass parent_slot; -#endif - } CajaEmblemSidebarClass; GType caja_emblem_sidebar_get_type (void); diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c index 4ad18137..9ef695c9 100644 --- a/src/caja-history-sidebar.c +++ b/src/caja-history-sidebar.c @@ -74,12 +74,7 @@ enum static void caja_history_sidebar_iface_init (CajaSidebarIface *iface); static void sidebar_provider_iface_init (CajaSidebarProviderIface *iface); static GType caja_history_sidebar_provider_get_type (void); -#if GTK_CHECK_VERSION (3, 0, 0) static void caja_history_sidebar_style_updated (GtkWidget *widget); -#else -static void caja_history_sidebar_style_set (GtkWidget *widget, - GtkStyle *previous_style); -#endif G_DEFINE_TYPE_WITH_CODE (CajaHistorySidebar, caja_history_sidebar, GTK_TYPE_SCROLLED_WINDOW, G_IMPLEMENT_INTERFACE (CAJA_TYPE_SIDEBAR, @@ -325,11 +320,7 @@ caja_history_sidebar_class_init (CajaHistorySidebarClass *class) { G_OBJECT_CLASS (class)->finalize = caja_history_sidebar_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (class)->style_updated = caja_history_sidebar_style_updated; -#else - GTK_WIDGET_CLASS (class)->style_set = caja_history_sidebar_style_set; -#endif } static const char * @@ -382,12 +373,7 @@ caja_history_sidebar_set_parent_window (CajaHistorySidebar *sidebar, } static void -#if GTK_CHECK_VERSION (3, 0, 0) caja_history_sidebar_style_updated (GtkWidget *widget) -#else -caja_history_sidebar_style_set (GtkWidget *widget, - GtkStyle *previous_style) -#endif { CajaHistorySidebar *sidebar; diff --git a/src/caja-image-properties-page.c b/src/caja-image-properties-page.c index d43b3c09..12c79e38 100644 --- a/src/caja-image-properties-page.c +++ b/src/caja-image-properties-page.c @@ -46,10 +46,6 @@ #define LOAD_BUFFER_SIZE 8192 -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - struct CajaImagePropertiesPageDetails { GCancellable *cancellable; @@ -97,11 +93,7 @@ typedef struct static GType caja_image_properties_page_provider_get_type (void); static void property_page_provider_iface_init (CajaPropertyPageProviderIface *iface); -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE (CajaImagePropertiesPage, caja_image_properties_page, GTK_TYPE_BOX); -#else -G_DEFINE_TYPE (CajaImagePropertiesPage, caja_image_properties_page, GTK_TYPE_VBOX); -#endif G_DEFINE_TYPE_WITH_CODE (CajaImagePropertiesPageProvider, caja_image_properties_page_provider, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (CAJA_TYPE_PROPERTY_PAGE_PROVIDER, @@ -658,14 +650,13 @@ caja_image_properties_page_init (CajaImagePropertiesPage *page) CAJA_TYPE_IMAGE_PROPERTIES_PAGE, CajaImagePropertiesPageDetails); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_orientable_set_orientation (GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL); -#endif + gtk_box_set_homogeneous (GTK_BOX (page), FALSE); gtk_box_set_spacing (GTK_BOX (page), 2); gtk_container_set_border_width (GTK_CONTAINER (page), 6); - page->details->vbox = gtk_vbox_new (FALSE, 6); + page->details->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); page->details->loading_label = append_label (page->details->vbox,_("loading...")); gtk_box_pack_start (GTK_BOX (page), diff --git a/src/caja-image-properties-page.h b/src/caja-image-properties-page.h index 6e07bab8..9725ffa4 100644 --- a/src/caja-image-properties-page.h +++ b/src/caja-image-properties-page.h @@ -42,21 +42,13 @@ typedef struct CajaImagePropertiesPageDetails CajaImagePropertiesPageDetails; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox parent; -#else - GtkVBox parent; -#endif CajaImagePropertiesPageDetails *details; } CajaImagePropertiesPage; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent; -#else - GtkVBoxClass parent; -#endif } CajaImagePropertiesPageClass; GType caja_image_properties_page_get_type (void); diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index d5611490..51c7e0b4 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -81,12 +81,7 @@ static void caja_information_panel_drag_data_received (GtkWidget guint info, guint time); static void caja_information_panel_read_defaults (CajaInformationPanel *information_panel); -#if GTK_CHECK_VERSION (3, 0, 0) static void caja_information_panel_style_updated (GtkWidget *widget); -#else -static void caja_information_panel_style_set (GtkWidget *widget, - GtkStyle *previous_style); -#endif static void caja_information_panel_theme_changed (GSettings *settings, const gchar *key, gpointer user_data); @@ -210,11 +205,7 @@ caja_information_panel_class_init (CajaInformationPanelClass *klass) widget_class->drag_data_received = caja_information_panel_drag_data_received; widget_class->button_press_event = caja_information_panel_press_event; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->style_updated = caja_information_panel_style_updated; -#else - widget_class->style_set = caja_information_panel_style_set; -#endif /* add the "location changed" signal */ signals[LOCATION_CHANGED] = g_signal_new @@ -234,11 +225,7 @@ caja_information_panel_class_init (CajaInformationPanelClass *klass) static void make_button_box (CajaInformationPanel *information_panel) { -#if GTK_CHECK_VERSION (3, 0, 0) information_panel->details->button_box_centerer = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - information_panel->details->button_box_centerer = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (information_panel->details->container), information_panel->details->button_box_centerer, TRUE, TRUE, 0); @@ -268,11 +255,7 @@ caja_information_panel_init (CajaInformationPanel *information_panel) gtk_widget_add_events (GTK_WIDGET (information_panel), GDK_POINTER_MOTION_MASK); /* create the container box */ -#if GTK_CHECK_VERSION (3, 0, 0) information_panel->details->container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - information_panel->details->container = gtk_vbox_new (FALSE, 0); -#endif gtk_container_set_border_width (GTK_CONTAINER (information_panel->details->container), 0); gtk_widget_show (information_panel->details->container); gtk_container_add (GTK_CONTAINER (information_panel), @@ -1045,69 +1028,8 @@ caja_information_panel_update_buttons (CajaInformationPanel *information_panel) static void caja_information_panel_update_appearance (CajaInformationPanel *information_panel) { - -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (information_panel)), GTK_STYLE_CLASS_VIEW); -#else - EelBackground *background; - char *background_color; - char *background_image; - - g_return_if_fail (CAJA_IS_INFORMATION_PANEL (information_panel)); - - /* Connect the background changed signal to code that writes the color. */ - background = eel_get_widget_background (GTK_WIDGET (information_panel)); - if (!information_panel->details->background_connected) - { - information_panel->details->background_connected = TRUE; - g_signal_connect_object (background,"settings_changed", - G_CALLBACK (background_settings_changed_callback), information_panel, 0); - g_signal_connect_object (background, "reset", - G_CALLBACK (background_reset_callback), information_panel, 0); - } - - /* Set up the background color and image from the metadata. */ - background_color = caja_file_get_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL); - background_image = caja_file_get_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL); - - if (background_color == NULL && background_image == NULL) - { - background_color = g_strdup (information_panel->details->default_background_color); - background_image = g_strdup (information_panel->details->default_background_image); - } - - /* Block so we don't write these settings out in response to our set calls below */ - g_signal_handlers_block_by_func (background, - G_CALLBACK (background_settings_changed_callback), - information_panel); - - if (value_different (information_panel->details->current_background_color, background_color) || - value_different (information_panel->details->current_background_image, background_image)) - { - - g_free (information_panel->details->current_background_color); - information_panel->details->current_background_color = g_strdup (background_color); - g_free (information_panel->details->current_background_image); - information_panel->details->current_background_image = g_strdup (background_image); - - eel_background_set_image_uri (background, background_image); - eel_background_set_color (background, background_color); - - caja_sidebar_title_select_text_color (information_panel->details->title, background); - } - - g_free (background_color); - g_free (background_image); - - g_signal_handlers_unblock_by_func (background, - G_CALLBACK (background_settings_changed_callback), - information_panel); -#endif } static void @@ -1188,11 +1110,7 @@ title_changed_callback (CajaWindowInfo *window, /* ::style_set handler for the information_panel */ static void -#if GTK_CHECK_VERSION (3, 0, 0) caja_information_panel_style_updated (GtkWidget *widget) -#else -caja_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style) -#endif { CajaInformationPanel *information_panel; diff --git a/src/caja-location-bar.c b/src/caja-location-bar.c index a40c3e96..17bdd989 100644 --- a/src/caja-location-bar.c +++ b/src/caja-location-bar.c @@ -229,11 +229,8 @@ drag_data_received_callback (GtkWidget *widget, for (i = 1; names[i] != NULL; ++i) { -#if ENABLE_LIBUNIQUE == (FALSE) new_window = caja_application_create_navigation_window (application, screen); -#else - new_window = caja_application_create_navigation_window (application, NULL, screen); -#endif + location = g_file_new_for_uri (names[i]); caja_window_go_to (new_window, location); g_object_unref (location); @@ -283,18 +280,12 @@ drag_data_get_callback (GtkWidget *widget, we are imitating here. */ static void -#if GTK_CHECK_VERSION (3, 0, 0) style_set_handler (GtkWidget *widget, GtkStyleContext *previous_style) -#else -style_set_handler (GtkWidget *widget, GtkStyle *previous_style) -#endif { PangoLayout *layout; int width, width2; int xpad; -#if GTK_CHECK_VERSION (3, 0, 0) gint margin_start, margin_end; -#endif layout = gtk_label_get_layout (GTK_LABEL(widget)); @@ -307,14 +298,9 @@ style_set_handler (GtkWidget *widget, GtkStyle *previous_style) pango_layout_get_pixel_size (layout, &width2, NULL); width = MAX (width, width2); -#if GTK_CHECK_VERSION (3, 0, 0) margin_start = gtk_widget_get_margin_start (widget); margin_end = gtk_widget_get_margin_end (widget); xpad = margin_start + margin_end; -#else - gtk_misc_get_padding (GTK_MISC (widget), - &xpad, NULL); -#endif width += 2 * xpad; @@ -614,7 +600,6 @@ caja_location_bar_set_location (CajaLocationBar *bar, void caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active) { -#if GTK_CHECK_VERSION (3, 0, 0) if (is_active) { /* reset style to default */ @@ -628,20 +613,6 @@ caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active) style = gtk_widget_get_style_context (GTK_WIDGET (location_bar->details->entry)); gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color); gtk_widget_override_background_color (GTK_WIDGET (location_bar->details->entry), GTK_STATE_FLAG_ACTIVE, &color); -#else - if(is_active) - { - /* reset style to default */ - gtk_widget_modify_base (GTK_WIDGET (location_bar->details->entry), GTK_STATE_NORMAL, NULL); - } - else - { - GtkStyle *style; - GdkColor color; - style = gtk_widget_get_style (GTK_WIDGET (location_bar->details->entry)); - color = style->base[GTK_STATE_INSENSITIVE]; - gtk_widget_modify_base(GTK_WIDGET (location_bar->details->entry), GTK_STATE_NORMAL, &color); -#endif } } diff --git a/src/caja-location-dialog.c b/src/caja-location-dialog.c index b6257396..486f7339 100644 --- a/src/caja-location-dialog.c +++ b/src/caja-location-dialog.c @@ -32,10 +32,6 @@ #include "caja-desktop-window.h" #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct _CajaLocationDialogDetails { GtkWidget *entry; @@ -164,7 +160,7 @@ caja_location_dialog_init (CajaLocationDialog *dialog) gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); - box = gtk_hbox_new (FALSE, 12); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_widget_show (box); diff --git a/src/caja-location-entry.c b/src/caja-location-entry.c index ad333272..4f7af4eb 100644 --- a/src/caja-location-entry.c +++ b/src/caja-location-entry.c @@ -285,11 +285,7 @@ finalize (GObject *object) } static void -#if GTK_CHECK_VERSION (3, 0, 0) destroy (GtkWidget *object) -#else -destroy (GtkObject *object) -#endif { CajaLocationEntry *entry; @@ -305,11 +301,7 @@ destroy (GtkObject *object) g_free (entry->details->current_directory); entry->details->current_directory = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) EEL_CALL_PARENT (GTK_WIDGET_CLASS, destroy, (object)); -#else - EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); -#endif } static void @@ -392,11 +384,7 @@ caja_location_entry_class_init (CajaLocationEntryClass *class) { GTK_WIDGET_CLASS (class)->focus_in_event = caja_location_entry_focus_in; -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (class)->destroy = destroy; -#else - GTK_OBJECT_CLASS (class)->destroy = destroy; -#endif G_OBJECT_CLASS (class)->finalize = finalize; @@ -443,13 +431,10 @@ caja_location_entry_set_secondary_action (CajaLocationEntry *entry, static void caja_location_entry_init (CajaLocationEntry *entry) { - -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (entry)); gtk_style_context_add_class (context, "caja-location-entry"); -#endif entry->details = g_new0 (CajaLocationEntryDetails, 1); diff --git a/src/caja-main.c b/src/caja-main.c index 51ecbd93..549dfac0 100644 --- a/src/caja-main.c +++ b/src/caja-main.c @@ -28,20 +28,12 @@ /* caja-main.c: Implementation of the routines that drive program lifecycle and main window creation/destruction. */ #include -#include "caja-main.h" -#if ENABLE_LIBUNIQUE == (TRUE) -#include "caja-application.h" -#include "caja-self-check-functions.h" -#endif #include "caja-window.h" #include #include #include #include #include -#if ENABLE_LIBUNIQUE == (TRUE) -#include -#endif #include #include #include @@ -49,9 +41,6 @@ #include #include #include -#if ENABLE_LIBUNIQUE == (TRUE) -#include -#endif #include #include #ifdef HAVE_LOCALE_H @@ -68,101 +57,7 @@ #include #endif -#if ENABLE_LIBUNIQUE == (TRUE) -/* Keeps track of everyone who wants the main event loop kept active */ -static GSList* event_loop_registrants; - -static gboolean exit_with_last_window = TRUE; - -static gboolean is_event_loop_needed(void) -{ - return event_loop_registrants != NULL || !exit_with_last_window; -} - -static int quit_if_in_main_loop (gpointer callback_data) -{ - guint level; - - g_assert (callback_data == NULL); - - level = gtk_main_level (); - - /* We can be called even outside the main loop, - * so check that we are in a loop before calling quit. - */ - if (level != 0) - { - gtk_main_quit (); - } - /* We need to be called again if we quit a nested loop. */ - return level > 1; -} - -static void eel_gtk_main_quit_all (void) -{ - /* Calling gtk_main_quit directly only kills the current/top event loop. - * This idler will be run by the current event loop, killing it, and then - * by the next event loop, ... - */ - g_idle_add (quit_if_in_main_loop, NULL); -} - -static void event_loop_unregister (GtkWidget *object) -{ - event_loop_registrants = g_slist_remove (event_loop_registrants, object); - - if (!is_event_loop_needed ()) - { - eel_gtk_main_quit_all (); - } -} - -#if GTK_CHECK_VERSION(3, 0, 0) -void caja_main_event_loop_register (GtkWidget *object) -#else -void caja_main_event_loop_register (GtkObject *object) -#endif -{ - g_signal_connect (object, "destroy", G_CALLBACK (event_loop_unregister), NULL); - event_loop_registrants = g_slist_prepend (event_loop_registrants, GTK_WIDGET (object)); -} - -gboolean caja_main_is_event_loop_mainstay (GtkWidget *object) -{ - return g_slist_length (event_loop_registrants) == 1 - && event_loop_registrants->data == object; -} - -void caja_main_event_loop_quit (gboolean explicit) -{ - if (explicit) - { - /* Explicit --quit, make sure we don't restart */ - - /* To quit all instances, reset exit_with_last_window */ - exit_with_last_window = TRUE; - - if (event_loop_registrants == NULL) - { - /* If this is reached, caja must run in "daemon" mode - * (i.e. !exit_with_last_window) with no windows open. - * We need to quit_all here because the below loop won't - * trigger a quit. - */ - eel_gtk_main_quit_all(); - } - - /* TODO: With the old session we needed to set restart - style to MATE_RESTART_IF_RUNNING here, but i don't think we need - that now since mate-session doesn't restart apps except on startup. */ - } - while (event_loop_registrants != NULL) - { - gtk_widget_destroy (event_loop_registrants->data); - } -} -#endif static void dump_debug_log (void) { char *filename; @@ -334,7 +229,7 @@ running_as_root (void) { return geteuid () == 0; } -#if ENABLE_LIBUNIQUE == (FALSE) + int main (int argc, char *argv[]) { @@ -397,331 +292,4 @@ main (int argc, char *argv[]) return retval; } -#else -int -main (int argc, char *argv[]) -{ - gboolean kill_shell; - gboolean no_default_window; - gboolean browser_window; - gboolean no_desktop; - gboolean version; - gboolean autostart_mode; - const char *autostart_id; - gchar *geometry; - gchar **remaining; - gboolean perform_self_check; - CajaApplication *application; - GOptionContext *context; - GFile *file = NULL; - GFileInfo *fileinfo = NULL; - GAppInfo *appinfo = NULL; - char *uri = NULL; - char **uris = NULL; - GPtrArray *uris_array; - GError *error; - int i; - - const GOptionEntry options[] = - { -#ifndef CAJA_OMIT_SELF_CHECK - { - "check", 'c', 0, G_OPTION_ARG_NONE, &perform_self_check, - N_("Perform a quick set of self-check tests."), NULL - }, -#endif - { - "version", '\0', 0, G_OPTION_ARG_NONE, &version, - N_("Show the version of the program."), NULL - }, - { - "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, - N_("Create the initial window with the given geometry."), N_("GEOMETRY") - }, - { - "no-default-window", 'n', 0, G_OPTION_ARG_NONE, &no_default_window, - N_("Only create windows for explicitly specified URIs."), NULL - }, - { - "no-desktop", '\0', 0, G_OPTION_ARG_NONE, &no_desktop, - N_("Do not manage the desktop (ignore the preference set in the preferences dialog)."), NULL - }, - { - "browser", '\0', 0, G_OPTION_ARG_NONE, &browser_window, - N_("open a browser window."), NULL - }, - { - "quit", 'q', 0, G_OPTION_ARG_NONE, &kill_shell, - N_("Quit Caja."), NULL - }, - { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, N_("[URI...]") }, - - { NULL } - }; - -#if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD) - /* Caja uses lots and lots of small and medium size allocations, - * and then a few large ones for the desktop background. By default - * glibc uses a dynamic treshold for how large allocations should - * be mmaped. Unfortunately this triggers quickly for caja when - * it does the desktop background allocations, raising the limit - * such that a lot of temporary large allocations end up on the - * heap and are thus not returned to the OS. To fix this we set - * a hardcoded limit. I don't know what a good value is, but 128K - * was the old glibc static limit, lets use that. - */ - mallopt (M_MMAP_THRESHOLD, 128 *1024); -#endif - -#if !GLIB_CHECK_VERSION (2, 42, 0) - /* This will be done by gtk+ later, but for now, force it to MATE */ - g_desktop_app_info_set_desktop_env ("MATE"); -#endif - - if (g_getenv ("CAJA_DEBUG") != NULL) - { - eel_make_warnings_and_criticals_stop_in_debugger (); - } - - /* Initialize gettext support */ - bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - autostart_mode = FALSE; - autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID"); - if (autostart_id != NULL && *autostart_id != '\0') - { - autostart_mode = TRUE; - } - - /* Get parameters. */ - remaining = NULL; - geometry = NULL; - version = FALSE; - kill_shell = FALSE; - no_default_window = FALSE; - no_desktop = FALSE; - perform_self_check = FALSE; - browser_window = FALSE; - - g_set_prgname ("caja"); - - if (g_file_test (DATADIR "/applications/caja.desktop", G_FILE_TEST_EXISTS)) - { - egg_set_desktop_file (DATADIR "/applications/caja.desktop"); - } - - context = g_option_context_new (_("\n\nBrowse the file system with the file manager")); - g_option_context_add_main_entries (context, options, NULL); - - g_option_context_add_group (context, gtk_get_option_group (TRUE)); - g_option_context_add_group (context, egg_sm_client_get_option_group ()); - - error = NULL; - if (!g_option_context_parse (context, &argc, &argv, &error)) - { - g_printerr ("Could not parse arguments: %s\n", error->message); - g_error_free (error); - return 1; - } - - g_option_context_free (context); - - if (version) - { - g_print ("MATE caja " PACKAGE_VERSION "\n"); - return 0; - } - -#ifdef HAVE_EXEMPI - xmp_init(); -#endif - - setup_debug_log (); - - /* If in autostart mode (aka started by mate-session), we need to ensure - * caja starts with the correct options. - */ - if (autostart_mode) - { - no_default_window = TRUE; - no_desktop = FALSE; - } - else if (running_as_root () || !running_in_mate ()) - { - /* do not manage desktop when running as root or on other desktops */ - no_desktop = TRUE; - - /* set smclient mode to "no restart" when running as root or on other desktops */ - egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_NO_RESTART); - } - - if (perform_self_check && remaining != NULL) - { - /* translators: %s is an option (e.g. --check) */ - fprintf (stderr, _("caja: %s cannot be used with URIs.\n"), - "--check"); - return EXIT_FAILURE; - } - if (perform_self_check && kill_shell) - { - fprintf (stderr, _("caja: --check cannot be used with other options.\n")); - return EXIT_FAILURE; - } - if (kill_shell && remaining != NULL) - { - fprintf (stderr, _("caja: %s cannot be used with URIs.\n"), - "--quit"); - return EXIT_FAILURE; - } - if (geometry != NULL && remaining != NULL && remaining[0] != NULL && remaining[1] != NULL) - { - fprintf (stderr, _("caja: --geometry cannot be used with more than one URI.\n")); - return EXIT_FAILURE; - } - - /* Initialize the services that we use. */ - LIBXML_TEST_VERSION - - /* Initialize preferences. This is needed so that proper - * defaults are available before any preference peeking - * happens. - */ - caja_global_preferences_init (); - - /* exit_with_last_window is already set to TRUE, and we need to keep that value - * on other desktops or when running caja as root. Otherwise, we read the value - * from the configuration. - */ - if (running_in_mate () && !running_as_root()) - { - exit_with_last_window = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_EXIT_WITH_LAST_WINDOW); - } - - application = NULL; - - /* Do either the self-check or the real work. */ - if (perform_self_check) - { - #ifndef CAJA_OMIT_SELF_CHECK - /* Run the checks (each twice) for caja and libcaja-private. */ - - caja_run_self_checks (); - caja_run_lib_self_checks (); - eel_exit_if_self_checks_failed (); - - caja_run_self_checks (); - caja_run_lib_self_checks (); - eel_exit_if_self_checks_failed (); - #endif - } - else - { - /* Convert args to URIs */ - if (remaining != NULL) - { - uris_array = g_ptr_array_new (); - for (i = 0; remaining[i] != NULL; i++) - { - file = g_file_new_for_commandline_arg (remaining[i]); - if (file != NULL) - { - uri = g_file_get_uri (file); - if (uri) - { - fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); - if (fileinfo && g_file_info_get_file_type(fileinfo) == G_FILE_TYPE_DIRECTORY) - { - g_ptr_array_add (uris_array, uri); - } - else - { - if (fileinfo) - g_object_unref (fileinfo); - fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); - if (fileinfo) - { - appinfo = g_app_info_get_default_for_type (g_file_info_get_content_type (fileinfo), TRUE); - if (appinfo) - { - if (g_strcmp0 (g_app_info_get_executable (appinfo), "caja") != 0) - { - g_app_info_launch_default_for_uri (uri, NULL, NULL); - } - else - { - fprintf (stderr, _("caja: set erroneously as default application for '%s' content type.\n"), - g_file_info_get_content_type (fileinfo)); - } - g_object_unref (appinfo); - } - g_free (uri); - } - else - { - g_ptr_array_add (uris_array, uri); - } - } - if (fileinfo) - g_object_unref (fileinfo); - } - if (file) - g_object_unref (file); - } - } - if (uris_array->len == 0) - { - /* Caja is being used only to open files (not directories), so closing */ - g_strfreev (remaining); - return EXIT_SUCCESS; - } - g_ptr_array_add (uris_array, NULL); - uris = (char**) g_ptr_array_free (uris_array, FALSE); - g_strfreev (remaining); - } - - - /* Run the caja application. */ - application = caja_application_new (); - - if (egg_sm_client_is_resumed (application->smclient)) - { - no_default_window = TRUE; - } - - caja_application_startup - (application, - kill_shell, no_default_window, no_desktop, - browser_window, - geometry, - uris); - g_strfreev (uris); - - if (unique_app_is_running (application->unique_app) || - kill_shell) - { - exit_with_last_window = TRUE; - } - - if (is_event_loop_needed ()) - { - gtk_main (); - } - } - - caja_icon_info_clear_caches (); - - if (application != NULL) - { - g_object_unref (application); - } - - eel_debug_shut_down (); - - caja_application_save_accel_map (NULL); - - return EXIT_SUCCESS; -} -#endif diff --git a/src/caja-main.h b/src/caja-main.h deleted file mode 100644 index abb9e6a7..00000000 --- a/src/caja-main.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */ - -/* - * Caja - * - * Copyright (C) 1999, 2000 Red Hat, Inc. - * Copyright (C) 1999, 2000 Eazel, Inc. - * - * Caja is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * Caja is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* caja-main.c - */ - -#ifndef CAJA_MAIN_H -#define CAJA_MAIN_H - -#include - -#if GTK_CHECK_VERSION(3, 0, 0) -void caja_main_event_loop_register (GtkWidget *object); -#else -void caja_main_event_loop_register (GtkObject *object); -#endif -gboolean caja_main_is_event_loop_mainstay (GtkWidget *object); -void caja_main_event_loop_quit (gboolean explicit); - -#endif /* CAJA_MAIN_H */ - diff --git a/src/caja-navigation-window-menus.c b/src/caja-navigation-window-menus.c index 2f7a1f5b..4b40494c 100644 --- a/src/caja-navigation-window-menus.c +++ b/src/caja-navigation-window-menus.c @@ -64,7 +64,6 @@ static void schedule_refresh_go_menu (CajaNavigationWindow *window); -#if ENABLE_LIBUNIQUE == (FALSE) static void action_close_all_windows_callback (GtkAction *action, gpointer user_data) @@ -74,14 +73,7 @@ action_close_all_windows_callback (GtkAction *action, app = CAJA_APPLICATION (g_application_get_default ()); caja_application_close_all_navigation_windows (app); } -#else -static void -action_close_all_windows_callback (GtkAction *action, - gpointer user_data) -{ - caja_application_close_all_navigation_windows (); -} -#endif + static gboolean should_open_in_new_tab (void) { @@ -622,9 +614,6 @@ action_new_window_callback (GtkAction *action, current_window = CAJA_WINDOW (user_data); new_window = caja_application_create_navigation_window ( current_window->application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif gtk_window_get_screen (GTK_WINDOW (current_window))); caja_window_go_home (new_window); } diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c index 49a80cb4..62e0f9a2 100644 --- a/src/caja-navigation-window-pane.c +++ b/src/caja-navigation-window-pane.c @@ -45,11 +45,6 @@ G_DEFINE_TYPE (CajaNavigationWindowPane, CAJA_TYPE_WINDOW_PANE) #define parent_class caja_navigation_window_pane_parent_class -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - static void real_set_active (CajaWindowPane *pane, gboolean is_active) { @@ -747,9 +742,9 @@ caja_navigation_window_pane_setup (CajaNavigationWindowPane *pane) CajaEntry *entry; GtkSizeGroup *header_size_group; - pane->widget = gtk_vbox_new (FALSE, 0); + pane->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); pane->location_bar = hbox; gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_box_pack_start (GTK_BOX (pane->widget), hbox, diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index f5127b8f..08a7704b 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -34,9 +34,6 @@ #include "caja-actions.h" #include "caja-application.h" #include "caja-bookmarks-window.h" -#if ENABLE_LIBUNIQUE == (TRUE) -#include "caja-main.h" -#endif #include "caja-location-bar.h" #include "caja-query-editor.h" #include "caja-search-bar.h" @@ -94,10 +91,6 @@ static CajaWindowSlot *create_extra_pane (CajaNavigationWindow *window); G_DEFINE_TYPE (CajaNavigationWindow, caja_navigation_window, CAJA_TYPE_WINDOW) #define parent_class caja_navigation_window_parent_class -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - static const struct { unsigned int keyval; @@ -124,12 +117,10 @@ caja_navigation_window_init (CajaNavigationWindow *window) window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_NAVIGATION_WINDOW, CajaNavigationWindowDetails); -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_add_class (context, "caja-navigation-window"); -#endif pane = caja_navigation_window_pane_new (win); win->details->panes = g_list_prepend (win->details->panes, pane); @@ -137,34 +128,20 @@ caja_navigation_window_init (CajaNavigationWindow *window) window->details->header_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); gtk_size_group_set_ignore_hidden (window->details->header_size_group, FALSE); -#if GTK_CHECK_VERSION(3, 0, 0) window->details->content_paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_hexpand (window->details->content_paned, TRUE); gtk_widget_set_vexpand (window->details->content_paned, TRUE); gtk_grid_attach (GTK_GRID (CAJA_WINDOW (window)->details->grid), window->details->content_paned, 0, 3, 1, 1); -#else - window->details->content_paned = gtk_hpaned_new (); - gtk_table_attach (GTK_TABLE (CAJA_WINDOW (window)->details->table), - window->details->content_paned, - /* X direction */ /* Y direction */ - 0, 1, 3, 4, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK, - 0, 0); -#endif gtk_widget_show (window->details->content_paned); - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_paned_pack2 (GTK_PANED (window->details->content_paned), vbox, TRUE, FALSE); gtk_widget_show (vbox); - -#if GTK_CHECK_VERSION(3, 0, 0) + hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); -#else - hpaned = gtk_hpaned_new (); -#endif gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); gtk_widget_show (hpaned); window->details->split_view_hpane = hpaned; @@ -187,22 +164,12 @@ caja_navigation_window_init (CajaNavigationWindow *window) ui_manager = caja_window_get_ui_manager (CAJA_WINDOW (window)); toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar"); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); window->details->toolbar = toolbar; gtk_widget_set_hexpand (toolbar, TRUE); gtk_grid_attach (GTK_GRID (CAJA_WINDOW (window)->details->grid), toolbar, 0, 1, 1, 1); -#else - window->details->toolbar = toolbar; - gtk_table_attach (GTK_TABLE (CAJA_WINDOW (window)->details->table), - toolbar, - /* X direction */ /* Y direction */ - 0, 1, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); -#endif gtk_widget_show (toolbar); caja_navigation_window_initialize_toolbars (window); @@ -570,11 +537,7 @@ caja_navigation_window_key_press_event (GtkWidget *widget, return GTK_WIDGET_CLASS (caja_navigation_window_parent_class)->key_press_event (widget, event); } -#if GTK_CHECK_VERSION(3, 0, 0) static gboolean -#else -gboolean -#endif caja_navigation_window_button_press_event (GtkWidget *widget, GdkEventButton *event) { @@ -606,11 +569,7 @@ caja_navigation_window_button_press_event (GtkWidget *widget, } static void -#if GTK_CHECK_VERSION (3, 0, 0) caja_navigation_window_destroy (GtkWidget *object) -#else -caja_navigation_window_destroy (GtkObject *object) -#endif { CajaNavigationWindow *window; @@ -626,11 +585,7 @@ caja_navigation_window_destroy (GtkObject *object) window->details->content_paned = NULL; window->details->split_view_hpane = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (parent_class)->destroy (object); -#else - GTK_OBJECT_CLASS (parent_class)->destroy (object); -#endif } static void @@ -1261,11 +1216,8 @@ caja_navigation_window_class_init (CajaNavigationWindowClass *class) CAJA_WINDOW_CLASS (class)->bookmarks_placeholder = MENU_PATH_BOOKMARKS_PLACEHOLDER; G_OBJECT_CLASS (class)->finalize = caja_navigation_window_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) + GTK_WIDGET_CLASS (class)->destroy = caja_navigation_window_destroy; -#else - GTK_OBJECT_CLASS (class)->destroy = caja_navigation_window_destroy; -#endif GTK_WIDGET_CLASS (class)->show = caja_navigation_window_show; GTK_WIDGET_CLASS (class)->window_state_event = caja_navigation_window_state_event; GTK_WIDGET_CLASS (class)->key_press_event = caja_navigation_window_key_press_event; diff --git a/src/caja-navigation-window.h b/src/caja-navigation-window.h index 231d140c..18c713bd 100644 --- a/src/caja-navigation-window.h +++ b/src/caja-navigation-window.h @@ -115,9 +115,5 @@ gboolean caja_navigation_window_is_in_temporary_navigation_bar (GtkWidget *widge CajaNavigationWindow *window); gboolean caja_navigation_window_is_in_temporary_search_bar (GtkWidget *widget, CajaNavigationWindow *window); -#if !GTK_CHECK_VERSION(3, 0, 0) -gboolean caja_window_button_press_event (GtkWidget *widget, - GdkEventButton *event); -#endif #endif diff --git a/src/caja-notebook.c b/src/caja-notebook.c index 199e7a2b..1dd5f6a9 100644 --- a/src/caja-notebook.c +++ b/src/caja-notebook.c @@ -40,10 +40,6 @@ #define AFTER_ALL_TABS -1 -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static void caja_notebook_init (CajaNotebook *notebook); static void caja_notebook_class_init (CajaNotebookClass *klass); static int caja_notebook_insert_page (GtkNotebook *notebook, @@ -81,17 +77,6 @@ caja_notebook_class_init (CajaNotebookClass *klass) notebook_class->insert_page = caja_notebook_insert_page; -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_rc_parse_string ("style \"caja-tab-close-button-style\"\n" - "{\n" - "GtkWidget::focus-padding = 0\n" - "GtkWidget::focus-line-width = 0\n" - "xthickness = 0\n" - "ythickness = 0\n" - "}\n" - "widget \"*.caja-tab-close-button\" style \"caja-tab-close-button-style\""); -#endif - signals[TAB_CLOSE_REQUEST] = g_signal_new ("tab-close-request", G_OBJECT_CLASS_TYPE (object_class), @@ -186,12 +171,10 @@ button_press_cb (CajaNotebook *notebook, static void caja_notebook_init (CajaNotebook *notebook) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (notebook)); gtk_style_context_add_class (context, "caja-notebook"); -#endif gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); @@ -307,7 +290,7 @@ build_tab_label (CajaNotebook *nb, CajaWindowSlot *slot) /* set hbox spacing and label padding (see below) so that there's an * equal amount of space around the label */ - hbox = gtk_hbox_new (FALSE, 4); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_widget_show (hbox); /* setup load feedback */ @@ -329,14 +312,11 @@ build_tab_label (CajaNotebook *nb, CajaWindowSlot *slot) #else gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_start (label, 0); gtk_widget_set_margin_end (label, 0); gtk_widget_set_margin_top (label, 0); gtk_widget_set_margin_bottom (label, 0); -#else - gtk_misc_set_padding (GTK_MISC (label), 0, 0); -#endif + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); gtk_widget_show (label); diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c index 91722633..8c5fec70 100644 --- a/src/caja-pathbar.c +++ b/src/caja-pathbar.c @@ -35,14 +35,6 @@ #include "caja-window-private.h" #include "caja-window-slot.h" -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - enum { PATH_CLICKED, @@ -90,9 +82,6 @@ struct _ButtonData GtkWidget *image; GtkWidget *label; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *alignment; -#endif guint ignore_changes : 1; guint file_is_hidden : 1; guint fake_root : 1; @@ -106,17 +95,14 @@ G_DEFINE_TYPE (CajaPathBar, static void caja_path_bar_finalize (GObject *object); static void caja_path_bar_dispose (GObject *object); -#if GTK_CHECK_VERSION(3,0,0) + static void caja_path_bar_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural); static void caja_path_bar_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural); -#else -static void caja_path_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition); -#endif + static void caja_path_bar_unmap (GtkWidget *widget); static void caja_path_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -143,12 +129,9 @@ static void caja_path_bar_grab_notify (GtkWidget *widget, gboolean was_grabbed); static void caja_path_bar_state_changed (GtkWidget *widget, GtkStateType previous_state); -#if GTK_CHECK_VERSION (3, 0, 0) + static void caja_path_bar_style_updated (GtkWidget *widget); -#else -static void caja_path_bar_style_set (GtkWidget *widget, - GtkStyle *previous_style); -#endif + static void caja_path_bar_screen_changed (GtkWidget *widget, GdkScreen *previous_screen); static void caja_path_bar_check_icon_theme (CajaPathBar *path_bar); @@ -159,7 +142,7 @@ static gboolean caja_path_bar_update_path (CajaPathBar *path_bar, GFile *file_path, gboolean emit_signal); -#if GTK_CHECK_VERSION(3,0,0) + static GtkWidget * get_slider_button (CajaPathBar *path_bar, const gchar *arrow_type) @@ -179,26 +162,6 @@ get_slider_button (CajaPathBar *path_bar, return button; } -#else -static GtkWidget * -get_slider_button (CajaPathBar *path_bar, - GtkArrowType arrow_type) -{ - GtkWidget *button; - - gtk_widget_push_composite_child (); - - button = gtk_button_new (); - gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE); - gtk_container_add (GTK_CONTAINER (button), gtk_arrow_new (arrow_type, GTK_SHADOW_OUT)); - gtk_container_add (GTK_CONTAINER (path_bar), button); - gtk_widget_show_all (button); - - gtk_widget_pop_composite_child (); - - return button; -} -#endif static void update_button_types (CajaPathBar *path_bar) @@ -341,28 +304,22 @@ static void caja_path_bar_init (CajaPathBar *path_bar) { char *p; -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (path_bar)); gtk_style_context_add_class (context, "caja-pathbar"); -#endif gtk_widget_set_has_window (GTK_WIDGET (path_bar), FALSE); gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE); path_bar->spacing = 3; -#if GTK_CHECK_VERSION(3, 0, 0) path_bar->up_slider_button = get_slider_button (path_bar, "pan-start-symbolic"); path_bar->down_slider_button = get_slider_button (path_bar, "pan-end-symbolic"); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (path_bar->up_slider_button)), "slider-button"); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (path_bar->down_slider_button)), "slider-button"); -#else - path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT); - path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT); -#endif + path_bar->icon_size = CAJA_PATH_BAR_ICON_SIZE; p = caja_get_desktop_directory (); @@ -431,19 +388,13 @@ caja_path_bar_class_init (CajaPathBarClass *path_bar_class) gobject_class->finalize = caja_path_bar_finalize; gobject_class->dispose = caja_path_bar_dispose; -#if GTK_CHECK_VERSION(3,0,0) widget_class->get_preferred_height = caja_path_bar_get_preferred_height; widget_class->get_preferred_width = caja_path_bar_get_preferred_width; -#else - widget_class->size_request = caja_path_bar_size_request; -#endif + widget_class->unmap = caja_path_bar_unmap; widget_class->size_allocate = caja_path_bar_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->style_updated = caja_path_bar_style_updated; -#else - widget_class->style_set = caja_path_bar_style_set; -#endif + widget_class->screen_changed = caja_path_bar_screen_changed; widget_class->grab_notify = caja_path_bar_grab_notify; widget_class->state_changed = caja_path_bar_state_changed; @@ -472,9 +423,7 @@ caja_path_bar_class_init (CajaPathBarClass *path_bar_class) G_TYPE_NONE, 1, G_TYPE_FILE); -#if GTK_CHECK_VERSION(3,0,0) gtk_container_class_handle_border_width (container_class); -#endif } @@ -548,7 +497,7 @@ caja_path_bar_dispose (GObject *object) * Ideally, our size is determined by another widget, and we are just filling * available space. */ -#if GTK_CHECK_VERSION(3,0,0) + static void caja_path_bar_get_preferred_width (GtkWidget *widget, gint *minimum, @@ -626,53 +575,6 @@ caja_path_bar_get_preferred_height (GtkWidget *widget, } } -#else /* GTK_CHECK_VERSION(3,0,0) */ - -static void -caja_path_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - ButtonData *button_data; - CajaPathBar *path_bar; - GtkRequisition child_requisition; - GList *list; - guint border_width; - - path_bar = CAJA_PATH_BAR (widget); - - requisition->width = 0; - requisition->height = 0; - - for (list = path_bar->button_list; list; list = list->next) - { - button_data = BUTTON_DATA (list->data); - gtk_widget_size_request (button_data->button, &child_requisition); - requisition->width = MAX (child_requisition.width, requisition->width); - requisition->height = MAX (child_requisition.height, requisition->height); - } - - /* Add space for slider, if we have more than one path */ - /* Theoretically, the slider could be bigger than the other button. But we're */ - /* not going to worry about that now.*/ - - path_bar->slider_width = MIN(requisition->height * 2 / 3 + 5, requisition->height); - if (path_bar->button_list && path_bar->button_list->next != NULL) - { - requisition->width += (path_bar->spacing + path_bar->slider_width) * 2; - } - - gtk_widget_size_request (path_bar->up_slider_button, &child_requisition); - gtk_widget_size_request (path_bar->down_slider_button, &child_requisition); - - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - requisition->width += border_width * 2; - requisition->height += border_width * 2; - - gtk_widget_set_size_request (widget, requisition->width, - requisition->height); -} -#endif /* GTK_CHECK_VERSION(3,0,0) */ - static void caja_path_bar_update_slider_buttons (CajaPathBar *path_bar) { @@ -741,12 +643,8 @@ caja_path_bar_size_allocate (GtkWidget *widget, return; } direction = gtk_widget_get_direction (widget); -#if GTK_CHECK_VERSION(3,0,0) + allocation_width = allocation->width; -#else - gint border_width = (gint) gtk_container_get_border_width (GTK_CONTAINER (path_bar)); - allocation_width = allocation->width - 2 * border_width; -#endif /* First, we check to see if we need the scrollbars. */ if (path_bar->fake_root) @@ -859,45 +757,27 @@ caja_path_bar_size_allocate (GtkWidget *widget, } /* Now, we allocate space to the buttons */ -#if GTK_CHECK_VERSION(3,0,0) child_allocation.y = allocation->y; child_allocation.height = allocation->height; -#else - child_allocation.y = allocation->y + border_width; - child_allocation.height = MAX (1, (gint) allocation->height - border_width * 2); -#endif if (direction == GTK_TEXT_DIR_RTL) { -#if GTK_CHECK_VERSION(3,0,0) child_allocation.x = allocation->x + allocation->width; -#else - child_allocation.x = allocation->x + allocation->width - border_width; -#endif + if (need_sliders || path_bar->fake_root) { child_allocation.x -= (path_bar->spacing + path_bar->slider_width); -#if GTK_CHECK_VERSION(3,0,0) up_slider_offset = allocation->width - path_bar->slider_width; -#else - up_slider_offset = allocation->width - border_width - path_bar->slider_width; -#endif + } } else { -#if GTK_CHECK_VERSION(3,0,0) child_allocation.x = allocation->x; -#else - child_allocation.x = allocation->x + border_width; -#endif + if (need_sliders || path_bar->fake_root) { -#if GTK_CHECK_VERSION(3,0,0) up_slider_offset = 0; -#else - up_slider_offset = border_width; -#endif child_allocation.x += (path_bar->spacing + path_bar->slider_width); } } @@ -917,11 +797,7 @@ caja_path_bar_size_allocate (GtkWidget *widget, /* Check to see if we've don't have any more space to allocate buttons */ if (need_sliders && direction == GTK_TEXT_DIR_RTL) { -#if GTK_CHECK_VERSION(3,0,0) if (child_allocation.x - path_bar->spacing - path_bar->slider_width < widget_allocation.x) -#else - if (child_allocation.x - path_bar->spacing - path_bar->slider_width < widget_allocation.x + border_width) -#endif { break; } @@ -930,11 +806,8 @@ caja_path_bar_size_allocate (GtkWidget *widget, { if (need_sliders && direction == GTK_TEXT_DIR_LTR) { -#if GTK_CHECK_VERSION(3,0,0) if (child_allocation.x + child_allocation.width + path_bar->spacing + path_bar->slider_width > widget_allocation.x + allocation_width) -#else - if (child_allocation.x + child_allocation.width + path_bar->spacing + path_bar->slider_width > widget_allocation.x + border_width + allocation_width) -#endif + { break; } @@ -948,20 +821,13 @@ caja_path_bar_size_allocate (GtkWidget *widget, { child_allocation.x -= path_bar->spacing; down_slider_offset = child_allocation.x - widget_allocation.x - path_bar->slider_width; -#if GTK_CHECK_VERSION(3,0,0) down_slider_offset = child_allocation.x - allocation->x - path_bar->slider_width; -#else - down_slider_offset = border_width; -#endif } else { down_slider_offset = child_allocation.x - widget_allocation.x; -#if GTK_CHECK_VERSION(3,0,0) down_slider_offset += child_allocation.width + path_bar->spacing; -#else - down_slider_offset = allocation->width - border_width - path_bar->slider_width; -#endif + child_allocation.x += child_allocation.width + path_bar->spacing; } } @@ -1007,19 +873,11 @@ caja_path_bar_size_allocate (GtkWidget *widget, } static void -#if GTK_CHECK_VERSION (3, 0, 0) caja_path_bar_style_updated (GtkWidget *widget) { if (GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_updated) { GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_updated (widget); -#else -caja_path_bar_style_set (GtkWidget *widget, GtkStyle *previous_style) -{ - if (GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_set) - { - GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_set (widget, previous_style); -#endif } caja_path_bar_check_icon_theme (CAJA_PATH_BAR (widget)); @@ -1176,9 +1034,6 @@ caja_path_bar_scroll_down (CajaPathBar *path_bar) gtk_widget_queue_resize (GTK_WIDGET (path_bar)); -#if !GTK_CHECK_VERSION(3,0,0) - gint border_width = gtk_container_get_border_width (GTK_CONTAINER (path_bar)); -#endif direction = gtk_widget_get_direction (GTK_WIDGET (path_bar)); /* We find the button at the 'down' end that we have to make */ @@ -1219,9 +1074,6 @@ caja_path_bar_scroll_down (CajaPathBar *path_bar) else { space_available = (allocation.x + allocation.width) - -#if !GTK_CHECK_VERSION(3,0,0) - border_width - -#endif (slider_allocation.x + slider_allocation.width); } @@ -1270,10 +1122,6 @@ caja_path_bar_scroll_timeout (CajaPathBar *path_bar) { gboolean retval = FALSE; -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_THREADS_ENTER (); -#endif - if (path_bar->timer) { if (gtk_widget_has_focus (path_bar->up_slider_button)) @@ -1302,10 +1150,6 @@ caja_path_bar_scroll_timeout (CajaPathBar *path_bar) } } -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_THREADS_LEAVE (); -#endif - return retval; } @@ -1604,7 +1448,6 @@ get_dir_name (ButtonData *button_data) /* We always want to request the same size for the label, whether * or not the contents are bold */ -#if GTK_CHECK_VERSION(3,0,0) static void set_label_padding_size (ButtonData *button_data) { @@ -1632,33 +1475,6 @@ set_label_padding_size (ButtonData *button_data) g_object_unref (layout); } -#else /* GTK_CHECK_VERSION(3,0,0) */ - -static void -label_size_request_cb (GtkWidget *widget, - GtkRequisition *requisition, - ButtonData *button_data) -{ - const gchar *dir_name = get_dir_name (button_data); - PangoLayout *layout; - gint bold_width, bold_height; - gchar *markup; - - layout = gtk_widget_create_pango_layout (button_data->label, dir_name); - pango_layout_get_pixel_size (layout, &requisition->width, &requisition->height); - - markup = g_markup_printf_escaped ("%s", dir_name); - pango_layout_set_markup (layout, markup, -1); - g_free (markup); - - pango_layout_get_pixel_size (layout, &bold_width, &bold_height); - requisition->width = MAX (requisition->width, bold_width); - requisition->height = MAX (requisition->height, bold_height); - - g_object_unref (layout); -} -#endif /* GTK_CHECK_VERSION(3,0,0) */ - static void caja_path_bar_update_button_appearance (ButtonData *button_data) { @@ -1674,18 +1490,15 @@ caja_path_bar_update_button_appearance (ButtonData *button_data) markup = g_markup_printf_escaped ("%s", dir_name); gtk_label_set_markup (GTK_LABEL (button_data->label), markup); -#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_margin_end (GTK_WIDGET (button_data->label), 0); gtk_widget_set_margin_start (GTK_WIDGET (button_data->label), 0); -#endif g_free(markup); } else { gtk_label_set_text (GTK_LABEL (button_data->label), dir_name); -#if GTK_CHECK_VERSION(3,0,0) set_label_padding_size (button_data); -#endif } } @@ -1715,20 +1528,16 @@ caja_path_bar_update_button_appearance (ButtonData *button_data) if (pixbuf != NULL) { gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), pixbuf); -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_add_class (gtk_widget_get_style_context (button_data->button), "image-button"); -#endif gtk_widget_show (GTK_WIDGET (button_data->image)); g_object_unref (pixbuf); } else { gtk_widget_hide (GTK_WIDGET (button_data->image)); -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_remove_class (gtk_widget_get_style_context (button_data->button), "image-button"); -#endif } } } @@ -2058,17 +1867,11 @@ make_directory_button (CajaPathBar *path_bar, { GFile *path; GtkWidget *child; -#if !GTK_CHECK_VERSION(3,0,0) - GtkWidget *label_alignment; -#endif ButtonData *button_data; path = caja_file_get_location (file); child = NULL; -#if !GTK_CHECK_VERSION(3,0,0) - label_alignment = NULL; -#endif file_is_hidden = !! file_is_hidden; /* Is it a special button? */ @@ -2076,10 +1879,8 @@ make_directory_button (CajaPathBar *path_bar, setup_button_type (button_data, path_bar, path); button_data->button = gtk_toggle_button_new (); -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_add_class (gtk_widget_get_style_context (button_data->button), "text-button"); -#endif #if GTK_CHECK_VERSION(3,20,0) gtk_widget_set_focus_on_click (button_data->button, FALSE); #else @@ -2102,47 +1903,20 @@ make_directory_button (CajaPathBar *path_bar, case MOUNT_BUTTON: case DEFAULT_LOCATION_BUTTON: button_data->label = gtk_label_new (NULL); -#if GTK_CHECK_VERSION(3,0,0) - child = gtk_hbox_new (FALSE, 2); + child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0); -#else - label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0); - gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label); - child = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0); -#endif + break; case NORMAL_BUTTON: default: button_data->label = gtk_label_new (NULL); -#if GTK_CHECK_VERSION(3,0,0) - child = gtk_hbox_new (FALSE, 2); + child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0); -#else - label_alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0); - gtk_container_add (GTK_CONTAINER (label_alignment), button_data->label); - child = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (child), label_alignment, FALSE, FALSE, 0); -#endif button_data->is_base_dir = base_dir; } -#if !GTK_CHECK_VERSION(3,0,0) - /* label_alignment is created because we can't override size-request - * on label itself and still have the contents of the label centered - * properly in the label's requisition - */ - if (label_alignment) - { - g_signal_connect (label_alignment, "size-request", - G_CALLBACK (label_size_request_cb), button_data); - } -#endif - if (button_data->path == NULL) { button_data->path = g_object_ref (path); @@ -2280,10 +2054,6 @@ caja_path_bar_update_path (CajaPathBar *path_bar, file = caja_file_get (file_path); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - while (file != NULL) { parent_file = caja_file_get_parent (file); @@ -2319,10 +2089,6 @@ caja_path_bar_update_path (CajaPathBar *path_bar, gtk_container_add (GTK_CONTAINER (path_bar), button); } -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - if (path_bar->current_path != NULL) { g_object_unref (path_bar->current_path); diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index b406032e..22652671 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -27,14 +27,9 @@ #include #include #include -#if GTK_CHECK_VERSION(3,0,0) #include -#endif #include #include -#if !GTK_CHECK_VERSION(3,0,0) -#include -#endif #include #include #include @@ -166,12 +161,8 @@ static void open_selected_bookmark (CajaPlacesSidebar GtkTreePath *path, CajaWindowOpenFlags flags); -#if GTK_CHECK_VERSION (3, 0, 0) static void caja_places_sidebar_style_updated (GtkWidget *widget); -#else -static void caja_places_sidebar_style_set (GtkWidget *widget, - GtkStyle *previous_style); -#endif + static gboolean eject_or_unmount_bookmark (CajaPlacesSidebar *sidebar, GtkTreePath *path); static gboolean eject_or_unmount_selection (CajaPlacesSidebar *sidebar); @@ -254,11 +245,7 @@ get_eject_icon (gboolean highlighted) if (highlighted) { GdkPixbuf *high; -#if GTK_CHECK_VERSION(3,0,0) high = eel_create_spotlight_pixbuf (eject); -#else - high = eel_gdk_pixbuf_render (eject, 1, 255, 255, 0, 0); -#endif g_object_unref (eject); eject = high; } @@ -1035,11 +1022,9 @@ over_eject_button (CajaPlacesSidebar *sidebar, eject_button_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU); if (x - total_width >= 0 && -#if GTK_CHECK_VERSION (3, 0, 0) /* fix unwanted unmount requests if clicking on the label */ x >= total_width - eject_button_size && x >= 80 && -#endif x - total_width <= eject_button_size) { return TRUE; } @@ -1895,9 +1880,6 @@ volume_mounted_cb (GVolume *volume, cur = CAJA_WINDOW (sidebar->window); new = caja_application_create_navigation_window (cur->application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif gtk_window_get_screen (GTK_WINDOW (cur))); caja_window_go_to (new, location); } @@ -1980,9 +1962,6 @@ open_selected_bookmark (CajaPlacesSidebar *sidebar, cur = CAJA_WINDOW (sidebar->window); new = caja_application_create_navigation_window (cur->application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif gtk_window_get_screen (GTK_WINDOW (cur))); caja_window_go_to (new, location); } @@ -3412,11 +3391,7 @@ caja_places_sidebar_class_init (CajaPlacesSidebarClass *class) { G_OBJECT_CLASS (class)->dispose = caja_places_sidebar_dispose; -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (class)->style_updated = caja_places_sidebar_style_updated; -#else - GTK_WIDGET_CLASS (class)->style_set = caja_places_sidebar_style_set; -#endif } static const char * @@ -3504,12 +3479,7 @@ caja_places_sidebar_set_parent_window (CajaPlacesSidebar *sidebar, } static void -#if GTK_CHECK_VERSION (3, 0, 0) caja_places_sidebar_style_updated (GtkWidget *widget) -#else -caja_places_sidebar_style_set (GtkWidget *widget, - GtkStyle *previous_style) -#endif { CajaPlacesSidebar *sidebar; diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 28a778e7..437e0bec 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -183,11 +183,6 @@ static GdkPixbuf * make_color_drag_image (CajaPropertyBro #define ERASE_OBJECT_NAME "erase.png" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - enum { PROPERTY_TYPE @@ -300,21 +295,19 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser) gtk_window_set_wmclass (GTK_WINDOW (widget), "property_browser", "Caja"); gtk_window_set_type_hint (GTK_WINDOW (widget), GDK_WINDOW_TYPE_HINT_DIALOG); -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (property_browser)); gtk_style_context_add_class (context, "caja-property-browser"); -#endif /* create the main vbox. */ - vbox = gtk_vbox_new (FALSE, 12); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (property_browser), vbox); /* create the container box */ - property_browser->details->container = gtk_hbox_new (FALSE, 6); + property_browser->details->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show (GTK_WIDGET (property_browser->details->container)); gtk_box_pack_start (GTK_BOX (vbox), property_browser->details->container, @@ -335,13 +328,13 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser) GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); /* allocate a table to hold the category selector */ - property_browser->details->category_box = gtk_vbox_new (FALSE, 6); + property_browser->details->category_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_add(GTK_CONTAINER(viewport), property_browser->details->category_box); gtk_container_add (GTK_CONTAINER (property_browser->details->category_container), viewport); gtk_widget_show (GTK_WIDGET (property_browser->details->category_box)); /* make the content container vbox */ - property_browser->details->content_container = gtk_vbox_new (FALSE, 6); + property_browser->details->content_container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_widget_show (property_browser->details->content_container); gtk_box_pack_start (GTK_BOX (property_browser->details->container), property_browser->details->content_container, @@ -360,7 +353,7 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser) gtk_widget_show(temp_frame); gtk_container_add(GTK_CONTAINER(property_browser->details->title_box), temp_frame); - temp_hbox = gtk_hbox_new(FALSE, 0); + temp_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show(temp_hbox); gtk_container_add(GTK_CONTAINER(temp_frame), temp_hbox); @@ -385,7 +378,7 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser) temp_box = gtk_event_box_new(); gtk_widget_show(temp_box); - property_browser->details->bottom_box = gtk_hbox_new (FALSE, 6); + property_browser->details->bottom_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show (property_browser->details->bottom_box); gtk_box_pack_end (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0); @@ -1103,11 +1096,7 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser) GtkWidget *button; GtkWidget *dialog; GtkWidget *label; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid = gtk_grid_new (); -#else - GtkWidget *table = gtk_table_new(2, 2, FALSE); -#endif dialog = gtk_dialog_new_with_buttons (_("Create a New Emblem"), GTK_WINDOW (property_browser), 0, @@ -1115,41 +1104,28 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser) GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) /* install the grid in the dialog */ gtk_container_set_border_width (GTK_CONTAINER (grid), 5); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); gtk_widget_show (grid); -#else - /* install the table in the dialog */ - gtk_container_set_border_width (GTK_CONTAINER (table), 5); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - gtk_widget_show (table); -#endif gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, TRUE, 0); -#else - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0); -#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK); /* make the keyword label and field */ widget = gtk_label_new_with_mnemonic(_("_Keyword:")); -#if GTK_CHECK_VERSION (3, 14, 0) - gtk_widget_set_halign (widget, GTK_ALIGN_START); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (widget), 0.0); #else gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5); #endif gtk_widget_show(widget); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach(GTK_GRID(grid), widget, 0, 0, 1, 1); property_browser->details->keyword = gtk_entry_new (); @@ -1157,15 +1133,6 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser) gtk_entry_set_max_length (GTK_ENTRY (property_browser->details->keyword), 24); gtk_widget_show(property_browser->details->keyword); gtk_grid_attach(GTK_GRID(grid), property_browser->details->keyword, 1, 0, 1, 1); -#else - gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - - property_browser->details->keyword = gtk_entry_new (); - gtk_entry_set_activates_default (GTK_ENTRY (property_browser->details->keyword), TRUE); - gtk_entry_set_max_length (GTK_ENTRY (property_browser->details->keyword), 24); - gtk_widget_show(property_browser->details->keyword); - gtk_table_attach(GTK_TABLE(table), property_browser->details->keyword, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); -#endif gtk_widget_grab_focus(property_browser->details->keyword); gtk_label_set_mnemonic_widget (GTK_LABEL (widget), GTK_WIDGET (property_browser->details->keyword)); @@ -1176,20 +1143,15 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser) /* set up a file chooser to pick the image file */ label = gtk_label_new_with_mnemonic (_("_Image:")); -#if GTK_CHECK_VERSION (3, 14, 0) - gtk_widget_set_halign (label, GTK_ALIGN_START); +#if GTK_CHECK_VERSION (3, 16, 0) + gtk_label_set_xalign (GTK_LABEL (label), 0.0); #else gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show (label); gtk_grid_attach (GTK_GRID(grid), label, 0, 1, 1, 1); -#else - gtk_widget_show (label); - gtk_table_attach (GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); -#endif - widget = gtk_hbox_new (FALSE, 0); + widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (widget); button = gtk_button_new (); @@ -1200,11 +1162,7 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser) gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_widget_show (button); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), widget, 1, 1, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), widget, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0); -#endif gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0); return dialog; @@ -1217,11 +1175,8 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser) { GtkWidget *widget; GtkWidget *dialog; -#if GTK_CHECK_VERSION (3, 0, 0) + GtkWidget *grid = gtk_grid_new (); -#else - GtkWidget *table = gtk_table_new(2, 2, FALSE); -#endif dialog = gtk_dialog_new_with_buttons (_("Create a New Color:"), GTK_WINDOW (property_browser), 0, @@ -1229,26 +1184,17 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser) GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) /* install the grid in the dialog */ gtk_widget_show (grid); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, TRUE, 0); -#else - /* install the table in the dialog */ - gtk_widget_show (table); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0); -#endif + gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK); /* make the name label and field */ widget = gtk_label_new_with_mnemonic(_("Color _name:")); gtk_widget_show(widget); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach(GTK_GRID(grid), widget, 0, 0, 1, 1); -#else - gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); -#endif property_browser->details->color_name = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (property_browser->details->color_name), TRUE); @@ -1256,11 +1202,7 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser) gtk_widget_grab_focus (property_browser->details->color_name); gtk_label_set_mnemonic_widget (GTK_LABEL (widget), property_browser->details->color_name); gtk_widget_show(property_browser->details->color_name); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach(GTK_GRID(grid), property_browser->details->color_name, 1, 0, 1, 1); -#else - gtk_table_attach(GTK_TABLE(table), property_browser->details->color_name, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); -#endif gtk_widget_grab_focus(property_browser->details->color_name); /* default image is the generic emblem */ @@ -1268,21 +1210,13 @@ caja_color_selection_dialog_new (CajaPropertyBrowser *property_browser) widget = gtk_label_new_with_mnemonic(_("Color _value:")); gtk_widget_show(widget); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach(GTK_GRID(grid), widget, 0, 1, 1, 1); -#else - gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); -#endif property_browser->details->color_picker = gtk_color_button_new (); gtk_widget_show (property_browser->details->color_picker); gtk_label_set_mnemonic_widget (GTK_LABEL (widget), property_browser->details->color_picker); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach(GTK_GRID(grid), property_browser->details->color_picker, 1, 1, 1, 1); -#else - gtk_table_attach(GTK_TABLE(table), property_browser->details->color_picker, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0); -#endif return dialog; } @@ -2254,9 +2188,7 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser) /* allocate a new container, with a scrollwindow and viewport */ property_browser->details->content_frame = gtk_scrolled_window_new (NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_vexpand (property_browser->details->content_frame, TRUE); -#endif viewport = gtk_viewport_new (NULL, NULL); gtk_widget_show(viewport); gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_IN); diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c index 38ef74bf..8319db25 100644 --- a/src/caja-query-editor.c +++ b/src/caja-query-editor.c @@ -34,11 +34,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - typedef enum { CAJA_QUERY_EDITOR_ROW_LOCATION, @@ -143,11 +138,7 @@ static CajaQueryEditorRowOps row_type[] = EEL_CLASS_BOILERPLATE (CajaQueryEditor, caja_query_editor, -#if GTK_CHECK_VERSION (3, 0, 0) GTK_TYPE_BOX) -#else - GTK_TYPE_VBOX) -#endif static void caja_query_editor_finalize (GObject *object) @@ -967,7 +958,7 @@ caja_query_editor_add_row (CajaQueryEditor *editor, row->editor = editor; row->type = type; - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); row->hbox = hbox; gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (editor->details->visible_vbox), hbox, FALSE, FALSE, 0); @@ -1030,23 +1021,19 @@ caja_query_editor_init (CajaQueryEditor *editor) editor->details = g_new0 (CajaQueryEditorDetails, 1); editor->details->is_visible = TRUE; - editor->details->invisible_vbox = gtk_vbox_new (FALSE, 6); -#if GTK_CHECK_VERSION (3, 0, 0) + editor->details->invisible_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL); -#endif gtk_box_pack_start (GTK_BOX (editor), editor->details->invisible_vbox, FALSE, FALSE, 0); - editor->details->visible_vbox = gtk_vbox_new (FALSE, 6); -#if GTK_CHECK_VERSION (3, 0, 0) + editor->details->visible_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL); -#endif gtk_box_pack_start (GTK_BOX (editor), editor->details->visible_vbox, FALSE, FALSE, 0); /* Only show visible vbox */ gtk_widget_show (editor->details->visible_vbox); /* Create invisible part: */ - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (editor->details->invisible_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -1129,7 +1116,7 @@ setup_internal_entry (CajaQueryEditor *editor) char *label_markup; /* Create visible part: */ - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (editor->details->visible_vbox), hbox, FALSE, FALSE, 0); @@ -1159,7 +1146,7 @@ setup_external_entry (CajaQueryEditor *editor, GtkWidget *entry) GtkWidget *hbox, *label; /* Create visible part: */ - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (editor->details->visible_vbox), hbox, FALSE, FALSE, 0); diff --git a/src/caja-query-editor.h b/src/caja-query-editor.h index 2a443624..9b255dc8 100644 --- a/src/caja-query-editor.h +++ b/src/caja-query-editor.h @@ -45,21 +45,13 @@ typedef struct CajaQueryEditorDetails CajaQueryEditorDetails; typedef struct CajaQueryEditor { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox parent; -#else - GtkVBox parent; -#endif CajaQueryEditorDetails *details; } CajaQueryEditor; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_class; -#else - GtkVBoxClass parent_class; -#endif void (* changed) (CajaQueryEditor *editor, CajaQuery *query, diff --git a/src/caja-search-bar.c b/src/caja-search-bar.c index bbe1be02..af0531ea 100644 --- a/src/caja-search-bar.c +++ b/src/caja-search-bar.c @@ -29,10 +29,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct CajaSearchBarDetails { GtkWidget *entry; @@ -154,42 +150,23 @@ focus_in_event_callback (GtkWidget *widget, static void caja_search_bar_init (CajaSearchBar *bar) { -#if !GTK_CHECK_VERSION(3, 0, 0) - GtkWidget *alignment; -#endif GtkWidget *hbox; GtkWidget *label; -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (bar)); gtk_style_context_add_class (context, "caja-search-bar"); -#endif bar->details = g_new0 (CajaSearchBarDetails, 1); gtk_event_box_set_visible_window (GTK_EVENT_BOX (bar), FALSE); -#if GTK_CHECK_VERSION(3, 0, 0) - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_set_margin_start (hbox, 6); gtk_widget_set_margin_end (hbox, 6); gtk_widget_show (hbox); gtk_container_add (GTK_CONTAINER (bar), hbox); -#else - alignment = gtk_alignment_new (0.5, 0.5, - 1.0, 1.0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), - 0, 0, 6, 6); - gtk_widget_show (alignment); - gtk_container_add (GTK_CONTAINER (bar), alignment); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - gtk_container_add (GTK_CONTAINER (alignment), hbox); -#endif - label = gtk_label_new (_("Search:")); gtk_widget_show (label); diff --git a/src/caja-side-pane.c b/src/caja-side-pane.c index 8799fb0d..fc34e1ba 100644 --- a/src/caja-side-pane.c +++ b/src/caja-side-pane.c @@ -30,14 +30,6 @@ #include #include -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - typedef struct { char *title; @@ -72,11 +64,7 @@ enum static guint signals[LAST_SIGNAL] = { 0 }; -#if GTK_CHECK_VERSION (3, 0, 0) EEL_CLASS_BOILERPLATE (CajaSidePane, caja_side_pane, GTK_TYPE_BOX) -#else -EEL_CLASS_BOILERPLATE (CajaSidePane, caja_side_pane, GTK_TYPE_VBOX) -#endif static SidePanel * panel_for_widget (CajaSidePane *side_pane, GtkWidget *widget) @@ -320,20 +308,16 @@ caja_side_pane_init (GObject *object) side_pane->details = G_TYPE_INSTANCE_GET_PRIVATE (object, CAJA_TYPE_SIDE_PANE, CajaSidePaneDetails); -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (object)); gtk_style_context_add_class (context, "caja-side-pane"); -#endif - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); side_pane->details->title_hbox = hbox; gtk_widget_show (hbox); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_orientable_set_orientation (GTK_ORIENTABLE (object), GTK_ORIENTATION_VERTICAL); -#endif gtk_box_pack_start (GTK_BOX (side_pane), hbox, FALSE, FALSE, 0); select_button = gtk_toggle_button_new (); @@ -349,7 +333,7 @@ caja_side_pane_init (GObject *object) G_CALLBACK (select_button_key_press_callback), side_pane); - select_hbox = gtk_hbox_new (FALSE, 0); + select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (select_hbox); side_pane->details->title_label = gtk_label_new (""); @@ -360,11 +344,7 @@ caja_side_pane_init (GObject *object) side_pane->details->title_label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); -#endif gtk_widget_show (arrow); gtk_box_pack_end (GTK_BOX (select_hbox), arrow, FALSE, FALSE, 0); @@ -388,7 +368,7 @@ caja_side_pane_init (GObject *object) gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0); - side_pane->details->shortcut_box = gtk_hbox_new (TRUE, 0); + side_pane->details->shortcut_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (side_pane->details->shortcut_box); gtk_box_pack_end (GTK_BOX (hbox), side_pane->details->shortcut_box, diff --git a/src/caja-side-pane.h b/src/caja-side-pane.h index 9ed67fe6..0a693f4c 100644 --- a/src/caja-side-pane.h +++ b/src/caja-side-pane.h @@ -46,21 +46,13 @@ extern "C" { typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox parent; -#else - GtkVBox parent; -#endif CajaSidePaneDetails *details; } CajaSidePane; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_slot; -#else - GtkVBoxClass parent_slot; -#endif void (*close_requested) (CajaSidePane *side_pane); void (*switch_page) (CajaSidePane *side_pane, diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c index 1f2c4295..372e7ee1 100644 --- a/src/caja-sidebar-title.c +++ b/src/caja-sidebar-title.c @@ -54,17 +54,8 @@ #define MIN_TITLE_FONT_SIZE 12 #define TITLE_PADDING 4 -#if GTK_CHECK_VERSION (3, 0, 0) #define DEFAULT_LIGHT_INFO_COLOR "#FFFFFF" #define DEFAULT_DARK_INFO_COLOR "#2A2A2A" -#else -#define DEFAULT_LIGHT_INFO_COLOR 0xFFFFFF -#define DEFAULT_DARK_INFO_COLOR 0x2A2A2A -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif static void caja_sidebar_title_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -74,12 +65,7 @@ static GtkWidget * sidebar_title_create_more_info_label (void); static void update_all (CajaSidebarTitle *sidebar_title); static void update_more_info (CajaSidebarTitle *sidebar_title); static void update_title_font (CajaSidebarTitle *sidebar_title); -#if GTK_CHECK_VERSION (3, 0, 0) static void style_updated (GtkWidget *widget); -#else -static void style_set (GtkWidget *widget, - GtkStyle *previous_style); -#endif static guint get_best_icon_size (CajaSidebarTitle *sidebar_title); enum @@ -106,35 +92,17 @@ struct CajaSidebarTitleDetails GtkWidget *more_info_label; GtkWidget *emblem_box; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA label_colors [LAST_LABEL_COLOR]; -#else - GdkColor label_colors [LAST_LABEL_COLOR]; -#endif guint best_icon_size; gboolean determined_icon; }; -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_BOX) -#else -G_DEFINE_TYPE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_VBOX) -#endif -#if GTK_CHECK_VERSION (3, 0, 0) static void style_updated (GtkWidget *widget) { CajaSidebarTitle *sidebar_title; -#else -static void -style_set (GtkWidget *widget, - GtkStyle *previous_style) -{ - CajaSidebarTitle *sidebar_title; - PangoFontDescription *font_desc; - GtkStyle *style; -#endif g_return_if_fail (CAJA_IS_SIDEBAR_TITLE (widget)); @@ -143,20 +111,6 @@ style_set (GtkWidget *widget, /* Update the dynamically-sized title font */ update_title_font (sidebar_title); - /* Update the fixed-size "more info" font */ - /*Disable this in GTK3 as it does NOT work and instead blocks changing font size*/ -#if !GTK_CHECK_VERSION (3, 0, 0) - style = gtk_widget_get_style (widget); - font_desc = pango_font_description_copy (style->font_desc); - if (pango_font_description_get_size (font_desc) < MORE_INFO_FONT_SIZE * PANGO_SCALE) - { - pango_font_description_set_size (font_desc, MORE_INFO_FONT_SIZE * PANGO_SCALE); - } - - gtk_widget_modify_font (sidebar_title->details->more_info_label, - font_desc); - pango_font_description_free (font_desc); -#endif } static void @@ -166,9 +120,7 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title) CAJA_TYPE_SIDEBAR_TITLE, CajaSidebarTitleDetails); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_orientable_set_orientation (GTK_ORIENTABLE (sidebar_title), GTK_ORIENTATION_VERTICAL); -#endif /* Create the icon */ sidebar_title->details->icon = gtk_image_new (); @@ -185,7 +137,7 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title) gtk_box_pack_start (GTK_BOX (sidebar_title), sidebar_title->details->more_info_label, 0, 0, 0); gtk_widget_show (sidebar_title->details->more_info_label); - sidebar_title->details->emblem_box = gtk_hbox_new (FALSE, 0); + sidebar_title->details->emblem_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (sidebar_title->details->emblem_box); gtk_box_pack_start (GTK_BOX (sidebar_title), sidebar_title->details->emblem_box, 0, 0, 0); @@ -194,11 +146,7 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title) update_all (sidebar_title); /* initialize the label colors & fonts */ -#if GTK_CHECK_VERSION (3, 0, 0) style_updated (GTK_WIDGET (sidebar_title)); -#else - style_set (GTK_WIDGET (sidebar_title), NULL); -#endif g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS, @@ -257,37 +205,20 @@ caja_sidebar_title_class_init (CajaSidebarTitleClass *klass) widget_class = GTK_WIDGET_CLASS (klass); widget_class->size_allocate = caja_sidebar_title_size_allocate; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->style_updated = style_updated; -#else - widget_class->style_set = style_set; -#endif gtk_widget_class_install_style_property (widget_class, -#if GTK_CHECK_VERSION (3, 0, 0) g_param_spec_boxed ("light_info_rgba", "Light Info RGBA", "Color used for information text against a dark background", GDK_TYPE_RGBA, -#else - g_param_spec_boxed ("light_info_color", - "Light Info Color", - "Color used for information text against a dark background", - GDK_TYPE_COLOR, -#endif G_PARAM_READABLE)); + gtk_widget_class_install_style_property (widget_class, -#if GTK_CHECK_VERSION (3, 0, 0) g_param_spec_boxed ("dark_info_rgba", "Dark Info RGBA", "Color used for information text against a light background", GDK_TYPE_RGBA, -#else - g_param_spec_boxed ("dark_info_color", - "Dark Info Color", - "Color used for information text against a light background", - GDK_TYPE_COLOR, -#endif G_PARAM_READABLE)); g_type_class_add_private (klass, sizeof (CajaSidebarTitleDetails)); @@ -301,36 +232,23 @@ caja_sidebar_title_new (void) } static void -#if GTK_CHECK_VERSION (3, 0, 0) setup_gc_with_fg (CajaSidebarTitle *sidebar_title, int idx, GdkRGBA *color) { sidebar_title->details->label_colors[idx] = *color; -#else -setup_gc_with_fg (CajaSidebarTitle *sidebar_title, int idx, guint32 color) -{ - sidebar_title->details->label_colors [idx] = eel_gdk_rgb_to_color (color); -#endif } void caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, EelBackground *background) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *light_info_color, *dark_info_color; GtkStyleContext *style; GdkRGBA color; -#else - GdkColor *light_info_color, *dark_info_color; - guint light_info_value, dark_info_value; - GtkStyle *style; -#endif g_assert (CAJA_IS_SIDEBAR_TITLE (sidebar_title)); g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (sidebar_title))); /* read the info colors from the current theme; use a reasonable default if undefined */ -#if GTK_CHECK_VERSION (3, 0, 0) style = gtk_widget_get_style_context (GTK_WIDGET (sidebar_title)); gtk_style_context_get_style (style, "light_info_color", &light_info_color, @@ -365,50 +283,12 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color); setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_ACTIVE, eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color); -#else - gtk_widget_style_get (GTK_WIDGET (sidebar_title), - "light_info_color", &light_info_color, - "dark_info_color", &dark_info_color, - NULL); - style = gtk_widget_get_style (GTK_WIDGET (sidebar_title)); - if (light_info_color) - { - light_info_value = eel_gdk_color_to_rgb (light_info_color); - gdk_color_free (light_info_color); - } - else - { - light_info_value = DEFAULT_LIGHT_INFO_COLOR; - } - - if (dark_info_color) - { - dark_info_value = eel_gdk_color_to_rgb (dark_info_color); - gdk_color_free (dark_info_color); - } - else - { - dark_info_value = DEFAULT_DARK_INFO_COLOR; - } - - setup_gc_with_fg (sidebar_title, LABEL_COLOR_HIGHLIGHT, - eel_gdk_color_to_rgb (&style->text[GTK_STATE_SELECTED])); - setup_gc_with_fg (sidebar_title, LABEL_COLOR_ACTIVE, - eel_gdk_color_to_rgb (&style->text[GTK_STATE_ACTIVE])); - setup_gc_with_fg (sidebar_title, LABEL_COLOR_PRELIGHT, - eel_gdk_color_to_rgb (&style->text[GTK_STATE_PRELIGHT])); - setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_HIGHLIGHT, - eel_gdk_color_is_dark (&style->base[GTK_STATE_SELECTED]) ? light_info_value : dark_info_value); - setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_ACTIVE, - eel_gdk_color_is_dark (&style->base[GTK_STATE_ACTIVE]) ? light_info_value : dark_info_value); -#endif /* If EelBackground is not set in the widget, we can safely * use the foreground color from the theme, because it will * always be displayed against the gtk background */ if (!eel_background_is_set(background)) -#if GTK_CHECK_VERSION (3, 0, 0) { gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &color); setup_gc_with_fg (sidebar_title, LABEL_COLOR, &color); @@ -437,24 +317,6 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, gdk_rgba_free (dark_info_color); gdk_rgba_free (light_info_color); -#else - { - setup_gc_with_fg (sidebar_title, LABEL_COLOR, - eel_gdk_color_to_rgb (&style->text[GTK_STATE_NORMAL])); - setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, - eel_gdk_color_is_dark (&style->base[GTK_STATE_NORMAL]) ? light_info_value : dark_info_value); - } - else if (eel_background_is_dark (background)) - { - setup_gc_with_fg (sidebar_title, LABEL_COLOR, 0xEFEFEF); - setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, light_info_value); - } - else /* converse */ - { - setup_gc_with_fg (sidebar_title, LABEL_COLOR, 0x000000); - setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, dark_info_value); - } -#endif } static char* @@ -547,12 +409,8 @@ update_title_font (CajaSidebarTitle *sidebar_title) { int available_width, width; int max_fit_font_size, max_style_font_size; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GtkStateFlags state; -#else - GtkStyle *style; -#endif GtkAllocation allocation; PangoFontDescription *title_font, *tmp_font; PangoLayout *layout; @@ -572,13 +430,9 @@ update_title_font (CajaSidebarTitle *sidebar_title) { return; } -#if GTK_CHECK_VERSION (3, 0, 0) + context = gtk_widget_get_style_context (GTK_WIDGET (sidebar_title)); gtk_style_context_get (context, state, GTK_STYLE_PROPERTY_FONT, &title_font, NULL); -#else - style = gtk_widget_get_style (GTK_WIDGET (sidebar_title)); - title_font = pango_font_description_copy (style->font_desc); -#endif max_style_font_size = pango_font_description_get_size (title_font) * 1.8 / PANGO_SCALE; if (max_style_font_size < MIN_TITLE_FONT_SIZE + 1) { @@ -607,11 +461,7 @@ update_title_font (CajaSidebarTitle *sidebar_title) pango_font_description_set_size (title_font, max_fit_font_size * PANGO_SCALE); pango_font_description_set_weight (title_font, PANGO_WEIGHT_BOLD); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font (sidebar_title->details->title_label, title_font); -#else - gtk_widget_modify_font (sidebar_title->details->title_label, title_font); -#endif pango_font_description_free (title_font); } diff --git a/src/caja-sidebar-title.h b/src/caja-sidebar-title.h index 04d93815..d6e651f9 100644 --- a/src/caja-sidebar-title.h +++ b/src/caja-sidebar-title.h @@ -49,21 +49,13 @@ typedef struct CajaSidebarTitleDetails CajaSidebarTitleDetails; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox box; -#else - GtkVBox box; -#endif CajaSidebarTitleDetails *details; } CajaSidebarTitle; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_class; -#else - GtkVBoxClass parent_class; -#endif } CajaSidebarTitleClass; GType caja_sidebar_title_get_type (void); diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c index ab716c3d..6d3d0112 100644 --- a/src/caja-spatial-window.c +++ b/src/caja-spatial-window.c @@ -37,9 +37,6 @@ #include "caja-desktop-window.h" #include "caja-bookmarks-window.h" #include "caja-location-dialog.h" -#if ENABLE_LIBUNIQUE == (TRUE) -#include "caja-main.h" -#endif #include "caja-query-editor.h" #include "caja-search-bar.h" #include "caja-window-manage-views.h" @@ -63,10 +60,6 @@ #include #include -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - #define MAX_TITLE_LENGTH 180 #define MAX_SHORTNAME_PATH 16 @@ -76,10 +69,6 @@ #define SPATIAL_ACTION_CLOSE_ALL_FOLDERS "Close All Folders" #define MENU_PATH_SPATIAL_BOOKMARKS_PLACEHOLDER "/MenuBar/Other Menus/Places/Bookmarks Placeholder" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct _CajaSpatialWindowDetails { GtkActionGroup *spatial_action_group; /* owned by ui_manager */ @@ -990,9 +979,6 @@ static const char* icon_entries[] = static void caja_spatial_window_init (CajaSpatialWindow *window) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkRcStyle *rc_style; -#endif GtkWidget *arrow; GtkWidget *hbox, *vbox; GtkActionGroup *action_group; @@ -1010,7 +996,6 @@ caja_spatial_window_init (CajaSpatialWindow *window) win = CAJA_WINDOW (window); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_hexpand (win->details->statusbar, TRUE); gtk_grid_attach (GTK_GRID (win->details->grid), win->details->statusbar, @@ -1020,32 +1005,16 @@ caja_spatial_window_init (CajaSpatialWindow *window) pane = caja_window_pane_new (win); win->details->panes = g_list_prepend (win->details->panes, pane); + /* FIXME: changing this to gtk_box_new breaks desktop :-/ + * see https://github.com/mate-desktop/caja/issues/591 + */ vbox = gtk_vbox_new (FALSE, 0); gtk_widget_set_hexpand (vbox, TRUE); gtk_widget_set_vexpand (vbox, TRUE); gtk_grid_attach (GTK_GRID (CAJA_WINDOW (window)->details->grid), vbox, 0, 1, 1, 3); -#else - gtk_table_attach (GTK_TABLE (win->details->table), - win->details->statusbar, - /* X direction */ /* Y direction */ - 0, 1, 5, 6, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - gtk_widget_show (win->details->statusbar); - pane = caja_window_pane_new (win); - win->details->panes = g_list_prepend (win->details->panes, pane); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_table_attach (GTK_TABLE (CAJA_WINDOW (window)->details->table), - vbox, - /* X direction */ /* Y direction */ - 0, 1, 1, 4, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK, - 0, 0); -#endif gtk_widget_show (vbox); window->details->content_box = vbox; @@ -1056,16 +1025,9 @@ caja_spatial_window_init (CajaSpatialWindow *window) window); gtk_button_set_relief (GTK_BUTTON (window->details->location_button), GTK_RELIEF_NORMAL); -#if !GTK_CHECK_VERSION (3, 0, 0) - rc_style = gtk_widget_get_modifier_style (window->details->location_button); - rc_style->xthickness = 0; - rc_style->ythickness = 0; - gtk_widget_modify_style (window->details->location_button, - rc_style); -#endif gtk_widget_show (window->details->location_button); - hbox = gtk_hbox_new (FALSE, 3); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_container_add (GTK_CONTAINER (window->details->location_button), hbox); gtk_widget_show (hbox); @@ -1081,11 +1043,7 @@ caja_spatial_window_init (CajaSpatialWindow *window) FALSE, FALSE, 0); gtk_widget_show (window->details->location_label); -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); -#endif gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 0); gtk_widget_show (arrow); diff --git a/src/caja-trash-bar.c b/src/caja-trash-bar.c index 25630612..53f9ebcd 100644 --- a/src/caja-trash-bar.c +++ b/src/caja-trash-bar.c @@ -51,11 +51,7 @@ struct CajaTrashBarPrivate gulong selection_handler_id; }; -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE (CajaTrashBar, caja_trash_bar, GTK_TYPE_BOX); -#else -G_DEFINE_TYPE (CajaTrashBar, caja_trash_bar, GTK_TYPE_HBOX); -#endif static void restore_button_clicked_cb (GtkWidget *button, @@ -193,9 +189,9 @@ caja_trash_bar_init (CajaTrashBar *bar) label = gtk_label_new (_("Trash")); gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (bar), GTK_ORIENTATION_HORIZONTAL); -#endif + gtk_box_pack_start (GTK_BOX (bar), label, FALSE, FALSE, 0); bar->priv->empty_button = gtk_button_new_with_mnemonic (_("Empty _Trash")); diff --git a/src/caja-trash-bar.h b/src/caja-trash-bar.h index fb0d7baa..5d20175e 100644 --- a/src/caja-trash-bar.h +++ b/src/caja-trash-bar.h @@ -42,22 +42,14 @@ extern "C" { typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox box; -#else - GtkHBox box; -#endif - CajaTrashBarPrivate *priv; } CajaTrashBar; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_class; -#else - GtkHBoxClass parent_class; -#endif + } CajaTrashBarClass; GType caja_trash_bar_get_type (void) G_GNUC_CONST; diff --git a/src/caja-view-as-action.c b/src/caja-view-as-action.c index 9325f607..d03cfa63 100644 --- a/src/caja-view-as-action.c +++ b/src/caja-view-as-action.c @@ -42,10 +42,6 @@ static GObjectClass *parent_class = NULL; #define CAJA_VIEW_AS_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), CAJA_TYPE_VIEW_AS_ACTION, CajaViewAsActionPrivate)) -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - struct CajaViewAsActionPrivate { CajaNavigationWindow *window; @@ -177,7 +173,7 @@ connect_proxy (GtkAction *action, /* Option menu for content view types; it's empty here, filled in when a uri is set. * Pack it into vbox so it doesn't grow vertically when location bar does. */ - view_as_menu_vbox = gtk_vbox_new (FALSE, 4); + view_as_menu_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_widget_show (view_as_menu_vbox); gtk_container_add (GTK_CONTAINER (item), view_as_menu_vbox); diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index 74578525..e25a0ba0 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -33,9 +33,6 @@ #include "caja-location-bar.h" #include "caja-search-bar.h" #include "caja-pathbar.h" -#if ENABLE_LIBUNIQUE == (TRUE) -#include "caja-main.h" -#endif #include "caja-window-private.h" #include "caja-window-slot.h" #include "caja-navigation-window-slot.h" @@ -603,9 +600,6 @@ caja_window_slot_open_location_full (CajaWindowSlot *slot, } else if (target_navigation) { target_window = caja_application_create_navigation_window (window->application, -#if ENABLE_LIBUNIQUE == (TRUE) - NULL, -#endif gtk_window_get_screen (GTK_WINDOW (window))); } else { target_window = caja_application_get_spatial_window @@ -1199,9 +1193,7 @@ got_file_info_for_view_selection_callback (CajaFile *file, GFile *location; GMountOperation *mount_op; MountNotMountedData *data; -#if ENABLE_LIBUNIQUE == (FALSE) CajaApplication *app; -#endif slot = callback_data; g_assert (CAJA_IS_WINDOW_SLOT (slot)); g_assert (slot->determine_view_file == file); @@ -1314,15 +1306,10 @@ got_file_info_for_view_selection_callback (CajaFile *file, * happens when a new window cannot display its initial URI. */ /* if this is the only window, we don't want to quit, so we redirect it to home */ -#if ENABLE_LIBUNIQUE == (FALSE) app = CAJA_APPLICATION (g_application_get_default ()); if (g_list_length (gtk_application_get_windows (GTK_APPLICATION (app))) == 1) { -#else - if (caja_application_get_n_windows () <= 1) - { - g_assert (caja_application_get_n_windows () == 1); -#endif + /* the user could have typed in a home directory that doesn't exist, in which case going home would cause an infinite loop, so we better test for that */ diff --git a/src/caja-window-private.h b/src/caja-window-private.h index a2361790..7afcb497 100644 --- a/src/caja-window-private.h +++ b/src/caja-window-private.h @@ -42,11 +42,8 @@ struct _CajaNavigationWindowPane; /* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */ struct CajaWindowDetails { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif + GtkWidget *statusbar; GtkWidget *menubar; diff --git a/src/caja-window-slot.c b/src/caja-window-slot.c index e7d53f2a..6286a5e3 100644 --- a/src/caja-window-slot.c +++ b/src/caja-window-slot.c @@ -33,10 +33,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - static void caja_window_slot_init (CajaWindowSlot *slot); static void caja_window_slot_class_init (CajaWindowSlotClass *class); static void caja_window_slot_dispose (GObject *object); @@ -184,7 +180,7 @@ caja_window_slot_init (CajaWindowSlot *slot) { GtkWidget *content_box, *eventbox, *extras_vbox, *frame; - content_box = gtk_vbox_new (FALSE, 0); + content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); slot->content_box = content_box; gtk_widget_show (content_box); @@ -198,13 +194,13 @@ caja_window_slot_init (CajaWindowSlot *slot) gtk_container_add (GTK_CONTAINER (frame), eventbox); gtk_widget_show (eventbox); - extras_vbox = gtk_vbox_new (FALSE, 6); + extras_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_set_border_width (GTK_CONTAINER (extras_vbox), 6); slot->extra_location_widgets = extras_vbox; gtk_container_add (GTK_CONTAINER (eventbox), extras_vbox); gtk_widget_show (extras_vbox); - slot->view_box = gtk_vbox_new (FALSE, 0); + slot->view_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (content_box), slot->view_box, TRUE, TRUE, 0); gtk_widget_show (slot->view_box); @@ -483,13 +479,8 @@ caja_window_slot_set_content_view_widget (CajaWindowSlot *slot, if (new_view != NULL) { widget = caja_view_get_widget (new_view); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_pack_start (GTK_BOX (slot->view_box), widget, TRUE, TRUE, 0); -#else - gtk_container_add (GTK_CONTAINER (slot->view_box), - GTK_WIDGET (new_view)); -#endif gtk_widget_show (widget); diff --git a/src/caja-window.c b/src/caja-window.c index 69c62429..84ae7487 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -32,9 +32,6 @@ #include "caja-application.h" #include "caja-bookmarks-window.h" #include "caja-information-panel.h" -#if ENABLE_LIBUNIQUE == (TRUE) -#include "caja-main.h" -#endif #include "caja-window-manage-views.h" #include "caja-window-bookmarks.h" #include "caja-window-slot.h" @@ -132,15 +129,10 @@ static const struct static void caja_window_init (CajaWindow *window) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *menu; GtkWidget *statusbar; -#if GTK_CHECK_VERSION (3, 0, 0) #if GTK_CHECK_VERSION (3, 20, 0) static const gchar css_custom[] = "#caja-extra-view-widget {" @@ -169,7 +161,6 @@ caja_window_init (CajaWindow *window) } g_object_unref (provider); -#endif window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_WINDOW, CajaWindowDetails); window->details->panes = NULL; @@ -177,40 +168,21 @@ caja_window_init (CajaWindow *window) window->details->show_hidden_files_mode = CAJA_WINDOW_SHOW_HIDDEN_FILES_DEFAULT; -#if !GTK_CHECK_VERSION (3, 0, 0) - /* Remove Top border on GtkStatusBar */ - gtk_rc_parse_string ( - "style \"statusbar-no-border\"\n" - "{\n" - " GtkStatusbar::shadow_type = GTK_SHADOW_NONE\n" - "}\n" - "widget \"*.statusbar-noborder\" style \"statusbar-no-border\""); -#endif - /* Set initial window title */ gtk_window_set_title (GTK_WINDOW (window), _("Caja")); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL); window->details->grid = grid; gtk_widget_show (grid); gtk_container_add (GTK_CONTAINER (window), grid); -#else - table = gtk_table_new (1, 6, FALSE); - window->details->table = table; - gtk_widget_show (table); - gtk_container_add (GTK_CONTAINER (window), table); -#endif statusbar = gtk_statusbar_new (); gtk_widget_set_name (statusbar, "statusbar-noborder"); /* set margin to zero to reduce size of statusbar */ -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_top (GTK_WIDGET (statusbar), 0); gtk_widget_set_margin_bottom (GTK_WIDGET (statusbar), 0); -#endif window->details->statusbar = statusbar; window->details->help_message_cid = gtk_statusbar_get_context_id @@ -221,35 +193,13 @@ caja_window_init (CajaWindow *window) menu = gtk_ui_manager_get_widget (window->details->ui_manager, "/MenuBar"); window->details->menubar = menu; -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_hexpand (menu, TRUE); gtk_widget_show (menu); gtk_grid_attach (GTK_GRID (grid), menu, 0, 0, 1, 1); -#else - gtk_widget_show (menu); - gtk_table_attach (GTK_TABLE (table), - menu, - /* X direction */ /* Y direction */ - 0, 1, 0, 1, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); -#endif /* Register to menu provider extension signal managing menu updates */ g_signal_connect_object (caja_signaller_get_current (), "popup_menu_changed", G_CALLBACK (caja_window_load_extension_menus), window, G_CONNECT_SWAPPED); -#if ENABLE_LIBUNIQUE == (TRUE) -/* Keep the main event loop alive as long as the window exists */ -#if GTK_CHECK_VERSION(3, 0, 0) - /* FIXME: port to GtkApplication with GTK3 */ - /*This is DONE when built with --disable-libunique */ - //gtk_quit_add_destroy (1, GTK_WIDGET (window)); - caja_main_event_loop_register (GTK_WIDGET (window)); -#else - gtk_quit_add_destroy (1, GTK_OBJECT (window)); - caja_main_event_loop_register (GTK_OBJECT (window)); -#endif -#endif } /* Unconditionally synchronize the GtkUIManager of WINDOW. */ @@ -442,11 +392,7 @@ update_cursor (CajaWindow *window) display = gtk_widget_get_display (GTK_WIDGET (window)); cursor = gdk_cursor_new_for_display (display, GDK_WATCH); gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref (cursor); -#else - gdk_cursor_unref (cursor); -#endif } else { @@ -591,9 +537,7 @@ caja_window_set_initial_window_geometry (CajaWindow *window) { GdkScreen *screen; guint max_width_for_screen, max_height_for_screen; -#if !GTK_CHECK_VERSION(3,0,0) - guint min_width, min_height; -#endif + guint default_width, default_height; screen = gtk_window_get_screen (GTK_WINDOW (window)); @@ -601,17 +545,6 @@ caja_window_set_initial_window_geometry (CajaWindow *window) max_width_for_screen = get_max_forced_width (screen); max_height_for_screen = get_max_forced_height (screen); -#if !GTK_CHECK_VERSION(3,0,0) - EEL_CALL_METHOD (CAJA_WINDOW_CLASS, window, - get_min_size, (window, &min_width, &min_height)); - - gtk_widget_set_size_request (GTK_WIDGET (window), - MIN (min_width, - max_width_for_screen), - MIN (min_height, - max_height_for_screen)); -#endif - EEL_CALL_METHOD (CAJA_WINDOW_CLASS, window, get_default_size, (window, &default_width, &default_height)); @@ -674,13 +607,8 @@ free_stored_viewers (CajaWindow *window) window->details->extra_viewer = NULL; } -#if GTK_CHECK_VERSION (3, 0, 0) static void caja_window_destroy (GtkWidget *object) -#else -static void -caja_window_destroy (GtkObject *object) -#endif { CajaWindow *window; GList *panes_copy; @@ -695,11 +623,7 @@ caja_window_destroy (GtkObject *object) g_assert (window->details->panes == NULL); g_assert (window->details->active_pane == NULL); -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (caja_window_parent_class)->destroy (object); -#else - GTK_OBJECT_CLASS (caja_window_parent_class)->destroy (object); -#endif } static void @@ -1064,9 +988,7 @@ caja_window_size_request (GtkWidget *widget, g_assert (CAJA_IS_WINDOW (widget)); g_assert (requisition != NULL); -#if !GTK_CHECK_VERSION(3,0,0) - GTK_WIDGET_CLASS (caja_window_parent_class)->size_request (widget, requisition); -#endif + screen = gtk_window_get_screen (GTK_WINDOW (widget)); /* Limit the requisition to be within 90% of the available screen @@ -1907,20 +1829,14 @@ caja_forget_history (void) CajaWindowSlot *slot; CajaNavigationWindowSlot *navigation_slot; GList *window_node, *l, *walk; -#if ENABLE_LIBUNIQUE == (FALSE) CajaApplication *app; app = CAJA_APPLICATION (g_application_get_default ()); -#endif /* Clear out each window's back & forward lists. Also, remove * each window's current location bookmark from history list * so it doesn't get clobbered. */ -#if ENABLE_LIBUNIQUE == (FALSE) for (window_node = gtk_application_get_windows (GTK_APPLICATION (app)); -#else - for (window_node = caja_application_get_window_list (); -#endif window_node != NULL; window_node = window_node->next) { @@ -1963,11 +1879,7 @@ caja_forget_history (void) free_history_list (); /* Re-add each window's current location to history list. */ -#if ENABLE_LIBUNIQUE == (FALSE) for (window_node = gtk_application_get_windows (GTK_APPLICATION (app)); -#else - for (window_node = caja_application_get_window_list (); -#endif window_node != NULL; window_node = window_node->next) { @@ -2175,16 +2087,10 @@ caja_window_class_init (CajaWindowClass *class) G_OBJECT_CLASS (class)->set_property = caja_window_set_property; G_OBJECT_CLASS (class)->finalize = caja_window_finalize; -#if !GTK_CHECK_VERSION (3, 0, 0) - GTK_OBJECT_CLASS (class)->destroy = caja_window_destroy; -#else GTK_WIDGET_CLASS (class)->destroy = caja_window_destroy; -#endif GTK_WIDGET_CLASS (class)->show = caja_window_show; -#if !GTK_CHECK_VERSION (3,0,0) - GTK_WIDGET_CLASS (class)->size_request = caja_window_size_request; -#endif + GTK_WIDGET_CLASS (class)->realize = caja_window_realize; GTK_WIDGET_CLASS (class)->key_press_event = caja_window_key_press_event; class->get_title = real_get_title; @@ -2256,17 +2162,7 @@ caja_window_class_init (CajaWindowClass *class) class->reload = caja_window_reload; class->go_up = caja_window_go_up_signal; -#if !GTK_CHECK_VERSION (3,0,0) - /* Allow to set the colors of the extra view widgets */ - gtk_rc_parse_string ("\n" - " style \"caja-extra-view-widgets-style-internal\"\n" - " {\n" - " bg[NORMAL] = \"" EXTRA_VIEW_WIDGETS_BACKGROUND "\"\n" - " }\n" - "\n" - " widget \"*.caja-extra-view-widget\" style:rc \"caja-extra-view-widgets-style-internal\" \n" - "\n"); -#endif + g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (CajaWindowDetails)); } diff --git a/src/caja-x-content-bar.c b/src/caja-x-content-bar.c index 1fc8aabe..8c834215 100644 --- a/src/caja-x-content-bar.c +++ b/src/caja-x-content-bar.c @@ -50,11 +50,7 @@ enum PROP_X_CONTENT_TYPE, }; -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE (CajaXContentBar, caja_x_content_bar, GTK_TYPE_BOX) -#else -G_DEFINE_TYPE (CajaXContentBar, caja_x_content_bar, GTK_TYPE_HBOX) -#endif void caja_x_content_bar_set_x_content_type (CajaXContentBar *bar, const char *x_content_type) @@ -308,9 +304,9 @@ caja_x_content_bar_init (CajaXContentBar *bar) bar->priv->label = gtk_label_new (NULL); gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (bar), GTK_ORIENTATION_HORIZONTAL); -#endif + #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (bar->priv->label), 0.0); #else diff --git a/src/caja-x-content-bar.h b/src/caja-x-content-bar.h index fc6fead6..50639e4e 100644 --- a/src/caja-x-content-bar.h +++ b/src/caja-x-content-bar.h @@ -43,22 +43,14 @@ extern "C" { typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox box; -#else - GtkHBox box; -#endif CajaXContentBarPrivate *priv; } CajaXContentBar; typedef struct { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_class; -#else - GtkHBoxClass parent_class; -#endif } CajaXContentBarClass; GType caja_x_content_bar_get_type (void) G_GNUC_CONST; diff --git a/src/caja-zoom-control.c b/src/caja-zoom-control.c index 5f0549f1..e11c2a39 100644 --- a/src/caja-zoom-control.c +++ b/src/caja-zoom-control.c @@ -37,9 +37,7 @@ #include #include #include -#if GTK_CHECK_VERSION(3, 0, 0) #include -#endif #include #include #include @@ -47,10 +45,6 @@ #include #include -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - enum { ZOOM_IN, @@ -113,11 +107,7 @@ static GType caja_zoom_control_accessible_get_type (void); #define NUM_ACTIONS ((int)G_N_ELEMENTS (caja_zoom_control_accessible_action_names)) -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE (CajaZoomControl, caja_zoom_control, GTK_TYPE_BOX); -#else -G_DEFINE_TYPE (CajaZoomControl, caja_zoom_control, GTK_TYPE_HBOX); -#endif static void caja_zoom_control_finalize (GObject *object) @@ -292,11 +282,7 @@ set_label_size (CajaZoomControl *zoom_control) static void label_style_set_callback (GtkWidget *label, -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *style, -#else - GtkStyle *style, -#endif gpointer user_data) { set_label_size (CAJA_ZOOM_CONTROL (user_data)); @@ -337,9 +323,9 @@ caja_zoom_control_init (CajaZoomControl *zoom_control) g_signal_connect (G_OBJECT (zoom_control->details->zoom_out), "clicked", G_CALLBACK (zoom_out_clicked), zoom_control); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_orientable_set_orientation (GTK_ORIENTABLE (zoom_control), GTK_ORIENTATION_HORIZONTAL); -#endif + gtk_container_add (GTK_CONTAINER (zoom_control->details->zoom_out), image); gtk_box_pack_start (GTK_BOX (zoom_control), zoom_control->details->zoom_out, FALSE, FALSE, 0); @@ -532,26 +518,6 @@ create_zoom_menu (CajaZoomControl *zoom_control) return menu; } -#if !GTK_CHECK_VERSION(3, 0, 0) -static AtkObject * -caja_zoom_control_get_accessible (GtkWidget *widget) -{ - AtkObject *accessible; - - accessible = eel_accessibility_get_atk_object (widget); - - if (accessible) - { - return accessible; - } - - accessible = g_object_new - (caja_zoom_control_accessible_get_type (), NULL); - - return eel_accessibility_set_atk_object_return (widget, accessible); -} -#endif - static void caja_zoom_control_change_value (CajaZoomControl *zoom_control, GtkScrollType scroll) @@ -694,12 +660,10 @@ caja_zoom_control_class_init (CajaZoomControlClass *class) widget_class = GTK_WIDGET_CLASS (class); -#if GTK_CHECK_VERSION(3, 0, 0) + gtk_widget_class_set_accessible_type (widget_class, caja_zoom_control_accessible_get_type ()); -#else - widget_class->get_accessible = caja_zoom_control_get_accessible; -#endif + widget_class->scroll_event = caja_zoom_control_scroll_event; class->change_value = caja_zoom_control_change_value; @@ -978,7 +942,6 @@ caja_zoom_control_accessible_initialize (AtkObject *accessible, atk_object_set_role (accessible, ATK_ROLE_DIAL); } -#if GTK_CHECK_VERSION(3, 0, 0) typedef struct _CajaZoomControlAccessible CajaZoomControlAccessible; typedef struct _CajaZoomControlAccessibleClass CajaZoomControlAccessibleClass; @@ -1014,56 +977,6 @@ static void caja_zoom_control_accessible_init (CajaZoomControlAccessible *accessible) { } -#else -static void -caja_zoom_control_accessible_class_init (AtkObjectClass *klass) -{ - accessible_parent_class = g_type_class_peek_parent (klass); - - klass->get_name = caja_zoom_control_accessible_get_name; - klass->get_description = caja_zoom_control_accessible_get_description; - klass->initialize = caja_zoom_control_accessible_initialize; -} - -static GType -caja_zoom_control_accessible_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static GInterfaceInfo atk_action_info = - { - (GInterfaceInitFunc)caja_zoom_control_accessible_action_interface_init, - (GInterfaceFinalizeFunc)NULL, - NULL - }; - - static GInterfaceInfo atk_value_info = - { - (GInterfaceInitFunc)caja_zoom_control_accessible_value_interface_init, - (GInterfaceFinalizeFunc)NULL, - NULL - }; - - type = eel_accessibility_create_derived_type - ("CajaZoomControlAccessible", -#if GTK_CHECK_VERSION (3, 0, 0) - GTK_TYPE_BOX, -#else - GTK_TYPE_HBOX, -#endif - caja_zoom_control_accessible_class_init); - - g_type_add_interface_static (type, ATK_TYPE_ACTION, - &atk_action_info); - g_type_add_interface_static (type, ATK_TYPE_VALUE, - &atk_value_info); - } - - return type; -} -#endif void caja_zoom_control_set_active_appearance (CajaZoomControl *zoom_control, gboolean is_active) diff --git a/src/caja-zoom-control.h b/src/caja-zoom-control.h index fb72d3c8..85a07046 100644 --- a/src/caja-zoom-control.h +++ b/src/caja-zoom-control.h @@ -49,21 +49,13 @@ typedef struct CajaZoomControlDetails CajaZoomControlDetails; struct CajaZoomControl { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBox parent; -#else - GtkHBox parent; -#endif CajaZoomControlDetails *details; }; struct CajaZoomControlClass { -#if GTK_CHECK_VERSION (3, 0, 0) GtkBoxClass parent_class; -#else - GtkHBoxClass parent_class; -#endif void (*zoom_in) (CajaZoomControl *control); void (*zoom_out) (CajaZoomControl *control); diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 1637532c..2a16f494 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -61,12 +61,6 @@ #include #include -#if !GTK_CHECK_VERSION(3, 0, 0) -#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment -#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment -#define GTK_SCROLLABLE GTK_LAYOUT -#endif - /* Timeout to check the desktop directory for updates */ #define RESCAN_TIMEOUT 4 @@ -354,7 +348,7 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, if (keyboard != NULL) { gdk_seat_ungrab (seat); } -#elif GTK_CHECK_VERSION(3, 0, 0) +#else GdkDevice *keyboard = NULL, *pointer = NULL, *cur; GdkDeviceManager *manager; GList *list, *l; @@ -392,14 +386,6 @@ fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container, if (keyboard != NULL) { gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); } -#else - - /* During a mouse click we have the pointer and keyboard grab. - * We will send a fake event to the root window which will cause it - * to try to get the grab so we need to let go ourselves. - */ - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gdk_keyboard_ungrab (GDK_CURRENT_TIME); #endif /* Stop the event because we don't want anyone else dealing with it. */ diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 28c446ec..02a22da6 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -129,10 +129,6 @@ #define MAX_MENU_LEVELS 5 #define TEMPLATE_LIMIT 30 -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - enum { ADD_FILE, BEGIN_FILE_CHANGES, @@ -1197,11 +1193,7 @@ select_pattern (FMDirectoryView *view) GtkWidget *dialog; GtkWidget *label; GtkWidget *example; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *entry; char *example_pattern; @@ -1222,27 +1214,19 @@ select_pattern (FMDirectoryView *view) label = gtk_label_new_with_mnemonic (_("_Pattern:")); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (label, GTK_ALIGN_START); example = gtk_label_new (NULL); gtk_widget_set_halign (example, GTK_ALIGN_START); -#else - example = gtk_label_new (NULL); -#endif example_pattern = g_strdup_printf ("%s%s", _("Examples: "), "*.png, file\?\?.txt, pict*.\?\?\?"); gtk_label_set_markup (GTK_LABEL (example), example_pattern); g_free (example_pattern); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (example, GTK_ALIGN_START); -#else - gtk_misc_set_alignment (GTK_MISC (example), 0.0, 0.5); -#endif + entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (entry, TRUE); grid = gtk_grid_new (); @@ -1262,31 +1246,7 @@ select_pattern (FMDirectoryView *view) gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); gtk_widget_show_all (grid); gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid); -#else - table = gtk_table_new (2, 2, FALSE); - - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - 0, 1, - GTK_FILL, GTK_FILL, - 5, 5); - - gtk_table_attach (GTK_TABLE (table), entry, - 1, 2, - 0, 1, - GTK_EXPAND | GTK_FILL, GTK_FILL, - 5, 5); - - gtk_table_attach (GTK_TABLE (table), example, - 1, 2, - 1, 2, - GTK_FILL, GTK_FILL, - 5, 0); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); - gtk_widget_show_all (table); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table); -#endif g_object_set_data (G_OBJECT (dialog), "entry", entry); g_signal_connect (dialog, "response", G_CALLBACK (pattern_select_response_cb), @@ -1363,11 +1323,8 @@ action_save_search_as_callback (GtkAction *action, { FMDirectoryView *directory_view; CajaSearchDirectory *search; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *dialog, *grid, *label, *entry, *chooser, *save_button; -#else - GtkWidget *dialog, *table, *label, *entry, *chooser, *save_button; -#endif + const char *entry_text; char *filename, *filename_utf8, *dirname, *path, *uri; GFile *location; @@ -1391,7 +1348,6 @@ action_save_search_as_callback (GtkAction *action, gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); g_object_set (grid, "orientation", GTK_ORIENTATION_VERTICAL, @@ -1401,14 +1357,6 @@ action_save_search_as_callback (GtkAction *action, NULL); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, TRUE, 0); gtk_widget_show (grid); -#else - table = gtk_table_new (2, 2, FALSE); - gtk_container_set_border_width (GTK_CONTAINER (table), 5); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0); - gtk_widget_show (table); -#endif label = gtk_label_new_with_mnemonic (_("Search _name:")); #if GTK_CHECK_VERSION (3, 16, 0) @@ -1416,20 +1364,12 @@ action_save_search_as_callback (GtkAction *action, #else gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); -#endif gtk_widget_show (label); entry = gtk_entry_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (entry, TRUE); gtk_grid_attach_next_to (GTK_GRID (grid), entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); -#endif gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); @@ -1444,22 +1384,14 @@ action_save_search_as_callback (GtkAction *action, #else gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5); #endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); -#else - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); -#endif gtk_widget_show (label); chooser = gtk_file_chooser_button_new (_("Select Folder to Save Search In"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (chooser, TRUE); gtk_grid_attach_next_to (GTK_GRID (grid), chooser, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), chooser, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); -#endif gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser); gtk_widget_show (chooser); @@ -2183,11 +2115,7 @@ real_unmerge_menus (FMDirectoryView *view) } static void -#if GTK_CHECK_VERSION (3, 0, 0) fm_directory_view_destroy (GtkWidget *object) -#else -fm_directory_view_destroy (GtkObject *object) -#endif { FMDirectoryView *view; GList *node, *next; @@ -2248,11 +2176,7 @@ fm_directory_view_destroy (GtkObject *object) view->details->directory_as_file = NULL; } -#if GTK_CHECK_VERSION (3, 0, 0) EEL_CALL_PARENT (GTK_WIDGET_CLASS, destroy, (object)); -#else - EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); -#endif } static void @@ -7100,7 +7024,7 @@ action_connect_to_server_link_callback (GtkAction *action, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); - box = gtk_hbox_new (FALSE, 12); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_widget_show (box); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), box, TRUE, TRUE, 0); @@ -10896,10 +10820,8 @@ gboolean fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view, GdkEventScroll *event) { -#if GTK_CHECK_VERSION (3, 0, 0) static gdouble total_delta_y = 0; gdouble delta_x, delta_y; -#endif if (event->state & GDK_CONTROL_MASK) { switch (event->direction) { @@ -10913,7 +10835,6 @@ fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view, fm_directory_view_bump_zoom_level (directory_view, -1); return TRUE; -#if GTK_CHECK_VERSION (3, 0, 0) case GDK_SCROLL_SMOOTH: gdk_event_get_scroll_deltas ((const GdkEvent *) event, &delta_x, &delta_y); @@ -10935,7 +10856,7 @@ fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view, /* eat event */ return TRUE; } -#endif + case GDK_SCROLL_LEFT: case GDK_SCROLL_RIGHT: break; @@ -11008,11 +10929,9 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_OBJECT_CLASS (klass)->set_property = fm_directory_view_set_property; G_OBJECT_CLASS (klass)->finalize = fm_directory_view_finalize; -#if !GTK_CHECK_VERSION (3, 0, 0) - GTK_OBJECT_CLASS (klass)->destroy = fm_directory_view_destroy; -#else + widget_class->destroy = fm_directory_view_destroy; -#endif + widget_class->scroll_event = fm_directory_view_scroll_event; widget_class->parent_set = fm_directory_view_parent_set; diff --git a/src/file-manager/fm-ditem-page.c b/src/file-manager/fm-ditem-page.c index 13803597..08f87b20 100644 --- a/src/file-manager/fm-ditem-page.c +++ b/src/file-manager/fm-ditem-page.c @@ -36,10 +36,6 @@ #define MAIN_GROUP "Desktop Entry" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - typedef struct ItemEntry { const char *field; @@ -320,38 +316,21 @@ entry_focus_out_cb (GtkWidget *entry, } static GtkWidget * -#if GTK_CHECK_VERSION (3, 0, 0) build_grid (GtkWidget *container, -#else -build_table (GtkWidget *container, -#endif GKeyFile *key_file, GtkSizeGroup *label_size_group, GList *entries) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *label; GtkWidget *entry; GList *l; char *val; -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); -#else - int i; - - table = gtk_table_new (g_list_length (entries) + 1, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - i = 0; -#endif for (l = entries; l; l = l->next) { @@ -370,9 +349,8 @@ build_table (GtkWidget *container, gtk_size_group_add_widget (label_size_group, label); entry = gtk_entry_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (entry, TRUE); -#endif + if (item_entry->localized) { @@ -393,18 +371,9 @@ build_table (GtkWidget *container, gtk_entry_set_text (GTK_ENTRY (entry), item_entry->current_value); g_free (val); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); gtk_grid_attach_next_to (GTK_GRID (grid), entry, label, GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, i, i+1, GTK_FILL, GTK_FILL, - 0, 0); - gtk_table_attach (GTK_TABLE (table), entry, - 1, 2, i, i+1, GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, - 0, 0); -#endif g_signal_connect (entry, "activate", G_CALLBACK (entry_activate_cb), @@ -438,39 +407,21 @@ build_table (GtkWidget *container, G_CALLBACK (fm_ditem_page_exec_drag_data_received), entry); } - -#if !GTK_CHECK_VERSION (3, 0, 0) - i++; -#endif } /* append dummy row */ label = gtk_label_new (""); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add (GTK_CONTAINER (grid), label); gtk_size_group_add_widget (label_size_group, label); gtk_widget_show_all (grid); return grid; -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, i, i+1, GTK_FILL, GTK_FILL, - 0, 0); - gtk_size_group_add_widget (label_size_group, label); - - gtk_widget_show_all (table); - return table; -#endif } static void create_page (GKeyFile *key_file, GtkWidget *box) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GList *entries; GtkSizeGroup *label_size_group; char *type; @@ -507,16 +458,11 @@ create_page (GKeyFile *key_file, GtkWidget *box) { /* we only handle launchers and links */ - /* ensure that we build an empty table with a dummy row at the end */ -#if GTK_CHECK_VERSION (3, 0, 0) + /* ensure that we build an empty gid with a dummy row at the end */ goto build_grid; -#else - goto build_table; -#endif } g_free (type); -#if GTK_CHECK_VERSION (3, 0, 0) build_grid: label_size_group = g_object_get_data (G_OBJECT (box), "label-size-group"); @@ -524,15 +470,7 @@ build_grid: g_list_free (entries); gtk_box_pack_start (GTK_BOX (box), grid, FALSE, TRUE, 0); -#else -build_table: - label_size_group = g_object_get_data (G_OBJECT (box), "label-size-group"); - table = build_table (box, key_file, label_size_group, entries); - g_list_free (entries); - - gtk_box_pack_start (GTK_BOX (box), table, FALSE, TRUE, 0); -#endif gtk_widget_show_all (GTK_WIDGET (box)); } @@ -588,7 +526,7 @@ fm_ditem_page_make_box (GtkSizeGroup *label_size_group, g_assert (fm_ditem_page_should_show (files)); - box = gtk_vbox_new (FALSE, 6); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); g_object_set_data_full (G_OBJECT (box), "label-size-group", label_size_group, (GDestroyNotify) g_object_unref); diff --git a/src/file-manager/fm-icon-container.c b/src/file-manager/fm-icon-container.c index 08b87529..be3acee2 100644 --- a/src/file-manager/fm-icon-container.c +++ b/src/file-manager/fm-icon-container.c @@ -595,10 +595,8 @@ fm_icon_container_class_init (FMIconContainerClass *klass) static void fm_icon_container_init (FMIconContainer *icon_container) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (icon_container)), GTK_STYLE_CLASS_VIEW); -#endif } CajaIconContainer * diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index c348cbd6..a388a3fb 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -212,11 +212,7 @@ G_DEFINE_TYPE_WITH_CODE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW, fm_icon_view_iface_init)); static void -#if GTK_CHECK_VERSION (3, 0, 0) fm_icon_view_destroy (GtkWidget *object) -#else -fm_icon_view_destroy (GtkObject *object) -#endif { FMIconView *icon_view; @@ -244,11 +240,7 @@ fm_icon_view_destroy (GtkObject *object) icon_view->details->icons_not_positioned = NULL; } -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (fm_icon_view_parent_class)->destroy (object); -#else - GTK_OBJECT_CLASS (fm_icon_view_parent_class)->destroy (object); -#endif } static void @@ -2493,7 +2485,6 @@ fm_icon_view_scroll_event (GtkWidget *widget, gboolean ret; icon_view = FM_ICON_VIEW (widget); -#if GTK_CHECK_VERSION (3, 0, 0) if (icon_view->details->compact && (scroll_event->direction == GDK_SCROLL_UP || scroll_event->direction == GDK_SCROLL_DOWN || @@ -2517,22 +2508,7 @@ fm_icon_view_scroll_event (GtkWidget *widget, } if ((scroll_event_copy->direction == GDK_SCROLL_UP) || (scroll_event_copy->delta_x == -1.0)) -#else - - if (icon_view->details->compact && - (scroll_event->direction == GDK_SCROLL_UP || - scroll_event->direction == GDK_SCROLL_DOWN)) - { - ret = fm_directory_view_handle_scroll_event (FM_DIRECTORY_VIEW (icon_view), scroll_event); - if (!ret) - { - /* in column-wise layout, re-emit vertical mouse scroll events as horizontal ones, - * if they don't bump zoom */ - event_copy = gdk_event_copy ((GdkEvent *) scroll_event); - scroll_event_copy = (GdkEventScroll *) event_copy; - if (scroll_event_copy->direction == GDK_SCROLL_UP) -#endif { scroll_event_copy->direction = GDK_SCROLL_LEFT; } @@ -3182,11 +3158,8 @@ fm_icon_view_class_init (FMIconViewClass *klass) G_OBJECT_CLASS (klass)->set_property = fm_icon_view_set_property; G_OBJECT_CLASS (klass)->finalize = fm_icon_view_finalize; -#if !GTK_CHECK_VERSION (3, 0, 0) - GTK_OBJECT_CLASS (klass)->destroy = fm_icon_view_destroy; -#else + GTK_WIDGET_CLASS (klass)->destroy = fm_icon_view_destroy; -#endif GTK_WIDGET_CLASS (klass)->screen_changed = fm_icon_view_screen_changed; GTK_WIDGET_CLASS (klass)->scroll_event = fm_icon_view_scroll_event; diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c index f33da35d..315fef70 100644 --- a/src/file-manager/fm-list-model.c +++ b/src/file-manager/fm-list-model.c @@ -29,11 +29,7 @@ #include #include -#if GTK_CHECK_VERSION(3,0,0) #include -#else -#include -#endif #include #include #include @@ -390,11 +386,7 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column g_list_find_custom (model->details->highlight_files, file, (GCompareFunc) caja_file_compare_location)) { -#if GTK_CHECK_VERSION(3,0,0) rendered_icon = eel_create_spotlight_pixbuf (icon); -#else - rendered_icon = eel_gdk_pixbuf_render (icon, 1, 255, 255, 0, 0); -#endif if (rendered_icon != NULL) { diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 999254d0..26d3cf74 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -63,10 +63,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - struct FMListViewDetails { GtkTreeView *tree_view; @@ -665,9 +661,6 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba FMListView *view; GtkTreeView *tree_view; GtkTreePath *path; -#if !GTK_CHECK_VERSION(3, 0, 0) - GtkWidget *caja_window; -#endif gboolean call_parent; GtkTreeSelection *selection; GtkWidgetClass *tree_view_class; @@ -683,13 +676,11 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba tree_view_class = GTK_WIDGET_GET_CLASS (tree_view); selection = gtk_tree_view_get_selection (tree_view); -#if GTK_CHECK_VERSION(3, 0, 0) /* Don't handle extra mouse buttons here */ if (event->button > 5) { return FALSE; } -#endif if (event->window != gtk_tree_view_get_bin_window (tree_view)) { @@ -860,13 +851,6 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba } } -#if !GTK_CHECK_VERSION(3, 0, 0) - if (event->button > 5) { - caja_window = GTK_WIDGET (fm_directory_view_get_caja_window (FM_DIRECTORY_VIEW (view))); - call_parent = !caja_navigation_window_button_press_event (caja_window, event); - } -#endif - if (call_parent) { tree_view_class->button_press_event (widget, event); @@ -905,22 +889,11 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba view->details->double_click_path[1] = view->details->double_click_path[0]; view->details->double_click_path[0] = NULL; } -#if GTK_CHECK_VERSION(3, 0, 0) + /* Deselect if people click outside any row. It's OK to let default code run; it won't reselect anything. */ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view)); tree_view_class->button_press_event (widget, event); -#else - if (event->button > 5) { - caja_window = GTK_WIDGET (fm_directory_view_get_caja_window (FM_DIRECTORY_VIEW (view))); - call_parent = !caja_navigation_window_button_press_event (caja_window, event); - } else { - /* Deselect if people click outside any row. It's OK to - let default code run; it won't reselect anything. */ - gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view)); - tree_view_class->button_press_event (widget, event); - } -#endif if (event->button == 3) { @@ -1749,9 +1722,6 @@ create_and_set_up_tree_view (FMListView *view) G_CALLBACK (subdirectory_unloaded_callback), view, 0); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (view->details->tree_view), GTK_SELECTION_MULTIPLE); -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_tree_view_set_rules_hint (view->details->tree_view, TRUE); -#endif caja_columns = caja_get_all_columns (); @@ -1783,14 +1753,12 @@ create_and_set_up_tree_view (FMListView *view) view->details->file_name_column = gtk_tree_view_column_new (); gtk_tree_view_column_set_expand (view->details->file_name_column, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) + GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET(view)); font_size = PANGO_PIXELS (pango_font_description_get_size ( gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL))); -#else - font_size = PANGO_PIXELS (pango_font_description_get_size (gtk_widget_get_style (GTK_WIDGET(view))->font_desc)); -#endif + gtk_tree_view_column_set_min_width (view->details->file_name_column, 20*font_size); g_object_ref_sink (view->details->file_name_column); view->details->file_name_column_num = column_num; @@ -2551,9 +2519,6 @@ create_column_editor (FMListView *view) GtkWidget *label; GtkWidget *box; GtkWidget *column_chooser; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *alignment; -#endif CajaFile *file; char *str; char *name; @@ -2575,7 +2540,7 @@ create_column_editor (FMListView *view) gtk_window_set_default_size (GTK_WINDOW (window), 300, 400); - box = gtk_vbox_new (FALSE, 12); + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (box), 12); gtk_widget_show (box); gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), box); @@ -2596,22 +2561,10 @@ create_column_editor (FMListView *view) g_free (str); -#if GTK_CHECK_VERSION (3, 0, 0) column_chooser = caja_column_chooser_new (file); gtk_widget_set_margin_start (column_chooser, 12); gtk_widget_show (column_chooser); gtk_box_pack_start (GTK_BOX (box), column_chooser, TRUE, TRUE, 0); -#else - alignment = gtk_alignment_new (0.5, 0.5, 1, 1); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), - 0, 0, 12, 0); - gtk_widget_show (alignment); - gtk_box_pack_start (GTK_BOX (box), alignment, TRUE, TRUE, 0); - - column_chooser = caja_column_chooser_new (file); - gtk_widget_show (column_chooser); - gtk_container_add (GTK_CONTAINER (alignment), column_chooser); -#endif g_signal_connect (column_chooser, "changed", G_CALLBACK (column_chooser_changed_callback), @@ -3005,15 +2958,8 @@ fm_list_view_click_policy_changed (FMDirectoryView *directory_view) } } -#if GTK_CHECK_VERSION(3,0,0) g_clear_object (&hand_cursor); -#else - if (hand_cursor != NULL) - { - gdk_cursor_unref (hand_cursor); - hand_cursor = NULL; - } -#endif + } else if (click_policy_auto_value == CAJA_CLICK_POLICY_SINGLE) { @@ -3311,35 +3257,20 @@ real_set_is_active (FMDirectoryView *view, gboolean is_active) { GtkWidget *tree_view; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *style; GdkRGBA color; -#else - GtkStyle *style; - GdkColor color; -#endif tree_view = GTK_WIDGET (fm_list_view_get_tree_view (FM_LIST_VIEW (view))); if (is_active) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, NULL); -#else - gtk_widget_modify_base (tree_view, GTK_STATE_NORMAL, NULL); -#endif } else { -#if GTK_CHECK_VERSION (3, 0, 0) style = gtk_widget_get_style_context (tree_view); gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color); gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, &color); -#else - style = gtk_widget_get_style (tree_view); - color = style->base[GTK_STATE_INSENSITIVE]; - gtk_widget_modify_base (tree_view, GTK_STATE_NORMAL, &color); -#endif } EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index db5e173c..87afdc5a 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -68,7 +68,6 @@ #include #endif -#if GTK_CHECK_VERSION (3, 0, 0) #define USED_FILL_R 0.988235294 #define USED_FILL_G 0.91372549 #define USED_FILL_B 0.309803922 @@ -76,16 +75,6 @@ #define FREE_FILL_R 0.447058824 #define FREE_FILL_G 0.623529412 #define FREE_FILL_B 0.811764706 -#else -#define USED_FILL_R (0.988235294 * 65535) -#define USED_FILL_G (0.91372549 * 65535) -#define USED_FILL_B (0.309803922 * 65535) - -#define FREE_FILL_R (0.447058824 * 65535) -#define FREE_FILL_G (0.623529412 * 65535) -#define FREE_FILL_B (0.811764706 * 65535) -#endif - #define PREVIEW_IMAGE_WIDTH 96 @@ -100,13 +89,7 @@ struct FMPropertiesWindowDetails { GtkNotebook *notebook; -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *basic_grid; -#else - GtkTable *basic_table; - GtkTable *permissions_table; - gboolean advanced_permissions; -#endif GtkWidget *icon_button; GtkWidget *icon_image; @@ -153,40 +136,17 @@ struct FMPropertiesWindowDetails { guint64 volume_capacity; guint64 volume_free; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA used_color; GdkRGBA free_color; GdkRGBA used_stroke_color; GdkRGBA free_stroke_color; -#else - GdkColor used_color; - GdkColor free_color; - GdkColor used_stroke_color; - GdkColor free_stroke_color; -#endif }; -#if GTK_CHECK_VERSION (3, 0, 0) typedef enum { PERMISSIONS_CHECKBOXES_READ, PERMISSIONS_CHECKBOXES_WRITE, PERMISSIONS_CHECKBOXES_EXECUTE } CheckboxType; -#else -enum { - PERMISSIONS_CHECKBOXES_OWNER_ROW, - PERMISSIONS_CHECKBOXES_GROUP_ROW, - PERMISSIONS_CHECKBOXES_OTHERS_ROW, - PERMISSIONS_CHECKBOXES_ROW_COUNT -}; - -enum { - PERMISSIONS_CHECKBOXES_READ_COLUMN, - PERMISSIONS_CHECKBOXES_WRITE_COLUMN, - PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN, - PERMISSIONS_CHECKBOXES_COLUMN_COUNT -}; -#endif enum { TITLE_COLUMN, @@ -263,22 +223,14 @@ static gboolean name_field_focus_out (CajaEntry *name_field, gpointer callback_data); static void name_field_activate (CajaEntry *name_field, gpointer callback_data); -#if GTK_CHECK_VERSION (3, 0, 0) static GtkLabel *attach_ellipsizing_value_label (GtkGrid *grid, GtkWidget *sibling, -#else -static GtkLabel *attach_ellipsizing_value_label (GtkTable *table, - int row, - int column, -#endif + const char *initial_text); static GtkWidget* create_pie_widget (FMPropertiesWindow *window); G_DEFINE_TYPE (FMPropertiesWindow, fm_properties_window, GTK_TYPE_DIALOG); -#if !GTK_CHECK_VERSION (3, 0, 0) -#define parent_class fm_properties_window_parent_class -#endif static gboolean is_multi_file_window (FMPropertiesWindow *window) @@ -397,11 +349,8 @@ add_prompt_and_separator (GtkWidget *vbox, const char *prompt_text) add_prompt (vbox, prompt_text, FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) separator_line = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); -#else - separator_line = gtk_hseparator_new (); -#endif + gtk_widget_show (separator_line); gtk_box_pack_end (GTK_BOX (vbox), separator_line, TRUE, TRUE, 2*ROW_PAD); } @@ -613,14 +562,9 @@ create_image_widget (FMPropertiesWindow *window, } static void -#if GTK_CHECK_VERSION (3, 0, 0) set_name_field (FMPropertiesWindow *window, const gchar *original_name, const gchar *name) -#else -set_name_field (FMPropertiesWindow *window, const gchar *original_name, - const gchar *name) -#endif { gboolean new_widget; gboolean use_label; @@ -640,36 +584,19 @@ set_name_field (FMPropertiesWindow *window, const gchar *original_name, } if (use_label) { -#if GTK_CHECK_VERSION (3, 0, 0) window->details->name_field = GTK_WIDGET (attach_ellipsizing_value_label (window->details->basic_grid, GTK_WIDGET (window->details->name_label), name)); -#else - window->details->name_field = - GTK_WIDGET (attach_ellipsizing_value_label - (window->details->basic_table, - window->details->name_row, - VALUE_COLUMN, name)); -#endif + } else { window->details->name_field = caja_entry_new (); gtk_entry_set_text (GTK_ENTRY (window->details->name_field), name); gtk_widget_show (window->details->name_field); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (window->details->basic_grid, window->details->name_field, GTK_WIDGET (window->details->name_label), GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (window->details->basic_table, - window->details->name_field, - VALUE_COLUMN, - VALUE_COLUMN + 1, - window->details->name_row, - window->details->name_row + 1, - GTK_FILL, 0, - 0, 0); -#endif + gtk_label_set_mnemonic_widget (GTK_LABEL (window->details->name_label), window->details->name_field); g_signal_connect_object (window->details->name_field, "focus_out_event", @@ -1421,14 +1348,8 @@ value_field_update (FMPropertiesWindow *window, GtkLabel *label) } static GtkLabel * -#if GTK_CHECK_VERSION (3, 0, 0) attach_label (GtkGrid *grid, GtkWidget *sibling, -#else -attach_label (GtkTable *table, - int row, - int column, -#endif const char *initial_text, gboolean ellipsize_text, gboolean selectable, @@ -1456,7 +1377,6 @@ attach_label (GtkTable *table, gtk_misc_set_alignment (GTK_MISC (label_field), 0, 0.5); #endif gtk_widget_show (label_field); -#if GTK_CHECK_VERSION (3, 0, 0) if (ellipsize_text) { gtk_widget_set_hexpand (label_field, TRUE); gtk_label_set_max_width_chars (GTK_LABEL (label_field), 24); @@ -1468,66 +1388,30 @@ attach_label (GtkTable *table, } else { gtk_container_add (GTK_CONTAINER (grid), label_field); } -#else - gtk_table_attach (table, label_field, - column, column + 1, - row, row + 1, - ellipsize_text - ? GTK_FILL | GTK_EXPAND - : GTK_FILL, - 0, - 0, 0); -#endif return GTK_LABEL (label_field); } static GtkLabel * -#if GTK_CHECK_VERSION (3, 0, 0) attach_value_label (GtkGrid *grid, GtkWidget *sibling, const char *initial_text) { return attach_label (grid, sibling, initial_text, FALSE, TRUE, FALSE); } -#else -attach_value_label (GtkTable *table, - int row, - int column, - const char *initial_text) -{ - return attach_label (table, row, column, initial_text, FALSE, TRUE, FALSE); -} -#endif static GtkLabel * -#if GTK_CHECK_VERSION (3, 0, 0) attach_ellipsizing_value_label (GtkGrid *grid, GtkWidget *sibling, const char *initial_text) { return attach_label (grid, sibling, initial_text, TRUE, TRUE, FALSE); } -#else -attach_ellipsizing_value_label (GtkTable *table, - int row, - int column, - const char *initial_text) -{ - return attach_label (table, row, column, initial_text, TRUE, TRUE, FALSE); -} -#endif static GtkWidget* attach_value_field_internal (FMPropertiesWindow *window, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid, GtkWidget *sibling, -#else - GtkTable *table, - int row, - int column, -#endif const char *file_attribute_name, const char *inconsistent_string, gboolean show_original, @@ -1536,15 +1420,9 @@ attach_value_field_internal (FMPropertiesWindow *window, GtkLabel *value_field; if (ellipsize_text) { -#if GTK_CHECK_VERSION (3, 0, 0) value_field = attach_ellipsizing_value_label (grid, sibling, ""); } else { value_field = attach_value_label (grid, sibling, ""); -#else - value_field = attach_ellipsizing_value_label (table, row, column, ""); - } else { - value_field = attach_value_label (table, row, column, ""); -#endif } /* Stash a copy of the file attribute name in this field for the callback's sake. */ @@ -1563,62 +1441,34 @@ attach_value_field_internal (FMPropertiesWindow *window, static GtkWidget* attach_value_field (FMPropertiesWindow *window, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid, GtkWidget *sibling, -#else - GtkTable *table, - int row, - int column, -#endif const char *file_attribute_name, const char *inconsistent_string, gboolean show_original) { return attach_value_field_internal (window, -#if GTK_CHECK_VERSION (3, 0, 0) grid, sibling, file_attribute_name, inconsistent_string, show_original, FALSE); -#else - table, row, column, - file_attribute_name, - inconsistent_string, - show_original, - FALSE); -#endif } static GtkWidget* attach_ellipsizing_value_field (FMPropertiesWindow *window, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid, GtkWidget *sibling, -#else - GtkTable *table, - int row, - int column, -#endif const char *file_attribute_name, const char *inconsistent_string, gboolean show_original) { return attach_value_field_internal (window, -#if GTK_CHECK_VERSION (3, 0, 0) grid, sibling, file_attribute_name, inconsistent_string, show_original, TRUE); -#else - table, row, column, - file_attribute_name, - inconsistent_string, - show_original, - TRUE); -#endif } static void @@ -1970,19 +1820,11 @@ combo_box_row_separator_func (GtkTreeModel *model, } static GtkComboBox * -#if GTK_CHECK_VERSION (3, 0, 0) attach_combo_box (GtkGrid *grid, GtkWidget *sibling, -#else -attach_combo_box (GtkTable *table, - int row, -#endif gboolean two_columns) { GtkWidget *combo_box; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *aligner; -#endif if (!two_columns) { combo_box = gtk_combo_box_text_new (); @@ -2000,9 +1842,9 @@ attach_combo_box (GtkTable *table, "text", 0); } -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (combo_box, GTK_ALIGN_START); -#endif + gtk_widget_show (combo_box); gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo_box), @@ -2010,44 +1852,20 @@ attach_combo_box (GtkTable *table, NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (grid, combo_box, sibling, GTK_POS_RIGHT, 1, 1); -#else - /* Put combo box in alignment to make it left-justified - * but minimally sized. - */ - aligner = gtk_alignment_new (0, 0.5, 0, 0); - gtk_widget_show (aligner); - - gtk_container_add (GTK_CONTAINER (aligner), combo_box); - gtk_table_attach (table, aligner, - VALUE_COLUMN, VALUE_COLUMN + 1, - row, row + 1, - GTK_FILL, 0, - 0, 0); -#endif return GTK_COMBO_BOX (combo_box); } static GtkComboBox* -#if GTK_CHECK_VERSION (3, 0, 0) attach_group_combo_box (GtkGrid *grid, GtkWidget *sibling, -#else -attach_group_combo_box (GtkTable *table, - int row, -#endif CajaFile *file) { GtkComboBox *combo_box; -#if GTK_CHECK_VERSION (3, 0, 0) combo_box = attach_combo_box (grid, sibling, FALSE); -#else - combo_box = attach_combo_box (table, row, FALSE); -#endif synch_groups_combo_box (combo_box, file); @@ -2325,22 +2143,13 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file) } static GtkComboBox* -#if GTK_CHECK_VERSION (3, 0, 0) attach_owner_combo_box (GtkGrid *grid, GtkWidget *sibling, -#else -attach_owner_combo_box (GtkTable *table, - int row, -#endif CajaFile *file) { GtkComboBox *combo_box; -#if GTK_CHECK_VERSION (3, 0, 0) combo_box = attach_combo_box (grid, sibling, TRUE); -#else - combo_box = attach_combo_box (table, row, TRUE); -#endif synch_user_menu (combo_box, file); @@ -2356,24 +2165,6 @@ attach_owner_combo_box (GtkTable *table, return combo_box; } -#if !GTK_CHECK_VERSION (3, 0, 0) -static guint -append_row (GtkTable *table) -{ - guint new_row_count; - gint nrows, ncols; - - g_object_get (table, "n-rows", &nrows, "n-columns", &ncols, NULL); - - new_row_count = nrows + 1; - - gtk_table_resize (table, new_row_count, ncols); - gtk_table_set_row_spacing (table, new_row_count - 1, ROW_PAD); - - return new_row_count - 1; -} -#endif - static gboolean file_has_prefix (CajaFile *file, GList *prefix_candidates) @@ -2559,23 +2350,14 @@ schedule_directory_contents_update (FMPropertiesWindow *window) static GtkLabel * attach_directory_contents_value_field (FMPropertiesWindow *window, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid, GtkWidget *sibling) -#else - GtkTable *table, - int row) -#endif { GtkLabel *value_field; GList *l; CajaFile *file; -#if GTK_CHECK_VERSION (3, 0, 0) value_field = attach_value_label (grid, sibling, ""); -#else - value_field = attach_value_label (table, row, VALUE_COLUMN, ""); -#endif g_assert (window->details->directory_contents_value_field == NULL); window->details->directory_contents_value_field = value_field; @@ -2599,43 +2381,17 @@ attach_directory_contents_value_field (FMPropertiesWindow *window, } static GtkLabel * -#if GTK_CHECK_VERSION (3, 0, 0) attach_title_field (GtkGrid *grid, const char *title) { return attach_label (grid, NULL, title, FALSE, FALSE, TRUE); } -#else -attach_title_field (GtkTable *table, - int row, - const char *title) -{ - return attach_label (table, row, TITLE_COLUMN, title, FALSE, FALSE, TRUE); -} -#endif - -#if !GTK_CHECK_VERSION (3, 0, 0) -static guint -append_title_field (GtkTable *table, const char *title, GtkLabel **label) -{ - guint last_row; - GtkLabel *title_label; - - last_row = append_row (table); - title_label = attach_title_field (table, last_row, title); - if (label) { - *label = title_label; - } - return last_row; -} -#endif #define INCONSISTENT_STATE_STRING \ "\xE2\x80\x92" -#if GTK_CHECK_VERSION (3, 0, 0) static void append_title_value_pair (FMPropertiesWindow *window, GtkGrid *grid, @@ -2689,70 +2445,6 @@ append_directory_contents_fields (FMPropertiesWindow *window, gtk_label_set_mnemonic_widget (title_field, GTK_WIDGET(value_field)); } -#else -static guint -append_title_value_pair (FMPropertiesWindow *window, - GtkTable *table, - const char *title, - const char *file_attribute_name, - const char *inconsistent_state, - gboolean show_original) -{ - guint last_row; - GtkLabel *title_label; - GtkWidget *value; - - last_row = append_title_field (table, title, &title_label); - value = attach_value_field (window, table, last_row, VALUE_COLUMN, - file_attribute_name, - inconsistent_state, - show_original); - gtk_label_set_mnemonic_widget (title_label, value); - return last_row; -} - -static guint -append_title_and_ellipsizing_value (FMPropertiesWindow *window, - GtkTable *table, - const char *title, - const char *file_attribute_name, - const char *inconsistent_state, - gboolean show_original) -{ - GtkLabel *title_label; - GtkWidget *value; - guint last_row; - - last_row = append_title_field (table, title, &title_label); - value = attach_ellipsizing_value_field (window, table, last_row, VALUE_COLUMN, - file_attribute_name, - inconsistent_state, - show_original); - gtk_label_set_mnemonic_widget (title_label, value); - - return last_row; -} - -static guint -append_directory_contents_fields (FMPropertiesWindow *window, - GtkTable *table) -{ - GtkLabel *title_field, *value_field; - guint last_row; - - last_row = append_row (table); - - title_field = attach_title_field (table, last_row, ""); - window->details->directory_contents_title_field = title_field; - gtk_label_set_line_wrap (title_field, TRUE); - - value_field = attach_directory_contents_value_field - (window, table, last_row); - - gtk_label_set_mnemonic_widget(title_field, GTK_WIDGET(value_field)); - return last_row; -} -#endif static GtkWidget * create_page_with_hbox (GtkNotebook *notebook, @@ -2763,11 +2455,7 @@ create_page_with_hbox (GtkNotebook *notebook, g_assert (GTK_IS_NOTEBOOK (notebook)); g_assert (title != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif gtk_widget_show (hbox); gtk_container_set_border_width (GTK_CONTAINER (hbox), 12); gtk_box_set_spacing (GTK_BOX (hbox), 12); @@ -2785,12 +2473,9 @@ create_page_with_vbox (GtkNotebook *notebook, g_assert (GTK_IS_NOTEBOOK (notebook)); g_assert (title != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_widget_show (vbox); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_notebook_append_page (notebook, vbox, gtk_label_new (title)); @@ -2798,23 +2483,12 @@ create_page_with_vbox (GtkNotebook *notebook, } static GtkWidget * -#if GTK_CHECK_VERSION (3, 0, 0) append_blank_row (GtkGrid *grid) { return GTK_WIDGET (attach_title_field (grid, "")); -#else -append_blank_row (GtkTable *table) -{ - GtkWidget *separator; - - append_title_field (table, "", (GtkLabel **) &separator); - - return separator; -#endif } static void -#if GTK_CHECK_VERSION (3, 0, 0) append_blank_slim_row (GtkGrid *grid) { GtkWidget *w; @@ -2832,16 +2506,9 @@ append_blank_slim_row (GtkGrid *grid) pango_attr_list_unref (attr_list); gtk_container_add (GTK_CONTAINER (grid), w); -#else -apply_standard_table_padding (GtkTable *table) -{ - gtk_table_set_row_spacings (table, ROW_PAD); - gtk_table_set_col_spacings (table, 12); -#endif } static GtkWidget * -#if GTK_CHECK_VERSION (3, 0, 0) create_grid_with_standard_properties (void) { GtkWidget *grid; @@ -2855,19 +2522,6 @@ create_grid_with_standard_properties (void) return grid; } -#else -create_attribute_value_table (GtkBox *vbox, int row_count) -{ - GtkWidget *table; - - table = gtk_table_new (row_count, COLUMN_COUNT, FALSE); - apply_standard_table_padding (GTK_TABLE (table)); - gtk_widget_show (table); - gtk_box_pack_start (vbox, table, FALSE, FALSE, 0); - - return table; -} -#endif static gboolean is_merged_trash_directory (CajaFile *file) @@ -3032,11 +2686,7 @@ should_show_volume_usage (FMPropertiesWindow *window) static void paint_used_legend (GtkWidget *widget, -#if GTK_CHECK_VERSION(3,0,0) cairo_t *cr, -#else - GdkEventExpose *eev, -#endif gpointer data) { FMPropertiesWindow *window; @@ -3050,46 +2700,22 @@ paint_used_legend (GtkWidget *widget, window = FM_PROPERTIES_WINDOW (data); -#if !GTK_CHECK_VERSION(3,0,0) - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#endif - cairo_rectangle (cr, 2, 2, width - 4, height - 4); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &window->details->used_color); cairo_fill_preserve (cr); gdk_cairo_set_source_rgba (cr, &window->details->used_stroke_color); cairo_stroke (cr); -#else - cairo_set_source_rgb (cr, - (double) window->details->used_color.red / 65535, - (double) window->details->used_color.green / 65535, - (double) window->details->used_color.blue / 65535); - cairo_fill_preserve (cr); - - cairo_set_source_rgb (cr, - (double) window->details->used_stroke_color.red / 65535, - (double) window->details->used_stroke_color.green / 65535, - (double) window->details->used_stroke_color.blue / 65535); - cairo_stroke (cr); - - cairo_destroy (cr); -#endif } static void paint_free_legend (GtkWidget *widget, -#if GTK_CHECK_VERSION(3,0,0) cairo_t *cr, gpointer data) -#else - GdkEventExpose *eev, gpointer data) -#endif { FMPropertiesWindow *window; gint width, height; @@ -3100,9 +2726,6 @@ paint_free_legend (GtkWidget *widget, width = allocation.width; height = allocation.height; -#if !GTK_CHECK_VERSION(3,0,0) - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#endif cairo_rectangle (cr, 2, @@ -3110,36 +2733,16 @@ paint_free_legend (GtkWidget *widget, width - 4, height - 4); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &window->details->free_color); cairo_fill_preserve(cr); gdk_cairo_set_source_rgba (cr, &window->details->free_stroke_color); cairo_stroke (cr); -#else - cairo_set_source_rgb (cr, - (double) window->details->free_color.red / 65535, - (double) window->details->free_color.green / 65535, - (double) window->details->free_color.blue / 65535); - cairo_fill_preserve(cr); - - cairo_set_source_rgb (cr, - (double) window->details->free_stroke_color.red / 65535, - (double) window->details->free_stroke_color.green / 65535, - (double) window->details->free_stroke_color.blue / 65535); - cairo_stroke (cr); - - cairo_destroy (cr); -#endif } static void paint_pie_chart (GtkWidget *widget, -#if GTK_CHECK_VERSION(3,0,0) cairo_t *cr, -#else - GdkEventExpose *eev, -#endif gpointer data) { @@ -3165,10 +2768,6 @@ paint_pie_chart (GtkWidget *widget, xc = width / 2; yc = height / 2; -#if !GTK_CHECK_VERSION(3,0,0) - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#endif - if (width < height) { radius = width / 2 - 8; } else { @@ -3194,23 +2793,11 @@ paint_pie_chart (GtkWidget *widget, cairo_line_to (cr,xc,yc); } -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &window->details->used_color); cairo_fill_preserve (cr); gdk_cairo_set_source_rgba (cr, &window->details->used_stroke_color); -#else - cairo_set_source_rgb (cr, - (double) window->details->used_color.red / 65535, - (double) window->details->used_color.green / 65535, - (double) window->details->used_color.blue / 65535); - cairo_fill_preserve (cr); - cairo_set_source_rgb (cr, - (double) window->details->used_stroke_color.red / 65535, - (double) window->details->used_stroke_color.green / 65535, - (double) window->details->used_stroke_color.blue / 65535); -#endif cairo_stroke (cr); } @@ -3225,29 +2812,14 @@ paint_pie_chart (GtkWidget *widget, cairo_line_to (cr,xc,yc); } -#if GTK_CHECK_VERSION (3, 0, 0) + gdk_cairo_set_source_rgba (cr, &window->details->free_color); cairo_fill_preserve(cr); gdk_cairo_set_source_rgba (cr, &window->details->free_stroke_color); -#else - cairo_set_source_rgb (cr, - (double) window->details->free_color.red / 65535, - (double) window->details->free_color.green / 65535, - (double) window->details->free_color.blue / 65535); - cairo_fill_preserve(cr); - cairo_set_source_rgb (cr, - (double) window->details->free_stroke_color.red / 65535, - (double) window->details->free_stroke_color.green / 65535, - (double) window->details->free_stroke_color.blue / 65535); -#endif cairo_stroke (cr); } - -#if !GTK_CHECK_VERSION(3,0,0) - cairo_destroy (cr); -#endif } @@ -3403,28 +2975,17 @@ hls_to_rgb (gdouble *h, } } static void -#if GTK_CHECK_VERSION (3, 0, 0) _pie_style_shade (GdkRGBA *a, GdkRGBA *b, -#else -_pie_style_shade (GdkColor *a, - GdkColor *b, -#endif gdouble k) { gdouble red; gdouble green; gdouble blue; -#if GTK_CHECK_VERSION (3, 0, 0) red = a->red; green = a->green; blue = a->blue; -#else - red = (gdouble) a->red / 65535.0; - green = (gdouble) a->green / 65535.0; - blue = (gdouble) a->blue / 65535.0; -#endif rgb_to_hls (&red, &green, &blue); @@ -3442,16 +3003,10 @@ _pie_style_shade (GdkColor *a, hls_to_rgb (&red, &green, &blue); -#if GTK_CHECK_VERSION (3, 0, 0) b->red = red; b->green = green; b->blue = blue; b->alpha = a->alpha; -#else - b->red = red * 65535.0; - b->green = green * 65535.0; - b->blue = blue * 65535.0; -#endif } @@ -3459,13 +3014,9 @@ static GtkWidget* create_pie_widget (FMPropertiesWindow *window) { CajaFile *file; -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid; GtkStyleContext *style; -#else - GtkTable *table; - GtkStyle *style; -#endif + GtkWidget *pie_canvas; GtkWidget *used_canvas; GtkWidget *used_label; @@ -3496,39 +3047,27 @@ create_pie_widget (FMPropertiesWindow *window) uri = caja_file_get_activation_uri (file); -#if GTK_CHECK_VERSION (3, 0, 0) grid = GTK_GRID (gtk_grid_new ()); gtk_container_set_border_width (GTK_CONTAINER (grid), 5); gtk_grid_set_column_spacing (GTK_GRID (grid), 5); style = gtk_widget_get_style_context (GTK_WIDGET (grid)); if (!gtk_style_context_lookup_color (style, "chart_rgba_1", &window->details->used_color)) { -#else - table = GTK_TABLE (gtk_table_new (4, 3, FALSE)); - style = gtk_rc_get_style (GTK_WIDGET(table)); - - if (!gtk_style_lookup_color (style, "chart_color_1", &window->details->used_color)) { -#endif window->details->used_color.red = USED_FILL_R; window->details->used_color.green = USED_FILL_G; window->details->used_color.blue = USED_FILL_B; -#if GTK_CHECK_VERSION (3, 0, 0) window->details->used_color.alpha = 1; -#endif + } -#if GTK_CHECK_VERSION (3, 0, 0) + if (!gtk_style_context_lookup_color (style, "chart_rgba_2", &window->details->free_color)) { -#else - if (!gtk_style_lookup_color (style, "chart_color_2", &window->details->free_color)) { -#endif window->details->free_color.red = FREE_FILL_R; window->details->free_color.green = FREE_FILL_G; window->details->free_color.blue = FREE_FILL_B; -#if GTK_CHECK_VERSION (3, 0, 0) window->details->free_color.alpha = 1; -#endif + } _pie_style_shade (&window->details->used_color, &window->details->used_stroke_color, 0.7); @@ -3538,19 +3077,19 @@ create_pie_widget (FMPropertiesWindow *window) gtk_widget_set_size_request (pie_canvas, 200, 200); used_canvas = gtk_drawing_area_new (); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_valign (used_canvas, GTK_ALIGN_CENTER); gtk_widget_set_halign (used_canvas, GTK_ALIGN_CENTER); -#endif + gtk_widget_set_size_request (used_canvas, 20, 20); /* Translators: "used" refers to the capacity of the filesystem */ used_label = gtk_label_new (g_strconcat (used, " ", _("used"), NULL)); free_canvas = gtk_drawing_area_new (); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_valign (free_canvas, GTK_ALIGN_CENTER); gtk_widget_set_halign (free_canvas, GTK_ALIGN_CENTER); -#endif + gtk_widget_set_size_request (free_canvas, 20, 20); /* Translators: "free" refers to the capacity of the filesystem */ free_label = gtk_label_new (g_strconcat (free, " ", _("free"), NULL)); @@ -3578,7 +3117,6 @@ create_pie_widget (FMPropertiesWindow *window) g_free (used); g_free (free); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_add_with_properties (GTK_CONTAINER (grid), pie_canvas, "height", 4, NULL); @@ -3596,40 +3134,16 @@ create_pie_widget (FMPropertiesWindow *window) GTK_POS_BOTTOM, 2, 1); gtk_grid_attach_next_to (grid, fstype_label, capacity_label, GTK_POS_BOTTOM, 2, 1); -#else - gtk_table_attach (table, pie_canvas , 0, 1, 0, 4, GTK_FILL, GTK_SHRINK, 5, 5); - - gtk_table_attach (table, used_canvas, 1, 2, 0, 1, 0, 0, 5, 5); - gtk_table_attach (table, used_label , 2, 3, 0, 1, GTK_FILL, 0, 5, 5); - - gtk_table_attach (table, free_canvas, 1, 2, 1, 2, 0, 0, 5, 5); - gtk_table_attach (table, free_label , 2, 3, 1, 2, GTK_FILL, 0, 5, 5); - gtk_table_attach (table, capacity_label , 1, 3, 2, 3, GTK_FILL, 0, 5, 5); - gtk_table_attach (table, fstype_label , 1, 3, 3, 4, GTK_FILL, 0, 5, 5); -#endif - -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect (pie_canvas, "draw", G_CALLBACK (paint_pie_chart), window); g_signal_connect (used_canvas, "draw", G_CALLBACK (paint_used_legend), window); g_signal_connect (free_canvas, "draw", G_CALLBACK (paint_free_legend), window); -#else - g_signal_connect (G_OBJECT (pie_canvas), "expose-event", - G_CALLBACK (paint_pie_chart), window); - g_signal_connect (G_OBJECT (used_canvas), "expose-event", - G_CALLBACK (paint_used_legend), window); - g_signal_connect (G_OBJECT (free_canvas), "expose-event", - G_CALLBACK (paint_free_legend), window); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) return GTK_WIDGET (grid); -#else - return GTK_WIDGET (table); -#endif + } static GtkWidget* @@ -3670,73 +3184,37 @@ create_volume_usage_widget (FMPropertiesWindow *window) static void create_basic_page (FMPropertiesWindow *window) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid; -#else - GtkTable *table; - GtkWidget *icon_aligner; -#endif GtkWidget *icon_pixmap_widget; GtkWidget *volume_usage; GtkWidget *hbox, *vbox; -#if !GTK_CHECK_VERSION (3, 0, 0) - guint last_row, row; -#endif - hbox = create_page_with_hbox (window->details->notebook, _("Basic")); /* Icon pixmap */ icon_pixmap_widget = create_image_widget ( window, should_show_custom_icon_buttons (window)); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_halign (icon_pixmap_widget, GTK_ALIGN_END); gtk_widget_set_valign (icon_pixmap_widget, GTK_ALIGN_START); gtk_widget_show (icon_pixmap_widget); gtk_box_pack_start (GTK_BOX (hbox), icon_pixmap_widget, FALSE, FALSE, 0); -#else - gtk_widget_show (icon_pixmap_widget); - - icon_aligner = gtk_alignment_new (1, 0, 0, 0); - gtk_widget_show (icon_aligner); - - gtk_container_add (GTK_CONTAINER (icon_aligner), icon_pixmap_widget); - gtk_box_pack_start (GTK_BOX (hbox), icon_aligner, FALSE, FALSE, 0); -#endif window->details->icon_chooser = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) - /* Grid */ -#else - /* Table */ -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif + gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox); -#if GTK_CHECK_VERSION (3, 0, 0) grid = GTK_GRID (create_grid_with_standard_properties ()); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (grid), FALSE, FALSE, 0); window->details->basic_grid = grid; /* Name label. The text will be determined in update_name_field */ window->details->name_label = attach_title_field (grid, NULL); -#else - table = GTK_TABLE (create_attribute_value_table (GTK_BOX (vbox), 0)); - window->details->basic_table = table; - - /* Name label. The text will be determined in update_name_field */ - row = append_title_field (table, NULL, &window->details->name_label); - window->details->name_row = row; -#endif /* Name field */ window->details->name_field = NULL; @@ -3752,17 +3230,12 @@ create_basic_page (FMPropertiesWindow *window) GtkSizeGroup *label_size_group; GtkWidget *box; -#if !GTK_CHECK_VERSION (3, 0, 0) - row = append_row (table); -#endif - label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget (label_size_group, GTK_WIDGET (window->details->name_label)); box = fm_ditem_page_make_box (label_size_group, window->details->target_files); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (window->details->basic_grid, box, GTK_WIDGET (window->details->name_label), GTK_POS_BOTTOM, 2, 1); @@ -3837,84 +3310,7 @@ create_basic_page (FMPropertiesWindow *window) "width", 2, NULL); } -#else - gtk_table_attach (window->details->basic_table, box, - TITLE_COLUMN, VALUE_COLUMN + 1, - row, row + 1, - GTK_FILL, 0, - 0, 0); - } - - if (should_show_file_type (window)) { - append_title_value_pair (window, - table, _("Type:"), - "type", - INCONSISTENT_STATE_STRING, - FALSE); - } - - if (should_show_link_target (window)) { - append_title_and_ellipsizing_value (window, table, - _("Link target:"), - "link_target", - INCONSISTENT_STATE_STRING, - FALSE); - } - - if (is_multi_file_window (window) || - caja_file_is_directory (get_target_file (window))) { - append_directory_contents_fields (window, table); - } else { - append_title_value_pair (window, table, _("Size:"), - "size_detail", - INCONSISTENT_STATE_STRING, - FALSE); - } - - append_blank_row (table); - - if (should_show_location_info (window)) { - append_title_and_ellipsizing_value (window, table, _("Location:"), - "where", - INCONSISTENT_STATE_STRING, - TRUE); - - append_title_and_ellipsizing_value (window, table, - _("Volume:"), - "volume", - INCONSISTENT_STATE_STRING, - FALSE); - } - - if (should_show_accessed_date (window)) { - append_blank_row (table); - - append_title_value_pair (window, table, _("Accessed:"), - "date_accessed", - INCONSISTENT_STATE_STRING, - FALSE); - append_title_value_pair (window, table, _("Modified:"), - "date_modified", - INCONSISTENT_STATE_STRING, - FALSE); - } - - if (should_show_free_space (window)) { - append_blank_row (table); - - append_title_value_pair (window, table, _("Free space:"), - "free_space", - INCONSISTENT_STATE_STRING, - FALSE); - } - - if (should_show_volume_usage (window)) { - last_row = append_row (table); - volume_usage = create_volume_usage_widget (window); - gtk_table_attach_defaults (GTK_TABLE(table), volume_usage, 0, 2, last_row, last_row+1); - } -#endif -} +} static GHashTable * get_initial_emblems (GList *files) @@ -4082,11 +3478,7 @@ start_long_operation (FMPropertiesWindow *window) display = gtk_widget_get_display (GTK_WIDGET (window)); cursor = gdk_cursor_new_for_display (display, GDK_WATCH); gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref (cursor); -#else - gdk_cursor_unref (cursor); -#endif } window->details->long_operation_underway ++; } @@ -4382,17 +3774,10 @@ set_up_permissions_checkbox (FMPropertiesWindow *window, 0); } -#if GTK_CHECK_VERSION (3, 0, 0) static GtkWidget * add_permissions_checkbox_with_label (FMPropertiesWindow *window, GtkGrid *grid, GtkWidget *sibling, -#else -static void -add_permissions_checkbox_with_label (FMPropertiesWindow *window, - GtkTable *table, - int row, int column, -#endif const char *label, guint32 permission_to_check, GtkLabel *label_for, @@ -4403,20 +3788,12 @@ add_permissions_checkbox_with_label (FMPropertiesWindow *window, check_button = gtk_check_button_new_with_mnemonic (label); gtk_widget_show (check_button); -#if GTK_CHECK_VERSION (3, 0, 0) if (sibling) { gtk_grid_attach_next_to (grid, check_button, sibling, GTK_POS_RIGHT, 1, 1); } else { gtk_container_add (GTK_CONTAINER (grid), check_button); } -#else - gtk_table_attach (table, check_button, - column, column + 1, - row, row + 1, - GTK_FILL, 0, - 0, 0); -#endif set_up_permissions_checkbox (window, check_button, @@ -4428,12 +3805,10 @@ add_permissions_checkbox_with_label (FMPropertiesWindow *window, eel_accessibility_set_up_label_widget_relation (GTK_WIDGET (label_for), check_button); } -#if GTK_CHECK_VERSION (3, 0, 0) + return check_button; -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) static GtkWidget * add_permissions_checkbox (FMPropertiesWindow *window, GtkGrid *grid, @@ -4460,33 +3835,6 @@ add_permissions_checkbox (FMPropertiesWindow *window, label_for, is_folder); } -#else -static void -add_permissions_checkbox (FMPropertiesWindow *window, - GtkTable *table, - int row, int column, - guint32 permission_to_check, - GtkLabel *label_for, - gboolean is_folder) -{ - gchar *label; - - if (column == PERMISSIONS_CHECKBOXES_READ_COLUMN) { - label = _("_Read"); - } else if (column == PERMISSIONS_CHECKBOXES_WRITE_COLUMN) { - label = _("_Write"); - } else { - label = _("E_xecute"); - } - - add_permissions_checkbox_with_label (window, table, - row, column, - label, - permission_to_check, - label_for, - is_folder); -} -#endif enum { UNIX_PERM_SUID = S_ISUID, @@ -4807,11 +4155,7 @@ permission_combo_update (FMPropertiesWindow *window, } static void -#if GTK_CHECK_VERSION (3, 0, 0) add_permissions_combo_box (FMPropertiesWindow *window, GtkGrid *grid, -#else -add_permissions_combo_box (FMPropertiesWindow *window, GtkTable *table, -#endif PermissionType type, gboolean is_folder, gboolean short_label) { @@ -4820,24 +4164,13 @@ add_permissions_combo_box (FMPropertiesWindow *window, GtkTable *table, GtkListStore *store; GtkCellRenderer *cell; GtkTreeIter iter; -#if !GTK_CHECK_VERSION (3, 0, 0) - int row; -#endif if (short_label) { -#if GTK_CHECK_VERSION (3, 0, 0) label = attach_title_field (grid, _("Access:")); } else if (is_folder) { label = attach_title_field (grid, _("Folder access:")); } else { label = attach_title_field (grid, _("File access:")); -#else - row = append_title_field (table, _("Access:"), &label); - } else if (is_folder) { - row = append_title_field (table, _("Folder access:"), &label); - } else { - row = append_title_field (table, _("File access:"), &label); -#endif } store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN); @@ -4891,41 +4224,23 @@ add_permissions_combo_box (FMPropertiesWindow *window, GtkTable *table, gtk_label_set_mnemonic_widget (label, combo); gtk_widget_show (combo); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach_next_to (grid, combo, GTK_WIDGET (label), GTK_POS_RIGHT, 1, 1); -#else - gtk_table_attach (table, combo, - VALUE_COLUMN, VALUE_COLUMN + 1, - row, row + 1, - GTK_FILL, 0, - 0, 0); -#endif } static GtkWidget * append_special_execution_checkbox (FMPropertiesWindow *window, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid, GtkWidget *sibling, -#else - GtkTable *table, -#endif const char *label_text, guint32 permission_to_check) { GtkWidget *check_button; -#if !GTK_CHECK_VERSION (3, 0, 0) - guint last_row; - - last_row = append_row (table); -#endif check_button = gtk_check_button_new_with_mnemonic (label_text); gtk_widget_show (check_button); -#if GTK_CHECK_VERSION (3, 0, 0) if (sibling != NULL) { gtk_grid_attach_next_to (grid, check_button, sibling, GTK_POS_RIGHT, 1, 1); @@ -4934,13 +4249,6 @@ append_special_execution_checkbox (FMPropertiesWindow *window, "left-attach", 1, NULL); } -#else - gtk_table_attach (table, check_button, - VALUE_COLUMN, VALUE_COLUMN + 1, - last_row, last_row + 1, - GTK_FILL, 0, - 0, 0); -#endif set_up_permissions_checkbox (window, check_button, @@ -4953,7 +4261,6 @@ append_special_execution_checkbox (FMPropertiesWindow *window, } static void -#if GTK_CHECK_VERSION (3, 0, 0) append_special_execution_flags (FMPropertiesWindow *window, GtkGrid *grid) { GtkWidget *title; @@ -4965,24 +4272,6 @@ append_special_execution_flags (FMPropertiesWindow *window, GtkGrid *grid) append_special_execution_checkbox (window, grid, NULL, _("Set gro_up ID"), UNIX_PERM_SGID); append_special_execution_checkbox (window, grid, NULL, _("_Sticky"), UNIX_PERM_STICKY); } -#else -append_special_execution_flags (FMPropertiesWindow *window, GtkTable *table) -{ - gint nrows; - - append_special_execution_checkbox - (window, table, _("Set _user ID"), UNIX_PERM_SUID); - - g_object_get (table, "n-rows", &nrows, NULL); - attach_title_field (table, nrows - 1, _("Special flags:")); - - append_special_execution_checkbox (window, table, _("Set gro_up ID"), UNIX_PERM_SGID); - append_special_execution_checkbox (window, table, _("_Sticky"), UNIX_PERM_STICKY); - - g_object_get (table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (table, nrows - 1, 18); -} -#endif static gboolean all_can_get_permissions (GList *file_list) @@ -5042,7 +4331,6 @@ get_initial_permissions (GList *file_list) } static void -#if GTK_CHECK_VERSION (3, 0, 0) create_simple_permissions (FMPropertiesWindow *window, GtkGrid *page_grid) { gboolean has_file, has_directory; @@ -5141,121 +4429,9 @@ create_simple_permissions (FMPropertiesWindow *window, GtkGrid *page_grid) UNIX_PERM_USER_EXEC|UNIX_PERM_GROUP_EXEC|UNIX_PERM_OTHER_EXEC, execute_label, FALSE); } -#else -create_simple_permissions (FMPropertiesWindow *window, GtkTable *page_table) -{ - gboolean has_file, has_directory; - GtkLabel *group_label; - GtkLabel *owner_label; - GtkLabel *execute_label; - GtkWidget *value; - GtkComboBox *group_combo_box; - GtkComboBox *owner_combo_box; - guint last_row; - gint nrows; - - last_row = 0; - - has_file = files_has_file (window); - has_directory = files_has_directory (window); - - if (!is_multi_file_window (window) && caja_file_can_set_owner (get_target_file (window))) { - owner_label = attach_title_field (page_table, last_row, _("_Owner:")); - /* Combo box in this case. */ - owner_combo_box = attach_owner_combo_box (page_table, last_row, get_target_file (window)); - gtk_label_set_mnemonic_widget (owner_label, - GTK_WIDGET (owner_combo_box)); - } else { - owner_label = attach_title_field (page_table, last_row, _("Owner:")); - /* Static text in this case. */ - value = attach_value_field (window, - page_table, last_row, VALUE_COLUMN, - "owner", - INCONSISTENT_STATE_STRING, - FALSE); - gtk_label_set_mnemonic_widget (owner_label, value); - } - - if (has_directory) { - add_permissions_combo_box (window, page_table, - PERMISSION_USER, TRUE, FALSE); - } - if (has_file || window->details->has_recursive_apply) { - add_permissions_combo_box (window, page_table, - PERMISSION_USER, FALSE, !has_directory); - } - - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - - if (!is_multi_file_window (window) && caja_file_can_set_group (get_target_file (window))) { - last_row = append_title_field (page_table, - _("_Group:"), - &group_label); - /* Combo box in this case. */ - group_combo_box = attach_group_combo_box (page_table, last_row, - get_target_file (window)); - gtk_label_set_mnemonic_widget (group_label, - GTK_WIDGET (group_combo_box)); - } else { - last_row = append_title_field (page_table, - _("Group:"), - &group_label); - /* Static text in this case. */ - value = attach_value_field (window, page_table, last_row, - VALUE_COLUMN, - "group", - INCONSISTENT_STATE_STRING, - FALSE); - gtk_label_set_mnemonic_widget (group_label, value); - } - - if (has_directory) { - add_permissions_combo_box (window, page_table, - PERMISSION_GROUP, TRUE, - FALSE); - } - if (has_file || window->details->has_recursive_apply) { - add_permissions_combo_box (window, page_table, - PERMISSION_GROUP, FALSE, - !has_directory); - } - - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - - append_title_field (page_table, - _("Others"), - &group_label); - - if (has_directory) { - add_permissions_combo_box (window, page_table, - PERMISSION_OTHER, TRUE, - FALSE); - } - if (has_file || window->details->has_recursive_apply) { - add_permissions_combo_box (window, page_table, - PERMISSION_OTHER, FALSE, - !has_directory); - } - - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - - last_row = append_title_field (page_table, - _("Execute:"), - &execute_label); - add_permissions_checkbox_with_label (window, page_table, - last_row, 1, - _("Allow _executing file as program"), - UNIX_PERM_USER_EXEC|UNIX_PERM_GROUP_EXEC|UNIX_PERM_OTHER_EXEC, - execute_label, FALSE); -} -#endif static void create_permission_checkboxes (FMPropertiesWindow *window, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *page_grid, gboolean is_folder) { @@ -5348,108 +4524,8 @@ create_permission_checkboxes (FMPropertiesWindow *window, other_perm_label, is_folder); } -#else - GtkTable *page_table, - gboolean is_folder) -{ - guint checkbox_titles_row; - GtkLabel *owner_perm_label; - GtkLabel *group_perm_label; - GtkLabel *other_perm_label; - GtkTable *check_button_table; - - checkbox_titles_row = append_title_field (page_table, _("Owner:"), &owner_perm_label); - append_title_field (page_table, _("Group:"), &group_perm_label); - append_title_field (page_table, _("Others:"), &other_perm_label); - - check_button_table = GTK_TABLE (gtk_table_new - (PERMISSIONS_CHECKBOXES_ROW_COUNT, - PERMISSIONS_CHECKBOXES_COLUMN_COUNT, - FALSE)); - apply_standard_table_padding (check_button_table); - gtk_widget_show (GTK_WIDGET (check_button_table)); - gtk_table_attach (page_table, GTK_WIDGET (check_button_table), - VALUE_COLUMN, VALUE_COLUMN + 1, - checkbox_titles_row, checkbox_titles_row + PERMISSIONS_CHECKBOXES_ROW_COUNT, - 0, 0, - 0, 0); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_OWNER_ROW, - PERMISSIONS_CHECKBOXES_READ_COLUMN, - UNIX_PERM_USER_READ, - owner_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_OWNER_ROW, - PERMISSIONS_CHECKBOXES_WRITE_COLUMN, - UNIX_PERM_USER_WRITE, - owner_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_OWNER_ROW, - PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN, - UNIX_PERM_USER_EXEC, - owner_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_GROUP_ROW, - PERMISSIONS_CHECKBOXES_READ_COLUMN, - UNIX_PERM_GROUP_READ, - group_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_GROUP_ROW, - PERMISSIONS_CHECKBOXES_WRITE_COLUMN, - UNIX_PERM_GROUP_WRITE, - group_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_GROUP_ROW, - PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN, - UNIX_PERM_GROUP_EXEC, - group_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_OTHERS_ROW, - PERMISSIONS_CHECKBOXES_READ_COLUMN, - UNIX_PERM_OTHER_READ, - other_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_OTHERS_ROW, - PERMISSIONS_CHECKBOXES_WRITE_COLUMN, - UNIX_PERM_OTHER_WRITE, - other_perm_label, - is_folder); - - add_permissions_checkbox (window, - check_button_table, - PERMISSIONS_CHECKBOXES_OTHERS_ROW, - PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN, - UNIX_PERM_OTHER_EXEC, - other_perm_label, - is_folder); -} -#endif static void -#if GTK_CHECK_VERSION (3, 0, 0) create_advanced_permissions (FMPropertiesWindow *window, GtkGrid *page_grid) { GtkLabel *group_label; @@ -5526,98 +4602,6 @@ create_advanced_permissions (FMPropertiesWindow *window, GtkGrid *page_grid) "permissions", INCONSISTENT_STATE_STRING, FALSE); } -#else -create_advanced_permissions (FMPropertiesWindow *window, GtkTable *page_table) -{ - guint last_row; - GtkLabel *group_label; - GtkLabel *owner_label; - GtkComboBox *group_combo_box; - GtkComboBox *owner_combo_box; - gboolean has_directory, has_file; - gint nrows; - - last_row = 0; - - if (!is_multi_file_window (window) && caja_file_can_set_owner (get_target_file (window))) { - - owner_label = attach_title_field (page_table, last_row, _("_Owner:")); - /* Combo box in this case. */ - owner_combo_box = attach_owner_combo_box (page_table, last_row, get_target_file (window)); - gtk_label_set_mnemonic_widget (owner_label, - GTK_WIDGET (owner_combo_box)); - } else { - GtkWidget *value; - - owner_label = attach_title_field (page_table, last_row, _("Owner:")); - /* Static text in this case. */ - value = attach_value_field (window, - page_table, last_row, VALUE_COLUMN, - "owner", - INCONSISTENT_STATE_STRING, - FALSE); - gtk_label_set_mnemonic_widget (owner_label, value); - } - - if (!is_multi_file_window (window) && caja_file_can_set_group (get_target_file (window))) { - last_row = append_title_field (page_table, - _("_Group:"), - &group_label); - /* Combo box in this case. */ - group_combo_box = attach_group_combo_box (page_table, last_row, - get_target_file (window)); - gtk_label_set_mnemonic_widget (group_label, - GTK_WIDGET (group_combo_box)); - } else { - last_row = append_title_field (page_table, - _("Group:"), - NULL); - /* Static text in this case. */ - attach_value_field (window, page_table, last_row, - VALUE_COLUMN, - "group", - INCONSISTENT_STATE_STRING, - FALSE); - } - - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - - has_directory = files_has_directory (window); - has_file = files_has_file (window); - - if (has_directory) { - if (has_file || window->details->has_recursive_apply) { - append_title_field (page_table, - _("Folder Permissions:"), - NULL); - } - create_permission_checkboxes (window, page_table, TRUE); - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - - } - - - if (has_file || window->details->has_recursive_apply) { - if (has_directory) { - append_title_field (page_table, - _("File Permissions:"), - NULL); - } - create_permission_checkboxes (window, page_table, FALSE); - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - } - - append_special_execution_flags (window, page_table); - - append_title_value_pair - (window, page_table, _("Text view:"), - "permissions", INCONSISTENT_STATE_STRING, - FALSE); -} -#endif static void set_recursive_permissions_done (gpointer callback_data) @@ -5742,7 +4726,6 @@ static void create_permissions_page (FMPropertiesWindow *window) { GtkWidget *vbox, *button, *hbox; -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *page_grid; char *file_name, *prompt_text; GList *file_list; @@ -5791,84 +4774,11 @@ create_permissions_page (FMPropertiesWindow *window) FALSE); if (window->details->has_recursive_apply) { -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif gtk_widget_show (hbox); gtk_container_add_with_properties (GTK_CONTAINER (page_grid), hbox, "width", 2, NULL); -#else - GtkTable *page_table; - char *file_name, *prompt_text; - GList *file_list; - guint last_row; - gint nrows; - - vbox = create_page_with_vbox (window->details->notebook, - _("Permissions")); - - file_list = window->details->original_files; - - window->details->initial_permissions = NULL; - - if (all_can_get_permissions (file_list) && all_can_get_permissions (window->details->target_files)) { - window->details->initial_permissions = get_initial_permissions (window->details->target_files); - window->details->has_recursive_apply = files_has_changable_permissions_directory (window); - - if (!all_can_set_permissions (file_list)) { - add_prompt_and_separator ( - vbox, - _("You are not the owner, so you cannot change these permissions.")); - } - - page_table = GTK_TABLE (gtk_table_new (1, COLUMN_COUNT, FALSE)); - window->details->permissions_table = page_table; - - apply_standard_table_padding (page_table); - gtk_widget_show (GTK_WIDGET (page_table)); - gtk_box_pack_start (GTK_BOX (vbox), - GTK_WIDGET (page_table), - TRUE, TRUE, 0); - - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_ADVANCED_PERMISSIONS)) { - window->details->advanced_permissions = TRUE; - create_advanced_permissions (window, page_table); - } else { - window->details->advanced_permissions = FALSE; - create_simple_permissions (window, page_table); - } - - g_object_get (page_table, "n-rows", &nrows, NULL); - gtk_table_set_row_spacing (page_table, nrows - 1, 18); - -#ifdef HAVE_SELINUX - append_title_value_pair - (window, page_table, _("SELinux context:"), - "selinux_context", INCONSISTENT_STATE_STRING, - FALSE); -#endif - append_title_value_pair - (window, page_table, _("Last changed:"), - "date_permissions", INCONSISTENT_STATE_STRING, - FALSE); - - if (window->details->has_recursive_apply) { - last_row = append_row (page_table); -#if GTK_CHECK_VERSION (3, 0, 0) - hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif - gtk_widget_show (hbox); - gtk_table_attach (page_table, hbox, - 0, 2, - last_row, last_row+1, - GTK_FILL, 0, - 0, 0); -#endif button = gtk_button_new_with_mnemonic (_("Apply Permissions to Enclosed Files")); gtk_widget_show (button); @@ -6253,9 +5163,6 @@ create_properties_window (StartupData *startup_data) NULL); /* FIXME - HIGificiation, should be done inside GTK+ */ -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_ensure_style (GTK_WIDGET (window)); -#endif gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12); gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (window))), 0); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))), 12); @@ -6507,11 +5414,7 @@ real_response (GtkDialog *dialog, } static void -#if GTK_CHECK_VERSION (3, 0, 0) real_destroy (GtkWidget *object) -#else -real_destroy (GtkObject *object) -#endif { FMPropertiesWindow *window; GList *l; @@ -6569,11 +5472,7 @@ real_destroy (GtkObject *object) window->details->update_files_timeout_id = 0; } -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (fm_properties_window_parent_class)->destroy (object); -#else - GTK_OBJECT_CLASS (parent_class)->destroy (object); -#endif } static void @@ -6586,13 +5485,8 @@ real_finalize (GObject *object) g_list_free_full (window->details->mime_list, g_free); g_free (window->details->pending_name); -#if GTK_CHECK_VERSION (3, 0, 0) - G_OBJECT_CLASS (fm_properties_window_parent_class)->finalize (object); -#else - g_free (window->details); - G_OBJECT_CLASS (parent_class)->finalize (object); -#endif + G_OBJECT_CLASS (fm_properties_window_parent_class)->finalize (object); } /* converts @@ -6833,29 +5727,22 @@ fm_properties_window_class_init (FMPropertiesWindowClass *class) GtkBindingSet *binding_set; G_OBJECT_CLASS (class)->finalize = real_finalize; -#if !GTK_CHECK_VERSION (3, 0, 0) - GTK_OBJECT_CLASS (class)->destroy = real_destroy; -#else + GTK_WIDGET_CLASS (class)->destroy = real_destroy; -#endif + GTK_DIALOG_CLASS (class)->response = real_response; binding_set = gtk_binding_set_by_class (class); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); -#if GTK_CHECK_VERSION (3, 0, 0) g_type_class_add_private (class, sizeof (FMPropertiesWindowDetails)); -#endif } static void fm_properties_window_init (FMPropertiesWindow *window) { -#if GTK_CHECK_VERSION (3, 0, 0) window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, FM_TYPE_PROPERTIES_WINDOW, FMPropertiesWindowDetails); -#else - window->details = g_new0 (FMPropertiesWindowDetails, 1); -#endif + } diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c index 039a1ef8..cf400375 100644 --- a/src/file-manager/fm-tree-model.c +++ b/src/file-manager/fm-tree-model.c @@ -29,11 +29,7 @@ #include #include "fm-tree-model.h" -#if GTK_CHECK_VERSION(3,0,0) #include -#else -#include -#endif #include #include #include @@ -336,11 +332,7 @@ get_menu_icon_for_file (TreeNode *node, if (highlight) { -#if GTK_CHECK_VERSION(3,0,0) pixbuf = eel_create_spotlight_pixbuf (retval); -#else - pixbuf = eel_gdk_pixbuf_render (retval, 1, 255, 255, 0, 0); -#endif if (pixbuf != NULL) { -- cgit v1.2.1