rpms/gnome-power-manager/F-12 0001-Use-gnome-settings-daemon-popup-code.patch, NONE, 1.1 gnome-power-manager.spec, 1.178, 1.179

Bastien Nocera hadess at fedoraproject.org
Tue Oct 27 23:43:20 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/gnome-power-manager/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6999

Modified Files:
	gnome-power-manager.spec 
Added Files:
	0001-Use-gnome-settings-daemon-popup-code.patch 
Log Message:
* Tue Oct 27 2009 Bastien Nocera <bnocera at redhat.com> 2.28.1-3
- Update OSD to match gnome-settings-daemon's


0001-Use-gnome-settings-daemon-popup-code.patch:
 b/data/Makefile.am            |    3 
 b/src/Makefile.am             |    5 
 b/src/gpm-backlight.c         |   39 +
 b/src/gsd-media-keys-window.c | 1109 ++++++++++++++++++++++++++++++++++++++++++
 b/src/gsd-media-keys-window.h |   70 ++
 src/gpm-popup-window.c        |  725 ---------------------------
 src/gpm-popup-window.h        |   61 --
 7 files changed, 1215 insertions(+), 797 deletions(-)

--- NEW FILE 0001-Use-gnome-settings-daemon-popup-code.patch ---
>From db85afd7306ba8127b38f70feff281d4c4a6a022 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Tue, 27 Oct 2009 23:33:46 +0000
Subject: [PATCH] Use gnome-settings-daemon popup code

Instead of forking it.

https://bugzilla.gnome.org/show_bug.cgi?id=594664
---
 data/Makefile.am            |    3 +-
 src/Makefile.am             |    5 +-
 src/gpm-backlight.c         |   39 ++-
 src/gpm-popup-window.c      |  725 ----------------------------
 src/gpm-popup-window.h      |   61 ---
 src/gsd-media-keys-window.c | 1109 +++++++++++++++++++++++++++++++++++++++++++
 src/gsd-media-keys-window.h |   69 +++
 7 files changed, 1215 insertions(+), 796 deletions(-)
 delete mode 100644 src/gpm-popup-window.c
 delete mode 100644 src/gpm-popup-window.h
 create mode 100644 src/gsd-media-keys-window.c
 create mode 100644 src/gsd-media-keys-window.h

diff --git a/data/Makefile.am b/data/Makefile.am
index 1a76ac8..99df812 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -26,7 +26,8 @@ $(service_DATA): $(service_in_files) Makefile
 pkgdata_DATA =						\
 	gpm-statistics.ui				\
 	gpm-feedback-widget.ui				\
-	gpm-prefs.ui
+	gpm-prefs.ui					\
+	acme.ui
 
 EXTRA_DIST =						\
 	gnome-power-manager.schemas.in			\
diff --git a/src/Makefile.am b/src/Makefile.am
index b41da1f..b038669 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,7 @@ INCLUDES =						\
 	-DLIBDIR=\""$(libdir)"\" 			\
 	-DVERSION="\"$(VERSION)\"" 			\
 	-DGPM_DATA=\"$(pkgdatadir)\"			\
+	-DGTKBUILDERDIR=\"$(pkgdatadir)\"		\
 	-DDKP_DISABLE_DEPRECATED			\
 	-DEGG_LOG_FILE=\""/tmp/gpm.log"\"		\
 	-DEGG_VERBOSE="\"GPM_VERBOSE\""			\
@@ -161,8 +162,8 @@ gnome_power_manager_SOURCES =				\
 	gpm-networkmanager.h				\
 	gpm-networkmanager.c				\
 	gpm-stock-icons.h				\
-	gpm-popup-window.h				\
-	gpm-popup-window.c				\
+	gsd-media-keys-window.h				\
+	gsd-media-keys-window.c				\
 	gpm-engine.h					\
 	gpm-engine.c					\
 	$(NULL)
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index 7714bcc..92ec869 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -48,7 +48,7 @@
 #include "gpm-control.h"
 #include "gpm-common.h"
 #include "egg-debug.h"
-#include "gpm-popup-window.h"
+#include "gsd-media-keys-window.h"
 #include "gpm-dpms.h"
 #include "gpm-idle.h"
 #include "gpm-marshal.h"
@@ -167,6 +167,25 @@ gpm_backlight_set_brightness (GpmBacklight *backlight, guint percentage, GError
 }
 
 /**
+ * gpm_backlight_dialog_init:
+ *
+ * Initialises the popup, and makes sure that it matches the compositing of the screen.
+ **/
+static void
+dialog_init (GpmBacklight *backlight)
+{
+	if (backlight->priv->popup != NULL
+	    && !gsd_media_keys_window_is_valid (GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup))) {
+		gtk_widget_destroy (backlight->priv->popup);
+		backlight->priv->popup = NULL;
+	}
+
+	if (backlight->priv->popup == NULL) {
+		backlight->priv->popup= gsd_media_keys_window_new ();
+	}
+}
+
+/**
  * gpm_common_sum_scale:
  *
  * Finds the average between value1 and value2 set on a scale factor
@@ -261,7 +280,9 @@ gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean int
 
 	/* only show dialog if interactive */
 	if (interactive) {
-		gpm_popup_window_set_value (GPM_POPUP_WINDOW (backlight->priv->popup), (float) brightness);
+		dialog_init (backlight);
+		gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
+							round (brightness));
 		gtk_widget_show (backlight->priv->popup);
 	}
 
@@ -352,7 +373,9 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
 		/* show the new value */
 		if (ret) {
 			gpm_brightness_get (backlight->priv->brightness, &percentage);
-			gpm_popup_window_set_value (GPM_POPUP_WINDOW (backlight->priv->popup), (gfloat) percentage/100.0f);
+			dialog_init (backlight);
+			gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
+								percentage);
 			gtk_widget_show (backlight->priv->popup);
 			/* save the new percentage */
 			backlight->priv->master_percentage = percentage;
@@ -369,7 +392,9 @@ gpm_backlight_button_pressed_cb (GpmButton *button, const gchar *type, GpmBackli
 		/* show the new value */
 		if (ret) {
 			gpm_brightness_get (backlight->priv->brightness, &percentage);
-			gpm_popup_window_set_value (GPM_POPUP_WINDOW (backlight->priv->popup), (gfloat) percentage/100.0f);
+			dialog_init (backlight);
+			gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
+								percentage);
 			gtk_widget_show (backlight->priv->popup);
 			/* save the new percentage */
 			backlight->priv->master_percentage = percentage;
@@ -688,10 +713,10 @@ gpm_backlight_init (GpmBacklight *backlight)
 	gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout);
 
 	/* use a visual widget */
-	backlight->priv->popup = gpm_popup_window_new ();
+	backlight->priv->popup = gsd_media_keys_window_new ();
+	gsd_media_keys_window_set_action (GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
+					  GSD_MEDIA_KEYS_WINDOW_ACTION_BRIGHTNESS);
         gtk_window_set_position (GTK_WINDOW (backlight->priv->popup), GTK_WIN_POS_NONE);
-	gpm_popup_window_set_icon_name (GPM_POPUP_WINDOW (backlight->priv->popup),
-					GPM_STOCK_BRIGHTNESS_LCD);
 
 	/* DPMS mode poll class */
 	backlight->priv->dpms = gpm_dpms_new ();
diff --git a/src/gpm-popup-window.c b/src/gpm-popup-window.c
deleted file mode 100644
index 6cc4038..0000000
--- a/src/gpm-popup-window.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2006-2007 William Jon McCann <mccann at jhu.edu>
- * Copyright (C) 2009 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <math.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include "egg-debug.h"
-
-#include "gpm-popup-window.h"
-
-#define GPM_POPUP_WINDOW_DIALOG_TIMEOUT		2000	/* dialog timeout in ms */
-#define GPM_POPUP_WINDOW_DIALOG_FADE_TIMEOUT	1500	/* timeout before fade starts */
-#define GPM_POPUP_WINDOW_FADE_TIMEOUT		10	/* timeout in ms between each frame of the fade */
-
-#define GPM_POPUP_WINDOW_BG_ALPHA		0.50
-#define GPM_POPUP_WINDOW_FG_ALPHA		1.00
-
-#define GPM_POPUP_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_POPUP_WINDOW, GpmPopupWindowPrivate))
-
-struct GpmPopupWindowPrivate
-{
-	gboolean		 is_composited;
-	guint			 hide_timeout_id;
-	guint			 fade_timeout_id;
-	gdouble			 fade_out_alpha;
-	gfloat			 value;
[...1737 lines suppressed...]
+{
+        GdkColormap *colormap;
+        GtkAllocation allocation;
+        GdkBitmap *mask;
+        cairo_t *cr;
+
+        colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget));
+
+        if (colormap != NULL) {
+                gtk_widget_set_colormap (widget, colormap);
+        }
+
+        if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize) {
+                GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize (widget);
+        }
+
+        gtk_widget_get_allocation (widget, &allocation);
+        mask = gdk_pixmap_new (gtk_widget_get_window (widget),
+                               allocation.width,
+                               allocation.height,
+                               1);
+        cr = gdk_cairo_create (mask);
+
+        cairo_set_source_rgba (cr, 1., 1., 1., 0.);
+        cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+        cairo_paint (cr);
+
+        /* make the whole window ignore events */
+        gdk_window_input_shape_combine_mask (gtk_widget_get_window (widget), mask, 0, 0);
+        g_object_unref (mask);
+        cairo_destroy (cr);
+}
+
+static void
+gsd_media_keys_window_class_init (GsdMediaKeysWindowClass *klass)
+{
+        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+        widget_class->show = gsd_media_keys_window_real_show;
+        widget_class->hide = gsd_media_keys_window_real_hide;
+        widget_class->realize = gsd_media_keys_window_real_realize;
+
+        g_type_class_add_private (klass, sizeof (GsdMediaKeysWindowPrivate));
+}
+
+gboolean
+gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window)
+{
+        GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
+        return gdk_screen_is_composited (screen) == window->priv->is_composited;
+}
+
+static void
+gsd_media_keys_window_init (GsdMediaKeysWindow *window)
+{
+        GdkScreen *screen;
+
+        window->priv = GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE (window);
+
+        screen = gtk_widget_get_screen (GTK_WIDGET (window));
+
+        window->priv->is_composited = gdk_screen_is_composited (screen);
+
+        if (window->priv->is_composited) {
+                gdouble scalew, scaleh, scale;
+                gint size;
+
+                gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
+                gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
+
+                /* assume 130x130 on a 640x480 display and scale from there */
+                scalew = gdk_screen_get_width (screen) / 640.0;
+                scaleh = gdk_screen_get_height (screen) / 480.0;
+                scale = MIN (scalew, scaleh);
+                size = 130 * MAX (1, scale);
+
+                gtk_window_set_default_size (GTK_WINDOW (window), size, size);
+                g_signal_connect (window, "expose-event", G_CALLBACK (on_expose_event), window);
+
+                window->priv->fade_out_alpha = 1.0;
+        } else {
+                GtkBuilder *builder;
+                const gchar *objects[] = {"acme_frame", NULL};
+                GtkWidget *frame;
+
+                builder = gtk_builder_new ();
+                gtk_builder_add_objects_from_file (builder,
+                                                   GTKBUILDERDIR "/acme.ui",
+                                                   (char **) objects,
+                                                   NULL);
+
+                window->priv->image = GTK_IMAGE (gtk_builder_get_object (builder, "acme_image"));
+                window->priv->progress = GTK_WIDGET (gtk_builder_get_object (builder, "acme_volume_progressbar"));
+                frame = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                            "acme_frame"));
+
+                if (frame != NULL) {
+                        gtk_container_add (GTK_CONTAINER (window), frame);
+                        gtk_widget_show_all (frame);
+                }
+
+                /* The builder needs to stay alive until the window
+                   takes ownership of the frame (and its children)  */
+                g_object_unref (builder);
+        }
+}
+
+GtkWidget *
+gsd_media_keys_window_new (void)
+{
+        GObject *object;
+
+        object = g_object_new (GSD_TYPE_MEDIA_KEYS_WINDOW,
+                               "type", GTK_WINDOW_POPUP,
+                               "type-hint", GDK_WINDOW_TYPE_HINT_NOTIFICATION,
+                               "skip-taskbar-hint", TRUE,
+                               "skip-pager-hint", TRUE,
+                               "focus-on-map", FALSE,
+                               NULL);
+
+        return GTK_WIDGET (object);
+}
diff --git a/src/gsd-media-keys-window.h b/src/gsd-media-keys-window.h
new file mode 100644
index 0000000..dd4ae90
--- /dev/null
+++ b/src/gsd-media-keys-window.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
+ *
+ * Copyright (C) 2006 William Jon McCann <mccann at jhu.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef GSD_MEDIA_KEYS_WINDOW_H
+#define GSD_MEDIA_KEYS_WINDOW_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_MEDIA_KEYS_WINDOW            (gsd_media_keys_window_get_type ())
+#define GSD_MEDIA_KEYS_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj),  GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindow))
+#define GSD_MEDIA_KEYS_WINDOW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),   GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowClass))
+#define GSD_IS_MEDIA_KEYS_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj),  GSD_TYPE_MEDIA_KEYS_WINDOW))
+#define GSD_IS_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW))
+
+typedef struct GsdMediaKeysWindow                   GsdMediaKeysWindow;
+typedef struct GsdMediaKeysWindowClass              GsdMediaKeysWindowClass;
+typedef struct GsdMediaKeysWindowPrivate            GsdMediaKeysWindowPrivate;
+
+struct GsdMediaKeysWindow {
+        GtkWindow                   parent;
+
+        GsdMediaKeysWindowPrivate  *priv;
+};
+
+struct GsdMediaKeysWindowClass {
+        GtkWindowClass parent_class;
+};
+
+typedef enum {
+        GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME,
+        GSD_MEDIA_KEYS_WINDOW_ACTION_EJECT,
+        GSD_MEDIA_KEYS_WINDOW_ACTION_BRIGHTNESS
+} GsdMediaKeysWindowAction;
+
+GType                 gsd_media_keys_window_get_type          (void);
+
+GtkWidget *           gsd_media_keys_window_new               (void);
+void                  gsd_media_keys_window_set_action        (GsdMediaKeysWindow      *window,
+                                                               GsdMediaKeysWindowAction action);
+void                  gsd_media_keys_window_set_volume_muted  (GsdMediaKeysWindow      *window,
+                                                               gboolean                 muted);
+void                  gsd_media_keys_window_set_volume_level  (GsdMediaKeysWindow      *window,
+                                                               int                      level);
+gboolean              gsd_media_keys_window_is_valid          (GsdMediaKeysWindow      *window);
+
+G_END_DECLS
+
+#endif
-- 
1.6.5.rc2



Index: gnome-power-manager.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-power-manager/F-12/gnome-power-manager.spec,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -p -r1.178 -r1.179
--- gnome-power-manager.spec	22 Oct 2009 08:27:17 -0000	1.178
+++ gnome-power-manager.spec	27 Oct 2009 23:43:19 -0000	1.179
@@ -5,7 +5,7 @@
 Summary: GNOME power management service
 Name: gnome-power-manager
 Version: 2.28.1
-Release: 2%{?dist}
+Release: 3%{?dist}
 #Release: 0.5.%{?alphatag}git%{?dist}
 License: GPLv2+ and GFDL
 Group: Applications/System
@@ -21,6 +21,10 @@ Patch1: 0001-Do-not-show-About-and-Help-
 # Fedora-specific backport, already same UI in git master
 Patch2: 0002-Make-the-left-and-right-buttons-on-the-status-icon-b.patch
 
+# https://bugzilla.gnome.org/show_bug.cgi?id=594664
+%define		_default_patch_fuzz 2
+Patch3: 0001-Use-gnome-settings-daemon-popup-code.patch
+
 BuildRequires: libwnck-devel
 BuildRequires: hal-devel >= %{hal_version}
 BuildRequires: dbus-devel >= %{dbus_version}
@@ -70,6 +74,7 @@ Extra GNOME power management application
 #%setup -q -n %{?name}-%{?version}-%{?alphatag}
 %patch1 -p1 -b .remove-help
 %patch2 -p1 -b .uni-menu
+%patch3 -p1 -b .osd
 
 %build
 %configure \
@@ -188,6 +193,9 @@ fi
 %{_datadir}/icons/hicolor/*/apps/gnome-inhibit-applet.*
 
 %changelog
+* Tue Oct 27 2009 Bastien Nocera <bnocera at redhat.com> 2.28.1-3
+- Update OSD to match gnome-settings-daemon's
+
 * Thu Oct 22 2009 Richard Hughes  <rhughes at redhat.com> - 2.28.1-2
 - Backport two patches from git master to polish the UI for F12.
 




More information about the fedora-extras-commits mailing list