merge 639228 639966 tag 639228 + patch tag 639228 + pending thanks Hi Qi,
Here are a couple of patches adapting mail-notification to Evolution 3 and GTK+ 3. They're based on the work done on Fedora 16, available at http://pkgs.fedoraproject.org/gitweb/?p=mail-notification.git;a=tree This also requires changes to debian/control and debian/rules; I'll get a working package uploaded in the next few days. Regards, Stephen
--- mail-notification-5.4.dfsg.1.orig/jbsrc/lib/src/extras/jb-evolution-plugin.c +++ mail-notification-5.4.dfsg.1/jbsrc/lib/src/extras/jb-evolution-plugin.c @@ -41,7 +41,7 @@ if (! minversion) minversion = "2.12"; - packages = g_strdup_printf("evolution-plugin >= %s", minversion); + packages = g_strdup_printf("evolution-plugin-3.0 >= %s", minversion); result = jb_check_packages("Evolution", "evolution-plugin", packages); g_free(packages); @@ -53,7 +53,7 @@ char *plugindir; jb_message_checking("for the Evolution plugin directory"); - plugindir = jb_get_package_variable("evolution-plugin", "plugindir"); + plugindir = jb_get_package_variable("evolution-plugin-3.0", "plugindir"); jb_message_result_string(plugindir ? plugindir : "not found"); if (! plugindir) --- mail-notification-5.4.dfsg.1.orig/src/mn-evolution-folder-tree-server.gob +++ mail-notification-5.4.dfsg.1/src/mn-evolution-folder-tree-server.gob @@ -19,6 +19,10 @@ %privateheader{ #include <gtk/gtk.h> +#include <libedataserver/eds-version.h> +#if EDS_CHECK_VERSION(2,91,0) +#include <mail/e-mail-session.h> +#endif %} %{ @@ -42,6 +46,7 @@ private GtkWidget *plug; private GtkWidget *tree; /* plug's child, destroyed with it */ + private EMailSession *session; property STRING uri set @@ -62,7 +67,12 @@ constructor (self) { -#if EDS_CHECK_VERSION(2,29,0) +#if EDS_CHECK_VERSION(3,1,0) + selfp->tree = em_folder_tree_new(NULL, NULL); +#elif EDS_CHECK_VERSION(2,91,0) + selfp->session = e_mail_session_new(); + selfp->tree = em_folder_tree_new(selfp->session); +#elif EDS_CHECK_VERSION(2,29,0) selfp->tree = em_folder_tree_new(); #else EMFolderTreeModel *model; @@ -85,6 +95,12 @@ finalize (self) { +#if EDS_CHECK_VERSION(2,91,0) +#if !EDS_CHECK_VERSION(3,1,0) + g_object_unref(selfp->session); + selfp->session = NULL; +#endif +#endif g_signal_handlers_disconnect_by_func(selfp->plug, self_plug_destroy_h, self); } --- mail-notification-5.4.dfsg.1.orig/src/mn-evolution-plugin.c +++ mail-notification-5.4.dfsg.1/src/mn-evolution-plugin.c @@ -25,6 +25,7 @@ #include <dbus/dbus-glib-lowlevel.h> #include <dbus/dbus-glib-bindings.h> #include <camel/camel.h> +#include <libedataserver/eds-version.h> #include <mail/em-event.h> #include <mail/mail-tools.h> #include "mn-evolution.h" @@ -240,7 +241,11 @@ EMEventTargetFolder *folder) { if (evo_server) +#if EDS_CHECK_VERSION(3,1,0) + mn_evolution_server_folder_changed(evo_server, e_mail_folder_uri_build(folder->store, folder->folder_name)); +#else mn_evolution_server_folder_changed(evo_server, folder->uri); +#endif } void @@ -249,10 +254,15 @@ { if (evo_server) { - char *url; +#if EDS_CHECK_VERSION(2,91,0) + const char *url = camel_folder_get_uri(message->folder); +#else + char *url = mail_tools_folder_to_url(message->folder); +#endif - url = mail_tools_folder_to_url(message->folder); mn_evolution_server_message_reading(evo_server, url); +#if !EDS_CHECK_VERSION(2,91,0) g_free(url); +#endif } } --- mail-notification-5.4.dfsg.1.orig/src/mn-evolution-server.gob +++ mail-notification-5.4.dfsg.1/src/mn-evolution-server.gob @@ -36,7 +36,9 @@ #include <mail/em-message-browser.h> #endif #include <mail/em-utils.h> +#if !EDS_CHECK_VERSION(2,91,0) #include <mail/mail-session.h> +#endif #include <mail/mail-tools.h> #include "mn-evolution.h" #include "mn-evolution-folder-tree-server.h" @@ -148,7 +150,15 @@ if (! folder) { +#if EDS_CHECK_VERSION(2,91,0) + static EMailSession * session = NULL; + if (!session) + session = e_mail_session_new(); + + folder = e_mail_session_uri_to_folder_sync(session, uri, 0, NULL, NULL); +#else folder = mail_tool_uri_to_folder(uri, 0, NULL); +#endif if (folder) self_cache_folder(uri, folder); else @@ -274,7 +284,11 @@ folder = self_lookup_folder(folder_uri, err); if (folder) { +#if EDS_CHECK_VERSION(3,1,0) + *ret = g_strdup(camel_folder_get_display_name(folder)); +#else *ret = g_strdup(camel_folder_get_name(folder)); +#endif g_object_unref(folder); } @@ -304,8 +318,12 @@ shell = e_shell_get_default(); shell_backend = e_shell_get_backend_by_name(shell, "mail"); - browser = e_mail_browser_new(shell_backend); + browser = e_mail_browser_new(E_MAIL_BACKEND(shell_backend)); +#if EDS_CHECK_VERSION(3,1,0) + e_mail_reader_set_folder(E_MAIL_READER(browser), folder); +#else e_mail_reader_set_folder(E_MAIL_READER(browser), folder, folder_uri); +#endif e_mail_reader_set_message(E_MAIL_READER(browser), message_uid); gtk_widget_show(browser); #else
--- mail-notification-5.4.dfsg.1.orig/src/mn-evolution-folder-tree-server.gob +++ mail-notification-5.4.dfsg.1/src/mn-evolution-folder-tree-server.gob @@ -18,7 +18,7 @@ */ %privateheader{ -#include <gtk/gtk.h> +#include <gtk/gtkx.h> #include <libedataserver/eds-version.h> #if EDS_CHECK_VERSION(2,91,0) #include <mail/e-mail-session.h> @@ -27,6 +27,7 @@ %{ #include <dbus/dbus.h> +#include <gtk/gtkx.h> #include <libedataserver/eds-version.h> #if !EDS_CHECK_VERSION(2,29,0) #include <mail/mail-component.h> @@ -81,7 +82,7 @@ selfp->tree = em_folder_tree_new_with_model(model); #endif - selfp->plug = gtk_plug_new((GdkNativeWindow) selfp->id); + selfp->plug = gtk_plug_new((Window) selfp->id); gtk_container_add(GTK_CONTAINER(selfp->plug), selfp->tree); gtk_widget_show_all(selfp->plug); @@ -105,7 +106,7 @@ } private void - plug_destroy_h (GtkObject *object, gpointer user_data) + plug_destroy_h (GtkWidget *object, gpointer user_data) { Self *self = user_data; char *service; --- mail-notification-5.4.dfsg.1.orig/jbsrc/jb.c +++ mail-notification-5.4.dfsg.1/jbsrc/jb.c @@ -163,7 +163,7 @@ { jb_check_glibc(); - jb_require_packages("GNOME", "gnome", "glib-2.0 >= 2.14 gthread-2.0 gconf-2.0 >= 2.4.0 gtk+-2.0 >= 2.12 libgnomeui-2.0 >= 2.14.0 gnome-vfs-2.0 libglade-2.0 libxml-2.0 libnotify >= 0.4.1"); + jb_require_packages("GNOME", "gnome", "glib-2.0 >= 2.14 gthread-2.0 gconf-2.0 >= 2.4.0 gtk+-3.0 libgnome-2.0 >= 2.14.0 gnome-vfs-2.0 libxml-2.0 libnotify >= 0.4.1"); jb_require_packages("D-Bus", "dbus", "dbus-glib-1"); jb_check_packages_for_options("GMime", "gmime", "gmime-2.4", --- mail-notification-5.4.dfsg.1.orig/src/eggtrayicon.h +++ mail-notification-5.4.dfsg.1/src/eggtrayicon.h @@ -23,10 +23,9 @@ #ifndef __EGG_TRAY_ICON_H__ #define __EGG_TRAY_ICON_H__ -#include <gtk/gtkplug.h> -#ifdef GDK_WINDOWING_X11 +#include <gtk/gtk.h> +#include <gtk/gtkx.h> #include <gdk/gdkx.h> -#endif G_BEGIN_DECLS --- mail-notification-5.4.dfsg.1.orig/src/mn-dialog.gob +++ mail-notification-5.4.dfsg.1/src/mn-dialog.gob @@ -26,7 +26,6 @@ init (self) { gtk_container_set_border_width(GTK_CONTAINER(self), 5); - gtk_dialog_set_has_separator(GTK_DIALOG(self), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(self)->vbox), 2); + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(self))), 2); } } --- mail-notification-5.4.dfsg.1.orig/src/mn-file-chooser-button.gob +++ mail-notification-5.4.dfsg.1/src/mn-file-chooser-button.gob @@ -38,7 +38,7 @@ %{ #include <glib/gi18n.h> -#include <gnome.h> +#include <libgnome/libgnome.h> #include "mn-util.h" %} @@ -127,7 +127,7 @@ g_signal_connect(selfp->dialog, "response", G_CALLBACK(self_response_h), self); } - if (! GTK_WIDGET_VISIBLE(selfp->dialog)) + if (! gtk_widget_get_visible(selfp->dialog)) { GtkWindow *parent; @@ -211,6 +211,7 @@ GDK_THREADS_ENTER(); +#if 0 if (results) { GnomeVFSGetFileInfoResult *result = results->data; @@ -242,6 +243,7 @@ } } } +#endif selfp->async_handle = NULL; g_object_unref(self); --- mail-notification-5.4.dfsg.1.orig/src/mn-mail-icon-widget.gob +++ mail-notification-5.4.dfsg.1/src/mn-mail-icon-widget.gob @@ -91,7 +91,7 @@ init (self) { - GTK_WIDGET_SET_FLAGS(self, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(self), FALSE); gtk_widget_set_name(GTK_WIDGET(self), "mn-mail-icon"); @@ -107,7 +107,7 @@ mn_source_clear(&selfp->blink_timeout_id); } - override (Gtk:Widget) void + private void size_request (GtkWidget *widget, GtkRequisition *requisition) { Self *self = SELF(widget); @@ -129,12 +129,30 @@ } } + override (Gtk:Widget) void + get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width) + { + GtkRequisition requisition; + + self_size_request(widget, &requisition); + *minimal_width = *natural_width = requisition.width; + } + + override (Gtk:Widget) void + get_preferred_height (GtkWidget *widget, gint *minimal_height, gint *natural_height) + { + GtkRequisition requisition; + + self_size_request(widget, &requisition); + *minimal_height = *natural_height = requisition.height; + } + override (Gtk:Widget) gboolean - expose_event (GtkWidget *widget, GdkEventExpose *event) + draw (GtkWidget *widget, cairo_t *cr) { Self *self = SELF(widget); - if (! GTK_WIDGET_DRAWABLE(widget) || ! selfp->stock_id) + if (! gtk_widget_is_drawable(widget) || ! selfp->stock_id) return FALSE; if (selfp->is_on) @@ -142,23 +160,34 @@ int x; int y; GdkRectangle image_area; + GtkAllocation allocation; + GtkRequisition requisition; /* note: widget->requisition is the pixbuf size, see size_request() */ - x = floor(widget->allocation.x + ((widget->allocation.width - widget->requisition.width) * ICON_XALIGN)); - y = floor(widget->allocation.y + ((widget->allocation.height - widget->requisition.height) * ICON_YALIGN)); + gtk_widget_get_allocation(widget, &allocation); + gtk_widget_get_requisition(widget, &requisition); + + x = floor(allocation.x + ((allocation.width - requisition.width) * ICON_XALIGN)); + y = floor(allocation.y + ((allocation.height - requisition.height) * ICON_YALIGN)); image_area.x = x; image_area.y = y; - image_area.width = widget->requisition.width; - image_area.height = widget->requisition.height; + image_area.width = requisition.width; + image_area.height = requisition.height; +#if 0 if (gdk_rectangle_intersect(&event->area, &image_area, &image_area)) +#endif { GdkPixbuf *pixbuf; pixbuf = self_render_icon(self); + gdk_cairo_set_source_pixbuf(cr, pixbuf, image_area.x, image_area.y); + cairo_move_to(cr, image_area.x - x, image_area.y - y); + cairo_paint(cr); +#if 0 gdk_draw_pixbuf(widget->window, NULL, pixbuf, @@ -171,6 +200,7 @@ GDK_RGB_DITHER_NORMAL, 0, 0); +#endif g_object_unref(pixbuf); } @@ -185,13 +215,16 @@ int box_y; int box_width; int box_height; + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); if (! selfp->count_layout) { const char *size; char *markup; - if (widget->allocation.height < 32) + if (allocation.height < 32) size = "small"; else size = "medium"; @@ -208,17 +241,16 @@ box_width = count_rect.width + COUNT_BOX_XPAD * 2; box_height = count_rect.height + COUNT_BOX_YPAD * 2; - box_x = widget->allocation.x + widget->allocation.width - box_width - COUNT_BOX_XMARGIN; - box_y = widget->allocation.y + widget->allocation.height - box_height - COUNT_BOX_YMARGIN; + box_x = allocation.x + allocation.width - box_width - COUNT_BOX_XMARGIN; + box_y = allocation.y + allocation.height - box_height - COUNT_BOX_YMARGIN; count_x = box_x - count_rect.x + COUNT_BOX_XPAD; count_y = box_y - count_rect.y + COUNT_BOX_YPAD; - gtk_paint_box(widget->style, - widget->window, - GTK_WIDGET_STATE(widget), + gtk_paint_box(gtk_widget_get_style(widget), + cr, + gtk_widget_get_state_flags(widget), GTK_SHADOW_OUT, - &event->area, widget, NULL, box_x, @@ -226,11 +258,10 @@ box_width, box_height); - gtk_paint_layout(widget->style, - widget->window, - GTK_WIDGET_STATE(widget), + gtk_paint_layout(gtk_widget_get_style(widget), + cr, + gtk_widget_get_state_flags(widget), FALSE, - &event->area, widget, NULL, count_x, --- mail-notification-5.4.dfsg.1.orig/src/mn-mail-icon.gob +++ mail-notification-5.4.dfsg.1/src/mn-mail-icon.gob @@ -238,11 +238,13 @@ gpointer user_data) { GtkWidget *widget = user_data; + GtkAllocation allocation; - gdk_window_get_origin(widget->window, x, y); + gdk_window_get_origin(gtk_widget_get_window(widget), x, y); + gtk_widget_get_allocation(widget, &allocation); - *x += widget->allocation.x; - *y += widget->allocation.y; + *x += allocation.x; + *y += allocation.y; if (*y > gdk_screen_get_height(gtk_widget_get_screen(widget)) / 2) { @@ -252,7 +254,7 @@ *y -= req.height; } else - *y += widget->allocation.height; + *y += allocation.height; *push_in = TRUE; } --- mail-notification-5.4.dfsg.1.orig/src/mn-message.gob +++ mail-notification-5.4.dfsg.1/src/mn-message.gob @@ -76,7 +76,7 @@ %{ #include <errno.h> #include <glib/gi18n.h> -#include <gnome.h> +#include <libgnome/libgnome.h> #include <libgnomevfs/gnome-vfs.h> #include "mn-conf.h" #include "mn-util.h" --- mail-notification-5.4.dfsg.1.orig/src/mn-sound-player.gob +++ mail-notification-5.4.dfsg.1/src/mn-sound-player.gob @@ -25,7 +25,7 @@ #include <sys/types.h> #include <signal.h> #include <glib/gi18n.h> -#include <gnome.h> +#include <libgnome/libgnome.h> #include "mn-conf.h" #include "mn-locked-callback.h" #include "mn-util.h" --- mail-notification-5.4.dfsg.1.orig/src/mn-mailbox-properties-dialog.gob +++ mail-notification-5.4.dfsg.1/src/mn-mailbox-properties-dialog.gob @@ -147,7 +147,7 @@ MNMailboxProperties *properties; mn_container_create_interface(GTK_CONTAINER(self), - PKGDATADIR G_DIR_SEPARATOR_S "mailbox-properties-dialog.glade", + PKGDATADIR G_DIR_SEPARATOR_S "mailbox-properties-dialog.ui", "notebook", "mn_mailbox_properties_dialog_", "notebook", &self->notebook, @@ -684,7 +684,7 @@ protected void entry_activate_h (self, GtkEntry *entry) { - if (GTK_WIDGET_IS_SENSITIVE(GTK_WINDOW(self)->default_widget)) + if (gtk_widget_is_sensitive(gtk_window_get_default_widget(GTK_WINDOW(self)))) gtk_window_activate_default(GTK_WINDOW(self)); else { @@ -707,9 +707,9 @@ if (elem->data == entry) break; - if (GTK_WIDGET_MAPPED(elem->data) - && GTK_WIDGET_VISIBLE(elem->data) - && GTK_WIDGET_SENSITIVE(elem->data)) + if (gtk_widget_get_mapped(elem->data) + && gtk_widget_get_visible(elem->data) + && gtk_widget_get_sensitive(elem->data)) next = elem->data; } while (! next); --- mail-notification-5.4.dfsg.1.orig/src/mn-mailbox-view.gob +++ mail-notification-5.4.dfsg.1/src/mn-mailbox-view.gob @@ -189,7 +189,7 @@ GSList *configurations; GSList *l; - memcpy(&configurations, data->data, data->length); + memcpy(&configurations, gtk_selection_data_get_data(data), gtk_selection_data_get_length(data)); MN_LIST_FOREACH(l, configurations) { @@ -210,14 +210,14 @@ data = gtk_clipboard_wait_for_contents(global_clipboard, clipboard_info[TARGET_GNOME_COPIED_FILES].atom); if (data) { - if (data->format == 8 && data->length > 0) + if (gtk_selection_data_get_format(data) == 8 && gtk_selection_data_get_length(data) > 0) { char *gnome_copied_files; gboolean status; MNGnomeCopiedFilesType type; GSList *uri_list; - gnome_copied_files = g_strndup(data->data, data->length); + gnome_copied_files = g_strndup(gtk_selection_data_get_data(data), gtk_selection_data_get_length(data)); status = mn_parse_gnome_copied_files(gnome_copied_files, &type, &uri_list); g_free(gnome_copied_files); @@ -272,23 +272,23 @@ binding_set = gtk_binding_set_by_class(class); /* Delete removes a row */ - gtk_binding_entry_add_signal(binding_set, GDK_Delete, 0, "activate-remove", 0); - gtk_binding_entry_add_signal(binding_set, GDK_KP_Delete, 0, "activate-remove", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_Delete, 0, "activate-remove", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_KP_Delete, 0, "activate-remove", 0); /* HIG 2.0 cut/copy/paste shortcuts */ - gtk_binding_entry_add_signal(binding_set, GDK_x, GDK_CONTROL_MASK, "activate-cut", 0); - gtk_binding_entry_add_signal(binding_set, GDK_c, GDK_CONTROL_MASK, "activate-copy", 0); - gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK, "activate-paste", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_x, GDK_CONTROL_MASK, "activate-cut", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_c, GDK_CONTROL_MASK, "activate-copy", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_v, GDK_CONTROL_MASK, "activate-paste", 0); /* cut/copy/paste shortcuts taken from gtkentry.c */ - gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK, "activate-cut", 0); - gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_CONTROL_MASK, "activate-copy", 0); - gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK, "activate-paste", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_Delete, GDK_SHIFT_MASK, "activate-cut", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_Insert, GDK_CONTROL_MASK, "activate-copy", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_Insert, GDK_SHIFT_MASK, "activate-paste", 0); /* HIG 2.0 properties */ - gtk_binding_entry_add_signal(binding_set, GDK_Return, GDK_MOD1_MASK, "activate-properties", 0); - gtk_binding_entry_add_signal(binding_set, GDK_ISO_Enter, GDK_MOD1_MASK, "activate-properties", 0); - gtk_binding_entry_add_signal(binding_set, GDK_KP_Enter, GDK_MOD1_MASK, "activate-properties", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_Return, GDK_MOD1_MASK, "activate-properties", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_ISO_Enter, GDK_MOD1_MASK, "activate-properties", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_KP_Enter, GDK_MOD1_MASK, "activate-properties", 0); } init (self) --- mail-notification-5.4.dfsg.1.orig/src/mn-shell.gob +++ mail-notification-5.4.dfsg.1/src/mn-shell.gob @@ -497,7 +497,7 @@ } private void - icon_destroy_h (GtkObject *object, gpointer user_data) + icon_destroy_h (GtkWidget *object, gpointer user_data) { Self *self = user_data; --- mail-notification-5.4.dfsg.1.orig/src/mn-text-table.gob +++ mail-notification-5.4.dfsg.1/src/mn-text-table.gob @@ -78,7 +78,7 @@ init (self) { - GTK_WIDGET_SET_FLAGS(self, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(self), FALSE); g_object_connect(self, "swapped-signal::style-set", self_context_changed, self, @@ -101,7 +101,7 @@ g_free(cell); } - override (Gtk:Widget) void + private void size_request (GtkWidget *widget, GtkRequisition *requisition) { Self *self = SELF(widget); @@ -112,14 +112,38 @@ requisition->height = selfp->height; } + override (Gtk:Widget) void + get_preferred_width (GtkWidget *widget, gint *minimal_width, gint *natural_width) + { + GtkRequisition requisition; + + self_size_request(widget, &requisition); + + *minimal_width = *natural_width = requisition.width; + } + + override (Gtk:Widget) void + get_preferred_height (GtkWidget *widget, gint *minimal_height, gint *natural_height) + { + GtkRequisition requisition; + + self_size_request(widget, &requisition); + + *minimal_height = *natural_height = requisition.height; + } + override (Gtk:Widget) gboolean - expose_event (GtkWidget *widget, GdkEventExpose *event) + draw (GtkWidget *widget, cairo_t *cr) { Self *self = SELF(widget); + GtkAllocation allocation; int i; - int y = widget->allocation.y; + int y; + + gtk_widget_get_allocation(widget, &allocation); + y = 0; - if (! GTK_WIDGET_DRAWABLE(widget)) + if (! gtk_widget_is_drawable(widget)) return FALSE; self_relayout(self); @@ -128,7 +152,7 @@ { Row *row = g_ptr_array_index(selfp->rows, i); int j; - int x = widget->allocation.x; + int x = 0; int column = 0; MN_ARRAY_FOREACH(j, row->cells) @@ -136,11 +160,10 @@ MNTextTableCell *cell = g_ptr_array_index(row->cells, j); if (cell->layout) - gtk_paint_layout(widget->style, - widget->window, - GTK_WIDGET_STATE(widget), + gtk_paint_layout(gtk_widget_get_style(widget), + cr, + gtk_widget_get_state_flags(widget), FALSE, - &event->area, widget, NULL, x, --- mail-notification-5.4.dfsg.1.orig/src/mn-tooltips.gob +++ mail-notification-5.4.dfsg.1/src/mn-tooltips.gob @@ -173,7 +173,13 @@ { if (! selfp->window) { + GtkStyleContext *ctx; + selfp->window = gtk_window_new(GTK_WINDOW_POPUP); + + ctx = gtk_widget_get_style_context(GTK_WIDGET(selfp->window)); + gtk_style_context_add_class(ctx, "tooltip"); + self_update_screen(self, TRUE); gtk_widget_set_app_paintable(selfp->window, TRUE); gtk_window_set_resizable(GTK_WINDOW(selfp->window), FALSE); @@ -181,7 +187,7 @@ gtk_container_set_border_width(GTK_CONTAINER(selfp->window), selfp->border_width); g_signal_connect_swapped(selfp->window, - "expose-event", + "draw", G_CALLBACK(self_paint_window), self); @@ -214,7 +220,7 @@ if (selfp->active_data && selfp->active_data->widget == widget - && GTK_WIDGET_DRAWABLE(selfp->active_data->widget)) + && gtk_widget_is_drawable(selfp->active_data->widget)) { if (data->tip_widget) g_object_unref(data->tip_widget); @@ -285,22 +291,13 @@ } private gboolean - paint_window (self) + paint_window (self, cairo_t *cr) { GtkRequisition req; - gtk_widget_size_request(selfp->window, &req); - gtk_paint_flat_box(selfp->window->style, - selfp->window->window, - GTK_STATE_NORMAL, - GTK_SHADOW_OUT, - NULL, - selfp->window, - "tooltip", - 0, - 0, - req.width, - req.height); + gtk_widget_size_request(GTK_WIDGET(selfp->window), &req); + gtk_render_background(gtk_widget_get_style_context(GTK_WIDGET(selfp->window)), + cr, 0, 0, req.width, req.height); return FALSE; } @@ -319,10 +316,11 @@ gint monitor_num, px, py; GdkRectangle monitor; int screen_width; + GtkAllocation allocation; if (! selfp->window) self_force_window(self); - else if (GTK_WIDGET_VISIBLE(selfp->window)) + else if (gtk_widget_get_visible(selfp->window)) g_get_current_time(&selfp->last_popdown); gtk_widget_ensure_style(selfp->window); @@ -338,7 +336,7 @@ data = selfp->active_data; - child = GTK_BIN(selfp->window)->child; + child = gtk_bin_get_child(GTK_BIN(selfp->window)); if (child) gtk_container_remove(GTK_CONTAINER(selfp->window), child); @@ -352,14 +350,16 @@ w = requisition.width; h = requisition.height; - gdk_window_get_origin(widget->window, &x, &y); - if (GTK_WIDGET_NO_WINDOW(widget)) + gtk_widget_get_allocation(selfp->window, &allocation); + + gdk_window_get_origin(gtk_widget_get_window(widget), &x, &y); + if (! gtk_widget_get_has_window(widget)) { - x += widget->allocation.x; - y += widget->allocation.y; + x += allocation.x; + y += allocation.y; } - x += widget->allocation.width / 2; + x += allocation.width / 2; if (! keyboard_mode) gdk_window_get_pointer(gdk_screen_get_root_window(screen), &x, NULL, NULL); @@ -380,11 +380,11 @@ else if (x < monitor.x) x = monitor.x; - if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height + if ((y + h + allocation.height + 4) > monitor.y + monitor.height && (y - 4) > monitor.y) y = y - h - 4; else - y = y + widget->allocation.height + 4; + y = y + allocation.height + 4; /* * The following block is not part of GTK+ and has been added to @@ -420,7 +420,7 @@ { Self *self = SELF(data); - if (selfp->active_data && GTK_WIDGET_DRAWABLE(selfp->active_data->widget)) + if (selfp->active_data && gtk_widget_is_drawable(selfp->active_data->widget)) self_draw_tips(self); selfp->timeout_id = 0; @@ -432,7 +432,7 @@ { if (selfp->window) { - if (GTK_WIDGET_VISIBLE(selfp->window)) + if (gtk_widget_get_visible(selfp->window)) g_get_current_time(&selfp->last_popdown); gtk_widget_hide(selfp->window); } @@ -449,7 +449,7 @@ { TooltipsData *data = l->data; - if (data->widget == widget && GTK_WIDGET_DRAWABLE(widget)) + if (data->widget == widget && gtk_widget_is_drawable(widget)) { selfp->active_data = data; break; @@ -519,7 +519,7 @@ if (GTK_IS_WINDOW(toplevel)) { - GtkWidget *focus = GTK_WINDOW(toplevel)->focus_widget; + GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(toplevel)); g_object_set_data(G_OBJECT(toplevel), TOOLTIPS_KEYBOARD_MODE, GINT_TO_POINTER(TRUE)); @@ -535,7 +535,7 @@ if (GTK_IS_WINDOW(toplevel)) { - GtkWidget *focus = GTK_WINDOW(toplevel)->focus_widget; + GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(toplevel)); if (focus) self_hide_tip(focus); @@ -605,24 +605,26 @@ break; case GDK_ENTER_NOTIFY: - if (! (GTK_IS_MENU_ITEM(widget) && GTK_MENU_ITEM(widget)->submenu)) + if (! (GTK_IS_MENU_ITEM(widget) && gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget)))) self_start_delay(self, widget); break; case GDK_LEAVE_NOTIFY: self_set_active_widget(self, NULL); - selfp->use_sticky_delay = selfp->window && GTK_WIDGET_VISIBLE(selfp->window); + selfp->use_sticky_delay = selfp->window && gtk_widget_get_visible(selfp->window); break; case GDK_MOTION_NOTIFY: /* Handle menu items specially ... pend popup for each motion * on other widgets, we ignore motion. */ - if (GTK_IS_MENU_ITEM(widget) && ! GTK_MENU_ITEM(widget)->submenu) + if (GTK_IS_MENU_ITEM(widget) && ! gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget))) { /* Completely evil hack to make sure we get the LEAVE_NOTIFY */ +#if 0 GTK_PRIVATE_SET_FLAG(widget, GTK_LEAVE_PENDING); +#endif self_set_active_widget(self, NULL); self_start_delay(self, widget); break; --- mail-notification-5.4.dfsg.1.orig/src/nautilus-cell-renderer-pixbuf-emblem.c +++ mail-notification-5.4.dfsg.1/src/nautilus-cell-renderer-pixbuf-emblem.c @@ -39,17 +39,16 @@ GtkWidget *widget); static void nautilus_cell_renderer_pixbuf_emblem_get_size (GtkCellRenderer *cell, GtkWidget *widget, - GdkRectangle *rectangle, + const GdkRectangle *rectangle, gint *x_offset, gint *y_offset, gint *width, gint *height); static void nautilus_cell_renderer_pixbuf_emblem_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); enum { @@ -356,7 +355,7 @@ static void nautilus_cell_renderer_pixbuf_emblem_get_size (GtkCellRenderer *cell, GtkWidget *widget, - GdkRectangle *cell_area, + const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, @@ -368,6 +367,10 @@ gint pixbuf_height = 0; gint calc_width; gint calc_height; + int xpad; + int ypad; + gfloat xalign; + gfloat yalign; if (!cellpixbuf->pixbuf && cellinfo->stock_id) nautilus_cell_renderer_pixbuf_emblem_create_stock_pixbuf (cellpixbuf, widget); @@ -385,8 +388,11 @@ pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_closed)); } - calc_width = (gint) cell->xpad * 2 + pixbuf_width; - calc_height = (gint) cell->ypad * 2 + pixbuf_height; + gtk_cell_renderer_get_padding(cell, &xpad, &ypad); + gtk_cell_renderer_get_alignment(cell, &xalign, &yalign); + + calc_width = (gint) xpad * 2 + pixbuf_width; + calc_height = (gint) ypad * 2 + pixbuf_height; if (x_offset) *x_offset = 0; if (y_offset) *y_offset = 0; @@ -394,14 +400,14 @@ if (cell_area && pixbuf_width > 0 && pixbuf_height > 0) { if (x_offset) { *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? - 1.0 - cell->xalign : cell->xalign) * - (cell_area->width - calc_width - 2 * cell->xpad)); - *x_offset = MAX (*x_offset, 0) + cell->xpad; + 1.0 - xalign : xalign) * + (cell_area->width - calc_width - 2 * xpad)); + *x_offset = MAX (*x_offset, 0) + xpad; } if (y_offset) { - *y_offset = (cell->yalign * - (cell_area->height - calc_height - 2 * cell->ypad)); - *y_offset = MAX (*y_offset, 0) + cell->ypad; + *y_offset = (yalign * + (cell_area->height - calc_height - 2 * ypad)); + *y_offset = MAX (*y_offset, 0) + ypad; } } @@ -414,11 +420,10 @@ static void nautilus_cell_renderer_pixbuf_emblem_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) { @@ -429,13 +434,19 @@ GdkRectangle pix_emblem_rect; GdkRectangle draw_rect; gboolean stock_pixbuf = FALSE; + gboolean is_expander = FALSE; + gboolean is_expanded = FALSE; + int xpad; + int ypad; + + g_object_get(cell, "is-expander", &is_expander, "is-expanded", &is_expanded, NULL); pixbuf = cellpixbuf->pixbuf; - if (cell->is_expander) { - if (cell->is_expanded && + if (is_expander) { + if (is_expanded && cellpixbuf->pixbuf_expander_open != NULL) { pixbuf = cellpixbuf->pixbuf_expander_open; - } else if (!cell->is_expanded && + } else if (!is_expanded && cellpixbuf->pixbuf_expander_closed != NULL) { pixbuf = cellpixbuf->pixbuf_expander_closed; } @@ -456,11 +467,15 @@ if (stock_pixbuf) pixbuf = cellpixbuf->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)) { +#if 0 if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) && gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect)) { gdk_draw_pixbuf (window, @@ -475,6 +490,11 @@ draw_rect.height, GDK_RGB_DITHER_NORMAL, 0, 0); +#endif + + cairo_move_to(cr, draw_rect.x - pix_rect.x, draw_rect.y - pix_rect.y); + gdk_cairo_set_source_pixbuf(cr, pixbuf, draw_rect.x, draw_rect.y); + cairo_paint(cr); } if (cellpixbuf->pixbuf_emblem) { @@ -482,6 +502,8 @@ pix_emblem_rect.height = gdk_pixbuf_get_height (cellpixbuf->pixbuf_emblem); pix_emblem_rect.x = pix_rect.x; pix_emblem_rect.y = pix_rect.y + pix_rect.height - pix_emblem_rect.height; + if (gdk_rectangle_intersect (cell_area, &pix_emblem_rect, &draw_rect)) { +#if 0 if (gdk_rectangle_intersect (cell_area, &pix_emblem_rect, &draw_rect) && gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect)) { gdk_draw_pixbuf (window, @@ -496,6 +518,10 @@ draw_rect.height, GDK_RGB_DITHER_NORMAL, 0, 0); +#endif + cairo_move_to(cr, draw_rect.x - pix_emblem_rect.x, draw_rect.y - pix_emblem_rect.y); + gdk_cairo_set_source_pixbuf(cr, cellpixbuf->pixbuf_emblem, draw_rect.x, draw_rect.y); + cairo_paint(cr); } } } --- mail-notification-5.4.dfsg.1.orig/src/nautilus-cell-renderer-pixbuf-emblem.h +++ mail-notification-5.4.dfsg.1/src/nautilus-cell-renderer-pixbuf-emblem.h @@ -25,18 +25,18 @@ #ifndef NAUTILUS_CELL_RENDERER_PIXBUF_EMBLEM_H #define NAUTILUS_CELL_RENDERER_PIXBUF_EMBLEM_H -#include <gtk/gtkcellrenderer.h> +#include <gtk/gtk.h> #define NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM \ (nautilus_cell_renderer_pixbuf_emblem_get_type ()) #define NAUTILUS_CELL_RENDERER_PIXBUF_EMBLEM(obj) \ - (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, NautilusCellRendererPixbufEmblem)) + (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, NautilusCellRendererPixbufEmblem)) #define NAUTILUS_CELL_RENDERER_PIXBUF_EMBLEM_CLASS(klass) \ - (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, NautilusCellRendererPixbufEmblemClass)) + (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM, NautilusCellRendererPixbufEmblemClass)) #define NAUTILUS_IS_CELL_RENDERER_PIXBUF_EMBLEM(obj) \ - (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM)) + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM)) #define NAUTILUS_IS_CELL_RENDERER_PIXBUF_EMBLEM_CLASS(klass) \ - (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM)) + (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_CELL_RENDERER_PIXBUF_EMBLEM)) typedef struct _NautilusCellRendererPixbufEmblem NautilusCellRendererPixbufEmblem; typedef struct _NautilusCellRendererPixbufEmblemClass NautilusCellRendererPixbufEmblemClass; --- mail-notification-5.4.dfsg.1.orig/data/mail-notification.desktop.in +++ mail-notification-5.4.dfsg.1/data/mail-notification.desktop.in @@ -5,7 +5,7 @@ _Comment=Get notified when new mail arrives Type=Application Categories=GNOME;GTK;Network;Email; -Exec=mail-notification --sm-disable +Exec=mail-notification Terminal=false StartupNotify=true X-GNOME-DocPath=mail-notification/mail-notification.xml --- mail-notification-5.4.dfsg.1.orig/src/eggtrayicon.c +++ mail-notification-5.4.dfsg.1/src/eggtrayicon.c @@ -25,7 +25,7 @@ #include "eggtrayicon.h" -#include <gdkconfig.h> +#include <gdk/gdk.h> #if defined (GDK_WINDOWING_X11) #include <gdk/gdkx.h> #include <X11/Xatom.h> @@ -258,7 +258,7 @@ { GdkWindow *gdkwin; - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget), + gdkwin = gdk_x11_window_lookup_for_display (gtk_widget_get_display (widget), icon->manager_window); gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); @@ -290,7 +290,7 @@ ev.window = window; ev.message_type = icon->system_tray_opcode_atom; ev.format = 32; - ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window); + ev.data.l[0] = gdk_x11_get_server_time (gtk_widget_get_window(GTK_WIDGET (icon))); ev.data.l[1] = message; ev.data.l[2] = data1; ev.data.l[3] = data2; @@ -342,12 +342,12 @@ { GdkWindow *gdkwin; - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), + gdkwin = gdk_x11_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), icon->manager_window); gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon); - if (dock_if_realized && GTK_WIDGET_REALIZED (icon)) + if (dock_if_realized && gtk_widget_get_realized (GTK_WIDGET(icon))) egg_tray_icon_send_dock_request (icon); egg_tray_icon_get_orientation_property (icon); @@ -355,10 +355,14 @@ } static gboolean -transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) +transparent_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data) { +#if 0 gdk_window_clear_area (widget->window, event->area.x, event->area.y, event->area.width, event->area.height); +#endif + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + cairo_fill (cr); return FALSE; } @@ -366,20 +370,21 @@ make_transparent_again (GtkWidget *widget, GtkStyle *previous_style, gpointer user_data) { +#if 0 gdk_window_set_back_pixmap (widget->window, NULL, TRUE); +#endif } static void make_transparent (GtkWidget *widget, gpointer user_data) { - if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget)) + if (! gtk_widget_get_has_window (widget) || gtk_widget_get_app_paintable (widget)) return; gtk_widget_set_app_paintable (widget, TRUE); gtk_widget_set_double_buffered (widget, FALSE); - gdk_window_set_back_pixmap (widget->window, NULL, TRUE); - g_signal_connect (widget, "expose_event", - G_CALLBACK (transparent_expose_event), NULL); + g_signal_connect (widget, "draw", + G_CALLBACK (transparent_draw), NULL); g_signal_connect_after (widget, "style_set", G_CALLBACK (make_transparent_again), NULL); } @@ -391,7 +396,7 @@ g_return_if_fail (icon->manager_window != None); - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), + gdkwin = gdk_x11_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), icon->manager_window); gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); --- mail-notification-5.4.dfsg.1.orig/src/mn-about-dialog.gob +++ mail-notification-5.4.dfsg.1/src/mn-about-dialog.gob @@ -30,8 +30,10 @@ { class_init (class) { +#if 0 gtk_about_dialog_set_email_hook(self_activate_link_cb, "mailto:", NULL); gtk_about_dialog_set_url_hook(self_activate_link_cb, NULL, NULL); +#endif } init (self) --- mail-notification-5.4.dfsg.1.orig/src/mn-authenticated-mailbox.gob +++ mail-notification-5.4.dfsg.1/src/mn-authenticated-mailbox.gob @@ -28,7 +28,7 @@ %{ #include <glib/gi18n.h> -#include <gnome.h> +#include <libgnome/libgnome.h> #include "mn-mailbox-private.h" #include "mn-shell.h" #include "mn-util.h" @@ -377,6 +377,7 @@ /* keep the title in sync with gnome-authentication-manager */ +#if 0 /* translators: header capitalization */ selfp->auth_dialog = gnome_password_dialog_new(_("Authentication Required"), message, @@ -409,6 +410,9 @@ gtk_widget_destroy(selfp->auth_dialog); return ok; +#else + return FALSE; +#endif } private void --- mail-notification-5.4.dfsg.1.orig/src/mn-autodetect-mailbox-properties.gob +++ mail-notification-5.4.dfsg.1/src/mn-autodetect-mailbox-properties.gob @@ -166,10 +166,9 @@ toplevel = gtk_widget_get_toplevel(GTK_WIDGET(button)); /* translators: header capitalization */ - selfp->chooser = gtk_file_chooser_dialog_new_with_backend(_("Select a File or Folder"), + selfp->chooser = gtk_file_chooser_dialog_new(_("Select a File or Folder"), GTK_WINDOW(toplevel), GTK_FILE_CHOOSER_ACTION_OPEN, - "gnome-vfs", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, 1, NULL); --- mail-notification-5.4.dfsg.1.orig/src/mn-conf.c +++ mail-notification-5.4.dfsg.1/src/mn-conf.c @@ -23,7 +23,7 @@ #include <errno.h> #include <stdarg.h> #include <glib/gi18n.h> -#include <gnome.h> +#include <libgnome/libgnome.h> #include "mn-util.h" #include "mn-conf.h" #include "mn-shell.h" --- mail-notification-5.4.dfsg.1.orig/src/mn-main.c +++ mail-notification-5.4.dfsg.1/src/mn-main.c @@ -21,7 +21,7 @@ #include <stdlib.h> #include <signal.h> #include <glib/gi18n.h> -#include <gnome.h> +#include <libgnome/libgnome.h> #include <libgnomevfs/gnome-vfs.h> #include <libnotify/notify.h> #include <dbus/dbus-glib-lowlevel.h> @@ -452,7 +452,7 @@ gnome_program_init(PACKAGE, VERSION, - LIBGNOMEUI_MODULE, + LIBGNOME_MODULE, argc, argv, GNOME_PARAM_HUMAN_READABLE_NAME, _("Mail Notification"), @@ -460,6 +460,8 @@ GNOME_PARAM_GOPTION_CONTEXT, option_context, NULL); + gtk_init(&argc, &argv); + if (arg_version) { print_version(); @@ -497,7 +499,9 @@ if (! gnome_vfs_init()) mn_show_fatal_error_dialog(NULL, _("Unable to initialize the GnomeVFS library.")); +#if 0 gnome_authentication_manager_init(); +#endif /* must be called before init_gmime() */ mn_conf_init(); --- mail-notification-5.4.dfsg.1.orig/src/mn-pi-mailbox-properties.gob +++ mail-notification-5.4.dfsg.1/src/mn-pi-mailbox-properties.gob @@ -195,7 +195,7 @@ int i; for (i = 0; i < MN_PI_MAILBOX_N_CONNECTION_TYPES; i++) - gtk_widget_set_sensitive(self->port_spin[i], GTK_WIDGET_SENSITIVE(self->conn_radio[i]) && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self->conn_radio[i]))); + gtk_widget_set_sensitive(self->port_spin[i], gtk_widget_get_sensitive(self->conn_radio[i]) && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self->conn_radio[i]))); g_object_notify(G_OBJECT(self), "complete"); } --- mail-notification-5.4.dfsg.1.orig/src/mn-properties-dialog.gob +++ mail-notification-5.4.dfsg.1/src/mn-properties-dialog.gob @@ -84,7 +84,7 @@ GtkTreeSelection *selection; mn_container_create_interface(GTK_CONTAINER(self), - PKGDATADIR G_DIR_SEPARATOR_S "properties-dialog.glade", + PKGDATADIR G_DIR_SEPARATOR_S "properties-dialog.ui", "main_vbox", "mn_properties_dialog_", "notebook", &selfp->notebook, --- mail-notification-5.4.dfsg.1.orig/src/mn-util.c +++ mail-notification-5.4.dfsg.1/src/mn-util.c @@ -26,8 +26,7 @@ #include <gmodule.h> #include <glib/gi18n.h> #include <gobject/gvaluecollector.h> -#include <gnome.h> -#include <glade/glade.h> +#include <libgnome/libgnome.h> #include "mn-util.h" #include "mn-mailboxes.h" #include "mn-shell.h" @@ -303,49 +302,55 @@ return pixbuf; } -static GladeXML * +static GtkBuilder * mn_glade_xml_new (const char *filename, const char *root, const char *domain) { - GladeXML *xml; + GtkBuilder *builder; + GError *err = NULL; g_return_val_if_fail(filename != NULL, NULL); - xml = glade_xml_new(filename, root, domain); - if (! xml) - mn_show_fatal_error_dialog(NULL, "Unable to load interface \"%s\".", filename); + builder = gtk_builder_new(); + gtk_builder_set_translation_domain(builder, domain); + if (! gtk_builder_add_from_file(builder, filename, &err)) { + mn_show_fatal_error_dialog(NULL, "Unable to load interface \"%s\": %s.", filename, err->message); + g_error_free(err); + g_object_unref(builder); + return NULL; + } - return xml; + return builder; } static GtkWidget * -mn_glade_xml_get_widget (GladeXML *xml, const char *widget_name) +mn_glade_xml_get_widget (GtkBuilder *builder, const char *widget_name) { GtkWidget *widget; - g_return_val_if_fail(GLADE_IS_XML(xml), NULL); + g_return_val_if_fail(GTK_IS_BUILDER(builder), NULL); g_return_val_if_fail(widget_name != NULL, NULL); - widget = glade_xml_get_widget(xml, widget_name); + widget = GTK_WIDGET(gtk_builder_get_object(builder, widget_name)); if (! widget) - mn_show_fatal_error_dialog(NULL, "Widget \"%s\" not found in interface \"%s\".", widget_name, xml->filename); + mn_show_fatal_error_dialog(NULL, "Widget \"%s\" not found in interface.", widget_name); return widget; } static void -create_interface_connect_cb (const char *handler_name, +create_interface_connect_cb (GtkBuilder *builder, GObject *object, const char *signal_name, - const char *signal_data, + const char *handler_name, GObject *connect_object, - gboolean after, + GConnectFlags flags, gpointer user_data) { static GModule *module = NULL; ContainerCreateInterfaceConnectInfo *info = user_data; char *cb_name; GCallback cb; - GConnectFlags flags; + GConnectFlags cflags; if (! module) { @@ -359,11 +364,9 @@ mn_show_fatal_error_dialog(NULL, "Signal handler \"%s\" not found.", cb_name); g_free(cb_name); - flags = G_CONNECT_SWAPPED; - if (after) - flags |= G_CONNECT_AFTER; + cflags = G_CONNECT_SWAPPED; - g_signal_connect_data(object, signal_name, cb, info->container, NULL, flags); + g_signal_connect_data(object, signal_name, cb, info->container, NULL, cflags); } void @@ -373,7 +376,7 @@ const char *callback_prefix, ...) { - GladeXML *xml; + GtkBuilder *xml; GtkWidget *child; ContainerCreateInterfaceConnectInfo info; va_list args; @@ -387,14 +390,16 @@ xml = mn_glade_xml_new(filename, child_name, NULL); child = mn_glade_xml_get_widget(xml, child_name); - if (GTK_IS_DIALOG(container)) - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(container)->vbox), child, TRUE, TRUE, 0); - else + if (GTK_IS_DIALOG(container)) { + gtk_widget_unparent(child); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(container))), child, TRUE, TRUE, 0); + } else { gtk_container_add(container, child); + } info.container = container; info.callback_prefix = callback_prefix; - glade_xml_signal_autoconnect_full(xml, create_interface_connect_cb, &info); + gtk_builder_connect_signals_full(xml, create_interface_connect_cb, &info); va_start(args, callback_prefix); @@ -422,7 +427,7 @@ toplevel = gtk_widget_get_toplevel(widget); - return GTK_WIDGET_TOPLEVEL(toplevel) ? GTK_WINDOW(toplevel) : NULL; + return gtk_widget_get_toplevel(toplevel) ? GTK_WINDOW(toplevel) : NULL; } static void @@ -493,9 +498,11 @@ gpointer user_data) { GtkAdjustment *adjustment; + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(widget)); - gtk_adjustment_set_value(adjustment, (double) y / (widget->allocation.height - 2) * (adjustment->upper - adjustment->page_size)); + gtk_adjustment_set_value(adjustment, (double) y / (allocation.height - 2) * (gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment))); return TRUE; /* we're forcibly in a drop zone */ } @@ -562,7 +569,7 @@ MNMailbox *mailbox; /* text/x-moz-url is encoded in UCS-2 but in format 8: broken */ - if (selection_data->format != 8 || selection_data->length <= 0 || (selection_data->length % 2) != 0) + if (gtk_selection_data_get_format(selection_data) != 8 || gtk_selection_data_get_length(selection_data) <= 0 || (gtk_selection_data_get_length(selection_data) % 2) != 0) { mn_show_error_dialog(mn_widget_get_parent_window(widget), _("A drag and drop error has occurred"), @@ -570,8 +577,8 @@ return; } - char_data = (const guint16 *) selection_data->data; - char_len = selection_data->length / 2; + char_data = (const guint16 *) gtk_selection_data_get_data(selection_data); + char_len = gtk_selection_data_get_length(selection_data) / 2; url = g_string_new(NULL); for (i = 0; i < char_len && char_data[i] != '\n'; i++) @@ -1322,7 +1329,7 @@ } static void -dialog_run_nonmodal_destroy_h (GtkObject *object, gpointer user_data) +dialog_run_nonmodal_destroy_h (GtkWidget *object, gpointer user_data) { RunNonmodalInfo *info = user_data; @@ -1375,7 +1382,7 @@ g_object_ref(dialog); - if (! GTK_WIDGET_VISIBLE(dialog)) + if (! gtk_widget_get_visible(dialog)) gtk_widget_show(GTK_WIDGET(dialog)); g_object_connect(dialog,