[gnome-disk-utility] rebuild against new libnotify
Matthias Clasen
mclasen at fedoraproject.org
Wed Nov 3 20:44:12 UTC 2010
commit 4b496fa4e2a202113d235a4175c2befc58e4ed6c
Author: Matthias Clasen <mclasen at redhat.com>
Date: Wed Nov 3 16:43:34 2010 -0400
rebuild against new libnotify
gnome-disk-utility.spec | 14 +++-
no-statusicon.patch | 202 +++++++++++++++++++++++++++++++++++++++++++++++
no-xkb.patch | 46 +++++++++++
3 files changed, 260 insertions(+), 2 deletions(-)
---
diff --git a/gnome-disk-utility.spec b/gnome-disk-utility.spec
index bab6e0e..557087e 100644
--- a/gnome-disk-utility.spec
+++ b/gnome-disk-utility.spec
@@ -6,14 +6,14 @@
%define gnome_keyring_version 2.22
%define udisks_version 1.0.0-0.git20100215
%define unique_version 1.0.4
-%define libnotify_version 0.4.5
+%define libnotify_version 0.7.0
%define nautilus_version 2.26
%define libatasmart_version 0.14
Summary: Disk management application
Name: gnome-disk-utility
Version: 2.32.0
-Release: 1%{?dist}
+Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://git.gnome.org/cgit/gnome-disk-utility
@@ -39,6 +39,11 @@ Requires: %{name}-libs = %{version}-%{release}
Obsoletes: gnome-disk-utility-format
Obsoletes: nautilus-gdu
+# upstream patch
+Patch0: no-statusicon.patch
+# no need to use xkb here
+Patch1: no-xkb.patch
+
%description
This package contains the Palimpsest disk management application.
Palimpsest supports partitioning, file system creation, encryption,
@@ -93,6 +98,8 @@ develop applications with gnome-disk-utility-ui-libs.
%prep
%setup -q
+%patch0 -p1 -b .no-statusicon
+%patch1 -p1 -b .no-xkb
%build
%configure
@@ -198,6 +205,9 @@ fi
%{_includedir}/gnome-disk-utility/gdu-gtk/*
%changelog
+* Wed Nov 3 2010 Matthias Clasen <mclasen at redhat.com> - 2.32.0-2%{?dist}
+- Rebuild against libnotify 0.7.0
+
* Tue Sep 28 2010 Matthias Clasen <mclasen at redhat.com> - 2.32.0-1%{?dist}
- Update to 2.32.0
diff --git a/no-statusicon.patch b/no-statusicon.patch
new file mode 100644
index 0000000..4fa7611
--- /dev/null
+++ b/no-statusicon.patch
@@ -0,0 +1,202 @@
+diff -up gnome-disk-utility-2.32.0/src/notification/notification-main.c.no-statusicon gnome-disk-utility-2.32.0/src/notification/notification-main.c
+--- gnome-disk-utility-2.32.0/src/notification/notification-main.c.no-statusicon 2010-08-05 13:03:58.000000000 -0400
++++ gnome-disk-utility-2.32.0/src/notification/notification-main.c 2010-11-03 16:29:01.159241997 -0400
+@@ -39,16 +39,12 @@ typedef struct
+ {
+ GduPool *pool;
+
+- GtkStatusIcon *status_icon;
+-
+ /* List of GduDevice objects currently being unmounted */
+ GList *devices_being_unmounted;
+
+ /* List of GduDevice objects with ATA SMART failures */
+ GList *ata_smart_failures;
+
+- gboolean show_icon_for_ata_smart_failures;
+-
+ NotifyNotification *ata_smart_notification;
+
+ GFileMonitor *ata_smart_ignore_monitor;
+@@ -69,9 +65,7 @@ static void update_unmount_dialogs (Noti
+
+ static void update_ata_smart_failures (NotificationData *data);
+
+-static void update_status_icon (NotificationData *data);
+-
+-static void show_menu_for_status_icon (NotificationData *data);
++static void update_notification (NotificationData *data);
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+@@ -119,24 +113,6 @@ on_device_job_changed (GduPool *pool,
+ }
+
+ static void
+-on_status_icon_activate (GtkStatusIcon *status_icon,
+- gpointer user_data)
+-{
+- NotificationData *data = user_data;
+- show_menu_for_status_icon (data);
+-}
+-
+-static void
+-on_status_icon_popup_menu (GtkStatusIcon *status_icon,
+- guint button,
+- guint activate_time,
+- gpointer user_data)
+-{
+- NotificationData *data = user_data;
+- show_menu_for_status_icon (data);
+-}
+-
+-static void
+ on_ata_smart_ignore_monitor_changed (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+@@ -164,13 +140,6 @@ notification_data_new (void)
+ g_signal_connect (data->pool, "device-changed", G_CALLBACK (on_device_changed), data);
+ g_signal_connect (data->pool, "device-job-changed", G_CALLBACK (on_device_job_changed), data);
+
+- data->status_icon = gtk_status_icon_new ();
+- gtk_status_icon_set_visible (data->status_icon, FALSE);
+- gtk_status_icon_set_from_icon_name (data->status_icon, "gdu-warning");
+- gtk_status_icon_set_tooltip_markup (data->status_icon, _("One or more disks are failing"));
+- g_signal_connect (data->status_icon, "activate", G_CALLBACK (on_status_icon_activate), data);
+- g_signal_connect (data->status_icon, "popup-menu", G_CALLBACK (on_status_icon_popup_menu), data);
+-
+ dir_path = g_build_filename (g_get_user_config_dir (),
+ "gnome-disk-utility",
+ "ata-smart-ignore",
+@@ -208,10 +177,6 @@ notification_data_new (void)
+ static void
+ notification_data_free (NotificationData *data)
+ {
+- g_signal_handlers_disconnect_by_func (data->status_icon, on_status_icon_activate, data);
+- g_signal_handlers_disconnect_by_func (data->status_icon, on_status_icon_popup_menu, data);
+- g_object_unref (data->status_icon);
+-
+ g_signal_handlers_disconnect_by_func (data->pool, on_device_added, data);
+ g_signal_handlers_disconnect_by_func (data->pool, on_device_removed, data);
+ g_signal_handlers_disconnect_by_func (data->pool, on_device_changed, data);
+@@ -478,72 +443,69 @@ update_ata_smart_failures (NotificationD
+ g_list_foreach (devices, (GFunc) g_object_unref, NULL);
+ g_list_free (devices);
+
+- update_status_icon (data);
++ update_notification (data);
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static gboolean
+-show_notification (NotificationData *data)
++static void
++on_examine_action_clicked (NotifyNotification *notification,
++ char *action,
++ NotificationData *data)
+ {
+- static int count = 0;
+-
+- /* wait for the panel to be settled before showing a bubble */
+- if (gtk_status_icon_is_embedded (data->status_icon)) {
+- notify_notification_show (data->ata_smart_notification, NULL);
+- } else if (count < 20) {
+- count++;
+- g_timeout_add_seconds (1, (GSourceFunc) show_notification, data);
+- } else {
+- g_warning ("No notification area. Notification bubbles will not be displayed.");
+- }
+- return FALSE;
++ g_spawn_command_line_async ("palimpsest", NULL);
+ }
+
+ static void
+-update_status_icon (NotificationData *data)
++update_notification (NotificationData *data)
+ {
+- gboolean show_icon;
+- gboolean old_show_icon_for_ata_smart_failures;
+-
+- old_show_icon_for_ata_smart_failures = data->show_icon_for_ata_smart_failures;
++ int num_drives;
+
+- data->show_icon_for_ata_smart_failures = FALSE;
+- if (g_list_length (data->ata_smart_failures) > 0)
+- data->show_icon_for_ata_smart_failures = TRUE;
+-
+- show_icon = data->show_icon_for_ata_smart_failures;
+-
+- if (!show_icon) {
++ if (data->ata_smart_notification != NULL) {
+ if (data->ata_smart_notification != NULL) {
+ notify_notification_close (data->ata_smart_notification, NULL);
+ g_object_unref (data->ata_smart_notification);
+ data->ata_smart_notification = NULL;
+ }
+
+- gtk_status_icon_set_visible (data->status_icon, FALSE);
+ goto out;
+ }
+
+- gtk_status_icon_set_visible (data->status_icon, TRUE);
+-
+- /* we've started showing the icon for ATA RAID failures; pop up a libnotify notification */
+- if (old_show_icon_for_ata_smart_failures != data->show_icon_for_ata_smart_failures) {
++ num_drives = g_list_length (data->ata_smart_failures);
++ if (data->ata_smart_notification == NULL) {
++ data->ata_smart_notification = notify_notification_new (
++ /* Translators: This is used as the title of the notification */
++ _("Hard Disk Problems Detected"),
++ /* Translators: This is used as the text of the notification*/
++ g_dngettext (GETTEXT_PACKAGE,
++ N_("A hard disk is reporting health problems."),
++ N_("Multiple system hard disks are reporting health problems."),
++ num_drives),
++ "gdu-warning");
+
+- data->ata_smart_notification = notify_notification_new (
+- /* Translators: This is used as the title of the notification */
+- _("A hard disk may be failing"),
+- /* Translators: This is used as the text of the notification*/
+- _("One or more hard disks report health problems. Click the icon to get more information."),
+- "gtk-dialog-warning",
+- NULL);
+- notify_notification_attach_to_status_icon (data->ata_smart_notification,
+- data->status_icon);
+ notify_notification_set_urgency (data->ata_smart_notification, NOTIFY_URGENCY_CRITICAL);
+ notify_notification_set_timeout (data->ata_smart_notification, NOTIFY_EXPIRES_NEVER);
+- show_notification (data);
++ notify_notification_add_action (data->ata_smart_notification,
++ "examine",
++ _("Examine"),
++ (NotifyActionCallback) on_examine_action_clicked,
++ data,
++ NULL);
++ } else {
++ notify_notification_update (data->ata_smart_notification,
++ /* Translators: This is used as the title of the notification */
++ _("Hard Disk Problems Detected"),
++ /* Translators: This is used as the text of the notification*/
++ g_dngettext (GETTEXT_PACKAGE,
++ N_("A hard disk is reporting health problems."),
++ N_("Multiple hard disks are reporting health problems."),
++ num_drives),
++ "gdu-warning");
++
+ }
+
++ notify_notification_show (data->ata_smart_notification, NULL);
++
+ out:
+ ;
+ }
+@@ -693,7 +655,7 @@ main (int argc, char **argv)
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+- notify_init ("gdu-notification-daemon");
++ notify_init (_("Disk Utility"));
+
+ gtk_window_set_default_icon_name ("palimpsest");
+
diff --git a/no-xkb.patch b/no-xkb.patch
new file mode 100644
index 0000000..0546c5f
--- /dev/null
+++ b/no-xkb.patch
@@ -0,0 +1,46 @@
+--- gnome-disk-utility-2.32.0/src/gdu-gtk/gdu-volume-grid.c 2010-09-15 10:12:21.000000000 -0400
++++ gnome-disk-utility-2.32.0.no-xkb/src/gdu-gtk/gdu-volume-grid.c 2010-11-03 16:40:37.544241996 -0400
+@@ -25,7 +25,6 @@
+ #include <math.h>
+ #include <gdk/gdkkeysyms.h>
+ #include <gdk/gdkx.h>
+-#include <X11/XKBlib.h>
+
+ #include <gdu-gtk/gdu-gtk.h>
+
+@@ -259,26 +258,6 @@
+ }
+
+ static gboolean
+-is_ctrl_pressed (void)
+-{
+- gboolean ret;
+- XkbStateRec state;
+- Bool status;
+-
+- ret = FALSE;
+-
+- gdk_error_trap_push ();
+- status = XkbGetState (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XkbUseCoreKbd, &state);
+- gdk_error_trap_pop ();
+-
+- if (status == Success) {
+- ret = ((state.mods & ControlMask) != 0);
+- }
+-
+- return ret;
+-}
+-
+-static gboolean
+ gdu_volume_grid_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+ {
+@@ -332,7 +311,7 @@
+ }
+
+ if (target != NULL) {
+- if (is_ctrl_pressed ()) {
++ if ((event->state & GDK_CONTROL_MASK) != 0) {
+ grid->priv->focused = target;
+ } else {
+ grid->priv->selected = target;
More information about the scm-commits
mailing list