Control: tags -1 + patch Please find attached a patch. (You might want to remove the last line from debian/rules to create a dbgsym package.)
Description: Port to GTK 3. Bug-Debian: https://bugs.debian.org/967256 Author: Yavor Doganov <ya...@gnu.org> Forwarded: no Last-Update: 2024-01-19 ---
--- apwal-0.4.5.orig/src/Makefile +++ apwal-0.4.5/src/Makefile @@ -7,11 +7,11 @@ INSTALL ?= install ifdef APWAL_DEBUG -CFLAGS += -g -Wall -Werror `$(PKG_CONFIG) --cflags gtk+-2.0 gthread-2.0 libxml-2.0` -DGTK_DISABLE_DEPRECATED -DAPWAL_DEBUG $(CPPFLAGS) -LDFLAGS += `$(PKG_CONFIG) --libs gtk+-2.0 gthread-2.0 libxml-2.0` +CFLAGS += -DAPWAL_DEBUG $(CPPFLAGS) -g -Wall -Werror `$(PKG_CONFIG) --cflags gtk+-3.0 gthread-2.0 libxml-2.0` +LDFLAGS += `$(PKG_CONFIG) --libs gtk+-3.0 gthread-2.0 libxml-2.0` else -CFLAGS += -O2 `$(PKG_CONFIG) --cflags gtk+-2.0 gthread-2.0 libxml-2.0` $(CPPFLAGS) -LDFLAGS += -O2 `$(PKG_CONFIG) --libs gtk+-2.0 gthread-2.0 libxml-2.0` +CFLAGS += $(CPPFLAGS) -O2 `$(PKG_CONFIG) --cflags gtk+-3.0 gthread-2.0 libxml-2.0` +LDFLAGS += -O2 `$(PKG_CONFIG) --libs gtk+-3.0 gthread-2.0 libxml-2.0` endif OBJS=main.o app.o launcher.o editor.o property.o \ @@ -34,7 +34,6 @@ all: apwal apwal: $(OBJS) $(CC) -o $@ $^ $(LDFLAGS) - $(STRIP) $@ endif install: all @@ -42,14 +41,14 @@ $(INSTALL) apwal $(DESTDIR)/usr/bin .c.o: $(INCS) - $(CC) -c $< -o $*.o $(CFLAGS) + $(CC) $(CFLAGS) -c $< -o $*.o xmlrc.o: xmlrc.c $(INCS) - $(CC) -c $< -o $*.o $(CFLAGS) + $(CC) $(CFLAGS) -c $< -o $*.o about.o: about.c $(INCS) ../Makefile.inc - $(CC) -c $< -o $*.o $(CFLAGS) -DAPWAL_VERSION=\"$(VERS)\" + $(CC) -DAPWAL_VERSION=\"$(VERS)\" $(CFLAGS) -c $< -o $*.o -gtkstuff.o: pixbufinline.inc +gtkstuff.o: pixbufinline.inc gresource.c xmlrc.o: xmlrcinline.inc $(OBJS): $(INCS) @@ -88,6 +87,18 @@ echo "sizeof(pixbufinline_t));" >> $@; \ echo "" >> $@; +gresource.c: ../pixmaps/*.png + @echo "generating $@..." + @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> $*.xml + @echo "<gresources>" >> $*.xml + @echo "<gresource prefix=\"/fr/free/Apwal\">" >> $*.xml + @for f in ../pixmaps/*.png; do \ + echo "<file alias=\"`basename $$f .png`\">$$f</file>" >> $*.xml; \ + done; + @echo "</gresource>" >> $*.xml + @echo "</gresources>" >> $*.xml + @glib-compile-resources --generate-source $*.xml + tags: $(INCS) $(OBJS:.o=.c) ctags -R @@ -102,5 +113,5 @@ clean: - -rm -f $(OBJS) apwal pixbufinline.inc xmlrcinline.inc tags + -rm -f $(OBJS) apwal pixbufinline.inc gresource.* xmlrcinline.inc tags --- apwal-0.4.5.orig/src/apwalapp.h +++ apwal-0.4.5/src/apwalapp.h @@ -49,9 +49,6 @@ GtkWidget *w2_btn_cancel; GtkWidget *w2_btn_ok; - - GtkTooltips *tips; - struct apwal_pref_t *apwal_pref; struct editor_t *editor; struct property_t *prop; --- apwal-0.4.5.orig/src/launcher.h +++ apwal-0.4.5/src/launcher.h @@ -35,7 +35,6 @@ GtkWidget *event_box; GtkWidget *image; GdkPixbuf *pixbuf; - GdkBitmap *bitmap_mask; gint x; gint y; --- apwal-0.4.5.orig/src/launcher.c +++ apwal-0.4.5/src/launcher.c @@ -29,6 +29,7 @@ { launcher_t *l; app_list_t *apps; + GdkRectangle geom; l = (launcher_t *)malloc(sizeof(launcher_t)); g_assert(l != NULL); @@ -51,7 +52,6 @@ l->image = NULL; l->pixbuf = NULL; - l->bitmap_mask = NULL; l->x = 0; l->y = 0; @@ -60,8 +60,10 @@ l->editor_started = FALSE; - l->xwidth = gdk_screen_width(); - l->xheight = gdk_screen_height(); + gdk_monitor_get_geometry(gdk_display_get_primary_monitor + (gdk_display_get_default()), &geom); + l->xwidth = geom.width; + l->xheight = geom.height; l->timeout_activated = 0; l->apps = NULL; @@ -75,6 +77,10 @@ void launcher_load_apps(launcher_t *l, app_list_t *apps) { app_t *app; + cairo_surface_t *surf; + cairo_region_t *region; + GdkWindow *win; + GdkSeat *seat; GdkPixbuf *pixbuf; GdkModifierType state; // mouse state gint x_min, y_min; @@ -93,7 +99,6 @@ l->pixbuf = NULL; l->image = NULL; - l->bitmap_mask = NULL; l->apps = apps; if (!apps) @@ -107,7 +112,11 @@ app_list_delta_x(l->apps), app_list_delta_y(l->apps), x_min, y_min); // get the current position of the mouse cursor - gdk_window_get_pointer (l->window->window, &l->x, &l->y, &state); + gtk_widget_realize(l->window); + seat = gdk_display_get_default_seat(gdk_display_get_default()); + win = gtk_widget_get_window(l->window); + gdk_window_get_device_position(win, gdk_seat_get_pointer(seat), + &l->x, &l->y, &state); // check if the position is correct l->x = l->x + (x_min * ICON_WIDTH); if (l->x < 0) @@ -149,15 +158,19 @@ app = app_list_next(l->apps); } - gdk_pixbuf_render_pixmap_and_mask(l->pixbuf, - NULL/*pixmap_return*/, - &l->bitmap_mask/*mask_return*/, - 128/*alpha_threshold*/); - l->image = gtk_image_new_from_pixbuf(l->pixbuf); gtk_container_add(GTK_CONTAINER(l->event_box), l->image); - gtk_widget_shape_combine_mask(l->window, l->bitmap_mask, - 0/*offset_x*/, 0/*offset_y*/); + surf = gdk_cairo_surface_create_from_pixbuf(l->pixbuf, 0, win); + region = gdk_cairo_region_create_from_surface(surf); + width = gdk_window_get_width(win); + height = gdk_window_get_height(win); + gdk_window_shape_combine_region(win, region, + ((gint)(width - l->width) / 2) > 0 + ? (width - l->width) / 2 : 0, + ((gint)(height - l->height) / 2) > 0 + ? (height - l->height) / 2 : 0); + cairo_surface_destroy(surf); + cairo_region_destroy(region); gtk_widget_show(l->image); gtk_widget_show(l->event_box); @@ -221,6 +234,8 @@ app_t *app; GtkWidget *dialog; apwalapp_t *apwal; + gint width, height; + gint x_corr, y_corr; g_assert(l != NULL); @@ -243,8 +258,15 @@ } else { - pos_x = (((int)event->x) / ICON_WIDTH) + app_list_min_x(l->apps); - pos_y = (((int)event->y) / ICON_WIDTH) + app_list_min_y(l->apps); + gtk_window_get_size(GTK_WINDOW(l->window), &width, &height); + x_corr = (width - l->width) / 2; + if (x_corr < 0) + x_corr = 0; + y_corr = (height - l->height) / 2; + if (y_corr < 0) + y_corr = 0; + pos_x = (((int)event->x - x_corr) / ICON_WIDTH) + app_list_min_x(l->apps); + pos_y = (((int)event->y - y_corr) / ICON_WIDTH) + app_list_min_y(l->apps); TRACE("EXEC x:%d, y:%d, pos_x:%d, pos_y:%d ", (int)event->x, (int)event->y, pos_x, pos_y); app = app_list_at_xy(l->apps, pos_x, pos_y); --- apwal-0.4.5.orig/src/editor.c +++ apwal-0.4.5/src/editor.c @@ -46,6 +46,7 @@ editor_t* editor_new(struct apwalapp_t *apwal) { editor_t *editor; + GdkRectangle geom; g_assert(apwal != NULL); g_assert(apwal->editor_frame != NULL); @@ -58,8 +59,10 @@ editor->drag_in_progress = FALSE; - editor->xwidth = gdk_screen_width(); - editor->xheight = gdk_screen_height(); + gdk_monitor_get_geometry(gdk_display_get_primary_monitor + (gdk_display_get_default()), &geom); + editor->xwidth = geom.width; + editor->xheight = geom.height; editor->x = -2; editor->y = -2; @@ -206,34 +209,34 @@ g_assert(e->apwal->editor_frame != NULL); // table for the editor view - table = gtk_table_new(3/*rows*/,3/*cols*/, FALSE/*homogeous*/); + table = gtk_grid_new(); gtk_container_add(GTK_CONTAINER(e->apwal->editor_frame), table); gtk_widget_show(table); // arrows ^ v < > and '?' for the tips button = gtk_arrow_button_new(GTK_ARROW_UP); - gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 0, 1); + gtk_grid_attach(GTK_GRID(table), button, 1, 0, 1, 1); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(editor_arrow_up_clicked), e); gtk_widget_show(button); button = gtk_arrow_button_new(GTK_ARROW_DOWN); - gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 2, 3); + gtk_grid_attach(GTK_GRID(table), button, 1, 2, 1, 1); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(editor_arrow_down_clicked), e); gtk_widget_show(button); button = gtk_arrow_button_new(GTK_ARROW_LEFT); - gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 1, 1, 2); + gtk_grid_attach(GTK_GRID(table), button, 0, 1, 1, 1); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(editor_arrow_left_clicked), e); gtk_widget_show(button); button = gtk_arrow_button_new(GTK_ARROW_RIGHT); - gtk_table_attach_defaults(GTK_TABLE(table), button, 2, 3, 1, 2); + gtk_grid_attach(GTK_GRID(table), button, 2, 1, 1, 1); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(editor_arrow_right_clicked), e); gtk_widget_show(button); eventbox_for_image = gtk_event_box_new(); - gtk_table_attach_defaults(GTK_TABLE(table), eventbox_for_image, 0, 1, 0, 1); + gtk_grid_attach(GTK_GRID(table), eventbox_for_image, 0, 0, 1, 1); gtk_widget_show(eventbox_for_image); tooltips_str = "Editor behaviours\n" ". Double click on an icon to select a new one\n" @@ -241,8 +244,8 @@ ". Press the remove button to delete an application\n" ". Use the arrow buttons to see all the grid\n" ". The red cross is the position of the cursor"; - gtk_tooltips_set_tip(e->apwal->tips, eventbox_for_image, tooltips_str, NULL); - image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, + gtk_widget_set_tooltip_text(eventbox_for_image, tooltips_str); + image = gtk_image_new_from_icon_name("dialog-information", GTK_ICON_SIZE_MENU); // GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_container_add(GTK_CONTAINER(eventbox_for_image), image); @@ -256,7 +259,7 @@ G_CALLBACK(editor_button_release_event), e); g_signal_connect(G_OBJECT(eventbox), "motion_notify_event", G_CALLBACK(editor_motion_notify_event), e); - gtk_table_attach_defaults(GTK_TABLE(table), eventbox, 1, 2, 1, 2); + gtk_grid_attach(GTK_GRID(table), eventbox, 1, 1, 1, 1); gtk_widget_show(eventbox); // image --- apwal-0.4.5.orig/src/property.c +++ apwal-0.4.5/src/property.c @@ -86,11 +86,11 @@ TRACE("app:%p", app); app_dumpln(app); // block the "changed" signal to maintain coherency - g_signal_handlers_block_by_func(GTK_OBJECT(prop->entry_cmdline), + g_signal_handlers_block_by_func(G_OBJECT(prop->entry_cmdline), prop_cmdline_changed, prop); - g_signal_handlers_block_by_func(GTK_OBJECT(prop->entry_path), + g_signal_handlers_block_by_func(G_OBJECT(prop->entry_path), prop_path_changed, prop); - g_signal_handlers_block_by_func(GTK_OBJECT(prop->entry_icon), + g_signal_handlers_block_by_func(G_OBJECT(prop->entry_icon), prop_icon_changed, prop); // it is safe now, modifying the data gtk_entry_set_text(GTK_ENTRY(prop->entry_cmdline), app_get_cmdline(app)); @@ -116,11 +116,11 @@ gtk_entry_set_text(GTK_ENTRY(prop->entry_path), app_get_path(app)); gtk_entry_set_text(GTK_ENTRY(prop->entry_icon), app_get_icon(app)); // unblock the "changed" signal - g_signal_handlers_unblock_by_func(GTK_OBJECT(prop->entry_cmdline), + g_signal_handlers_unblock_by_func(G_OBJECT(prop->entry_cmdline), prop_cmdline_changed, prop); - g_signal_handlers_unblock_by_func(GTK_OBJECT(prop->entry_path), + g_signal_handlers_unblock_by_func(G_OBJECT(prop->entry_path), prop_path_changed, prop); - g_signal_handlers_unblock_by_func(GTK_OBJECT(prop->entry_icon), + g_signal_handlers_unblock_by_func(G_OBJECT(prop->entry_icon), prop_icon_changed, prop); pix = gdk_pixbuf_new_from_apwal((char*)app_get_icon(app), NULL, NULL); @@ -149,22 +149,22 @@ gtk_widget_set_sensitive(prop->apwal->property_frame, FALSE); // block the "changed" signal to maintain coherency - g_signal_handlers_block_by_func(GTK_OBJECT(prop->entry_cmdline), + g_signal_handlers_block_by_func(G_OBJECT(prop->entry_cmdline), prop_cmdline_changed, prop); - g_signal_handlers_block_by_func(GTK_OBJECT(prop->entry_path), + g_signal_handlers_block_by_func(G_OBJECT(prop->entry_path), prop_path_changed, prop); - g_signal_handlers_block_by_func(GTK_OBJECT(prop->entry_icon), + g_signal_handlers_block_by_func(G_OBJECT(prop->entry_icon), prop_icon_changed, prop); // it is safe now, modifying the data gtk_entry_set_text(GTK_ENTRY(prop->entry_cmdline), ""); gtk_entry_set_text(GTK_ENTRY(prop->entry_path), ""); gtk_entry_set_text(GTK_ENTRY(prop->entry_icon), ""); // unblock the "changed" signal - g_signal_handlers_unblock_by_func(GTK_OBJECT(prop->entry_cmdline), + g_signal_handlers_unblock_by_func(G_OBJECT(prop->entry_cmdline), prop_cmdline_changed, prop); - g_signal_handlers_unblock_by_func(GTK_OBJECT(prop->entry_path), + g_signal_handlers_unblock_by_func(G_OBJECT(prop->entry_path), prop_path_changed, prop); - g_signal_handlers_unblock_by_func(GTK_OBJECT(prop->entry_icon), + g_signal_handlers_unblock_by_func(G_OBJECT(prop->entry_icon), prop_icon_changed, prop); } // ---------------------------------------------------------------------------- @@ -203,19 +203,19 @@ group_buttons = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); // horizontal box - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox), 4); gtk_container_add(GTK_CONTAINER(prop->apwal->property_frame), hbox); gtk_widget_show(hbox); //vbox entries - vbox_entries = gtk_vbox_new(FALSE, 0); + vbox_entries = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox_entries), 2); gtk_box_pack_start(GTK_BOX(hbox), vbox_entries, TRUE, TRUE, 0); gtk_widget_show(vbox_entries); //hbox cmdline - hbox_cmdline = gtk_hbox_new(FALSE, 0); + hbox_cmdline = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox_cmdline), 0); gtk_box_pack_start(GTK_BOX(vbox_entries), hbox_cmdline, TRUE, TRUE, 0); gtk_widget_show(hbox_cmdline); @@ -242,14 +242,14 @@ gtk_box_pack_start(GTK_BOX(hbox_cmdline), btn_cmdline, FALSE, FALSE, 0); gtk_widget_show(btn_cmdline); //img cmdline - img_cmdline = gtk_image_new_from_stock(GTK_STOCK_OPEN, + img_cmdline = gtk_image_new_from_icon_name("document-open", GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_tooltips_set_tip(prop->apwal->tips, btn_cmdline, "Cmdline Browse...\nShow the File Selection Dialog Box to select the executable to launch", NULL); + gtk_widget_set_tooltip_text(btn_cmdline, "Cmdline Browse...\nShow the File Selection Dialog Box to select the executable to launch"); gtk_widget_show(img_cmdline); gtk_container_add(GTK_CONTAINER(btn_cmdline), img_cmdline); //hbox path - hbox_path = gtk_hbox_new(FALSE, 0); + hbox_path = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox_path), 0); gtk_box_pack_start(GTK_BOX(vbox_entries), hbox_path, TRUE, TRUE, 0); gtk_widget_show(hbox_path); @@ -257,7 +257,7 @@ //label path label_path = gtk_label_new("Execute Path "); gtk_size_group_add_widget(group_entries, label_path); - gtk_misc_set_alignment(GTK_MISC(label_path), 0.0, 0.5); + gtk_label_set_yalign(GTK_LABEL(label_path), 0.5); gtk_box_pack_start(GTK_BOX(hbox_path), label_path, FALSE, FALSE, 0); gtk_widget_show(label_path); @@ -277,14 +277,14 @@ gtk_box_pack_start(GTK_BOX(hbox_path), btn_path, FALSE, FALSE, 0); gtk_widget_show(btn_path); //img_path - img_path = gtk_image_new_from_stock(GTK_STOCK_OPEN, + img_path = gtk_image_new_from_icon_name("document-open", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show(img_path); gtk_container_add(GTK_CONTAINER(btn_path), img_path); - gtk_tooltips_set_tip(prop->apwal->tips, btn_path, "Path Browse...\nShow the Directory Selection Dialog Box to select the execution path of the currently selected application", NULL); + gtk_widget_set_tooltip_text(btn_path, "Path Browse...\nShow the Directory Selection Dialog Box to select the execution path of the currently selected application"); //hbox icon - hbox_icon = gtk_hbox_new(FALSE, 0); + hbox_icon = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox_icon), 0); gtk_box_pack_start(GTK_BOX(vbox_entries), hbox_icon, TRUE, TRUE, 0); gtk_widget_show(hbox_icon); @@ -292,7 +292,7 @@ //label icon label_icon = gtk_label_new("Icon "); gtk_size_group_add_widget(group_entries, label_icon); - gtk_misc_set_alignment(GTK_MISC(label_icon), 0.0, 0.5); + gtk_label_set_yalign(GTK_LABEL(label_icon), 0.5); gtk_box_pack_start(GTK_BOX(hbox_icon), label_icon, FALSE, FALSE, 0); gtk_widget_show(label_icon); @@ -316,7 +316,7 @@ prop->img_icon = gtk_image_new(); gtk_widget_show(prop->img_icon); gtk_container_add(GTK_CONTAINER(btn_icon), prop->img_icon); - gtk_tooltips_set_tip(prop->apwal->tips, btn_icon, "Icon Browse...\nShow the Icon Selection Window to select a new icon for the currently selected application", NULL); + gtk_widget_set_tooltip_text(btn_icon, "Icon Browse...\nShow the Icon Selection Window to select a new icon for the currently selected application"); //GdkPixbuf *pix1; //prop->pixbuf_open = gtk_widget_render_icon(prop->apwal->window, "gtk-open", @@ -327,17 +327,18 @@ //gdk_pixbuf_append(prop->pixbuf_open, pix1); // vbox - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); gtk_widget_show(vbox); // btn_remove - prop->btn_remove = gtk_button_new_from_stock(GTK_STOCK_REMOVE); + prop->btn_remove = gtk_button_new_from_icon_name("list-remove", + GTK_ICON_SIZE_BUTTON); g_signal_connect(G_OBJECT(prop->btn_remove), "clicked", G_CALLBACK(property_remove_clicked), prop); gtk_box_pack_end(GTK_BOX(vbox), prop->btn_remove, FALSE, FALSE, 0); - gtk_tooltips_set_tip(prop->apwal->tips, prop->btn_remove, "Remove\nRemove the application currently selected", NULL); + gtk_widget_set_tooltip_text(prop->btn_remove, "Remove\nRemove the application currently selected"); gtk_widget_show(prop->btn_remove); } --- apwal-0.4.5.orig/src/cereimg.c +++ apwal-0.4.5/src/cereimg.c @@ -58,24 +58,23 @@ GtkWidget *widget); static void cereimg_get_size (GtkCellRenderer *cell, GtkWidget *widget, - GdkRectangle *rectangle, + const GdkRectangle *rectangle, gint *x_offset, gint *y_offset, gint *width, gint *height); static void cereimg_render (GtkCellRenderer *cell, - GdkWindow *window, + cairo_t *window, GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, GtkCellRendererState flags); static gint cereimg_activate (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, - GdkRectangle *background_area, - GdkRectangle *cell_area, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, GtkCellRendererState flags); enum { @@ -147,7 +146,7 @@ cellinfo->stock_size = GTK_ICON_SIZE_MENU; g_object_set_data (G_OBJECT (cellimg), CELLTRACE_KEY, cellinfo); cellimg->activatable = TRUE; - GTK_CELL_RENDERER (cellimg)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; + g_object_set (cellimg, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); } @@ -373,8 +372,8 @@ cellimg->background_set = FALSE; if (!g_value_get_string (value)) g_warning("Don't know color, value is NULL"); - else if (gdk_color_parse (g_value_get_string (value), - &cellimg->background_color)) + else if (gdk_rgba_parse (&cellimg->background_color, + g_value_get_string (value))) cellimg->background_set = TRUE; else g_warning("Don't know color `%s'", g_value_get_string (value)); @@ -420,16 +419,18 @@ if (cellimg->pixbuf) g_object_unref (cellimg->pixbuf); - cellimg->pixbuf = gtk_widget_render_icon (widget, + cellimg->pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), cellinfo->stock_id, cellinfo->stock_size, - cellinfo->stock_detail); + GTK_ICON_LOOKUP_USE_BUILTIN, + NULL); + } static void cereimg_get_size (GtkCellRenderer *cell, GtkWidget *widget, - GdkRectangle *cell_area, + const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, @@ -441,6 +442,8 @@ gint pixbuf_height = 0; gint calc_width; gint calc_height; + gint xpad, ypad; + gfloat xalign, yalign; if (!cellimg->pixbuf && cellinfo->stock_id) cereimg_create_stock_pixbuf (cellimg, widget); @@ -461,8 +464,10 @@ pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellimg->pixbuf_expander_closed)); } - calc_width = (gint) GTK_CELL_RENDERER (cellimg)->xpad * 2 + pixbuf_width; - calc_height = (gint) GTK_CELL_RENDERER (cellimg)->ypad * 2 + pixbuf_height; + gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (cellimg), &xpad, &ypad); + gtk_cell_renderer_get_alignment (GTK_CELL_RENDERER (cellimg), &xalign, &yalign); + calc_width = xpad * 2 + pixbuf_width; + calc_height = ypad * 2 + pixbuf_height; if (x_offset) *x_offset = 0; if (y_offset) *y_offset = 0; @@ -471,13 +476,13 @@ { if (x_offset) { - *x_offset = GTK_CELL_RENDERER (cellimg)->xalign * (cell_area->width - calc_width - (2 * GTK_CELL_RENDERER (cellimg)->xpad)); - *x_offset = MAX (*x_offset, 0) + GTK_CELL_RENDERER (cellimg)->xpad; + *x_offset = xalign * (cell_area->width - calc_width - (2 * xpad)); + *x_offset = MAX (*x_offset, 0) + xpad; } if (y_offset) { - *y_offset = GTK_CELL_RENDERER (cellimg)->yalign * (cell_area->height - calc_height - (2 * GTK_CELL_RENDERER (cellimg)->ypad)); - *y_offset = MAX (*y_offset, 0) + GTK_CELL_RENDERER (cellimg)->ypad; + *y_offset = yalign * (cell_area->height - calc_height - (2 * ypad)); + *y_offset = MAX (*y_offset, 0) + ypad; } } @@ -490,11 +495,10 @@ static void cereimg_render (GtkCellRenderer *cell, - GdkWindow *window, + cairo_t *cr, GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, GtkCellRendererState flags) { @@ -504,8 +508,9 @@ GdkRectangle pix_rect; GdkRectangle draw_rect; gboolean stock_pixbuf = FALSE; + gboolean is_expander, is_expanded; + gint xpad, ypad; - GdkGC *gc; gboolean use_background; use_background = (cellimg->background_set == TRUE) && @@ -515,33 +520,27 @@ if (use_background) { //gdk_color_parse("#ccccff",&cellimg->background_color); - gc = gdk_gc_new (window); - gdk_gc_set_rgb_fg_color (gc, &cellimg->background_color); - gdk_draw_rectangle (window, gc, TRUE, - background_area->x, background_area->y, - background_area->width, background_area->height); + gdk_cairo_set_source_rgba (cr, &cellimg->background_color); + gdk_cairo_rectangle (cr, background_area); + cairo_fill (cr); //background_area->width+2 not needed anymore. } - else - { - gc = widget->style->black_gc; - } pixbuf = cellimg->pixbuf; - if (cell->is_expander) + g_object_get (cell, "is-expander", &is_expander, + "is-expanded", &is_expanded, NULL); + if (is_expander) { - if (cell->is_expanded && + if (is_expanded && cellimg->pixbuf_expander_open != NULL) pixbuf = cellimg->pixbuf_expander_open; - else if (! cell->is_expanded && + else if (! is_expanded && cellimg->pixbuf_expander_closed != NULL) pixbuf = cellimg->pixbuf_expander_closed; } if (!pixbuf && !cellinfo->stock_id) { - if (use_background) - g_object_unref(gc); return; } else if (!pixbuf && cellinfo->stock_id) @@ -554,27 +553,17 @@ if (stock_pixbuf) pixbuf = cellimg->pixbuf; + gtk_cell_renderer_get_padding (cell, &xpad, &ypad); pix_rect.x += cell_area->x; pix_rect.y += cell_area->y; - pix_rect.width -= cell->xpad * 2; - pix_rect.height -= cell->ypad * 2; + pix_rect.width -= xpad * 2; + pix_rect.height -= ypad * 2; if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect)) { - gdk_pixbuf_render_to_drawable ( - pixbuf, - window/*drawable*/, - gc/*widget->style->black_gc*/, - /* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */ - draw_rect.x - pix_rect.x/* src_x */, - draw_rect.y - pix_rect.y/* src_y */, - draw_rect.x/* dst_x */, - draw_rect.y/* dst_y */, - draw_rect.width/* width */, - draw_rect.height/* height */, - GDK_RGB_DITHER_NORMAL, - 0, 0); + gdk_cairo_set_source_pixbuf (cr, pixbuf, draw_rect.x, draw_rect.y); + cairo_paint (cr); #if 0 gdk_draw_pixbuf (window, gc/*widget->style->black_gc*/, @@ -590,9 +579,6 @@ 0, 0); #endif } - - if (use_background) - g_object_unref(gc); } static gint @@ -600,8 +586,8 @@ GdkEvent *event, GtkWidget *widget, const gchar *path, - GdkRectangle *background_area, - GdkRectangle *cell_area, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, GtkCellRendererState flags) { g_signal_emit (cell, cereimg_cell_signals[CLICKED], 0, path); --- apwal-0.4.5.orig/src/cereimg.h +++ apwal-0.4.5/src/cereimg.h @@ -64,7 +64,7 @@ GdkPixbuf *pixbuf; GdkPixbuf *pixbuf_expander_open; GdkPixbuf *pixbuf_expander_closed; - GdkColor background_color; + GdkRGBA background_color; guint activatable : 1; guint background_set : 1; --- apwal-0.4.5.orig/src/apwalapp.c +++ apwal-0.4.5/src/apwalapp.c @@ -33,9 +33,9 @@ static void apwalapp_w2_cancel_clicked(GtkWidget *widget, apwalapp_t *apwal); static void apwalapp_w2_ok_clicked(GtkWidget *widget, apwalapp_t *apwal); static gboolean apwalapp_w2_delete(GtkWidget *widget, GdkEvent *event, apwalapp_t *apwal); -static void apwalapp_switch_page(GtkWidget *widget, GtkNotebookPage *page, +static void apwalapp_switch_page(GtkWidget *widget, GtkNotebook *page, guint page_num, apwalapp_t *apwal); -static void apwalapp_switch_page2(GtkWidget *widget, GtkNotebookPage *page, +static void apwalapp_switch_page2(GtkWidget *widget, GtkNotebook *page, guint page_num, apwalapp_t *apwal); void apwal_load_apps(apwalapp_t *apwal, app_list_t *apps); //static gboolean apwalapp_window_key_release_event(GtkWidget *widget, @@ -300,18 +300,15 @@ //gtk_widget_hide_on_delete(apwal->window2); g_signal_connect(G_OBJECT(apwal->window2), "delete_event", G_CALLBACK(apwalapp_w2_delete), apwal); - - - apwal->tips = gtk_tooltips_new(); // vbox0 - vbox0 = gtk_vbox_new(FALSE, 0); + vbox0 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox0), 4); gtk_container_add(GTK_CONTAINER(apwal->window), vbox0); gtk_widget_show(vbox0); // vbox02 - vbox02 = gtk_vbox_new(FALSE, 0); + vbox02 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox02), 4); gtk_container_add(GTK_CONTAINER(apwal->window2), vbox02); gtk_widget_show(vbox02); @@ -335,7 +332,7 @@ gtk_widget_show(editor_label); // editor_vbox - editor_vbox = gtk_vbox_new(FALSE, 0); + editor_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(editor_vbox); gtk_notebook_append_page(GTK_NOTEBOOK(apwal->notebook), @@ -362,7 +359,7 @@ gtk_widget_show(iconsel_label); // iconsel_vbox - iconsel_vbox = gtk_vbox_new(FALSE, 0); + iconsel_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(iconsel_vbox); if (apwal->apwal_pref->iconsel_in_a_separate_window == FALSE) @@ -386,7 +383,7 @@ gtk_widget_show(iconsel_pref_label); // iconsel_pref_vbox - iconsel_pref_vbox = gtk_vbox_new(FALSE, 0); + iconsel_pref_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(iconsel_pref_vbox); if (apwal->apwal_pref->iconsel_in_a_separate_window == FALSE) @@ -411,7 +408,7 @@ gtk_widget_show(apwal_pref_label); // apwal_pref_vbox - apwal_pref_vbox = gtk_vbox_new(FALSE, 0); + apwal_pref_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(apwal_pref_vbox); gtk_notebook_append_page(GTK_NOTEBOOK(apwal->notebook), @@ -431,7 +428,7 @@ gtk_widget_show(about_label); // about_vbox - about_vbox = gtk_vbox_new(FALSE, 0); + about_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(about_vbox); gtk_notebook_append_page(GTK_NOTEBOOK(apwal->notebook), @@ -449,7 +446,7 @@ // -------- // horizontal button box 'ok' & 'cancel' & 'help' - btn_bbox = gtk_hbutton_box_new(); + btn_bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(btn_bbox), GTK_BUTTONBOX_END); gtk_box_set_spacing(GTK_BOX(btn_bbox), 10); gtk_container_set_border_width(GTK_CONTAINER(btn_bbox), 4); @@ -457,27 +454,25 @@ gtk_widget_show(btn_bbox); // button cancel - btn_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - GTK_WIDGET_SET_FLAGS(btn_cancel, GTK_CAN_DEFAULT); + btn_cancel = gtk_button_new_with_mnemonic("_Cancel"); + gtk_widget_set_can_default(btn_cancel, TRUE); g_signal_connect(G_OBJECT(btn_cancel), "clicked", G_CALLBACK(apwalapp_clicked_cancel), apwal); gtk_box_pack_end(GTK_BOX(btn_bbox), btn_cancel, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS(btn_cancel, GTK_CAN_DEFAULT); gtk_widget_grab_default(btn_cancel); gtk_widget_show(btn_cancel); // button ok - btn_ok = gtk_button_new_from_stock(GTK_STOCK_OK); - GTK_WIDGET_SET_FLAGS(btn_ok, GTK_CAN_DEFAULT); + btn_ok = gtk_button_new_with_mnemonic("_OK"); + gtk_widget_set_can_default(btn_ok, TRUE); g_signal_connect(G_OBJECT(btn_ok), "clicked", G_CALLBACK(apwalapp_clicked_ok), apwal); gtk_box_pack_end(GTK_BOX(btn_bbox), btn_ok, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS(btn_ok, GTK_CAN_DEFAULT); gtk_widget_grab_default(btn_ok); gtk_widget_show(btn_ok); // window 2 horizontal button box 'apply' 'close' / 'cancel' 'ok' - btn2_bbox = gtk_hbutton_box_new(); + btn2_bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); gtk_button_box_set_layout(GTK_BUTTON_BOX(btn2_bbox), GTK_BUTTONBOX_END); gtk_box_set_spacing(GTK_BOX(btn2_bbox), 10); gtk_container_set_border_width(GTK_CONTAINER(btn2_bbox), 4); @@ -485,48 +480,45 @@ gtk_widget_show(btn2_bbox); // button apply - apwal->w2_btn_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_apply, GTK_CAN_DEFAULT); + apwal->w2_btn_apply = gtk_button_new_with_mnemonic("_Apply"); + gtk_widget_set_can_default(apwal->w2_btn_apply, TRUE); g_signal_connect(G_OBJECT(apwal->w2_btn_apply), "clicked", G_CALLBACK(apwalapp_w2_apply_clicked), apwal); gtk_box_pack_end(GTK_BOX(btn2_bbox), apwal->w2_btn_apply, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_apply, GTK_CAN_DEFAULT); gtk_widget_grab_default(apwal->w2_btn_apply); if (apwal->apwal_pref->iconsel_modal == FALSE) gtk_widget_show(apwal->w2_btn_apply); gtk_widget_show(apwal->w2_btn_apply); // button close - apwal->w2_btn_close = gtk_button_new_from_stock(GTK_STOCK_CLOSE); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_close, GTK_CAN_DEFAULT); + apwal->w2_btn_close = gtk_button_new_from_icon_name("window-close", + GTK_ICON_SIZE_BUTTON); + gtk_widget_set_can_default(apwal->w2_btn_close, TRUE); g_signal_connect(G_OBJECT(apwal->w2_btn_close), "clicked", G_CALLBACK(apwalapp_w2_close_clicked), apwal); gtk_box_pack_end(GTK_BOX(btn2_bbox), apwal->w2_btn_close, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_close, GTK_CAN_DEFAULT); gtk_widget_grab_default(apwal->w2_btn_close); if (apwal->apwal_pref->iconsel_modal == FALSE) gtk_widget_show(apwal->w2_btn_close); gtk_widget_show(apwal->w2_btn_close); // button cancel - apwal->w2_btn_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_cancel, GTK_CAN_DEFAULT); + apwal->w2_btn_cancel = gtk_button_new_with_mnemonic("_Cancel"); + gtk_widget_set_can_default(apwal->w2_btn_cancel, TRUE); g_signal_connect(G_OBJECT(apwal->w2_btn_cancel), "clicked", G_CALLBACK(apwalapp_w2_cancel_clicked), apwal); gtk_box_pack_end(GTK_BOX(btn2_bbox), apwal->w2_btn_cancel, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_cancel, GTK_CAN_DEFAULT); gtk_widget_grab_default(apwal->w2_btn_cancel); if (apwal->apwal_pref->iconsel_modal == TRUE) gtk_widget_show(apwal->w2_btn_cancel); gtk_widget_show(apwal->w2_btn_cancel); // button OK - apwal->w2_btn_ok = gtk_button_new_from_stock(GTK_STOCK_OK); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_ok, GTK_CAN_DEFAULT); + apwal->w2_btn_ok = gtk_button_new_with_mnemonic("_OK"); + gtk_widget_set_can_default(apwal->w2_btn_ok, TRUE); g_signal_connect(G_OBJECT(apwal->w2_btn_ok), "clicked", G_CALLBACK(apwalapp_w2_ok_clicked), apwal); gtk_box_pack_end(GTK_BOX(btn2_bbox), apwal->w2_btn_ok, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS(apwal->w2_btn_ok, GTK_CAN_DEFAULT); gtk_widget_grab_default(apwal->w2_btn_ok); if (apwal->apwal_pref->iconsel_modal == TRUE) gtk_widget_show(apwal->w2_btn_ok); @@ -536,14 +528,14 @@ // gtk_widget_show window at the end of apwalapp_new() } // ---------------------------------------------------------------------------- -static void apwalapp_switch_page(GtkWidget *widget, GtkNotebookPage *page, +static void apwalapp_switch_page(GtkWidget *widget, GtkNotebook *page, guint page_num, apwalapp_t *apwal) { g_assert(apwal != NULL && page != NULL && widget != NULL); TRACE("%s", "notebook apwalapp_switch_page"); } // ---------------------------------------------------------------------------- -static void apwalapp_switch_page2(GtkWidget *widget, GtkNotebookPage *page, +static void apwalapp_switch_page2(GtkWidget *widget, GtkNotebook *page, guint page_num, apwalapp_t *apwal) { g_assert(apwal != NULL && page != NULL && widget != NULL); @@ -632,7 +624,7 @@ { g_assert(apwal != NULL); TRACE("%s", ""); - if (GTK_WIDGET_VISIBLE(apwal->window2)) + if (gtk_widget_is_visible(apwal->window2)) gtk_widget_hide(apwal->window2); // don't be worried about the modal state because if the window2 is modal // and showed then it is impossible to modify apwal preferences... hop :p @@ -659,7 +651,7 @@ // if non modal mode, then show the w2 if (apwal->apwal_pref->iconsel_modal == FALSE - && ! GTK_WIDGET_VISIBLE(apwal->window2)) + && ! gtk_widget_is_visible(apwal->window2)) gtk_widget_show(apwal->window2); } @@ -671,7 +663,7 @@ // if the iconsel is showed and modal is selected, the when hide the // iconsel window (because it can't be in modal mode and the grab_remove // when the user close this window has not to be called as well). - if (GTK_WIDGET_VISIBLE(apwal->window2)) + if (gtk_widget_is_visible(apwal->window2)) gtk_widget_hide(apwal->window2); gtk_widget_hide(apwal->w2_btn_apply); gtk_widget_hide(apwal->w2_btn_close); @@ -687,7 +679,7 @@ gtk_widget_hide(apwal->w2_btn_ok); // if we are asked to switch to non modal mode, then show the w2 - if (! GTK_WIDGET_VISIBLE(apwal->window2)) + if (! gtk_widget_is_visible(apwal->window2)) gtk_widget_show(apwal->window2); } @@ -781,7 +773,7 @@ return FALSE; // FALSE: propagate the event further } } - g_signal_stop_emission_by_name (GTK_OBJECT(widget), "key_release_event"); + g_signal_stop_emission_by_name (G_OBJECT(widget), "key_release_event"); return TRUE; // TRUE: do not propagate the event further } #endif @@ -790,7 +782,7 @@ GtkDirectionType direction, apwalapp_t *apwal) { -g_signal_stop_emission_by_name(GTK_OBJECT(window), "move_focus"); +g_signal_stop_emission_by_name(G_OBJECT(window), "move_focus"); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- --- apwal-0.4.5.orig/src/iconsel_interface.c +++ apwal-0.4.5/src/iconsel_interface.c @@ -159,8 +159,9 @@ iconsel->transparent_pixbuf = gdk_pixbuf_new_from_apwal("transparent", NULL, NULL); iconsel->pixbuf_open = gdk_pixbuf_new_from_apwal("relief", NULL, NULL); - pix1 = gtk_widget_render_icon(iconsel->apwal->window, "gtk-open", - GTK_ICON_SIZE_MENU, NULL); + pix1 = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), + "document-open", GTK_ICON_SIZE_MENU, + GTK_ICON_LOOKUP_USE_BUILTIN, NULL); gdk_pixbuf_append(iconsel->pixbuf_open, pix1); @@ -204,7 +205,7 @@ sizegrp = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); // vertical box iconsel - iconsel_vbox = gtk_vbox_new(FALSE, 0); + iconsel_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(iconsel->apwal->iconsel_frame), iconsel_vbox); gtk_container_set_border_width(GTK_CONTAINER(iconsel_vbox), 4); @@ -218,7 +219,7 @@ gtk_widget_show(iconsel->selected_frame); // info horizontal box - info_hbox = gtk_hbox_new(FALSE, 0); + info_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(info_hbox), 4); gtk_box_set_spacing(GTK_BOX(info_hbox), 4); gtk_container_add(GTK_CONTAINER(iconsel->selected_frame), info_hbox); @@ -237,46 +238,46 @@ gtk_widget_show(iconsel->selected_image); // info label vertical box - info_lbl_vbox = gtk_vbox_new(FALSE, 0); + info_lbl_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(info_lbl_vbox), 4); gtk_box_pack_start(GTK_BOX(info_hbox), info_lbl_vbox, FALSE, FALSE, 0); gtk_widget_show(info_lbl_vbox); // info label filename iconsel->selected_file_label = gtk_label_new(NULL); - gtk_misc_set_alignment(GTK_MISC(iconsel->selected_file_label), 0.0, 0.5); + gtk_label_set_yalign(GTK_LABEL(iconsel->selected_file_label), 0.5); gtk_box_pack_start(GTK_BOX(info_lbl_vbox), iconsel->selected_file_label, TRUE, TRUE, 0); gtk_widget_show(iconsel->selected_file_label); // info label path iconsel->selected_path_label = gtk_label_new(NULL); - gtk_misc_set_alignment(GTK_MISC(iconsel->selected_path_label), 0.0, 0.5); + gtk_label_set_yalign(GTK_LABEL(iconsel->selected_path_label), 0.5); gtk_box_pack_start(GTK_BOX(info_lbl_vbox), iconsel->selected_path_label, TRUE, TRUE, 0); gtk_widget_show(iconsel->selected_path_label); // info label res iconsel->selected_res_label = gtk_label_new(NULL); - gtk_misc_set_alignment(GTK_MISC(iconsel->selected_res_label), 0.0, 0.5); + gtk_label_set_yalign(GTK_LABEL(iconsel->selected_res_label), 0.5); gtk_box_pack_start(GTK_BOX(info_lbl_vbox), iconsel->selected_res_label, TRUE, TRUE, 0); gtk_widget_show(iconsel->selected_res_label); // info label vertical box - info_apply_vbox = gtk_vbox_new(FALSE, 0); + info_apply_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); //gtk_container_set_border_width(GTK_CONTAINER(info_apply_vbox), 4); gtk_box_pack_end(GTK_BOX(info_hbox), info_apply_vbox, FALSE, FALSE, 0); gtk_widget_show(info_apply_vbox); // button apply - iconsel->selected_apply_btn = gtk_button_new_from_stock(GTK_STOCK_APPLY); + iconsel->selected_apply_btn = gtk_button_new_with_mnemonic("_Apply"); g_signal_connect(G_OBJECT(iconsel->selected_apply_btn), "clicked", G_CALLBACK(iconsel_selected_apply_btn_clicked), iconsel); gtk_size_group_add_widget(sizegrp, iconsel->selected_apply_btn); gtk_box_pack_end(GTK_BOX(info_apply_vbox), iconsel->selected_apply_btn, FALSE, FALSE, 0); - gtk_tooltips_set_tip(iconsel->apwal->tips, iconsel->selected_apply_btn, "Set the icon for the current selected application", NULL); + gtk_widget_set_tooltip_text(iconsel->selected_apply_btn, "Set the icon for the current selected application"); if (iconsel->apwal->apwal_pref->iconsel_in_a_separate_window == FALSE) gtk_widget_show(iconsel->selected_apply_btn); @@ -288,7 +289,7 @@ gtk_widget_show(filter_frame); // horizontal box 'filter' - filter_hbox = gtk_hbox_new(FALSE, 0); + filter_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(filter_hbox), 4); gtk_box_set_spacing(GTK_BOX(filter_hbox), 4); gtk_container_add(GTK_CONTAINER(filter_frame), filter_hbox); @@ -301,7 +302,7 @@ G_CALLBACK(iconsel_filter_entry_changed), iconsel); gtk_box_pack_start(GTK_BOX(filter_hbox), iconsel->filter_entry, TRUE, TRUE, 0); - gtk_tooltips_set_tip(iconsel->apwal->tips, iconsel->filter_entry, "Filter the icons displayed, you can use the wildcard '*'.\nFor example 'gnome*' will display the majority of Gnome icons", NULL); + gtk_widget_set_tooltip_text(iconsel->filter_entry, "Filter the icons displayed, you can use the wildcard '*'.\nFor example 'gnome*' will display the majority of Gnome icons"); gtk_widget_show(iconsel->filter_entry); // button reset filter @@ -310,7 +311,7 @@ G_CALLBACK(iconsel_filter_reset_clicked), iconsel); gtk_size_group_add_widget(sizegrp, iconsel->filter_btn); gtk_box_pack_end(GTK_BOX(filter_hbox), iconsel->filter_btn, FALSE, FALSE, 0); - gtk_tooltips_set_tip(iconsel->apwal->tips, iconsel->filter_btn, "Reset the filter and show all the icons are visible", NULL); + gtk_widget_set_tooltip_text(iconsel->filter_btn, "Reset the filter and show all the icons are visible"); gtk_widget_show(iconsel->filter_btn); // scrolled window @@ -332,7 +333,7 @@ // event box event_box = gtk_event_box_new(); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), + gtk_container_add(GTK_CONTAINER(scroll), event_box); g_signal_connect(G_OBJECT(event_box), "button-release-event", G_CALLBACK(iconsel_release_event), iconsel); @@ -340,12 +341,11 @@ // image iconsel->image = gtk_image_new(); - gtk_misc_set_alignment(GTK_MISC(iconsel->image), 0.0, 0.0); gtk_container_add(GTK_CONTAINER(event_box), iconsel->image); gtk_widget_show(iconsel->image); // get the size of the scoll widget. it is the size of it border. - gtk_widget_size_request(scroll, &requisition); + gtk_widget_get_preferred_size(scroll, &requisition, NULL); iconsel->scroll_border_width = requisition.width; TRACE("scroll_border_width: %d", iconsel->scroll_border_width); @@ -390,7 +390,7 @@ TRACE("%s", ""); // horizontal box - selpref_vbox = gtk_vbox_new(FALSE, 0); + selpref_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(iconsel->apwal->iconsel_pref_frame), selpref_vbox); gtk_widget_show(selpref_vbox); @@ -402,7 +402,7 @@ gtk_widget_show(path_frame); // vertical box 'path' - path_vbox = gtk_vbox_new(FALSE, 0); + path_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(path_frame), path_vbox); gtk_container_set_border_width(GTK_CONTAINER(path_vbox), 4); gtk_widget_show(path_vbox); @@ -422,7 +422,7 @@ gtk_widget_show(iconsel->path_tree); // vertical box 'exts' - path_hbox = gtk_hbox_new(FALSE, 0); + path_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(path_hbox), 4); gtk_box_set_spacing(GTK_BOX(path_hbox), 4); gtk_box_pack_start(GTK_BOX(path_vbox), path_hbox, FALSE, FALSE, 0); @@ -431,7 +431,8 @@ sizegrp = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); // button add path - path_btn_add = gtk_button_new_from_stock(GTK_STOCK_ADD); + path_btn_add = gtk_button_new_from_icon_name("list-add", + GTK_ICON_SIZE_BUTTON); g_signal_connect(G_OBJECT(path_btn_add), "clicked", G_CALLBACK(iconsel_path_add_clicked), iconsel); gtk_box_pack_start(GTK_BOX(path_hbox), path_btn_add, TRUE, TRUE, 0); @@ -464,12 +465,12 @@ #endif // horizontal box option and sort on the left, extension on the right - hbox = gtk_hbox_new(FALSE, 0); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start(GTK_BOX(selpref_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); // vertical box option and sort - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); gtk_widget_show(vbox); @@ -480,7 +481,7 @@ gtk_widget_show(option_frame); // option vbox - option_vbox = gtk_vbox_new(FALSE, 0); + option_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(option_vbox), 4); gtk_container_add(GTK_CONTAINER(option_frame), option_vbox); gtk_widget_show(option_vbox); @@ -491,7 +492,7 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk0), iconsel->apwal->iconsel_pref->select_48); g_signal_connect(G_OBJECT(chk0), "toggled", G_CALLBACK(iconsel_48_toggled), iconsel); - gtk_tooltips_set_tip(iconsel->apwal->tips, chk0, "Filter icons when they are loaded from disk.\nSelect 48x48 pixels icons (Strongly recommended)", NULL); + gtk_widget_set_tooltip_text(chk0, "Filter icons when they are loaded from disk.\nSelect 48x48 pixels icons (Strongly recommended)"); gtk_widget_show(chk0); // check button @@ -500,7 +501,7 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk1), iconsel->apwal->iconsel_pref->select_lt48); g_signal_connect(G_OBJECT(chk1), "toggled", G_CALLBACK(iconsel_lt48_toggled), iconsel); - gtk_tooltips_set_tip(iconsel->apwal->tips, chk1, "Filter icons when they are loaded from disk.\nSelect icons smaller that 48x48 pixels", NULL); + gtk_widget_set_tooltip_text(chk1, "Filter icons when they are loaded from disk.\nSelect icons smaller that 48x48 pixels"); gtk_widget_show(chk1); // check button @@ -509,7 +510,7 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk2), iconsel->apwal->iconsel_pref->select_gt48); g_signal_connect(G_OBJECT(chk2), "toggled", G_CALLBACK(iconsel_gt48_toggled), iconsel); - gtk_tooltips_set_tip(iconsel->apwal->tips, chk2, "Filter icons when they are loaded from disk. Select icons bigger that 48x48 pixels", NULL); + gtk_widget_set_tooltip_text(chk2, "Filter icons when they are loaded from disk. Select icons bigger that 48x48 pixels"); gtk_widget_show(chk2); // sort frame @@ -519,7 +520,7 @@ gtk_widget_show(sort_frame); // sort vbox - sort_vbox = gtk_vbox_new(FALSE, 0); + sort_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(sort_vbox), 4); gtk_container_add(GTK_CONTAINER(sort_frame), sort_vbox); gtk_widget_show(sort_vbox); @@ -528,13 +529,13 @@ sort_chk0 = gtk_radio_button_new_with_label(NULL, "Sort by Name"); sort_grp = gtk_radio_button_get_group(GTK_RADIO_BUTTON(sort_chk0)); gtk_box_pack_start(GTK_BOX(sort_vbox), sort_chk0, FALSE, FALSE, 0); - gtk_tooltips_set_tip(iconsel->apwal->tips, sort_chk0, "Order of the icons displayed in the 'Icon Selection' tab.\nIn this case icons are only sorted by name", NULL); + gtk_widget_set_tooltip_text(sort_chk0, "Order of the icons displayed in the 'Icon Selection' tab.\nIn this case icons are only sorted by name"); gtk_widget_show(sort_chk0); // radio button sort_chk1 = gtk_radio_button_new_with_label(sort_grp, "Sort by Path, Name"); gtk_box_pack_start(GTK_BOX(sort_vbox), sort_chk1, FALSE, FALSE, 0); - gtk_tooltips_set_tip(iconsel->apwal->tips, sort_chk1, "Order of the icons displayed in the 'Icon Selection' tab.\nIcons will be sorted by directory then by name in each directory", NULL); + gtk_widget_set_tooltip_text(sort_chk1, "Order of the icons displayed in the 'Icon Selection' tab.\nIcons will be sorted by directory then by name in each directory"); gtk_widget_show(sort_chk1); // set the sort toggle button AND connect the signals. signals are executed @@ -550,7 +551,7 @@ G_CALLBACK(iconsel_sort_path_clicked), iconsel); // vertical box extension frame - vbox2 = gtk_vbox_new(FALSE, 0); + vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 0); gtk_widget_show(vbox2); @@ -561,7 +562,7 @@ gtk_widget_show(exts_frame); // vertical box 'exts' - exts_vbox = gtk_vbox_new(FALSE, 0); + exts_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(exts_frame), exts_vbox); gtk_container_set_border_width(GTK_CONTAINER(exts_vbox), 4); gtk_widget_show(exts_vbox); @@ -581,11 +582,12 @@ gtk_widget_show(iconsel->exts_tree); // extension button add - exts_btn_add = gtk_button_new_from_stock(GTK_STOCK_ADD); + exts_btn_add = gtk_button_new_from_icon_name("list-add", + GTK_ICON_SIZE_BUTTON); g_signal_connect(G_OBJECT(exts_btn_add), "clicked", G_CALLBACK(iconsel_exts_add_clicked), iconsel); gtk_box_pack_start(GTK_BOX(exts_vbox), exts_btn_add, FALSE, FALSE, 0); - gtk_tooltips_set_tip(iconsel->apwal->tips, exts_btn_add, "Filter icons when they are loaded from disk.\nOnly icons which match one of this extension will be loaded", NULL); + gtk_widget_set_tooltip_text(exts_btn_add, "Filter icons when they are loaded from disk.\nOnly icons which match one of this extension will be loaded"); gtk_widget_show(exts_btn_add); } @@ -989,7 +991,6 @@ g_object_unref(G_OBJECT(store)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE); gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(treeview), TRUE); - gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); @@ -1082,7 +1083,6 @@ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); - gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); @@ -1406,7 +1406,7 @@ button = gtk_widget_get_ancestor(label, GTK_TYPE_BUTTON); if (button != NULL) { - gtk_tooltips_set_tip(iconsel->apwal->tips, button, tooltips, NULL ); + gtk_widget_set_tooltip_text(button, tooltips); } else { --- apwal-0.4.5.orig/src/filesel.c +++ apwal-0.4.5/src/filesel.c @@ -39,8 +39,8 @@ g_assert(filesel != NULL); filesel->filechooser = gtk_file_chooser_dialog_new("Directory chooser", NULL/*parent_window*/, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); + "_Cancel", GTK_RESPONSE_CANCEL, + "_Open", GTK_RESPONSE_ACCEPT, NULL); gtk_widget_hide(filesel->filechooser); filesel->old_value = NULL; --- apwal-0.4.5.orig/src/about.c +++ apwal-0.4.5/src/about.c @@ -49,7 +49,7 @@ g_assert(about->apwal->about_frame != NULL); // vertical box - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 4); gtk_box_set_spacing(GTK_BOX(vbox), 4); gtk_container_add(GTK_CONTAINER(about->apwal->about_frame), vbox); --- apwal-0.4.5.orig/src/apwalpref.c +++ apwal-0.4.5/src/apwalpref.c @@ -26,6 +26,7 @@ apwalapp_t *apwal); static void apwal_pref_tooltips_toggled(GtkToggleButton *chk, apwalapp_t *apwal); +static void apwal_pref_tooltips_action(gboolean action); static void apwal_pref_iconsel_in_a_sepwin_toggled(GtkToggleButton *chk, apwalapp_t *apwal); static void apwal_pref_iconsel_modal_toggled(GtkToggleButton *chk, @@ -74,10 +75,9 @@ gdouble timeout; g_assert(apwal != NULL); - g_assert(apwal->apwal_pref != NULL && apwal->apwal_pref_frame != NULL && - apwal->tips != NULL); + g_assert(apwal->apwal_pref != NULL && apwal->apwal_pref_frame != NULL); TRACE("%s", ""); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 4); gtk_container_add(GTK_CONTAINER(apwal->apwal_pref_frame), vbox); gtk_widget_show(vbox); @@ -89,14 +89,14 @@ gtk_widget_show(launcher_frame); // launcher vbox - launcher_vbox = gtk_vbox_new(FALSE, 0); + launcher_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(launcher_vbox), 4); gtk_box_set_spacing(GTK_BOX(launcher_vbox), 4); gtk_container_add(GTK_CONTAINER(launcher_frame), launcher_vbox); gtk_widget_show(launcher_vbox); // timeout hbox - timeout_hbox = gtk_hbox_new(FALSE, 0); + timeout_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width(GTK_CONTAINER(timeout_hbox), 4); gtk_box_set_spacing(GTK_BOX(timeout_hbox), 4); gtk_container_add(GTK_CONTAINER(launcher_vbox), timeout_hbox); @@ -106,7 +106,7 @@ timeout_event = gtk_event_box_new(); gtk_box_pack_start(GTK_BOX(timeout_hbox), timeout_event, FALSE, FALSE, 0); gtk_widget_show(timeout_event); - gtk_tooltips_set_tip(apwal->tips, timeout_event, "Period of time during which the Apwal Launcher will still be displayed if not focused", NULL); + gtk_widget_set_tooltip_text(timeout_event, "Period of time during which the Apwal Launcher will still be displayed if not focused"); // timeout label timeout_label = gtk_label_new("Launcher Timeout (in second)"); @@ -135,7 +135,7 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(exit_at_app_launch_chk), apwal->apwal_pref->exit_at_app_launch); gtk_widget_show(exit_at_app_launch_chk); - gtk_tooltips_set_tip(apwal->tips, exit_at_app_launch_chk, "When you launch an application from the Apwal Launcher you can either prefer that Apwal hides itself immediately or not", NULL); + gtk_widget_set_tooltip_text(exit_at_app_launch_chk, "When you launch an application from the Apwal Launcher you can either prefer that Apwal hides itself immediately or not"); // iconsel_modal // editor frame @@ -145,7 +145,7 @@ gtk_widget_show(editor_frame); // editor vbox - editor_vbox = gtk_vbox_new(FALSE, 0); + editor_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(editor_vbox), 4); gtk_box_set_spacing(GTK_BOX(editor_vbox), 4); gtk_container_add(GTK_CONTAINER(editor_frame), editor_vbox); @@ -157,14 +157,14 @@ g_signal_connect(G_OBJECT(tooltips_chk), "toggled", G_CALLBACK(apwal_pref_tooltips_toggled), apwal); gtk_widget_show(tooltips_chk); - gtk_tooltips_set_tip(apwal->tips, tooltips_chk, "Activate or not the contextual information boxes like the one you are currently reading", NULL); + gtk_widget_set_tooltip_text(tooltips_chk, "Activate or not the contextual information boxes like the one you are currently reading"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tooltips_chk), apwal->apwal_pref->activate_tooltips); if (apwal->apwal_pref->activate_tooltips == TRUE) - gtk_tooltips_enable(apwal->tips); + apwal_pref_tooltips_action(TRUE); else - gtk_tooltips_disable(apwal->tips); + apwal_pref_tooltips_action(FALSE); //iconsel_in_a_separate_window iconsel_in_a_sepwin_chk = gtk_check_button_new_with_label( @@ -173,7 +173,7 @@ FALSE, FALSE, 0); // g_connect after iconsel_modal gtk_widget_show(iconsel_in_a_sepwin_chk); - gtk_tooltips_set_tip(apwal->tips, iconsel_in_a_sepwin_chk, "The 'Icon Selection' and the 'Icon Selection Preference' tabs could be either showed in tabs in the main window or in a separate window", NULL); + gtk_widget_set_tooltip_text(iconsel_in_a_sepwin_chk, "The 'Icon Selection' and the 'Icon Selection Preference' tabs could be either showed in tabs in the main window or in a separate window"); // iconsel_modal apwal->apwal_pref->iconsel_modal_chk = gtk_check_button_new_with_label( @@ -184,8 +184,8 @@ g_signal_connect(G_OBJECT(apwal->apwal_pref->iconsel_modal_chk), "toggled", G_CALLBACK(apwal_pref_iconsel_modal_toggled), apwal); gtk_widget_show(apwal->apwal_pref->iconsel_modal_chk); - gtk_tooltips_set_tip(apwal->tips, apwal->apwal_pref->iconsel_modal_chk, - "If the 'Icon Selection' and the 'Icon Selection Preference' tabs are in a separate window, this separate window could either be modal or not.\nNote: Modal implies that you have to answer and close the Icon Selection Dialog Box in order to access again the main window", NULL); + gtk_widget_set_tooltip_text(apwal->apwal_pref->iconsel_modal_chk, + "If the 'Icon Selection' and the 'Icon Selection Preference' tabs are in a separate window, this separate window could either be modal or not.\nNote: Modal implies that you have to answer and close the Icon Selection Dialog Box in order to access again the main window"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( apwal->apwal_pref->iconsel_modal_chk), @@ -210,6 +210,28 @@ TRACE("%s", ""); apwal->apwal_pref->exit_at_app_launch = gtk_toggle_button_get_active(chk); } + +static void apwal_pref_tooltips_action(gboolean action) +{ + static GtkCssProvider *css = NULL; + /* Works only with compositing window managers. */ + const char *css_data = "tooltip { opacity: 0; }"; + + if (!css) + { + css = gtk_css_provider_new(); + gtk_css_provider_load_from_data(css, css_data, -1, NULL); + } + + if (action) + gtk_style_context_remove_provider_for_screen(gdk_screen_get_default(), + GTK_STYLE_PROVIDER(css)); + else + gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), + GTK_STYLE_PROVIDER(css), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); +} + static void apwal_pref_tooltips_toggled(GtkToggleButton *chk, apwalapp_t *apwal) { @@ -217,10 +239,7 @@ g_assert(apwal->apwal_pref != NULL); TRACE("%s", ""); apwal->apwal_pref->activate_tooltips = gtk_toggle_button_get_active(chk); - if (apwal->apwal_pref->activate_tooltips == TRUE) - gtk_tooltips_enable(apwal->tips); - else - gtk_tooltips_disable(apwal->tips); + apwal_pref_tooltips_action(apwal->apwal_pref->activate_tooltips); } // ---------------------------------------------------------------------------- static void apwal_pref_iconsel_in_a_sepwin_toggled(GtkToggleButton *chk, --- apwal-0.4.5.orig/src/splash.c +++ apwal-0.4.5/src/splash.c @@ -53,7 +53,7 @@ gtk_container_add(GTK_CONTAINER(splash->window), frame); gtk_widget_show(frame); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_widget_show(vbox); @@ -67,7 +67,8 @@ gtk_box_pack_start(GTK_BOX(vbox), splash->progressbar, FALSE, FALSE, 0); gtk_widget_show(splash->progressbar); - splash->busycursor = gdk_cursor_new(GDK_WATCH); + splash->busycursor = gdk_cursor_new_for_display(gdk_display_get_default(), + GDK_WATCH); return splash; } @@ -78,9 +79,8 @@ // busy cursor on // FIXME: gdk_window_set_cursor on splash window do NOT work - gdk_window_set_cursor(splash->window->window, splash->busycursor); - gdk_window_set_cursor(splash->apwal->window->window, splash->busycursor); - gdk_window_set_cursor(splash->apwal->window2->window, splash->busycursor); + gdk_window_set_cursor(gtk_widget_get_window(splash->apwal->window), + splash->busycursor); //gdk_flush(); // no grab because if iconsel is modal then it is not anymore after @@ -89,7 +89,7 @@ gtk_widget_set_sensitive(splash->apwal->window2, FALSE); // choose the window on which the user is currently looking at. - if ( ! GTK_WIDGET_VISIBLE(splash->apwal->window2)) + if ( ! gtk_widget_is_visible(splash->apwal->window2)) gtk_window_set_transient_for(GTK_WINDOW(splash->window), GTK_WINDOW(splash->apwal->window)); else @@ -109,9 +109,7 @@ gtk_widget_set_sensitive(splash->apwal->window2, TRUE); //busy cursor off - gdk_window_set_cursor(splash->window->window, NULL); - gdk_window_set_cursor(splash->apwal->window->window, NULL); - gdk_window_set_cursor(splash->apwal->window2->window, NULL); + gdk_window_set_cursor(gtk_widget_get_window(splash->apwal->window), NULL); while (gtk_events_pending()) gtk_main_iteration(); --- apwal-0.4.5.orig/src/gtkstuff.c +++ apwal-0.4.5/src/gtkstuff.c @@ -30,6 +30,7 @@ } pixbufinline_t; #include "pixbufinline.inc" +#include "gresource.c" /* pixbufinline_t pixbufinline[] = @@ -47,12 +48,30 @@ { GtkWidget *button; GtkWidget *arrow; - GtkShadowType shadow_type = GTK_SHADOW_NONE; + const gchar *name = "unknown"; //GTK_SHADOW_NONE GTK_SHADOW_IN GTK_SHADOW_OUT //GTK_SHADOW_ETCHED_IN GTK_SHADOW_ETCHED_OUT + switch (arrow_type) + { + case GTK_ARROW_UP: + name = "go-up"; + break; + case GTK_ARROW_DOWN: + name = "go-down"; + break; + case GTK_ARROW_LEFT: + name = "go-previous"; + break; + case GTK_ARROW_RIGHT: + name = "go-next"; + break; + default: + ERR("gtk_arrow_button_new called with invalid argument"); + } + button = gtk_button_new (); - arrow = gtk_arrow_new (arrow_type, shadow_type); + arrow = gtk_image_new_from_icon_name (name, GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER(button), arrow); // GTK_RELIEF_NORMAL GTK_RELIEF_HALF GTK_RELIEF_NONE @@ -87,6 +106,7 @@ { GdkPixbuf *pixbuf; GError *err; + gchar *resname; gint idx; g_assert(name != NULL); @@ -98,10 +118,9 @@ idx = index_of_inline_pixbuf(name); if (idx != -1) { - pixbuf = gdk_pixbuf_new_from_inline(pixbufinline[idx].size, - pixbufinline[idx].pixbufinline, - TRUE/*copy_pixels*/, - &err/*GError*/); + resname = g_strconcat("/fr/free/Apwal/", name, NULL); + pixbuf = gdk_pixbuf_new_from_resource(resname, &err); + g_free(resname); if (pixbuf) { return pixbuf; @@ -133,26 +152,16 @@ } } - idx = index_of_inline_pixbuf("unknown"); - if (idx != -1) + pixbuf = gdk_pixbuf_new_from_resource("/fr/free/Apwal/unknown", &err); + if (pixbuf == NULL) { - pixbuf = gdk_pixbuf_new_from_inline(pixbufinline[idx].size, - pixbufinline[idx].pixbufinline, - TRUE/*copy_pixels*/, - &err/*GError*/); - if (pixbuf == NULL) - { - g_assert(err != NULL && err->message != NULL); - ERR("gdk_pixbuf_new_from_inline NULL with unknown ->aoutch, idx:%d, E:%s", - idx, err->message); - g_error_free(err); - err = NULL; - } - return pixbuf; + g_assert(err != NULL && err->message != NULL); + ERR("gdk_pixbuf_new_from_inline NULL with unknown ->aoutch, idx:%d, E:%s", + idx, err->message); + g_error_free(err); + err = NULL; } - else - ERR("%s", "inline pixbuf:'unknown' not found"); - return NULL; + return pixbuf; } // ---------------------------------------------------------------------------- GdkPixbuf* gdk_pixbuf_new_from_apwal(gchar *name, gint *rwidth, gint *rheight) @@ -231,36 +240,41 @@ // ---------------------------------------------------------------------------- // gtk_widget_modify_text on RH8 doesn't reset the color if the color arg is // NULL. So use this wrapper to avoid the problem. -void gtk_widget_set_text_color(GtkWidget *widget, GdkColor *color) +void gtk_widget_set_text_color(GtkWidget *widget, GdkRGBA *color) { //GtkStyle *wstyle; - GtkRcStyle *rcstyle; - GtkStateType state = GTK_STATE_NORMAL; - GtkRcFlags component = GTK_RC_TEXT; + GtkStyleContext *ctxt; + static GtkCssProvider *css = NULL; + gchar *rgba, *css_data; //int i; - rcstyle = gtk_widget_get_modifier_style(widget); + if (!css) + css = gtk_css_provider_new(); + + ctxt = gtk_widget_get_style_context(widget); //for (i=0; i<5; i++) // TRACE("%d %3d.%3d.%3d.%3d", i, rcstyle->fg[i].pixel, rcstyle->fg[i].red, rcstyle->fg[i].green, rcstyle->fg[i].blue); if (color != NULL) { - if (component == GTK_RC_TEXT) - rcstyle->text[state] = *color; - else - ERR("component%d != GTK_RC_TEXT", component); - rcstyle->color_flags[state] |= component; + rgba = gdk_rgba_to_string(color); + css_data = g_strdup_printf (".apwal {color: %s;}", rgba); + gtk_css_provider_load_from_data (css, css_data, -1, NULL); + g_free(rgba); + g_free(css_data); + gtk_style_context_add_provider(ctxt, GTK_STYLE_PROVIDER(css), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + gtk_style_context_add_class(ctxt, "apwal"); } else { - rcstyle->color_flags[state] &= ~component; + gtk_style_context_remove_provider(ctxt, GTK_STYLE_PROVIDER(css)); } - gtk_widget_modify_style(widget, rcstyle); } // ---------------------------------------------------------------------------- void gtk_widget_set_text_color_invalid(GtkWidget *widget) { - GdkColor color = { 0, 65535, 0, 0 } /*Red*/; + GdkRGBA color = { 1.0, 0, 0, 1.0 } /*Red*/; gtk_widget_set_text_color(widget, &color); } // ----------------------------------------------------------------------------