From 453ec2d2ac8ec3e3679ad02d0ab3bfba0a158ce3 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Tue, 12 Mar 2002 11:03:39 +0000 Subject: [PATCH] r1298: Panel icons highlight when the pointer is over them. --- ROX-Filer/Help/Changes | 4 ++ ROX-Filer/src/action.c | 2 - ROX-Filer/src/appmenu.c | 9 ++--- ROX-Filer/src/collection.c | 2 + ROX-Filer/src/config.h.in | 2 +- ROX-Filer/src/display.c | 4 +- ROX-Filer/src/dnd.c | 35 +++++++--------- ROX-Filer/src/filer.c | 98 ++++++++++++++++++++++----------------------- ROX-Filer/src/gtksavebox.c | 2 + ROX-Filer/src/gui_support.c | 13 +++--- ROX-Filer/src/icon.c | 2 + ROX-Filer/src/infobox.c | 29 +++++++------- ROX-Filer/src/menu.c | 3 ++ ROX-Filer/src/minibuffer.c | 28 ++++++++----- ROX-Filer/src/options.c | 6 ++- ROX-Filer/src/panel.c | 78 +++++++++++++++++++++++------------- ROX-Filer/src/pinboard.c | 68 ++++++++++++++----------------- ROX-Filer/src/remote.c | 9 ++--- ROX-Filer/src/toolbar.c | 14 ++++--- ROX-Filer/src/type.c | 40 +++++++++--------- ROX-Filer/src/usericons.c | 62 +++++++++++++--------------- 21 files changed, 265 insertions(+), 245 deletions(-) diff --git a/ROX-Filer/Help/Changes b/ROX-Filer/Help/Changes index 4f3deb61..b99eb157 100644 --- a/ROX-Filer/Help/Changes +++ b/ROX-Filer/Help/Changes @@ -2,6 +2,10 @@ A RISC OS-like filer for X by Thomas Leonard +12-Mar-2002 +~~~~~~~~~~~ +Panel icons highlight when the pointer is over them. + 11-Mar-2002 ~~~~~~~~~~~ Converted Set Run Action box to new style. diff --git a/ROX-Filer/src/action.c b/ROX-Filer/src/action.c index a1feac7c..aa2a8512 100644 --- a/ROX-Filer/src/action.c +++ b/ROX-Filer/src/action.c @@ -23,8 +23,6 @@ * These routines generally fork() and talk to us via pipes. */ -#define GTK_DISABLE_DEPRECATED - #include "config.h" #include diff --git a/ROX-Filer/src/appmenu.c b/ROX-Filer/src/appmenu.c index 1ac898e8..043f380f 100644 --- a/ROX-Filer/src/appmenu.c +++ b/ROX-Filer/src/appmenu.c @@ -153,7 +153,7 @@ static GtkWidget *appmenu_add_submenu(xmlNode *subm_node) item = create_menu_item(node); if (item) - gtk_menu_append(GTK_MENU(sub_menu), item); + gtk_menu_shell_append(GTK_MENU_SHELL(sub_menu), item); } return sub_menu; @@ -202,14 +202,13 @@ static GtkWidget *create_menu_item(xmlNode *node) if (option) { - gtk_object_set_data_full(GTK_OBJECT(item), "option", + g_object_set_data_full(G_OBJECT(item), "option", g_strdup(option), g_free); g_free(option); } - gtk_signal_connect(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(apprun_menu), + g_signal_connect(item, "activate", G_CALLBACK(apprun_menu), NULL); } @@ -226,7 +225,7 @@ static void apprun_menu(GtkWidget *item, gpointer data) g_return_if_fail(current_app_path != NULL); - option = gtk_object_get_data(GTK_OBJECT(item), "option"); + option = g_object_get_data(G_OBJECT(item), "option"); argv[0] = g_strconcat(current_app_path, "/AppRun", NULL); argv[1] = option; /* (may be NULL) */ diff --git a/ROX-Filer/src/collection.c b/ROX-Filer/src/collection.c index aed7725f..ad087bb5 100644 --- a/ROX-Filer/src/collection.c +++ b/ROX-Filer/src/collection.c @@ -26,6 +26,8 @@ #include "config.h" +#undef GTK_DISABLE_DEPRECATED + #include #include diff --git a/ROX-Filer/src/config.h.in b/ROX-Filer/src/config.h.in index 8b390c38..8516160c 100644 --- a/ROX-Filer/src/config.h.in +++ b/ROX-Filer/src/config.h.in @@ -34,4 +34,4 @@ # define SIZE_FMT "ld" #endif -/* #define GTK_DISABLE_DEPRECATED */ +#define GTK_DISABLE_DEPRECATED diff --git a/ROX-Filer/src/display.c b/ROX-Filer/src/display.c index 7ec616fb..87a99cf8 100644 --- a/ROX-Filer/src/display.c +++ b/ROX-Filer/src/display.c @@ -610,7 +610,7 @@ void display_set_thumbs(FilerWindow *filer_window, gboolean thumbs) update_views(filer_window); - gtk_widget_queue_clear(GTK_WIDGET(filer_window->collection)); + gtk_widget_queue_draw(GTK_WIDGET(filer_window->collection)); if (!thumbs) filer_cancel_thumbnails(filer_window); @@ -1235,7 +1235,7 @@ static void display_details_set(FilerWindow *filer_window, DetailsType details) filer_window->details_type = details; update_views(filer_window); - gtk_widget_queue_clear(GTK_WIDGET(filer_window->collection)); + gtk_widget_queue_draw(GTK_WIDGET(filer_window->collection)); } /* Note: Call shrink_grid after this */ diff --git a/ROX-Filer/src/dnd.c b/ROX-Filer/src/dnd.c index 46728599..5b1fee1c 100644 --- a/ROX-Filer/src/dnd.c +++ b/ROX-Filer/src/dnd.c @@ -143,7 +143,7 @@ static GtkWidget *dnd_menu = NULL; /* The handler of the signal handler for scroll events. * This is used to cancel spring loading when autoscrolling is used. */ -static gint scrolled_signal = -1; +static gulong scrolled_signal = -1; static GtkObject *scrolled_adj = NULL; /* The object watched */ /* Possible values for drop_dest_type (can also be NULL). @@ -465,10 +465,9 @@ void make_drop_target(GtkWidget *widget, GtkDestDefaults defaults) GDK_ACTION_COPY | GDK_ACTION_ASK | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE); - gtk_signal_connect(GTK_OBJECT(widget), "drag_drop", - GTK_SIGNAL_FUNC(drag_drop), NULL); - gtk_signal_connect(GTK_OBJECT(widget), "drag_data_received", - GTK_SIGNAL_FUNC(drag_data_received), NULL); + g_signal_connect(widget, "drag_drop", G_CALLBACK(drag_drop), NULL); + g_signal_connect(widget, "drag_data_received", + G_CALLBACK(drag_data_received), NULL); } /* Set up this filer window as a drop target. Called once, when the @@ -480,12 +479,12 @@ void drag_set_dest(FilerWindow *filer_window) make_drop_target(widget, 0); - gtk_signal_connect(GTK_OBJECT(widget), "drag_motion", - GTK_SIGNAL_FUNC(drag_motion), filer_window); - gtk_signal_connect(GTK_OBJECT(widget), "drag_leave", - GTK_SIGNAL_FUNC(drag_leave), filer_window); - gtk_signal_connect(GTK_OBJECT(widget), "drag_end", - GTK_SIGNAL_FUNC(drag_end), filer_window); + g_signal_connect(widget, "drag_motion", + G_CALLBACK(drag_motion), filer_window); + g_signal_connect(widget, "drag_leave", + G_CALLBACK(drag_leave), filer_window); + g_signal_connect(widget, "drag_end", + G_CALLBACK(drag_end), filer_window); } /* Like drag_set_dest, but for a pinboard-type widget. @@ -503,9 +502,8 @@ void drag_set_pinboard_dest(GtkWidget *widget) target_table, sizeof(target_table) / sizeof(*target_table), GDK_ACTION_LINK); - gtk_signal_connect(GTK_OBJECT(widget), "drag_data_received", - (GtkSignalFunc) desktop_drag_data_received, - NULL); + g_signal_connect(widget, "drag_data_received", + G_CALLBACK(desktop_drag_data_received), NULL); } /* Called during the drag when the mouse is in a widget registered @@ -674,8 +672,7 @@ static void drag_leave(GtkWidget *widget, dnd_spring_abort(); if (scrolled_adj) { - gtk_signal_disconnect(scrolled_adj, - scrolled_signal); + g_signal_handler_disconnect(scrolled_adj, scrolled_signal); scrolled_adj = NULL; } } @@ -1251,10 +1248,8 @@ static gboolean spring_now(gpointer data) if (spring_window) { gtk_timeout_add(500, spring_check_idle, NULL); - gtk_signal_connect(GTK_OBJECT(spring_window->window), - "destroy", - GTK_SIGNAL_FUNC(spring_win_destroyed), - NULL); + g_signal_connect(spring_window->window, "destroy", + G_CALLBACK(spring_win_destroyed), NULL); centre_window(spring_window->window->window, x, y); } } diff --git a/ROX-Filer/src/filer.c b/ROX-Filer/src/filer.c index 72c106d8..3ca9bd7c 100644 --- a/ROX-Filer/src/filer.c +++ b/ROX-Filer/src/filer.c @@ -109,7 +109,7 @@ static void filer_size_for(FilerWindow *filer_window, int w, int h, int n, gboolean allow_shrink); static void set_selection_state(FilerWindow *collection, gboolean normal); -static void filer_next_thumb(GtkObject *window, gchar *path); +static void filer_next_thumb(GObject *window, const gchar *path); static void start_thumb_scanning(FilerWindow *filer_window); @@ -495,7 +495,7 @@ static void filer_window_destroyed(GtkWidget *widget, { all_filer_windows = g_list_remove(all_filer_windows, filer_window); - gtk_object_set_data(GTK_OBJECT(widget), "filer_window", NULL); + g_object_set_data(G_OBJECT(widget), "filer_window", NULL); if (window_with_primary == filer_window) window_with_primary = NULL; @@ -617,7 +617,7 @@ static void selection_get(GtkWidget *widget, int i; Collection *collection; - filer_window = gtk_object_get_data(GTK_OBJECT(widget), "filer_window"); + filer_window = g_object_get_data(G_OBJECT(widget), "filer_window"); reply = g_string_new(NULL); header = g_string_new(NULL); @@ -1423,11 +1423,10 @@ static void filer_add_widgets(FilerWindow *filer_window) * You can thus ref filer_window->window and use this to see * if the window no longer exists. */ - gtk_object_set_data(GTK_OBJECT(filer_window->window), + g_object_set_data(G_OBJECT(filer_window->window), "filer_window", filer_window); - gtk_object_set_data(GTK_OBJECT(collection), - "filer_window", filer_window); + g_object_set_data(G_OBJECT(collection), "filer_window", filer_window); filer_window->collection = COLLECTION(collection); filer_window->collection->free_item = display_free_colitem; @@ -1486,7 +1485,7 @@ static void filer_add_widgets(FilerWindow *filer_window) gtk_widget_show_all(viewport); gtk_box_pack_start(GTK_BOX(vbox), viewport, TRUE, TRUE, 0); filer_window->scrollbar = gtk_vscrollbar_new(adj); - gtk_widget_set_usize(viewport, 4, 4); + gtk_widget_set_size_request(viewport, 4, 4); gtk_container_set_resize_mode(GTK_CONTAINER(viewport), GTK_RESIZE_IMMEDIATE); @@ -1506,6 +1505,7 @@ static void filer_add_widgets(FilerWindow *filer_window) FALSE, TRUE, 0); filer_window->thumb_progress = gtk_progress_bar_new(); + gtk_box_pack_start(GTK_BOX(filer_window->thumb_bar), filer_window->thumb_progress, TRUE, TRUE, 0); @@ -1513,9 +1513,9 @@ static void filer_add_widgets(FilerWindow *filer_window) GTK_WIDGET_UNSET_FLAGS(cancel, GTK_CAN_FOCUS); gtk_box_pack_start(GTK_BOX(filer_window->thumb_bar), cancel, FALSE, TRUE, 0); - gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", - GTK_SIGNAL_FUNC(filer_cancel_thumbnails), - (GtkObject *) filer_window); + g_signal_connect_swapped(cancel, "clicked", + G_CALLBACK(filer_cancel_thumbnails), + filer_window); } /* Put the scrollbar on the left of everything else... */ @@ -1548,14 +1548,12 @@ static void filer_add_signals(FilerWindow *filer_window) /* Events on the top-level window */ gtk_widget_add_events(filer_window->window, GDK_ENTER_NOTIFY); - gtk_signal_connect(GTK_OBJECT(filer_window->window), - "enter-notify-event", - GTK_SIGNAL_FUNC(pointer_in), filer_window); - gtk_signal_connect(GTK_OBJECT(filer_window->window), - "leave-notify-event", - GTK_SIGNAL_FUNC(pointer_out), filer_window); - gtk_signal_connect(GTK_OBJECT(filer_window->window), "destroy", - GTK_SIGNAL_FUNC(filer_window_destroyed), filer_window); + g_signal_connect(filer_window->window, "enter-notify-event", + G_CALLBACK(pointer_in), filer_window); + g_signal_connect(filer_window->window, "leave-notify-event", + G_CALLBACK(pointer_out), filer_window); + g_signal_connect(filer_window->window, "destroy", + G_CALLBACK(filer_window_destroyed), filer_window); /* Events on the collection widget */ gtk_widget_set_events(GTK_WIDGET(collection), @@ -1563,29 +1561,29 @@ static void filer_add_signals(FilerWindow *filer_window) GDK_BUTTON3_MOTION_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); - gtk_signal_connect(collection, "lose_selection", - GTK_SIGNAL_FUNC(lose_selection), filer_window); - gtk_signal_connect(collection, "selection_changed", - GTK_SIGNAL_FUNC(selection_changed), filer_window); - gtk_signal_connect(collection, "selection_clear_event", - GTK_SIGNAL_FUNC(collection_lose_selection), NULL); - gtk_signal_connect(collection, "selection_get", - GTK_SIGNAL_FUNC(selection_get), NULL); + g_signal_connect(collection, "lose_selection", + G_CALLBACK(lose_selection), filer_window); + g_signal_connect(collection, "selection_changed", + G_CALLBACK(selection_changed), filer_window); + g_signal_connect(collection, "selection_clear_event", + G_CALLBACK(collection_lose_selection), NULL); + g_signal_connect(collection, "selection_get", + G_CALLBACK(selection_get), NULL); gtk_selection_add_targets(GTK_WIDGET(collection), GDK_SELECTION_PRIMARY, target_table, sizeof(target_table) / sizeof(*target_table)); - gtk_signal_connect(collection, "key_press_event", - GTK_SIGNAL_FUNC(key_press_event), filer_window); - gtk_signal_connect(collection, "button-release-event", - GTK_SIGNAL_FUNC(coll_button_release), filer_window); - gtk_signal_connect(collection, "button-press-event", - GTK_SIGNAL_FUNC(coll_button_press), filer_window); - gtk_signal_connect(collection, "motion-notify-event", - GTK_SIGNAL_FUNC(coll_motion_notify), filer_window); + g_signal_connect(collection, "key_press_event", + G_CALLBACK(key_press_event), filer_window); + g_signal_connect(collection, "button-release-event", + G_CALLBACK(coll_button_release), filer_window); + g_signal_connect(collection, "button-press-event", + G_CALLBACK(coll_button_press), filer_window); + g_signal_connect(collection, "motion-notify-event", + G_CALLBACK(coll_motion_notify), filer_window); /* Drag and drop events */ - gtk_signal_connect(collection, "drag_data_get", + g_signal_connect(collection, "drag_data_get", GTK_SIGNAL_FUNC(drag_data_get), NULL); drag_set_dest(filer_window); } @@ -2198,9 +2196,8 @@ static void show_tooltip(guchar *text) gtk_widget_set_app_paintable(tip_widget, TRUE); gtk_widget_set_name(tip_widget, "gtk-tooltips"); - gtk_signal_connect_object(GTK_OBJECT(tip_widget), "expose_event", - GTK_SIGNAL_FUNC(filer_tooltip_draw), - (GtkObject *) tip_widget); + g_signal_connect_swapped(tip_widget, "expose_event", + G_CALLBACK(filer_tooltip_draw), tip_widget); label = gtk_label_new(text); gtk_misc_set_padding(GTK_MISC(label), 4, 2); @@ -2222,11 +2219,11 @@ static void show_tooltip(guchar *text) /* And again test if pointer is over the tooltip window */ if (py >= y && py <= y + h) y = py - h- 2; - gtk_widget_set_uposition(tip_widget, x, y); + gtk_window_move(GTK_WINDOW(tip_widget), x, y); gtk_widget_show(tip_widget); - gtk_signal_connect_object(GTK_OBJECT(tip_widget), "destroy", - GTK_SIGNAL_FUNC(tip_destroyed), NULL); + g_signal_connect_swapped(tip_widget, "destroy", + G_CALLBACK(tip_destroyed), NULL); time(&tip_time); } @@ -2292,24 +2289,24 @@ void filer_cancel_thumbnails(FilerWindow *filer_window) * unref'd when there is nothing more to do. * If the collection no longer has a filer window, nothing is done. */ -static gboolean filer_next_thumb_real(GtkObject *window) +static gboolean filer_next_thumb_real(GObject *window) { FilerWindow *filer_window; gchar *path; int done, total; - filer_window = gtk_object_get_data(window, "filer_window"); + filer_window = g_object_get_data(window, "filer_window"); if (!filer_window) { - gtk_object_unref(window); + g_object_unref(window); return FALSE; } if (!filer_window->thumb_queue) { filer_cancel_thumbnails(filer_window); - gtk_object_unref(window); + g_object_unref(window); return FALSE; } @@ -2324,8 +2321,9 @@ static gboolean filer_next_thumb_real(GtkObject *window) path); g_free(path); - gtk_progress_set_percentage(GTK_PROGRESS(filer_window->thumb_progress), - done / (float) total); + gtk_progress_bar_set_fraction( + GTK_PROGRESS_BAR(filer_window->thumb_progress), + done / (float) total); return FALSE; } @@ -2333,7 +2331,7 @@ static gboolean filer_next_thumb_real(GtkObject *window) /* path is the thumb just loaded, if any. * collection is unref'd (eventually). */ -static void filer_next_thumb(GtkObject *window, gchar *path) +static void filer_next_thumb(GObject *window, const gchar *path) { if (path) dir_force_update_path(path); @@ -2348,8 +2346,8 @@ static void start_thumb_scanning(FilerWindow *filer_window) gtk_widget_show_all(filer_window->thumb_bar); - gtk_object_ref(GTK_OBJECT(filer_window->window)); - filer_next_thumb(GTK_OBJECT(filer_window->window), NULL); + g_object_ref(G_OBJECT(filer_window->window)); + filer_next_thumb(G_OBJECT(filer_window->window), NULL); } /* Set this image to be loaded some time in the future */ diff --git a/ROX-Filer/src/gtksavebox.c b/ROX-Filer/src/gtksavebox.c index ae60ba2e..67851475 100644 --- a/ROX-Filer/src/gtksavebox.c +++ b/ROX-Filer/src/gtksavebox.c @@ -28,6 +28,8 @@ #include "config.h" +#undef GTK_DISABLE_DEPRECATED + #include #include #include diff --git a/ROX-Filer/src/gui_support.c b/ROX-Filer/src/gui_support.c index 4e94b8cb..c8423784 100644 --- a/ROX-Filer/src/gui_support.c +++ b/ROX-Filer/src/gui_support.c @@ -302,10 +302,9 @@ GtkWidget *new_help_button(HelpFunc show_help, gpointer data) b = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(b), GTK_RELIEF_NONE); - icon = gtk_pixmap_new(im_help->pixmap, im_help->mask); + icon = gtk_image_new_from_pixmap(im_help->pixmap, im_help->mask); gtk_container_add(GTK_CONTAINER(b), icon); - gtk_signal_connect_object(GTK_OBJECT(b), "clicked", - GTK_SIGNAL_FUNC(show_help), data); + g_signal_connect_swapped(b, "clicked", G_CALLBACK(show_help), data); GTK_WIDGET_UNSET_FLAGS(b, GTK_CAN_FOCUS); @@ -590,13 +589,13 @@ void centre_window(GdkWindow *window, int x, int y) static GtkWidget *current_wink_widget = NULL; static gint wink_timeout = -1; /* Called when it's time to stop */ -static gint wink_destroy; /* Called if the widget dies first */ +static gulong wink_destroy; /* Called if the widget dies first */ static gboolean end_wink(gpointer data) { gtk_drag_unhighlight(current_wink_widget); - gtk_signal_disconnect(GTK_OBJECT(current_wink_widget), wink_destroy); + g_signal_handler_disconnect(current_wink_widget, wink_destroy); current_wink_widget = NULL; @@ -630,8 +629,8 @@ void wink_widget(GtkWidget *widget) wink_timeout = gtk_timeout_add(300, (GtkFunction) end_wink, NULL); - wink_destroy = gtk_signal_connect_object(GTK_OBJECT(widget), "destroy", - GTK_SIGNAL_FUNC(wink_widget_died), NULL); + wink_destroy = g_signal_connect_swapped(widget, "destroy", + G_CALLBACK(wink_widget_died), NULL); } static gboolean idle_destroy_cb(GtkWidget *widget) diff --git a/ROX-Filer/src/icon.c b/ROX-Filer/src/icon.c index 0cf590fc..3b6a9a24 100644 --- a/ROX-Filer/src/icon.c +++ b/ROX-Filer/src/icon.c @@ -23,6 +23,8 @@ #include "config.h" +#undef GTK_DISABLE_DEPRECATED + #include #include diff --git a/ROX-Filer/src/infobox.c b/ROX-Filer/src/infobox.c index 8c6c050b..f8e7f769 100644 --- a/ROX-Filer/src/infobox.c +++ b/ROX-Filer/src/infobox.c @@ -54,7 +54,7 @@ struct _FileStatus }; /* Static prototypes */ -static void refresh_info(GtkObject *window); +static void refresh_info(GObject *window); static GtkWidget *make_vbox(guchar *path); static GtkWidget *make_details(guchar *path, DirItem *item, xmlNode *about); static GtkWidget *make_file_says(guchar *path); @@ -62,7 +62,7 @@ static void add_file_output(FileStatus *fs, gint source, GdkInputCondition condition); static guchar *pretty_type(DirItem *file, guchar *path); static GtkWidget *make_vbox(guchar *path); -static void got_response(GtkObject *window, gint response, gpointer data); +static void got_response(GObject *window, gint response, gpointer data); static void file_info_destroyed(GtkWidget *widget, FileStatus *fs); /**************************************************************** @@ -91,11 +91,10 @@ void infobox_new(const gchar *pathname) gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), details, TRUE, TRUE, 0); - gtk_object_set_data(GTK_OBJECT(window), "details", details); - gtk_object_set_data_full(GTK_OBJECT(window), "path", path, g_free); + g_object_set_data(G_OBJECT(window), "details", details); + g_object_set_data_full(G_OBJECT(window), "path", path, g_free); - gtk_signal_connect(GTK_OBJECT(window), "response", - GTK_SIGNAL_FUNC(got_response), NULL); + g_signal_connect(window, "response", G_CALLBACK(got_response), NULL); number_of_windows++; gtk_widget_show_all(window); @@ -105,7 +104,7 @@ void infobox_new(const gchar *pathname) * INTERNAL FUNCTIONS * ****************************************************************/ -static void got_response(GtkObject *window, gint response, gpointer data) +static void got_response(GObject *window, gint response, gpointer data) { if (response == GTK_RESPONSE_APPLY) refresh_info(window); @@ -117,13 +116,13 @@ static void got_response(GtkObject *window, gint response, gpointer data) } } -static void refresh_info(GtkObject *window) +static void refresh_info(GObject *window) { GtkWidget *details, *vbox; guchar *path; - path = gtk_object_get_data(window, "path"); - details = gtk_object_get_data(window, "details"); + path = g_object_get_data(window, "path"); + details = g_object_get_data(window, "details"); g_return_if_fail(details != NULL); g_return_if_fail(path != NULL); @@ -131,7 +130,7 @@ static void refresh_info(GtkObject *window) gtk_widget_destroy(details); details = make_vbox(path); - gtk_object_set_data(window, "details", details); + g_object_set_data(window, "details", details); gtk_box_pack_start(GTK_BOX(vbox), details, TRUE, TRUE, 0); gtk_widget_show_all(details); } @@ -238,8 +237,8 @@ static GtkWidget *make_details(guchar *path, DirItem *item, xmlNode *about) gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), 1, NULL, cell_renderer, "text", 1, NULL); - gtk_signal_connect(GTK_OBJECT(view), "cursor_changed", - GTK_SIGNAL_FUNC(set_selection), NULL); + g_signal_connect(view, "cursor_changed", + G_CALLBACK(set_selection), NULL); add_row(store, _("Name:"), item->leafname); @@ -372,8 +371,8 @@ static GtkWidget *make_file_says(guchar *path) fs->text = g_strdup(""); fs->input = gdk_input_add(fs->fd, GDK_INPUT_READ, (GdkInputFunction) add_file_output, fs); - gtk_signal_connect(GTK_OBJECT(frame), "destroy", - GTK_SIGNAL_FUNC(file_info_destroyed), fs); + g_signal_connect(frame, "destroy", + G_CALLBACK(file_info_destroyed), fs); break; } diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c index 598134ce..6f686e04 100644 --- a/ROX-Filer/src/menu.c +++ b/ROX-Filer/src/menu.c @@ -22,6 +22,9 @@ /* menu.c - code for handling the popup menu */ #include "config.h" + +#undef GTK_DISABLE_DEPRECATED + #include #include #include diff --git a/ROX-Filer/src/minibuffer.c b/ROX-Filer/src/minibuffer.c index 1949a363..5eb11c5f 100644 --- a/ROX-Filer/src/minibuffer.c +++ b/ROX-Filer/src/minibuffer.c @@ -96,14 +96,13 @@ void create_minibuffer(FilerWindow *filer_window) mini = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), mini, TRUE, TRUE, 0); gtk_widget_set_name(mini, "fixed-style"); - gtk_signal_connect(GTK_OBJECT(mini), "key_press_event", - GTK_SIGNAL_FUNC(key_press_event), filer_window); - gtk_signal_connect(GTK_OBJECT(mini), "changed", - GTK_SIGNAL_FUNC(changed), filer_window); + g_signal_connect(mini, "key_press_event", + G_CALLBACK(key_press_event), filer_window); + g_signal_connect(mini, "changed", G_CALLBACK(changed), filer_window); /* Grabbing focus musn't select the text... */ - gtk_signal_connect_object(GTK_OBJECT(mini), "grab-focus", - GTK_SIGNAL_FUNC(grab_focus), GTK_OBJECT(mini)); + g_signal_connect_swapped(mini, "grab-focus", + G_CALLBACK(grab_focus), mini); filer_window->minibuffer = mini; filer_window->minibuffer_label = label; @@ -173,7 +172,7 @@ void minibuffer_show(FilerWindow *filer_window, MiniType mini_type) filer_window->mini_type = mini_type; - gtk_entry_set_position(mini, pos); + gtk_editable_set_position(GTK_EDITABLE(mini), pos); gtk_widget_show_all(filer_window->minibuffer_area); @@ -368,12 +367,17 @@ static void complete(FilerWindow *filer_window) else if (current_stem < shortest_stem) { guchar *extra; + gint tmp_pos; extra = g_strndup(item->leafname + current_stem, shortest_stem - current_stem); - gtk_entry_append_text(entry, extra); + + tmp_pos = entry->text_length; + gtk_editable_insert_text(GTK_EDITABLE(entry), extra, -1, + &tmp_pos); + g_free(extra); - gtk_entry_set_position(entry, -1); + gtk_editable_set_position(GTK_EDITABLE(entry), -1); if (o_filer_beep_multi.int_value) gdk_beep(); @@ -389,7 +393,7 @@ static void complete(FilerWindow *filer_window) g_string_append_c(new, '/'); gtk_entry_set_text(entry, new->str); - gtk_entry_set_position(entry, -1); + gtk_editable_set_position(GTK_EDITABLE(entry), -1); } } @@ -984,7 +988,9 @@ static gboolean grab_focus(GtkWidget *minibuffer) class->grab_focus(minibuffer); - gtk_signal_emit_stop_by_name(GTK_OBJECT(minibuffer), "grab_focus"); + g_signal_stop_emission(minibuffer, + g_signal_lookup("grab_focus", G_OBJECT_TYPE(minibuffer)), 0); + return 1; } diff --git a/ROX-Filer/src/options.c b/ROX-Filer/src/options.c index ef8e118c..0c1c0821 100644 --- a/ROX-Filer/src/options.c +++ b/ROX-Filer/src/options.c @@ -68,6 +68,8 @@ #include "config.h" +#undef GTK_DISABLE_DEPRECATED + #include #include #include @@ -799,7 +801,7 @@ static GtkWidget *build_frame(void) gtk_box_pack_start(GTK_BOX(hbox), actions, TRUE, TRUE, 0); } - button = button_new_mixed(GTK_STOCK_UNDO, "_Revert"); + button = button_new_mixed(GTK_STOCK_UNDO, _("_Revert")); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(actions), button, FALSE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", @@ -808,7 +810,7 @@ static GtkWidget *build_frame(void) _("Restore all choices to how they were when the " "Options box was opened."), NULL); - button = button_new_mixed(GTK_STOCK_APPLY, "_OK"); + button = button_new_mixed(GTK_STOCK_APPLY, _("_OK")); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(actions), button, FALSE, TRUE, 0); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", diff --git a/ROX-Filer/src/panel.c b/ROX-Filer/src/panel.c index 5937bc50..96d41625 100644 --- a/ROX-Filer/src/panel.c +++ b/ROX-Filer/src/panel.c @@ -23,6 +23,8 @@ #include "config.h" +#undef GTK_DISABLE_DEPRECATED + #include #include #include @@ -192,23 +194,23 @@ Panel *panel_new(const gchar *name, PanelSide side) panel->name = g_strdup(name); panel->side = side; panel->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_policy(GTK_WINDOW(panel->window), FALSE, FALSE, TRUE); + gtk_window_set_resizable(GTK_WINDOW(panel->window), FALSE); gtk_window_set_wmclass(GTK_WINDOW(panel->window), "ROX-Panel", PROJECT); gtk_widget_set_events(panel->window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON2_MOTION_MASK); - gtk_signal_connect(GTK_OBJECT(panel->window), "delete-event", - GTK_SIGNAL_FUNC(panel_delete), panel); - gtk_signal_connect(GTK_OBJECT(panel->window), "destroy", - GTK_SIGNAL_FUNC(panel_destroyed), panel); - gtk_signal_connect(GTK_OBJECT(panel->window), "button_press_event", - GTK_SIGNAL_FUNC(panel_button_press), panel); - gtk_signal_connect(GTK_OBJECT(panel->window), "button_release_event", - GTK_SIGNAL_FUNC(panel_button_release), panel); - gtk_signal_connect(GTK_OBJECT(panel->window), "motion-notify-event", - GTK_SIGNAL_FUNC(panel_motion_event), panel); + g_signal_connect(panel->window, "delete-event", + G_CALLBACK(panel_delete), panel); + g_signal_connect(panel->window, "destroy", + G_CALLBACK(panel_destroyed), panel); + g_signal_connect(panel->window, "button_press_event", + G_CALLBACK(panel_button_press), panel); + g_signal_connect(panel->window, "button_release_event", + G_CALLBACK(panel_button_release), panel); + g_signal_connect(panel->window, "motion-notify-event", + G_CALLBACK(panel_motion_event), panel); if (strchr(name, '/')) load_path = g_strdup(name); @@ -267,7 +269,7 @@ Panel *panel_new(const gchar *name, PanelSide side) gtk_box_pack_start(GTK_BOX(box), panel->gap, FALSE, FALSE, 0); frame = make_insert_frame(panel); - gtk_object_set_data(GTK_OBJECT(frame), "after", "yes"); + g_object_set_data(G_OBJECT(frame), "after", "yes"); gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 4); gtk_widget_realize(panel->window); @@ -313,10 +315,10 @@ Panel *panel_new(const gchar *name, PanelSide side) current_panel[side] = panel; gtk_widget_queue_resize(box); - gtk_signal_connect_after(GTK_OBJECT(panel->window), "size-request", - GTK_SIGNAL_FUNC(panel_post_resize), (GtkObject *) panel); - gtk_signal_connect_after(GTK_OBJECT(panel->window), "size-allocate", - GTK_SIGNAL_FUNC(reposition_panel), (GtkObject *) panel); + g_signal_connect(panel->window, "size-request", + G_CALLBACK(panel_post_resize), panel); + g_signal_connect(panel->window, "size-allocate", + G_CALLBACK(reposition_panel), panel); number_of_windows++; gtk_widget_show(panel->window); @@ -456,6 +458,24 @@ static const char *pan_from_file(gchar *line) return NULL; } +static gboolean icon_pointer_in(GtkWidget *widget, + GdkEventCrossing *event, + Icon *icon) +{ + gtk_widget_set_state(widget, GTK_STATE_PRELIGHT); + + return 0; +} + +static gboolean icon_pointer_out(GtkWidget *widget, + GdkEventCrossing *event, + Icon *icon) +{ + gtk_widget_set_state(widget, GTK_STATE_NORMAL); + + return 0; +} + /* Add an icon with this path to the panel. If after is TRUE then the * icon is added to the right/bottom end of the panel. * @@ -514,18 +534,22 @@ static void panel_add_item(Panel *panel, } diritem_restat(icon->path, icon->item); - gtk_signal_connect_object(GTK_OBJECT(widget), "destroy", - GTK_SIGNAL_FUNC(icon_destroyed), (gpointer) icon); + g_signal_connect_swapped(widget, "destroy", + G_CALLBACK(icon_destroyed), icon); if (icon->item->base_type == TYPE_DIRECTORY) run_applet(icon); - gtk_signal_connect(GTK_OBJECT(widget), "button_release_event", - GTK_SIGNAL_FUNC(icon_button_release), icon); - gtk_signal_connect(GTK_OBJECT(widget), "button_press_event", - GTK_SIGNAL_FUNC(icon_button_press), icon); - gtk_signal_connect(GTK_OBJECT(icon->widget), "motion-notify-event", - GTK_SIGNAL_FUNC(icon_motion_event), icon); + g_signal_connect(widget, "button_release_event", + G_CALLBACK(icon_button_release), icon); + g_signal_connect(widget, "button_press_event", + G_CALLBACK(icon_button_press), icon); + g_signal_connect(icon->widget, "motion-notify-event", + G_CALLBACK(icon_motion_event), icon); + g_signal_connect(icon->widget, "enter-notify-event", + G_CALLBACK(icon_pointer_in), icon); + g_signal_connect(icon->widget, "leave-notify-event", + G_CALLBACK(icon_pointer_out), icon); if (!icon->socket) { @@ -749,7 +773,7 @@ static void reposition_panel(GtkWidget *window, if (side == PANEL_BOTTOM) y = screen_height - alloc->height; - gtk_widget_set_uposition(panel->window, x, y); + gtk_window_move(GTK_WINDOW(panel->window), x, y); gdk_window_move(panel->window->window, x, y); if (side == PANEL_BOTTOM || side == PANEL_TOP) @@ -853,7 +877,7 @@ static void add_uri_list(GtkWidget *widget, g_return_if_fail(selection_data->data[selection_data->length] == '\0'); - if (gtk_object_get_data(GTK_OBJECT(widget), "after")) + if (g_object_get_data(G_OBJECT(widget), "after")) after = TRUE; uris = uri_list_to_glist(selection_data->data); @@ -908,7 +932,7 @@ static void make_widgets(xmlNodePtr side, GList *widgets) Icon *icon; xmlNodePtr tree; - icon = gtk_object_get_data(GTK_OBJECT(next->data), "icon"); + icon = g_object_get_data(G_OBJECT(next->data), "icon"); if (!icon) { diff --git a/ROX-Filer/src/pinboard.c b/ROX-Filer/src/pinboard.c index 0b717deb..78a913df 100644 --- a/ROX-Filer/src/pinboard.c +++ b/ROX-Filer/src/pinboard.c @@ -324,8 +324,8 @@ void pinboard_pin(const gchar *path, const gchar *name, int x, int y) gtk_container_add(GTK_CONTAINER(icon->win), icon->widget); drag_set_pinicon_dest(icon); - gtk_signal_connect(GTK_OBJECT(icon->widget), "drag_data_get", - GTK_SIGNAL_FUNC(drag_data_get), NULL); + g_signal_connect(icon->widget, "drag_data_get", + G_CALLBACK(drag_data_get), NULL); gtk_widget_realize(icon->win); gtk_widget_realize(icon->widget); @@ -333,7 +333,7 @@ void pinboard_pin(const gchar *path, const gchar *name, int x, int y) set_size_and_shape(icon, &width, &height); snap_to_grid(&x, &y); offset_from_centre(icon, width, height, &x, &y); - gtk_widget_set_uposition(icon->win, x, y); + gtk_window_move(GTK_WINDOW(icon->win), x, y); /* Set the correct position in the icon */ offset_to_centre(icon, width, height, &x, &y); icon->x = x; @@ -357,18 +357,18 @@ void pinboard_pin(const gchar *path, const gchar *name, int x, int y) GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK); - gtk_signal_connect(GTK_OBJECT(icon->widget), "enter-notify-event", - GTK_SIGNAL_FUNC(enter_notify), icon); - gtk_signal_connect(GTK_OBJECT(icon->widget), "button-press-event", - GTK_SIGNAL_FUNC(button_press_event), icon); - gtk_signal_connect(GTK_OBJECT(icon->widget), "button-release-event", - GTK_SIGNAL_FUNC(button_release_event), icon); - gtk_signal_connect(GTK_OBJECT(icon->widget), "motion-notify-event", - GTK_SIGNAL_FUNC(icon_motion_notify), icon); - gtk_signal_connect(GTK_OBJECT(icon->widget), "expose-event", - GTK_SIGNAL_FUNC(draw_icon), icon); - gtk_signal_connect_object(GTK_OBJECT(icon->win), "destroy", - GTK_SIGNAL_FUNC(icon_destroyed), (gpointer) icon); + g_signal_connect(icon->widget, "enter-notify-event", + G_CALLBACK(enter_notify), icon); + g_signal_connect(icon->widget, "button-press-event", + G_CALLBACK(button_press_event), icon); + g_signal_connect(icon->widget, "button-release-event", + G_CALLBACK(button_release_event), icon); + g_signal_connect(icon->widget, "motion-notify-event", + G_CALLBACK(icon_motion_notify), icon); + g_signal_connect(icon->widget, "expose-event", + G_CALLBACK(draw_icon), icon); + g_signal_connect_swapped(icon->win, "destroy", + G_CALLBACK(icon_destroyed), icon); current_pinboard->icons = g_list_prepend(current_pinboard->icons, icon); @@ -456,7 +456,7 @@ void pinboard_reshape_icon(Icon *icon) set_size_and_shape(icon, &width, &height); gdk_window_resize(icon->win->window, width, height); offset_from_centre(icon, width, height, &x, &y); - gtk_widget_set_uposition(icon->win, x, y); + gtk_window_move(GTK_WINDOW(icon->win), x, y); gtk_widget_queue_draw(icon->win); } @@ -481,7 +481,7 @@ static void pinboard_check_options(void) if (pinicon_style) { - gtk_style_unref(pinicon_style); + g_object_unref(G_OBJECT(pinicon_style)); pinicon_style = NULL; } @@ -510,7 +510,8 @@ static void mask_wink_border(Icon *icon, GdkColor *alpha) gtk_widget_shape_combine_mask(icon->win, icon->mask, 0, 0); - gtk_widget_draw(icon->widget, NULL); + gtk_widget_queue_draw(icon->widget); + gdk_window_process_updates(icon->widget->window, TRUE); } #define TEXT_AT(dx, dy) \ @@ -553,7 +554,7 @@ static void set_size_and_shape(Icon *icon, int *rwidth, int *rheight) width = MAX(iwidth, icon->name_width + 2) + 2 * WINK_FRAME; height = iheight + GAP + (font_height + 2) + 2 * WINK_FRAME; - gtk_widget_set_usize(icon->win, width, height); + gtk_widget_set_size_request(icon->win, width, height); icon->width = width; icon->height = height; @@ -1052,21 +1053,17 @@ static gboolean add_root_handlers(void) proxy_filter, NULL); */ - gtk_signal_connect(GTK_OBJECT(proxy_invisible), - "property_notify_event", - GTK_SIGNAL_FUNC(root_property_event), NULL); - gtk_signal_connect(GTK_OBJECT(proxy_invisible), - "button_press_event", - GTK_SIGNAL_FUNC(root_button_press), NULL); + g_signal_connect(proxy_invisible, "property_notify_event", + G_CALLBACK(root_property_event), NULL); + g_signal_connect(proxy_invisible, "button_press_event", + G_CALLBACK(root_button_press), NULL); /* Drag and drop handlers */ drag_set_pinboard_dest(proxy_invisible); - gtk_signal_connect(GTK_OBJECT(proxy_invisible), "drag_motion", - GTK_SIGNAL_FUNC(bg_drag_motion), - NULL); - gtk_signal_connect(GTK_OBJECT(proxy_invisible), "drag_leave", - GTK_SIGNAL_FUNC(bg_drag_leave), - NULL); + g_signal_connect(proxy_invisible, "drag_motion", + G_CALLBACK(bg_drag_motion), NULL); + g_signal_connect(proxy_invisible, "drag_leave", + G_CALLBACK(bg_drag_leave), NULL); } root = gdk_window_lookup(GDK_ROOT_WINDOW()); @@ -1279,12 +1276,9 @@ static void drag_set_pinicon_dest(Icon *icon) make_drop_target(icon->widget, 0); - gtk_signal_connect(obj, "drag_motion", - GTK_SIGNAL_FUNC(drag_motion), icon); - gtk_signal_connect(obj, "drag_leave", - GTK_SIGNAL_FUNC(drag_leave), icon); - gtk_signal_connect(obj, "drag_end", - GTK_SIGNAL_FUNC(drag_end), icon); + g_signal_connect(obj, "drag_motion", G_CALLBACK(drag_motion), icon); + g_signal_connect(obj, "drag_leave", G_CALLBACK(drag_leave), icon); + g_signal_connect(obj, "drag_end", G_CALLBACK(drag_end), icon); } /* Called during the drag when the mouse is in a widget registered diff --git a/ROX-Filer/src/remote.c b/ROX-Filer/src/remote.c index 3da6f003..d91ca8e2 100644 --- a/ROX-Filer/src/remote.c +++ b/ROX-Filer/src/remote.c @@ -183,8 +183,8 @@ gboolean remote_init(xmlDocPtr rpc, gboolean new_copy) (void *) &xwindow, 1); /* Get notified when we get a message */ - gtk_signal_connect(GTK_OBJECT(ipc_window), "client-event", - GTK_SIGNAL_FUNC(client_event), NULL); + g_signal_connect(ipc_window, "client-event", + G_CALLBACK(client_event), NULL); /* Make the root window contain a pointer to the IPC window */ gdk_property_change(GDK_ROOT_PARENT(), filer_atom, @@ -817,9 +817,8 @@ static void soap_send(GtkWidget *from, GdkAtom prop, GdkWindow *dest) event.message_type = xsoap; gtk_widget_add_events(from, GDK_PROPERTY_CHANGE_MASK); - gtk_signal_connect(GTK_OBJECT(from), "property-notify-event", - GTK_SIGNAL_FUNC(soap_done), - GINT_TO_POINTER(prop)); + g_signal_connect(from, "property-notify-event", + G_CALLBACK(soap_done), GINT_TO_POINTER(prop)); gdk_event_send_client_message((GdkEvent *) &event, GDK_WINDOW_XWINDOW(dest)); diff --git a/ROX-Filer/src/toolbar.c b/ROX-Filer/src/toolbar.c index 967441da..63747fbf 100644 --- a/ROX-Filer/src/toolbar.c +++ b/ROX-Filer/src/toolbar.c @@ -23,6 +23,8 @@ #include "config.h" +#undef GTK_DISABLE_DEPRECATED + #include #include "global.h" @@ -191,8 +193,8 @@ GtkWidget *toolbar_tool_option(int i) GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); gtk_tooltips_set_tip(tooltips, button, _(tool->tip), NULL); - icon_widget = gtk_pixmap_new(tool->icon->pixmap, - tool->icon->mask); + icon_widget = gtk_image_new_from_pixmap(tool->icon->pixmap, + tool->icon->mask); vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), icon_widget, TRUE, TRUE, 0); @@ -205,10 +207,10 @@ GtkWidget *toolbar_tool_option(int i) gtk_container_set_border_width(GTK_CONTAINER(button), 1); gtk_misc_set_padding(GTK_MISC(icon_widget), 16, 1); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(toggle_shaded), GTK_OBJECT(vbox)); + g_signal_connect_swapped(button, "clicked", + G_CALLBACK(toggle_shaded), vbox); - gtk_object_set_data(GTK_OBJECT(button), "tool_name", tool->name); + g_object_set_data(G_OBJECT(button), "tool_name", tool->name); return button; } @@ -360,7 +362,7 @@ static GtkWidget *create_toolbar(FilerWindow *filer_window) filer_window->toolbar_text = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(filer_window->toolbar_text), 0, 0.5); - gtk_widget_set_usize(filer_window->toolbar_text, 8, -1); + gtk_widget_set_size_request(filer_window->toolbar_text, 8, -1); gtk_box_pack_start(GTK_BOX(box), filer_window->toolbar_text, TRUE, TRUE, 4); diff --git a/ROX-Filer/src/type.c b/ROX-Filer/src/type.c index 705fe8fa..7ee35632 100644 --- a/ROX-Filer/src/type.c +++ b/ROX-Filer/src/type.c @@ -641,8 +641,8 @@ static void set_shell_action(GtkWidget *dialog) int error = 0, len; FILE *file; - entry = gtk_object_get_data(GTK_OBJECT(dialog), "shell_command"); - for_all = gtk_object_get_data(GTK_OBJECT(dialog), "set_for_all"); + entry = g_object_get_data(G_OBJECT(dialog), "shell_command"); + for_all = g_object_get_data(G_OBJECT(dialog), "set_for_all"); g_return_if_fail(entry != NULL); command = gtk_entry_get_text(entry); @@ -889,7 +889,7 @@ void type_set_handler_dialog(MIME_type *type) gtk_dialog_set_has_separator(dialog, FALSE); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); - gtk_object_set_data(GTK_OBJECT(dialog), "mime_type", type); + g_object_set_data(G_OBJECT(dialog), "mime_type", type); gtk_window_set_title(GTK_WINDOW(dialog), _("Set run action")); @@ -897,13 +897,13 @@ void type_set_handler_dialog(MIME_type *type) type->media_type); radio = gtk_radio_button_new_with_label(NULL, tmp); g_free(tmp); - gtk_object_set_data(GTK_OBJECT(dialog), "set_for_all", radio); + g_object_set_data(G_OBJECT(dialog), "set_for_all", radio); tmp = g_strdup_printf(_("Only for the type `%s/%s'"), type->media_type, type->subtype); gtk_box_pack_start(GTK_BOX(dialog->vbox), radio, FALSE, TRUE, 0); radio = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(radio)), + gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio)), tmp); g_free(tmp); gtk_box_pack_start(GTK_BOX(dialog->vbox), radio, FALSE, TRUE, 0); @@ -938,8 +938,8 @@ void type_set_handler_dialog(MIME_type *type) gtk_drag_dest_set(eb, GTK_DEST_DEFAULT_ALL, targets, sizeof(targets) / sizeof(*targets), GDK_ACTION_COPY); - gtk_signal_connect(GTK_OBJECT(eb), "drag_data_received", - GTK_SIGNAL_FUNC(drag_app_dropped), dialog); + g_signal_connect(eb, "drag_data_received", + G_CALLBACK(drag_app_dropped), dialog); label = gtk_label_new(_("Drop a suitable\napplication here")); gtk_misc_set_padding(GTK_MISC(label), 10, 20); @@ -965,22 +965,22 @@ void type_set_handler_dialog(MIME_type *type) entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(dialog->vbox), entry, FALSE, TRUE, 0); gtk_widget_grab_focus(entry); - gtk_object_set_data(GTK_OBJECT(dialog), "shell_command", entry); - gtk_signal_connect_object(GTK_OBJECT(entry), "activate", - GTK_SIGNAL_FUNC(set_shell_action), GTK_OBJECT(dialog)); + g_object_set_data(G_OBJECT(dialog), "shell_command", entry); + g_signal_connect_swapped(GTK_OBJECT(entry), "activate", + G_CALLBACK(set_shell_action), GTK_OBJECT(dialog)); /* If possible, fill in the entry box with the current command */ tmp = get_current_command(type); if (tmp) { gtk_entry_set_text(GTK_ENTRY(entry), tmp); - gtk_entry_set_position(GTK_ENTRY(entry), -1); + gtk_editable_set_position(GTK_EDITABLE(entry), -1); g_free(tmp); } else { gtk_entry_set_text(GTK_ENTRY(entry), " \"$1\""); - gtk_entry_set_position(GTK_ENTRY(entry), 0); + gtk_editable_set_position(GTK_EDITABLE(entry), 0); } gtk_dialog_add_buttons(dialog, @@ -993,8 +993,8 @@ void type_set_handler_dialog(MIME_type *type) gtk_dialog_set_default_response(dialog, GTK_RESPONSE_OK); - gtk_signal_connect(GTK_OBJECT(dialog), "response", - GTK_SIGNAL_FUNC(set_action_response), NULL); + g_signal_connect(dialog, "response", + G_CALLBACK(set_action_response), NULL); gtk_widget_show_all(GTK_WIDGET(dialog)); } @@ -1012,8 +1012,8 @@ char *get_action_save_path(GtkWidget *dialog) GtkToggleButton *for_all; g_return_val_if_fail(dialog != NULL, NULL); - type = gtk_object_get_data(GTK_OBJECT(dialog), "mime_type"); - for_all = gtk_object_get_data(GTK_OBJECT(dialog), "set_for_all"); + type = g_object_get_data(G_OBJECT(dialog), "mime_type"); + for_all = g_object_get_data(G_OBJECT(dialog), "set_for_all"); g_return_val_if_fail(for_all != NULL && type != NULL, NULL); if (gtk_toggle_button_get_active(for_all)) @@ -1154,8 +1154,8 @@ static GList *build_type_reread(Option *none, xmlNode *node, guchar *label) button = gtk_button_new_with_label(_(label)); gtk_container_add(GTK_CONTAINER(align), button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(reread_mime_files), NULL); + g_signal_connect_swapped(button, "clicked", + G_CALLBACK(reread_mime_files), NULL); return g_list_append(NULL, align); } @@ -1170,8 +1170,8 @@ static GList *build_type_edit(Option *none, xmlNode *node, guchar *label) button = gtk_button_new_with_label(_(label)); gtk_container_add(GTK_CONTAINER(align), button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(edit_mime_types), NULL); + g_signal_connect_swapped(button, "clicked", + G_CALLBACK(edit_mime_types), NULL); return g_list_append(NULL, align); } diff --git a/ROX-Filer/src/usericons.c b/ROX-Filer/src/usericons.c index b932140d..30e0ae59 100644 --- a/ROX-Filer/src/usericons.c +++ b/ROX-Filer/src/usericons.c @@ -213,10 +213,8 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_object_set_data_full(GTK_OBJECT(dialog), - "pathname", - strdup(path), - g_free); + g_object_set_data_full(G_OBJECT(dialog), "pathname", + strdup(path), g_free); gtk_window_set_title(GTK_WINDOW(dialog), _("Set icon")); gtk_container_set_border_width(GTK_CONTAINER(dialog), 10); @@ -246,10 +244,8 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) gtk_box_pack_start(GTK_BOX(vbox), radio[0], FALSE, TRUE, 0); g_free(tmp); - gtk_object_set_data_full(GTK_OBJECT(dialog), - "radios", radio, g_free); - gtk_object_set_data(GTK_OBJECT(dialog), - "mime_type", item->mime_type); + g_object_set_data_full(G_OBJECT(dialog), "radios", radio, g_free); + g_object_set_data(G_OBJECT(dialog), "mime_type", item->mime_type); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[0]), TRUE); @@ -261,8 +257,8 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, targets, sizeof(targets) / sizeof(*targets), GDK_ACTION_COPY); - gtk_signal_connect(GTK_OBJECT(frame), "drag_data_received", - GTK_SIGNAL_FUNC(drag_icon_dropped), dialog); + g_signal_connect(frame, "drag_data_received", + G_CALLBACK(drag_icon_dropped), dialog); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); @@ -274,13 +270,13 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) gtk_box_pack_start(GTK_BOX(vbox2), align, FALSE, TRUE, 0); button = gtk_button_new(); gtk_container_add(GTK_CONTAINER(align), button); - icon = gtk_pixmap_new(im_dirs->pixmap, im_dirs->mask); + icon = gtk_image_new_from_pixmap(im_dirs->pixmap, im_dirs->mask); gtk_container_add(GTK_CONTAINER(button), icon); gtk_tooltips_set_tip(tooltips, button, _("Menu of directories previously used for icons"), NULL); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(show_current_dirs_menu), NULL); + g_signal_connect(button, "clicked", + G_CALLBACK(show_current_dirs_menu), NULL); hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 4); @@ -306,10 +302,9 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, TRUE, 0); gtk_widget_grab_focus(entry); - gtk_object_set_data(GTK_OBJECT(dialog), "icon_path", entry); - gtk_signal_connect_object(GTK_OBJECT(entry), "activate", - GTK_SIGNAL_FUNC(get_path_set_icon), - GTK_OBJECT(dialog)); + g_object_set_data(G_OBJECT(dialog), "icon_path", entry); + g_signal_connect_swapped(entry, "activate", + G_CALLBACK(get_path_set_icon), dialog); hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 4); @@ -323,9 +318,8 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) button = gtk_button_new_with_label(_("Remove custom icon")); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(remove_icon), - GTK_OBJECT(dialog)); + g_signal_connect_swapped(button, "clicked", + G_CALLBACK(remove_icon), dialog); hbox = gtk_hbox_new(TRUE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); @@ -334,16 +328,14 @@ void icon_set_handler_dialog(DirItem *item, const guchar *path) gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_window_set_default(GTK_WINDOW(dialog), button); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(get_path_set_icon), - GTK_OBJECT(dialog)); + g_signal_connect_swapped(button, "clicked", + G_CALLBACK(get_path_set_icon), dialog); button = gtk_button_new_with_label(_("Cancel")); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - GTK_OBJECT(dialog)); + g_signal_connect_swapped(button, "clicked", + G_CALLBACK(gtk_widget_destroy), dialog); gtk_widget_show_all(dialog); } @@ -468,10 +460,10 @@ static void do_set_icon(GtkWidget *dialog, const gchar *icon) guchar *path = NULL; GtkToggleButton **radio; - path = gtk_object_get_data(GTK_OBJECT(dialog), "pathname"); + path = g_object_get_data(G_OBJECT(dialog), "pathname"); g_return_if_fail(path != NULL); - radio = gtk_object_get_data(GTK_OBJECT(dialog), "radios"); + radio = g_object_get_data(G_OBJECT(dialog), "radios"); g_return_if_fail(radio != NULL); if (gtk_toggle_button_get_active(radio[0])) @@ -484,7 +476,7 @@ static void do_set_icon(GtkWidget *dialog, const gchar *icon) gboolean just_media; MIME_type *type; - type = gtk_object_get_data(GTK_OBJECT(dialog), "mime_type"); + type = g_object_get_data(G_OBJECT(dialog), "mime_type"); just_media = gtk_toggle_button_get_active(radio[2]); if (!set_icon_for_type(type, icon, just_media)) @@ -540,7 +532,7 @@ static void get_path_set_icon(GtkWidget *dialog) GtkEntry *entry; const gchar *icon; - entry = gtk_object_get_data(GTK_OBJECT(dialog), "icon_path"); + entry = g_object_get_data(G_OBJECT(dialog), "icon_path"); g_return_if_fail(entry != NULL); icon = gtk_entry_get_text(entry); @@ -555,7 +547,7 @@ static void remove_icon(GtkWidget *dialog) g_return_if_fail(dialog != NULL); - path = gtk_object_get_data(GTK_OBJECT(dialog), "pathname"); + path = g_object_get_data(G_OBJECT(dialog), "pathname"); g_return_if_fail(path != NULL); delete_globicon(path); @@ -623,9 +615,9 @@ static void get_dir(gpointer key, gpointer value, gpointer data) static void open_icon_dir(GtkMenuItem *item, gpointer data) { FilerWindow *filer; - char *dir; + const char *dir; - gtk_label_get(GTK_LABEL(GTK_BIN(item)->child), &dir); + dir = gtk_label_get_text(GTK_LABEL(GTK_BIN(item)->child)); filer = filer_opendir(dir, NULL); if (filer) display_set_thumbs(filer, TRUE); @@ -638,8 +630,8 @@ static void add_dir_to_menu(gpointer key, gpointer value, gpointer data) item = gtk_menu_item_new_with_label(key); gtk_widget_set_accel_path(item, NULL, NULL); /* XXX */ - gtk_signal_connect(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(open_icon_dir), NULL); + g_signal_connect(item, "activate", + G_CALLBACK(open_icon_dir), NULL); g_free(key); gtk_menu_shell_append(menu, item); } -- 2.11.4.GIT