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/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 - 9 files changed, 41 insertions(+), 1425 deletions(-) (limited to 'src/file-manager') 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