=== modified file 'Makefile.am'
--- Makefile.am 2010-03-09 21:10:09 +0000
+++ Makefile.am 2010-07-24 23:31:47 +0000
@@ -1,8 +1,6 @@
NULL =
-if HAVE_VALA
VALA_BINDINGS = bindings/vala
-endif
SUBDIRS = \
libawn \
=== modified file 'applets/quick-prefs/applet.vala'
--- applets/quick-prefs/applet.vala 2010-05-28 21:49:08 +0000
+++ applets/quick-prefs/applet.vala 2010-07-24 23:31:47 +0000
@@ -54,9 +54,9 @@
public PrefsApplet (string canonical_name, string uid, int panel_id)
{
- this.canonical_name = canonical_name;
- this.uid = uid;
- this.panel_id = panel_id;
+ GLib.Object (canonical_name: canonical_name,
+ uid: uid,
+ panel_id: panel_id);
}
construct
=== modified file 'applets/taskmanager/dock-manager-api.vala'
--- applets/taskmanager/dock-manager-api.vala 2010-04-11 12:41:57 +0000
+++ applets/taskmanager/dock-manager-api.vala 2010-07-24 23:31:47 +0000
@@ -66,7 +66,7 @@
});
*/
- var conn = Bus.get (BusType.SESSION);
+ var conn = DBus.Bus.get (DBus.BusType.SESSION);
string obj_path = "/org/freedesktop/DockManager";
conn.register_object (obj_path, this);
}
@@ -244,7 +244,7 @@
{
this.icon = icon;
- var conn = Bus.get (BusType.SESSION);
+ var conn = DBus.Bus.get (DBus.BusType.SESSION);
this.object_path = "/org/freedesktop/DockManager/Item%d".printf (counter++);
conn.register_object (this.object_path, this);
=== modified file 'configure.in'
--- configure.in 2010-04-11 17:06:01 +0000
+++ configure.in 2010-07-24 23:31:47 +0000
@@ -60,20 +60,11 @@
dnl Vala support
dnl ==============================================
-AC_ARG_WITH(vala, AS_HELP_STRING([--with-vala],[Enables installation of the Vala bindings]),,[with_vala=yes])
-
-if test "$with_vala" != "no"; then
- VALA_PROG_VALAC(0.7.10)
- if test -n "$VALAC"; then
- if test "$USE_MAINTAINER_MODE" = "yes"; then
- AC_PATH_PROG(VALA_GEN_INTROSPECT, vala-gen-introspect, vala-gen-introspect, [])
- AC_PATH_PROG(VAPIGEN, vapigen, vapigen, [])
- fi
- else
- with_vala=no
- fi
+VALA_PROG_VALAC(0.8.1)
+if test "$USE_MAINTAINER_MODE" = "yes"; then
+ AC_PATH_PROG(VALA_GEN_INTROSPECT, vala-gen-introspect, vala-gen-introspect, [])
+ AC_PATH_PROG(VAPIGEN, vapigen, vapigen, [])
fi
-AM_CONDITIONAL(HAVE_VALA, test -n "$VALAC")
dnl ==============================================
dnl Check for Python modules
@@ -145,10 +136,8 @@
LDA_DEFSDIR=`$PKG_CONFIG --variable=defsdir desktop-agnostic`
AC_SUBST(LDA_DEFSDIR)
-if test "$with_vala" != "no"; then
- LDA_VAPIDIR="`$PKG_CONFIG --variable=vapidir desktop-agnostic`"
- AC_SUBST(LDA_VAPIDIR)
-fi
+LDA_VAPIDIR="`$PKG_CONFIG --variable=vapidir desktop-agnostic`"
+AC_SUBST(LDA_VAPIDIR)
AC_CHECK_LIB(m, lround)
@@ -238,7 +227,5 @@
echo ""
echo " prefix: ${prefix}"
echo ""
-echo " Vala Support: ${with_vala}"
-echo ""
echo " Documentation: ${enable_gtk_doc}"
echo ""
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-05-16 19:12:31 +0000
+++ src/Makefile.am 2010-07-24 23:31:47 +0000
@@ -13,6 +13,30 @@
-I$(builddir) \
$(NULL)
+VALA_FILES = \
+ awn-panel-dispatcher.vala \
+ awn-app.vala \
+ $(NULL)
+
+VALA_FLAGS = \
+ $(top_builddir)/bindings/vala/awn.vapi \
+ awn-panel.vapi \
+ --pkg dbus-glib-1 \
+ --pkg gtk+-2.0 \
+ --pkg desktop-agnostic-cfg \
+ $(NULL)
+
+awn-core.vala.stamp: $(VALA_FILES)
+ $(foreach vala_file,$(VALA_FILES),\
+ $(VALAC) -C -H $(vala_file:.vala=.h) $(vala_file) $(VALA_FLAGS) && \
+ $(SED) -i -r 's/^#include <(awn.+h)>$$/#include "\1"/' $(vala_file:.vala=.)[ch] || exit 1;)
+ touch "$@"
+
+VALA_GENERATED_FILES = \
+ $(VALA_FILES:.vala=.c) \
+ $(VALA_FILES:.vala=.h) \
+ $(NULL)
+
bin_PROGRAMS = avant-window-navigator
avant_window_navigator_LDADD = \
@@ -22,9 +46,6 @@
avant_window_navigator_SOURCES = \
awn-main.c \
- awn-app.c \
- awn-app.h \
- awn-app-glue.h \
awn-applet-manager.c \
awn-applet-manager.h \
awn-applet-proxy.c \
@@ -50,7 +71,6 @@
awn-monitor.h \
awn-panel.c \
awn-panel.h \
- awn-panel-glue.h \
awn-separator.c \
awn-separator.h \
awn-throbber.c \
@@ -62,27 +82,22 @@
inlinepixbufs.h \
xutils.h \
xutils.c \
+ $(VALA_GENERATED_FILES) \
$(NULL)
-# DBus glue
-awn-app-glue.h: awn-app-dbus.xml Makefile
- $(QUIET_GEN)$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_app --mode=glib-server --output=$@ $<
-
-awn-panel-glue.h: awn-panel-dbus.xml Makefile
- $(QUIET_GEN)$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=awn_panel --mode=glib-server --output=$@ $<
-
BUILT_SOURCES = \
- awn-app-glue.h \
- awn-panel-glue.h \
+ awn-core.vala.stamp \
$(MARSHALFILES) \
$(NULL)
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ $(VALA_GENERATED_FILES) \
+ $(NULL)
EXTRA_DIST = \
- awn-app-dbus.xml \
- awn-panel-dbus.xml \
awn-marshal.list \
+ $(VALA_GENERATED_FILES) \
$(NULL)
# vim: set ts=8 sts=8 sw=8 :
=== removed file 'src/awn-app-dbus.xml'
--- src/awn-app-dbus.xml 2009-11-09 00:45:42 +0000
+++ src/awn-app-dbus.xml 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
=== removed file 'src/awn-app.c'
--- src/awn-app.c 2010-04-09 23:58:31 +0000
+++ src/awn-app.c 1970-01-01 00:00:00 +0000
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2008 Neil J. Patel
- *
- * 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 library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authored by Neil Jagdish Patel
- *
- */
-
-/*
- * AwnApp is the 'controller' for the panel. It will launch the panel with the
- * correct settings.
- *
- * In the future, AwnApp will be responsible for launching each Awn panel
- * separately, and dealing with the configuration backend for each panel.
- */
-
-#include
-
-#include
-#include
-
-#include
-#include
-
-#include
-
-#include "awn-app.h"
-#include "awn-defines.h"
-#include "awn-panel.h"
-#include "awn-app-glue.h"
-#include
-
-
-G_DEFINE_TYPE (AwnApp, awn_app, G_TYPE_OBJECT)
-
-#define AWN_APP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
- AWN_TYPE_APP, AwnAppPrivate))
-
-struct _AwnAppPrivate
-{
- DBusGConnection *connection;
- DesktopAgnosticConfigClient *client;
-
- GHashTable *panels;
-};
-
-/* GObject functions */
-static void
-awn_app_finalize (GObject *app)
-{
- AwnAppPrivate *priv;
-
- g_return_if_fail (AWN_IS_APP (app));
- priv = AWN_APP (app)->priv;
-
- g_object_unref (priv->client);
-
- G_OBJECT_CLASS (awn_app_parent_class)->finalize (app);
-}
-
-static void
-awn_app_class_init (AwnAppClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
- obj_class->finalize = awn_app_finalize;
-
- g_type_class_add_private (obj_class, sizeof (AwnAppPrivate));
-
- dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
- &dbus_glib_awn_app_object_info);
-}
-
-static void
-awn_app_init (AwnApp *app)
-{
- AwnAppPrivate *priv;
- GError *error = NULL;
- GValueArray *panels = NULL;
-
- priv = app->priv = AWN_APP_GET_PRIVATE (app);
-
- priv->panels = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
- priv->client = awn_config_get_default (0, &error);
-
- if (error)
- {
- g_warning ("Unable to retrieve the configuration client: %s",
- error->message);
- g_error_free (error);
- gtk_main_quit ();
- }
-
- gtk_window_set_default_icon_name ("avant-window-navigator");
-
- /* Grab a connection to the bus */
- priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (priv->connection == NULL)
- {
- g_warning ("Unable to make connection to the D-Bus session bus: %s",
- error->message);
- g_error_free (error);
- gtk_main_quit ();
- }
-
- panels = desktop_agnostic_config_client_get_list (priv->client,
- AWN_GROUP_PANELS,
- AWN_PANELS_IDS,
- &error);
-
- if (error)
- {
- g_error ("Unable to retrieve panels config value: %s",
- error->message);
- g_error_free (error);
- return;
- }
-
- if (panels->n_values == 0)
- {
- gboolean is_gconf = FALSE;
- GType config_type = desktop_agnostic_config_get_type (NULL);
-
- if (config_type)
- {
- const gchar *config_backend = g_type_name (config_type);
- is_gconf = strstr (config_backend, "GConf") != NULL;
- }
- g_error ("No panels to create! %s", is_gconf ?
- "\n** Please check that the gconf-schema is installed."
- "\n** You might also try to run `killall gconfd-2`." : "");
- return;
- }
-
- // FIXME: we could check here if there are any values in the panel_list
- // and show a "Restart gconfd-2? dialog" if there aren't
-
- for (guint i=0; i < panels->n_values; i++)
- {
- GtkWidget *panel;
-
- GValue *value = g_value_array_get_nth (panels, i);
-
- gint panel_id = g_value_get_int (value);
- panel = awn_panel_new_with_panel_id (panel_id);
-
- gchar *object_path = g_strdup_printf (AWN_DBUS_PANEL_PATH "%d", panel_id);
-
- dbus_g_connection_register_g_object (priv->connection,
- object_path, G_OBJECT (panel));
-
- g_hash_table_insert (priv->panels, object_path, panel);
-
- gtk_widget_show (panel);
- }
-
- g_value_array_free (panels);
-}
-
-gboolean
-awn_app_remove_panel (AwnApp *app, gint panel_id, GError *error)
-{
- // remove the panel for real once we do multiple panels
- if (panel_id == AWN_PANEL_ID_DEFAULT)
- {
- gtk_main_quit ();
- }
-
- return TRUE;
-}
-
-gboolean
-awn_app_get_panels (AwnApp *app, GPtrArray **panels)
-{
- AwnAppPrivate *priv;
- GList *list, *l;
-
- priv = app->priv;
-
- *panels = g_ptr_array_sized_new (g_hash_table_size (priv->panels));
-
- list = l = g_hash_table_get_keys (priv->panels); // list should be freed
-
- while (list)
- {
- g_ptr_array_add (*panels, g_strdup (list->data));
-
- list = list->next;
- }
-
- g_list_free (l);
-
- return TRUE;
-}
-
-AwnApp*
-awn_app_get_default (void)
-{
- static AwnApp *app = NULL;
-
- if (app == NULL)
- {
- app = g_object_new (AWN_TYPE_APP, NULL);
- }
-
- return app;
-}
-
=== removed file 'src/awn-app.h'
--- src/awn-app.h 2009-11-09 00:45:42 +0000
+++ src/awn-app.h 1970-01-01 00:00:00 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2008 Neil Jagdish Patel
- *
- * 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 library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authored by Neil Jagdish Patel
- *
- */
-
-#ifndef _HAVE_AWN_APP_H
-#define _HAVE_AWN_APP_H
-
-#include
-#include
-
-G_BEGIN_DECLS
-
-#define AWN_TYPE_APP (awn_app_get_type ())
-
-#define AWN_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- AWN_TYPE_APP, AwnApp))
-
-#define AWN_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- AWN_TYPE_APP, AwnAppClass))
-
-#define AWN_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- AWN_TYPE_APP))
-
-#define AWN_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- AWN_TYPE_APP))
-
-#define AWN_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- AWN_TYPE_APP, AwnAppClass))
-
-typedef struct _AwnApp AwnApp;
-typedef struct _AwnAppClass AwnAppClass;
-typedef struct _AwnAppPrivate AwnAppPrivate;
-
-
-struct _AwnApp
-{
- GObject parent;
-
- /*< private >*/
- AwnAppPrivate *priv;
-};
-
-struct _AwnAppClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- /*< private >*/
- void (*_awn_app_1) (void);
- void (*_awn_app_2) (void);
- void (*_awn_app_3) (void);
- void (*_awn_app_4) (void);
-};
-
-GType awn_app_get_type (void) G_GNUC_CONST;
-
-AwnApp * awn_app_get_default (void);
-
-gboolean awn_app_remove_panel (AwnApp *app, gint panel_id, GError *error);
-
-gboolean awn_app_get_panels (AwnApp *app, GPtrArray **panels);
-
-G_END_DECLS
-
-#endif /* _HAVE_AWN_APP_H */
=== added file 'src/awn-app.vala'
--- src/awn-app.vala 1970-01-01 00:00:00 +0000
+++ src/awn-app.vala 2010-07-24 23:31:47 +0000
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2010 Michal Hruby
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Authored by Michal Hruby
+ *
+ */
+
+using DBus;
+
+namespace Awn
+{
+ [DBus (name="org.awnproject.Awn.App")]
+ public interface AppDBusInterface: GLib.Object
+ {
+ public abstract ObjectPath[] get_panels () throws DBus.Error;
+ public abstract void remove_panel (int panel_id) throws DBus.Error;
+ }
+
+ public class Application: GLib.Object, AppDBusInterface
+ {
+ private static Application instance;
+
+ private HashTable panels;
+ private Connection connection;
+ private DesktopAgnostic.Config.Client client;
+
+ private Application ()
+ {
+ this.panels = new HashTable.full (str_hash, str_equal,
+ g_free, g_object_unref);
+ this.client = Config.get_default (0);
+
+ Gtk.Window.set_default_icon_name ("avant-window-navigator");
+
+ this.connection = DBus.Bus.get (DBus.BusType.SESSION);
+ this.connection.register_object ("/org/awnproject/Awn", this);
+
+ try
+ {
+ var panel_ids = this.client.get_list ("panels", "panel_list");
+
+ if (panel_ids.n_values == 0)
+ {
+ bool is_gconf = false;
+ Type config_type = DesktopAgnostic.Config.get_type ();
+ if (config_type > 0)
+ {
+ is_gconf = config_type.name ().str ("GConf") != null;
+ }
+ error ("No panels to create! %s", is_gconf ?
+ "\n** Please check that the gconf-schema is installed." +
+ "\n** You might want to try running `killall gconfd-2`." : "");
+ }
+
+ foreach (Value val in panel_ids)
+ {
+ int panel_id = val.get_int ();
+ string path = "/org/awnproject/Awn/Panel%d".printf (panel_id);
+
+ Panel panel = new Panel.with_panel_id (panel_id);
+
+ this.panels.insert ((owned)path, panel);
+
+ panel.show ();
+ }
+
+ this.client.notify_add ("panels", "panel_list", this.panels_changed);
+ }
+ catch (GLib.Error e)
+ {
+ error ("Unable to retrieve panels config value: %s", e.message);
+ }
+ }
+
+ private void panels_changed (string key, string group, Value val)
+ {
+ List untouched_panels = new List ();
+ foreach (var p in this.panels.get_values ())
+ {
+ untouched_panels.append (p);
+ }
+
+ unowned ValueArray arr = (ValueArray) val.get_boxed ();
+ foreach (Value v in arr)
+ {
+ int panel_id = v.get_int ();
+ string path = "/org/awnproject/Awn/Panel%d".printf (panel_id);
+ unowned Panel? p = this.panels.lookup (path);
+
+ if (p == null)
+ {
+ var panel = new Panel.with_panel_id (panel_id);
+ this.panels.insert ((owned)path, panel);
+
+ panel.show ();
+ }
+ else
+ {
+ untouched_panels.remove (p);
+ }
+ }
+
+ foreach (unowned Panel p in untouched_panels)
+ {
+ string path = "/org/awnproject/Awn/Panel%d".printf (p.panel_id);
+ this.panels.remove (path);
+ p.destroy ();
+ }
+ }
+
+ public ObjectPath[] get_panels () throws DBus.Error
+ {
+ var keys = this.panels.get_keys ();
+ keys.sort (strcmp);
+
+ ObjectPath[] paths = new ObjectPath[keys.length ()];
+ int i = 0;
+ foreach (unowned string path in keys)
+ {
+ paths[i++] = new ObjectPath (path);
+ }
+
+ return paths;
+ }
+
+ public void remove_panel (int panel_id) throws DBus.Error
+ {
+ if (panel_id == 1)
+ {
+ Gtk.main_quit ();
+ }
+ else
+ {
+ // TODO
+ }
+ }
+
+ public static unowned Application get_default ()
+ {
+ if (instance == null)
+ {
+ instance = new Application ();
+ }
+ return instance;
+ }
+ }
+}
+
=== modified file 'src/awn-background-lucido.c'
--- src/awn-background-lucido.c 2010-07-16 10:51:33 +0000
+++ src/awn-background-lucido.c 2010-07-24 23:31:47 +0000
@@ -160,6 +160,7 @@
g_return_if_fail (manager);
g_signal_connect_swapped (manager, "applets-refreshed",
G_CALLBACK (awn_background_lucido_applets_refreshed), bg);
+ awn_background_lucido_applets_refreshed (AWN_BACKGROUND (bg));
}
static void
@@ -234,7 +235,6 @@
priv->tid = 0;
priv->pos = g_array_new (FALSE, TRUE, sizeof (gfloat));
priv->pos_size = 0;
- awn_background_lucido_applets_refreshed (AWN_BACKGROUND (bg));
}
AwnBackground *
=== modified file 'src/awn-background.c'
--- src/awn-background.c 2010-07-16 10:51:33 +0000
+++ src/awn-background.c 2010-07-24 23:31:47 +0000
@@ -714,7 +714,7 @@
void
awn_background_draw (AwnBackground *bg,
- cairo_t *cr,
+ cairo_t *cr,
GtkPositionType position,
GdkRectangle *area)
{
@@ -735,9 +735,12 @@
if (klass->get_needs_redraw (bg, position, area))
{
cairo_t *temp_cr;
+ gdouble clip_x1, clip_x2, clip_y1, clip_y2;
gint full_width = area->x + area->width;
gint full_height = area->y + area->height;
+ cairo_clip_extents (cr, &clip_x1, &clip_y1, &clip_x2, &clip_y2);
+
gboolean realloc_needed = bg->helper_surface == NULL ||
cairo_image_surface_get_width (bg->helper_surface) != full_width ||
cairo_image_surface_get_height (bg->helper_surface) != full_height;
@@ -753,10 +756,16 @@
full_width,
full_height);
temp_cr = cairo_create (bg->helper_surface);
+ cairo_rectangle (temp_cr, clip_x1, clip_y1,
+ clip_x2-clip_x1, clip_y2-clip_y1);
+ cairo_clip (temp_cr);
}
else
{
temp_cr = cairo_create (bg->helper_surface);
+ cairo_rectangle (temp_cr, clip_x1, clip_y1,
+ clip_x2-clip_x1, clip_y2-clip_y1);
+ cairo_clip (temp_cr);
cairo_set_operator (temp_cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (temp_cr);
cairo_set_operator (temp_cr, CAIRO_OPERATOR_OVER);
=== modified file 'src/awn-main.c'
--- src/awn-main.c 2010-04-21 22:03:42 +0000
+++ src/awn-main.c 2010-07-24 23:31:47 +0000
@@ -70,7 +70,7 @@
gint
main (gint argc, gchar *argv[])
{
- AwnApp *app;
+ AwnApplication *app;
GOptionContext *context;
DBusGConnection *connection;
DBusGProxy *proxy;
@@ -147,10 +147,7 @@
textdomain (GETTEXT_PACKAGE);
/* Launch Awn */
- app = awn_app_get_default ();
- dbus_g_connection_register_g_object (connection,
- AWN_DBUS_APP_PATH,
- G_OBJECT (app));
+ app = awn_application_get_default ();
g_unsetenv ("DESKTOP_AUTOSTART_ID");
gtk_main ();
=== modified file 'src/awn-monitor.c'
--- src/awn-monitor.c 2010-05-29 17:17:22 +0000
+++ src/awn-monitor.c 2010-07-24 23:31:47 +0000
@@ -242,6 +242,18 @@
priv = AWN_MONITOR_GET_PRIVATE (object);
+ if (priv->size_signal_id)
+ {
+ g_signal_handler_disconnect (priv->screen, priv->size_signal_id);
+ priv->size_signal_id = 0;
+ }
+
+ if (priv->monitors_signal_id)
+ {
+ g_signal_handler_disconnect (priv->screen, priv->monitors_signal_id);
+ priv->monitors_signal_id = 0;
+ }
+
desktop_agnostic_config_client_unbind_all_for_object (priv->client,
object, NULL);
=== removed file 'src/awn-panel-dbus.xml'
--- src/awn-panel-dbus.xml 2010-01-01 12:50:38 +0000
+++ src/awn-panel-dbus.xml 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
=== added file 'src/awn-panel-dispatcher.vala'
--- src/awn-panel-dispatcher.vala 1970-01-01 00:00:00 +0000
+++ src/awn-panel-dispatcher.vala 2010-07-24 23:31:47 +0000
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2010 Michal Hruby
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Authored by Michal Hruby
+ *
+ */
+
+namespace Awn
+{
+ public struct ImageStruct
+ {
+ int width;
+ int height;
+ int rowstride;
+ bool has_alpha;
+ int bits_per_sample;
+ int num_channels;
+ char[] pixel_data;
+ }
+
+ [DBus (name="org.awnproject.Awn.Panel")]
+ public interface PanelDBusInterface: Object
+ {
+ public abstract void add_applet (string desktop_file) throws DBus.Error;
+ public abstract void delete_applet (string uid) throws DBus.Error;
+
+ public abstract int64 docklet_request (int min_size,
+ bool shrink,
+ bool expand) throws DBus.Error;
+
+ public abstract string[] get_inhibitors () throws DBus.Error;
+ public abstract ImageStruct get_snapshot () throws DBus.Error;
+
+ public abstract uint inhibit_autohide (DBus.BusName sender,
+ string app_name,
+ string reason) throws DBus.Error;
+ public abstract void uninhibit_autohide (uint cookie) throws DBus.Error;
+
+ // FIXME: do we really need this?
+ public abstract void set_applet_flags (string uid,
+ int flags) throws DBus.Error;
+
+ public abstract double offset_modifier { get; }
+ public abstract int max_size { get; }
+ public abstract int offset { get; set; }
+ public abstract int path_type { get; }
+ public abstract int position { get; set; }
+ public abstract int size { get; set; }
+ public abstract int64 panel_xid { get; }
+
+ public signal void destroy_applet (string uid);
+ public signal void destroy_notify ();
+ public signal void property_changed (string prop_name, Value value);
+ }
+
+ public class PanelDispatcher: Object, PanelDBusInterface
+ {
+ public unowned Panel panel { get; construct; }
+
+ public PanelDispatcher (Panel panel)
+ {
+ Object (panel: panel);
+
+ panel.size_changed.connect ( (p, s) =>
+ {
+ this.property_changed ("size", s);
+ });
+ panel.position_changed.connect ( (p, pos) =>
+ {
+ this.property_changed ("position", pos);
+ });
+ panel.offset_changed.connect ( (p, o) =>
+ {
+ this.property_changed ("offset", o);
+ });
+ panel.property_changed.connect ( (p, pn, v) =>
+ {
+ this.property_changed (pn, v);
+ });
+
+ var conn = DBus.Bus.get (DBus.BusType.SESSION);
+ string obj_path = "/org/awnproject/Awn/Panel%d".printf(panel.panel_id);
+ conn.register_object (obj_path, this);
+ }
+
+ public void add_applet (string desktop_file) throws DBus.Error
+ {
+ panel.add_applet (desktop_file);
+ }
+ public void delete_applet (string uid) throws DBus.Error
+ {
+ panel.delete_applet (uid);
+ }
+
+ // FIXME: break this API and add the docklet flags from
+ // set_applet_flags () method here
+ public int64 docklet_request (int min_size, bool shrink, bool expand) throws DBus.Error
+ {
+ return panel.docklet_request (min_size, shrink, expand);
+ }
+
+ public string[] get_inhibitors () throws DBus.Error
+ {
+ string[] reasons = panel.get_inhibitors ();
+
+ return reasons;
+ }
+
+ public ImageStruct get_snapshot () throws DBus.Error
+ {
+ var result = ImageStruct ();
+ panel.get_snapshot (out result.width,
+ out result.height,
+ out result.rowstride,
+ out result.has_alpha,
+ out result.bits_per_sample,
+ out result.num_channels,
+ out result.pixel_data);
+
+ return result;
+ }
+
+ public uint inhibit_autohide (DBus.BusName sender,
+ string app_name,
+ string reason) throws DBus.Error
+ {
+ return panel.inhibit_autohide (sender, app_name, reason);
+ }
+
+ public void uninhibit_autohide (uint cookie) throws DBus.Error
+ {
+ panel.uninhibit_autohide (cookie);
+ }
+
+ public void set_applet_flags (string uid, int flags) throws DBus.Error
+ {
+ panel.set_applet_flags (uid, flags);
+ }
+
+ public double offset_modifier
+ {
+ get
+ {
+ return panel.offset_modifier;
+ }
+ }
+
+ public int max_size
+ {
+ get
+ {
+ return panel.max_size;
+ }
+ }
+
+ public int offset
+ {
+ get
+ {
+ return panel.offset;
+ }
+ set
+ {
+ panel.offset = value;
+ }
+ }
+
+ public int path_type
+ {
+ get
+ {
+ return panel.path_type;
+ }
+ }
+
+ public int position
+ {
+ get
+ {
+ return panel.position;
+ }
+ set
+ {
+ panel.position = value;
+ }
+ }
+
+ public int size
+ {
+ get
+ {
+ return panel.size;
+ }
+ set
+ {
+ panel.size = value;
+ }
+ }
+
+ public int64 panel_xid
+ {
+ get
+ {
+ return panel.panel_xid;
+ }
+ }
+ }
+}
=== modified file 'src/awn-panel.c'
--- src/awn-panel.c 2010-07-07 15:40:09 +0000
+++ src/awn-panel.c 2010-07-24 23:31:47 +0000
@@ -48,6 +48,7 @@
#include "awn-defines.h"
#include "awn-marshal.h"
#include "awn-monitor.h"
+#include "awn-panel-dispatcher.h"
#include "awn-throbber.h"
#include "awn-x.h"
@@ -68,6 +69,7 @@
GHashTable *inhibits;
guint startup_inhibit_cookie;
+ AwnPanelDispatcher *dbus_proxy;
AwnBackground *bg;
GtkWidget *alignment;
@@ -296,7 +298,9 @@
GdkEventButton *event);
static gboolean awn_panel_resize_timeout (gpointer data);
-static void awn_panel_add (GtkContainer *window,
+static void awn_panel_add (GtkContainer *window,
+ GtkWidget *widget);
+static void awn_panel_remove (GtkContainer *window,
GtkWidget *widget);
static void awn_panel_set_offset (AwnPanel *panel,
@@ -362,6 +366,11 @@
static gboolean awn_panel_set_drag_proxy (AwnPanel *panel,
gboolean check_mouse_pos);
+static void dbus_inhibitor_lost (AwnDBusWatcher *watcher,
+ gchar *name,
+ AwnInhibitItem *item);
+
+
/*
* GOBJECT CODE
*/
@@ -494,6 +503,7 @@
return priv->dnd_proxy_win != NULL;
}
+#if !GTK_CHECK_VERSION(2, 19, 5)
static gboolean
awn_panel_drag_motion (GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time_)
@@ -512,6 +522,7 @@
return TRUE;
}
+#endif
static gboolean
on_startup_complete (AwnPanel *panel)
@@ -606,6 +617,9 @@
G_CALLBACK (on_window_state_event), NULL);
g_signal_connect (panel, "delete-event",
G_CALLBACK (gtk_true), NULL);
+
+ /* DBus interface */
+ priv->dbus_proxy = awn_panel_dispatcher_new (AWN_PANEL (object));
/* Contents */
priv->manager = awn_applet_manager_new_from_config (priv->client);
@@ -1299,6 +1313,11 @@
{
AwnInhibitItem *item = data;
+ // remove the dbus watcher
+ g_signal_handlers_disconnect_by_func (awn_dbus_watcher_get_default (),
+ G_CALLBACK (dbus_inhibitor_lost),
+ item);
+
if (item->description) g_free (item->description);
g_free (item);
@@ -1352,7 +1371,7 @@
static gboolean awn_panel_check_mouse_pos (AwnPanel *panel,
MouseCheckType check_type)
{
- g_return_val_if_fail(AWN_IS_PANEL(panel), FALSE);
+ g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);
GtkWidget *widget = GTK_WIDGET (panel);
AwnPanelPrivate *priv = panel->priv;
@@ -1361,8 +1380,14 @@
gint x, y, window_x, window_y, width, height;
/* FIXME: probably needs some love to work on multiple monitors */
+ panel_win = gtk_widget_get_window (widget);
+
+ if (!panel_win)
+ {
+ return FALSE;
+ }
+
gdk_display_get_pointer (gdk_display_get_default (), NULL, &x, &y, NULL);
- panel_win = gtk_widget_get_window (widget);
gdk_window_get_root_origin (panel_win, &window_x, &window_y);
switch (check_type)
@@ -1535,7 +1560,7 @@
static gboolean
autohide_start_timeout (gpointer data)
{
- g_return_val_if_fail(AWN_IS_PANEL(data), FALSE);
+ g_return_val_if_fail (AWN_IS_PANEL (data), FALSE);
gboolean signal_ret = FALSE;
AwnPanel *panel = AWN_PANEL (data);
@@ -1733,6 +1758,12 @@
priv->resize_timer_id = 0;
}
+ if (priv->dbus_proxy)
+ {
+ g_object_unref (priv->dbus_proxy);
+ priv->dbus_proxy = NULL;
+ }
+
desktop_agnostic_config_client_unbind_all_for_object (priv->client,
object, NULL);
@@ -1750,11 +1781,15 @@
priv->inhibits = NULL;
}
+ if (priv->monitor)
+ {
+ g_object_unref (priv->monitor);
+ priv->monitor = NULL;
+ }
+
G_OBJECT_CLASS (awn_panel_parent_class)->finalize (object);
}
-#include "awn-panel-glue.h"
-
static void
awn_panel_class_init (AwnPanelClass *klass)
{
@@ -1769,6 +1804,7 @@
obj_class->set_property = awn_panel_set_property;
cont_class->add = awn_panel_add;
+ cont_class->remove = awn_panel_remove;
wid_class->expose_event = awn_panel_expose;
wid_class->show = awn_panel_show;
@@ -2024,9 +2060,6 @@
0);
g_type_class_add_private (obj_class, sizeof (AwnPanelPrivate));
-
- dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
- &dbus_glib_awn_panel_object_info);
}
static gboolean
@@ -2927,6 +2960,28 @@
}
static void
+awn_panel_remove (GtkContainer *panel, GtkWidget *widget)
+{
+ AwnPanelPrivate *priv;
+
+ g_return_if_fail (AWN_IS_PANEL (panel));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ priv = AWN_PANEL (panel)->priv;
+
+ if (widget == priv->eventbox)
+ {
+ /* the eventbox was added using the base method,
+ so it also has to be removed using that way */
+ GtkContainerClass *klass = GTK_CONTAINER_CLASS (awn_panel_parent_class);
+ klass->remove (GTK_CONTAINER (panel), widget);
+ }
+ else
+ {
+ gtk_container_remove (GTK_CONTAINER (priv->viewport), widget);
+ }
+}
+
+static void
on_theme_changed (AwnBackground *bg, AwnPanel *panel)
{
g_return_if_fail (AWN_IS_BACKGROUND (bg));
@@ -3213,9 +3268,9 @@
if (offset_mod != 1.0)
{
GValue mod_value = {0};
- g_value_init (&mod_value, G_TYPE_FLOAT);
+ g_value_init (&mod_value, G_TYPE_DOUBLE);
/* FIXME: we also need to calculate our dimensions based on offset_mod */
- g_value_set_float (&mod_value, offset_mod);
+ g_value_set_double (&mod_value, offset_mod);
priv->offset_mod = offset_mod;
g_object_notify (G_OBJECT (panel), "offset-modifier");
@@ -3674,11 +3729,11 @@
awn_panel_uninhibit_autohide (item->panel, item->cookie);
}
-void
+guint
awn_panel_inhibit_autohide (AwnPanel *panel,
+ const gchar *sender,
const gchar *app_name,
- const gchar *reason,
- DBusGMethodInvocation *context)
+ const gchar *reason)
{
AwnPanelPrivate *priv = panel->priv;
@@ -3686,7 +3741,6 @@
// watch the sender on dbus and remove all its inhibits when it
// disappears (to be sure that we don't misbehave due to crashing app)
- gchar *sender = dbus_g_method_get_sender (context);
gchar *detailed_signal = g_strdup_printf ("name-disappeared::%s", sender);
g_signal_connect (awn_dbus_watcher_get_default (), detailed_signal,
G_CALLBACK (dbus_inhibitor_lost),
@@ -3694,9 +3748,8 @@
GINT_TO_POINTER (cookie)));
g_free (detailed_signal);
- g_free (sender);
- dbus_g_method_return (context, cookie);
+ return cookie;
}
gboolean
@@ -3709,11 +3762,6 @@
if (!item) return TRUE; // we could set an error
- // remove the dbus watcher
- g_signal_handlers_disconnect_by_func (awn_dbus_watcher_get_default (),
- G_CALLBACK (dbus_inhibitor_lost),
- item);
-
g_hash_table_remove (priv->inhibits, GINT_TO_POINTER (cookie));
if (g_hash_table_size (priv->inhibits) == 0)
@@ -3730,13 +3778,14 @@
return TRUE;
}
-gboolean
-awn_panel_get_inhibitors (AwnPanel *panel, GStrv *reasons)
+GStrv
+awn_panel_get_inhibitors (AwnPanel *panel)
{
AwnPanelPrivate *priv = panel->priv;
GList *list, *l;
+ GStrv reasons;
- *reasons = g_new0 (char*, g_hash_table_size (priv->inhibits) + 1);
+ reasons = g_new0 (char*, g_hash_table_size (priv->inhibits) + 1);
list = l = g_hash_table_get_values (priv->inhibits); // list should be freed
int i=0;
@@ -3744,14 +3793,14 @@
while (list)
{
AwnInhibitItem *item = list->data;
- (*reasons)[i++] = g_strdup (item->description);
+ reasons[i++] = g_strdup (item->description);
list = list->next;
}
g_list_free (l);
- return TRUE;
+ return reasons;
}
static void
@@ -3945,12 +3994,12 @@
gtk_widget_hide (priv->docklet_closer);
}
-void
+gint64
awn_panel_docklet_request (AwnPanel *panel,
gint min_size,
gboolean shrink,
gboolean expand,
- DBusGMethodInvocation *context)
+ GError **error)
{
AwnPanelPrivate *priv = panel->priv;
GtkAllocation alloc;
@@ -4035,50 +4084,23 @@
window_id = gtk_socket_get_id (GTK_SOCKET (priv->docklet));
- dbus_g_method_return (context, window_id);
-}
-
-static void
-value_array_append_int (GValueArray *array, gint i)
-{
- GValue *value = g_new0 (GValue, 1);
-
- g_value_init (value, G_TYPE_INT);
- g_value_set_int (value, i);
-
- g_value_array_append (array, value);
-}
-
-static void
-value_array_append_bool (GValueArray *array, gboolean b)
-{
- GValue *value = g_new0 (GValue, 1);
-
- g_value_init (value, G_TYPE_BOOLEAN);
- g_value_set_boolean (value, b);
-
- g_value_array_append (array, value);
-}
-
-static void
-value_array_append_array (GValueArray *array, guchar *data, gsize data_len)
-{
- GArray *byte_array;
- GValue *value = g_new0 (GValue, 1);
-
- byte_array = g_array_sized_new (FALSE, FALSE, sizeof(guchar), data_len);
- g_array_append_vals (byte_array, data, data_len);
-
- g_value_init (value, dbus_g_type_get_collection ("GArray", G_TYPE_CHAR));
- g_value_take_boxed (value, byte_array);
-
- g_value_array_append (array, value);
+ return window_id;
}
gboolean
-awn_panel_get_snapshot (AwnPanel *panel, GValue *value, GError **error)
+awn_panel_get_snapshot (AwnPanel *panel,
+ gint *width,
+ gint *height,
+ gint *rowstride,
+ gboolean *has_alpha,
+ gint *bits_per_sample,
+ gint *num_channels,
+ gchar **pixels,
+ gint *pixels_length,
+ GError **error)
{
GdkRectangle rect;
+ guint data_len;
g_return_val_if_fail (AWN_IS_PANEL (panel), FALSE);
awn_panel_get_draw_rect (panel, &rect, 0, 0);
@@ -4102,28 +4124,20 @@
cairo_surface_flush (surface);
// stuff the pixbuf to our out param
- gint width = rect.width;
- gint height = rect.height;
- gint rowstride = cairo_image_surface_get_stride (surface);
- gint n_channels = 4;
- gint bits_per_sample = 8;
+ *width = rect.width;
+ *height = rect.height;
+ *rowstride = cairo_image_surface_get_stride (surface);
+ *has_alpha = TRUE;
+ *bits_per_sample = 8;
+ *num_channels = 4;
+
+ data_len = rect.height * cairo_image_surface_get_stride (surface);
//gint image_len = (height - 1) * rowstride + width *
// ((n_channels * bits_per_sample + 7) / 8);
guchar *image = cairo_image_surface_get_data (surface);
-
- GValueArray *image_struct = g_value_array_new (1);
-
- value_array_append_int (image_struct, width);
- value_array_append_int (image_struct, height);
- value_array_append_int (image_struct, rowstride);
- value_array_append_bool (image_struct, TRUE);
- value_array_append_int (image_struct, bits_per_sample);
- value_array_append_int (image_struct, n_channels);
- value_array_append_array (image_struct, image, height * rowstride);
-
- g_value_init (value, G_TYPE_VALUE_ARRAY);
- g_value_take_boxed (value, image_struct);
+ *pixels = g_memdup (image, data_len);
+ *pixels_length = data_len;
cairo_surface_destroy (surface);
=== modified file 'src/awn-panel.h'
--- src/awn-panel.h 2010-07-07 15:34:01 +0000
+++ src/awn-panel.h 2010-07-24 23:31:47 +0000
@@ -94,27 +94,33 @@
gint flags,
GError **error);
-void awn_panel_inhibit_autohide (AwnPanel *panel,
+guint awn_panel_inhibit_autohide (AwnPanel *panel,
+ const gchar *sender,
const gchar *app_name,
- const gchar *reason,
- DBusGMethodInvocation *context);
+ const gchar *reason);
gboolean awn_panel_uninhibit_autohide (AwnPanel *panel,
guint cookie);
-gboolean awn_panel_get_inhibitors (AwnPanel *panel,
- GStrv *reasons);
+GStrv awn_panel_get_inhibitors (AwnPanel *panel);
-void awn_panel_docklet_request (AwnPanel *panel,
+gint64 awn_panel_docklet_request (AwnPanel *panel,
gint min_size,
gboolean shrink,
gboolean expand,
- DBusGMethodInvocation *context);
+ GError **error);
gboolean awn_panel_get_docklet_mode (AwnPanel *panel);
gboolean awn_panel_get_snapshot (AwnPanel *panel,
- GValue *value,
+ gint *width,
+ gint *height,
+ gint *rowstride,
+ gboolean *has_alpha,
+ gint *bits_per_sample,
+ gint *num_channels,
+ gchar **pixels,
+ gint *pixels_length,
GError **error);
gboolean awn_panel_get_all_server_flags(AwnPanel *panel,
=== added file 'src/awn-panel.vapi'
--- src/awn-panel.vapi 1970-01-01 00:00:00 +0000
+++ src/awn-panel.vapi 2010-07-24 23:31:47 +0000
@@ -0,0 +1,47 @@
+/* awn-panel.vapi stub (manually generated) */
+
+[CCode (cprefix = "Awn", lower_case_cprefix = "awn_")]
+namespace Awn {
+ [CCode (cheader_filename = "awn-panel.h")]
+ public class Panel : Gtk.Window, Atk.Implementor, Gtk.Buildable {
+ [CCode (type = "GtkWidget*", has_construct_function = false)]
+ public Panel.with_panel_id (int panel_id);
+ public bool add_applet (string desktop_file) throws GLib.Error;
+ public bool delete_applet (string uid) throws GLib.Error;
+ public bool set_applet_flags (string uid, int flags) throws GLib.Error;
+ public uint inhibit_autohide (string sender, string app_name, string reason);
+ public bool uninhibit_autohide (uint cookie);
+
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] get_inhibitors ();
+
+ public bool get_snapshot (out int width, out int height, out int rowstride, out bool has_alpha, out int bits_per_sample, out int num_channels, out char[] pixel_data) throws GLib.Error;
+
+ public int64 docklet_request (int min_size, bool shrink, bool expand) throws GLib.Error;
+
+ [NoAccessorMethod]
+ public int panel_id { get; construct; }
+ [NoAccessorMethod]
+ public int64 panel_xid { get; }
+ [NoAccessorMethod]
+ public int position { get; set construct; }
+ [NoAccessorMethod]
+ public int size { get; set construct; }
+ [NoAccessorMethod]
+ public int offset { get; set construct; }
+ [NoAccessorMethod]
+ public int max_size { get; }
+ [NoAccessorMethod]
+ public int path_type { get; set construct; }
+ [NoAccessorMethod]
+ public float offset_modifier { get; set construct; }
+
+ public virtual signal void size_changed (int size);
+ public virtual signal void position_changed (int position);
+ public virtual signal void offset_changed (int offset);
+ public virtual signal void property_changed (string prop_name, GLib.Value val);
+
+ public virtual signal void destroy_applet (string uid);
+ public virtual signal void destroy_notify ();
+ }
+}
=== modified file 'tests/Makefile.am'
--- tests/Makefile.am 2010-01-11 21:30:13 +0000
+++ tests/Makefile.am 2010-07-24 23:31:47 +0000
@@ -41,7 +41,6 @@
test-taskmanager-dnd.py \
test-taskmanager-windows.py
-if HAVE_VALA
noinst_PROGRAMS += test-vala-awn-dialog
VALA_FILES = \
@@ -58,4 +57,3 @@
EXTRA_DIST += $(VALA_FILES)
CLEANFILES = test-vala-awn-dialog.c
-endif