update patch

This commit is contained in:
Matthias Clasen 2010-11-03 16:59:12 -04:00
parent 4b496fa4e2
commit eceff2866f

View File

@ -1,6 +1,6 @@
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 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.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 +++ gnome-disk-utility-2.32.0/src/notification/notification-main.c 2010-11-03 16:52:01.192241985 -0400
@@ -39,16 +39,12 @@ typedef struct @@ -39,16 +39,12 @@ typedef struct
{ {
GduPool *pool; GduPool *pool;
@ -79,7 +79,7 @@ diff -up gnome-disk-utility-2.32.0/src/notification/notification-main.c.no-statu
g_signal_handlers_disconnect_by_func (data->pool, on_device_added, data); 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_removed, data);
g_signal_handlers_disconnect_by_func (data->pool, on_device_changed, data); g_signal_handlers_disconnect_by_func (data->pool, on_device_changed, data);
@@ -478,72 +443,69 @@ update_ata_smart_failures (NotificationD @@ -478,197 +443,75 @@ update_ata_smart_failures (NotificationD
g_list_foreach (devices, (GFunc) g_object_unref, NULL); g_list_foreach (devices, (GFunc) g_object_unref, NULL);
g_list_free (devices); g_list_free (devices);
@ -191,7 +191,132 @@ diff -up gnome-disk-utility-2.32.0/src/notification/notification-main.c.no-statu
out: out:
; ;
} }
@@ -693,7 +655,7 @@ main (int argc, char **argv)
/* ---------------------------------------------------------------------------------------------------- */
-static void
-on_menu_item_activated (GtkMenuItem *menu_item,
- gpointer user_data)
-{
- NotificationData *data = user_data;
- GduDevice *device;
- GdkScreen *screen;
- gchar *command_line;
-
- device = GDU_DEVICE (g_object_get_data (G_OBJECT (menu_item), "gdu-device"));
-
- screen = gtk_status_icon_get_screen (data->status_icon);
- command_line = g_strdup_printf ("palimpsest --show-drive=%s", gdu_device_get_device_file (device));
- gdk_spawn_command_line_on_screen (screen, command_line, NULL);
- g_free (command_line);
-}
-
-static void
-show_menu_for_status_icon (NotificationData *data)
-{
- GtkWidget *menu;
- GList *l;
-
- /* remove notifications when the user clicks the icon */
- 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;
- }
-
- /* TODO: it would be nice to display something like
- *
- * Select a disk to get more information...
- * -----------------------------------------------
- * [Icon] 80 GB ATA INTEL SSDSA2MH08
- * [Icon] 250GB WD 2500JB External
- *
- * but unfortunately that would require fucking with gtk+'s
- * internals the same way the display-settings applet does
- * it; see e.g. line 951 of
- *
- * http://svn.gnome.org/viewvc/gnome-settings-daemon/trunk/plugins/xrandr/gsd-xrandr-manager.c?revision=810&view=markup
- */
-
- /* TODO: Perhaps it would also be nice to have a "Preferences..." menu item such
- * that the user can turn off notifications on a per-device basis.
- */
-
- menu = gtk_menu_new ();
- for (l = data->ata_smart_failures; l != NULL; l = l->next) {
- GduDevice *device = GDU_DEVICE (l->data);
- GduPresentable *presentable;
- gchar *name;
- gchar *vpd_name;
- const gchar *status;
- gchar *status_desc;
- gboolean highlight;
- GdkPixbuf *pixbuf;
- GtkWidget *image;
- GtkWidget *menu_item;
- gchar *s;
-
- presentable = gdu_pool_get_drive_by_device (data->pool, device);
- name = gdu_presentable_get_name (presentable);
- vpd_name = gdu_presentable_get_vpd_name (presentable);
-
- status = gdu_device_drive_ata_smart_get_status (device);
- status_desc = gdu_util_ata_smart_status_to_desc (status, &highlight, NULL, NULL);
-
- if (highlight) {
- s = g_strdup_printf ("<span fgcolor=\"red\"><b>%s</b></span>", status_desc);
- g_free (status_desc);
- status_desc = s;
- }
-
- s = g_strdup_printf ("<b>%s</b> %s\n"
- "<small>%s</small>",
- name,
- vpd_name,
- status_desc);
-
- menu_item = gtk_image_menu_item_new_with_label (s);
- gtk_label_set_use_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (menu_item))), TRUE);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menu_item), TRUE);
-
- g_object_set_data_full (G_OBJECT (menu_item), "gdu-device", g_object_ref (device), g_object_unref);
-
- pixbuf = gdu_util_get_pixbuf_for_presentable (presentable, GTK_ICON_SIZE_SMALL_TOOLBAR);
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (pixbuf);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
-
- g_signal_connect (menu_item,
- "activate",
- G_CALLBACK (on_menu_item_activated),
- data);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
-
- g_free (name);
- g_free (vpd_name);
- g_free (status_desc);
- g_free (s);
- g_object_unref (presentable);
- }
- gtk_widget_show_all (menu);
-
- gtk_menu_popup (GTK_MENU (menu),
- NULL,
- NULL,
- gtk_status_icon_position_menu,
- data->status_icon,
- 0,
- gtk_get_current_event_time ());
-
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
int
main (int argc, char **argv)
{
@@ -693,7 +536,7 @@ main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);