diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches new file mode 100644 index 00000000..6857a8d4 --- /dev/null +++ b/.pc/.quilt_patches @@ -0,0 +1 @@ +debian/patches diff --git a/.pc/.quilt_series b/.pc/.quilt_series new file mode 100644 index 00000000..c2067066 --- /dev/null +++ b/.pc/.quilt_series @@ -0,0 +1 @@ +series diff --git a/.pc/.version b/.pc/.version new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/.pc/.version @@ -0,0 +1 @@ +2 diff --git a/.pc/05_disable_corner_tapping.patch/plugins/mouse/gsd-mouse-manager.c b/.pc/05_disable_corner_tapping.patch/plugins/mouse/gsd-mouse-manager.c new file mode 100644 index 00000000..d3cd6664 --- /dev/null +++ b/.pc/05_disable_corner_tapping.patch/plugins/mouse/gsd-mouse-manager.c @@ -0,0 +1,1350 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#ifdef __linux +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-mouse-manager.h" +#include "gsd-input-helper.h" +#include "gsd-enums.h" + +#define GSD_MOUSE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerPrivate)) + +#define SETTINGS_MOUSE_DIR "org.gnome.settings-daemon.peripherals.mouse" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" + +/* Keys for both touchpad and mouse */ +#define KEY_LEFT_HANDED "left-handed" /* a boolean for mouse, an enum for touchpad */ +#define KEY_MOTION_ACCELERATION "motion-acceleration" +#define KEY_MOTION_THRESHOLD "motion-threshold" + +/* Touchpad settings */ +#define KEY_TOUCHPAD_DISABLE_W_TYPING "disable-while-typing" +#define KEY_PAD_HORIZ_SCROLL "horiz-scroll-enabled" +#define KEY_SCROLL_METHOD "scroll-method" +#define KEY_TAP_TO_CLICK "tap-to-click" +#define KEY_TOUCHPAD_ENABLED "touchpad-enabled" +#define KEY_NATURAL_SCROLL_ENABLED "natural-scroll" + +/* Mouse settings */ +#define KEY_LOCATE_POINTER "locate-pointer" +#define KEY_DWELL_CLICK_ENABLED "dwell-click-enabled" +#define KEY_SECONDARY_CLICK_ENABLED "secondary-click-enabled" +#define KEY_MIDDLE_BUTTON_EMULATION "middle-button-enabled" + +struct GsdMouseManagerPrivate +{ + guint start_idle_id; + GSettings *touchpad_settings; + GSettings *mouse_settings; + GSettings *mouse_a11y_settings; + GdkDeviceManager *device_manager; + guint device_added_id; + guint device_removed_id; + GHashTable *blacklist; + + gboolean mousetweaks_daemon_running; + gboolean syndaemon_spawned; + GPid syndaemon_pid; + gboolean locate_pointer_spawned; + GPid locate_pointer_pid; +}; + +static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass); +static void gsd_mouse_manager_init (GsdMouseManager *mouse_manager); +static void gsd_mouse_manager_finalize (GObject *object); +static void set_tap_to_click (GdkDevice *device, + gboolean state, + gboolean left_handed); +static void set_natural_scroll (GsdMouseManager *manager, + GdkDevice *device, + gboolean natural_scroll); + +G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + + +static GObject * +gsd_mouse_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMouseManager *mouse_manager; + + mouse_manager = GSD_MOUSE_MANAGER (G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (mouse_manager); +} + +static void +gsd_mouse_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->dispose (object); +} + +static void +gsd_mouse_manager_class_init (GsdMouseManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_mouse_manager_constructor; + object_class->dispose = gsd_mouse_manager_dispose; + object_class->finalize = gsd_mouse_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMouseManagerPrivate)); +} + +static XDevice * +open_gdk_device (GdkDevice *device) +{ + XDevice *xdevice; + int id; + + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + gdk_error_trap_push (); + + xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id); + + if (gdk_error_trap_pop () != 0) + return NULL; + + return xdevice; +} + +static gboolean +device_is_blacklisted (GsdMouseManager *manager, + GdkDevice *device) +{ + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + if (g_hash_table_lookup (manager->priv->blacklist, GINT_TO_POINTER (id)) != NULL) { + g_debug ("device %s (%d) is blacklisted", gdk_device_get_name (device), id); + return TRUE; + } + return FALSE; +} + +static gboolean +device_is_ignored (GsdMouseManager *manager, + GdkDevice *device) +{ + GdkInputSource source; + const char *name; + + if (device_is_blacklisted (manager, device)) + return TRUE; + + source = gdk_device_get_source (device); + if (source != GDK_SOURCE_MOUSE && + source != GDK_SOURCE_TOUCHPAD && + source != GDK_SOURCE_CURSOR) + return TRUE; + + name = gdk_device_get_name (device); + if (name != NULL && g_str_equal ("Virtual core XTEST pointer", name)) + return TRUE; + + return FALSE; +} + +static void +configure_button_layout (guchar *buttons, + gint n_buttons, + gboolean left_handed) +{ + const gint left_button = 1; + gint right_button; + gint i; + + /* if the button is higher than 2 (3rd button) then it's + * probably one direction of a scroll wheel or something else + * uninteresting + */ + right_button = MIN (n_buttons, 3); + + /* If we change things we need to make sure we only swap buttons. + * If we end up with multiple physical buttons assigned to the same + * logical button the server will complain. This code assumes physical + * button 0 is the physical left mouse button, and that the physical + * button other than 0 currently assigned left_button or right_button + * is the physical right mouse button. + */ + + /* check if the current mapping satisfies the above assumptions */ + if (buttons[left_button - 1] != left_button && + buttons[left_button - 1] != right_button) + /* The current mapping is weird. Swapping buttons is probably not a + * good idea. + */ + return; + + /* check if we are left_handed and currently not swapped */ + if (left_handed && buttons[left_button - 1] == left_button) { + /* find the right button */ + for (i = 0; i < n_buttons; i++) { + if (buttons[i] == right_button) { + buttons[i] = left_button; + break; + } + } + /* swap the buttons */ + buttons[left_button - 1] = right_button; + } + /* check if we are not left_handed but are swapped */ + else if (!left_handed && buttons[left_button - 1] == right_button) { + /* find the right button */ + for (i = 0; i < n_buttons; i++) { + if (buttons[i] == left_button) { + buttons[i] = right_button; + break; + } + } + /* swap the buttons */ + buttons[left_button - 1] = left_button; + } +} + +static gboolean +xinput_device_has_buttons (GdkDevice *device) +{ + int i; + XAnyClassInfo *class_info; + + /* FIXME can we use the XDevice's classes here instead? */ + XDeviceInfo *device_info, *info; + gint n_devices; + int id; + + /* Find the XDeviceInfo for the GdkDevice */ + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return FALSE; + + info = NULL; + for (i = 0; i < n_devices; i++) { + if (device_info[i].id == id) { + info = &device_info[i]; + break; + } + } + if (info == NULL) + goto bail; + + class_info = info->inputclassinfo; + for (i = 0; i < info->num_classes; i++) { + if (class_info->class == ButtonClass) { + XButtonInfo *button_info; + + button_info = (XButtonInfo *) class_info; + if (button_info->num_buttons > 0) { + XFreeDeviceList (device_info); + return TRUE; + } + } + + class_info = (XAnyClassInfo *) (((guchar *) class_info) + + class_info->length); + } + +bail: + XFreeDeviceList (device_info); + + return FALSE; +} + +static gboolean +touchpad_has_single_button (XDevice *device) +{ + Atom type, prop; + int format; + unsigned long nitems, bytes_after; + unsigned char *data; + gboolean is_single_button = FALSE; + int rc; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Capabilities", False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 1, False, + XA_INTEGER, &type, &format, &nitems, + &bytes_after, &data); + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 3) + is_single_button = (data[0] == 1 && data[1] == 0 && data[2] == 0); + + if (rc == Success) + XFree (data); + + gdk_error_trap_pop_ignored (); + + return is_single_button; +} + +static void +set_left_handed (GsdMouseManager *manager, + GdkDevice *device, + gboolean mouse_left_handed, + gboolean touchpad_left_handed) +{ + XDevice *xdevice; + guchar *buttons; + gsize buttons_capacity = 16; + gboolean left_handed; + gint n_buttons; + + if (!xinput_device_has_buttons (device)) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting handedness on %s", gdk_device_get_name (device)); + + buttons = g_new (guchar, buttons_capacity); + + /* If the device is a touchpad, swap tap buttons + * around too, otherwise a tap would be a right-click */ + if (device_is_touchpad (xdevice)) { + gboolean tap = g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TAP_TO_CLICK); + gboolean single_button = touchpad_has_single_button (xdevice); + + left_handed = touchpad_left_handed; + + if (tap && !single_button) + set_tap_to_click (device, tap, left_handed); + + if (single_button) + goto out; + } else { + left_handed = mouse_left_handed; + } + + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + buttons, + buttons_capacity); + + while (n_buttons > buttons_capacity) { + buttons_capacity = n_buttons; + buttons = (guchar *) g_realloc (buttons, + buttons_capacity * sizeof (guchar)); + + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + buttons, + buttons_capacity); + } + + configure_button_layout (buttons, n_buttons, left_handed); + + gdk_error_trap_push (); + XSetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, buttons, n_buttons); + gdk_error_trap_pop_ignored (); + +out: + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + g_free (buttons); +} + +static void +set_motion (GsdMouseManager *manager, + GdkDevice *device) +{ + XDevice *xdevice; + XPtrFeedbackControl feedback; + XFeedbackState *states, *state; + int num_feedbacks; + int numerator, denominator; + gfloat motion_acceleration; + int motion_threshold; + GSettings *settings; + guint i; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting motion on %s", gdk_device_get_name (device)); + + if (device_is_touchpad (xdevice)) + settings = manager->priv->touchpad_settings; + else + settings = manager->priv->mouse_settings; + + /* Calculate acceleration */ + motion_acceleration = g_settings_get_double (settings, KEY_MOTION_ACCELERATION); + + if (motion_acceleration >= 1.0) { + /* we want to get the acceleration, with a resolution of 0.5 + */ + if ((motion_acceleration - floor (motion_acceleration)) < 0.25) { + numerator = floor (motion_acceleration); + denominator = 1; + } else if ((motion_acceleration - floor (motion_acceleration)) < 0.5) { + numerator = ceil (2.0 * motion_acceleration); + denominator = 2; + } else if ((motion_acceleration - floor (motion_acceleration)) < 0.75) { + numerator = floor (2.0 *motion_acceleration); + denominator = 2; + } else { + numerator = ceil (motion_acceleration); + denominator = 1; + } + } else if (motion_acceleration < 1.0 && motion_acceleration > 0) { + /* This we do to 1/10ths */ + numerator = floor (motion_acceleration * 10) + 1; + denominator= 10; + } else { + numerator = -1; + denominator = -1; + } + + /* And threshold */ + motion_threshold = g_settings_get_int (settings, KEY_MOTION_THRESHOLD); + + /* Get the list of feedbacks for the device */ + states = XGetFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, &num_feedbacks); + if (states == NULL) + goto out; + state = (XFeedbackState *) states; + for (i = 0; i < num_feedbacks; i++) { + if (state->class == PtrFeedbackClass) { + /* And tell the device */ + feedback.class = PtrFeedbackClass; + feedback.length = sizeof (XPtrFeedbackControl); + feedback.id = state->id; + feedback.threshold = motion_threshold; + feedback.accelNum = numerator; + feedback.accelDenom = denominator; + + g_debug ("Setting accel %d/%d, threshold %d for device '%s'", + numerator, denominator, motion_threshold, gdk_device_get_name (device)); + + XChangeFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, + DvAccelNum | DvAccelDenom | DvThreshold, + (XFeedbackControl *) &feedback); + + break; + } + state = (XFeedbackState *) ((char *) state + state->length); + } + + XFreeFeedbackList (states); + + out: + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_middle_button (GsdMouseManager *manager, + GdkDevice *device, + gboolean middle_button) +{ + Atom prop; + XDevice *xdevice; + Atom type; + int format; + unsigned long nitems, bytes_after; + unsigned char *data; + int rc; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "Evdev Middle Button Emulation", True); + + if (!prop) /* no evdev devices */ + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting middle button on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, 0, 1, False, XA_INTEGER, &type, &format, + &nitems, &bytes_after, &data); + + if (rc == Success && format == 8 && type == XA_INTEGER && nitems == 1) { + data[0] = middle_button ? 1 : 0; + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, type, format, PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting middle button emulation on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +/* Ensure that syndaemon dies together with us, to avoid running several of + * them */ +static void +setup_syndaemon (gpointer user_data) +{ +#ifdef __linux + prctl (PR_SET_PDEATHSIG, SIGHUP); +#endif +} + +static gboolean +have_program_in_path (const char *name) +{ + gchar *path; + gboolean result; + + path = g_find_program_in_path (name); + result = (path != NULL); + g_free (path); + return result; +} + +static void +syndaemon_died (GPid pid, gint status, gpointer user_data) +{ + GsdMouseManager *manager = GSD_MOUSE_MANAGER (user_data); + + g_debug ("syndaemon stopped with status %i", status); + g_spawn_close_pid (pid); + manager->priv->syndaemon_spawned = FALSE; +} + +static int +set_disable_w_typing (GsdMouseManager *manager, gboolean state) +{ + if (state && touchpad_is_present ()) { + GError *error = NULL; + GPtrArray *args; + + if (manager->priv->syndaemon_spawned) + return 0; + + if (!have_program_in_path ("syndaemon")) + return 0; + + args = g_ptr_array_new (); + + g_ptr_array_add (args, "syndaemon"); + g_ptr_array_add (args, "-i"); + g_ptr_array_add (args, "1.0"); + g_ptr_array_add (args, "-t"); + g_ptr_array_add (args, "-K"); + g_ptr_array_add (args, "-R"); + g_ptr_array_add (args, NULL); + + /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid + * double-forking, otherwise syndaemon will immediately get + * killed again through (PR_SET_PDEATHSIG when the intermediate + * process dies */ + g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL, + G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL, + &manager->priv->syndaemon_pid, &error); + + manager->priv->syndaemon_spawned = (error == NULL); + g_ptr_array_free (args, FALSE); + + if (error) { + g_warning ("Failed to launch syndaemon: %s", error->message); + g_settings_set_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE); + g_error_free (error); + } else { + g_child_watch_add (manager->priv->syndaemon_pid, syndaemon_died, manager); + g_debug ("Launched syndaemon"); + } + } else if (manager->priv->syndaemon_spawned) { + kill (manager->priv->syndaemon_pid, SIGHUP); + g_spawn_close_pid (manager->priv->syndaemon_pid); + manager->priv->syndaemon_spawned = FALSE; + g_debug ("Killed syndaemon"); + } + + return 0; +} + +static void +set_tap_to_click (GdkDevice *device, + gboolean state, + gboolean left_handed) +{ + int format, rc; + unsigned long nitems, bytes_after; + XDevice *xdevice; + unsigned char* data; + Atom prop, type; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Tap Action", False); + if (!prop) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting tap to click on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, 0, 2, + False, XA_INTEGER, &type, &format, &nitems, + &bytes_after, &data); + + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7) { + /* Set RLM mapping for 1/2/3 fingers*/ + data[4] = (state) ? ((left_handed) ? 3 : 1) : 0; + data[5] = (state) ? ((left_handed) ? 1 : 3) : 0; + data[6] = (state) ? 2 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (rc == Success) + XFree (data); + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting tap to click on \"%s\"", gdk_device_get_name (device)); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_horiz_scroll (GdkDevice *device, + gboolean state) +{ + int rc; + XDevice *xdevice; + Atom act_type, prop_edge, prop_twofinger; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False); + + if (!prop_edge || !prop_twofinger) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting horiz scroll on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[1] = (state && data[0]); + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + XFree (data); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[1] = (state && data[0]); + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting horiz scroll on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + +} + +static void +set_edge_scroll (GdkDevice *device, + GsdTouchpadScrollMethod method) +{ + int rc; + XDevice *xdevice; + Atom act_type, prop_edge, prop_twofinger; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False); + + if (!prop_edge || !prop_twofinger) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting edge scroll on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[0] = (method == GSD_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING) ? 1 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + XFree (data); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[0] = (method == GSD_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING) ? 1 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting edge scroll on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_touchpad_disabled (GdkDevice *device) +{ + int id; + XDevice *xdevice; + + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + g_debug ("Trying to set device disabled for \"%s\" (%d)", gdk_device_get_name (device), id); + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + if (set_device_enabled (id, FALSE) == FALSE) + g_warning ("Error disabling device \"%s\" (%d)", gdk_device_get_name (device), id); + else + g_debug ("Disabled device \"%s\" (%d)", gdk_device_get_name (device), id); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_touchpad_enabled (int id) +{ + XDevice *xdevice; + + g_debug ("Trying to set device enabled for %d", id); + + gdk_error_trap_push (); + xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id); + if (gdk_error_trap_pop () != 0) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + if (set_device_enabled (id, TRUE) == FALSE) + g_warning ("Error enabling device \"%d\"", id); + else + g_debug ("Enabled device %d", id); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_locate_pointer (GsdMouseManager *manager, + gboolean state) +{ + if (state) { + GError *error = NULL; + char *args[2]; + + if (manager->priv->locate_pointer_spawned) + return; + + args[0] = LIBEXECDIR "/gsd-locate-pointer"; + args[1] = NULL; + + g_spawn_async (NULL, args, NULL, + 0, NULL, NULL, + &manager->priv->locate_pointer_pid, &error); + + manager->priv->locate_pointer_spawned = (error == NULL); + + if (error) { + g_settings_set_boolean (manager->priv->mouse_settings, KEY_LOCATE_POINTER, FALSE); + g_error_free (error); + } + + } else if (manager->priv->locate_pointer_spawned) { + kill (manager->priv->locate_pointer_pid, SIGHUP); + g_spawn_close_pid (manager->priv->locate_pointer_pid); + manager->priv->locate_pointer_spawned = FALSE; + } +} + +static void +set_mousetweaks_daemon (GsdMouseManager *manager, + gboolean dwell_click_enabled, + gboolean secondary_click_enabled) +{ + GError *error = NULL; + gchar *comm; + gboolean run_daemon = dwell_click_enabled || secondary_click_enabled; + + if (run_daemon || manager->priv->mousetweaks_daemon_running) + comm = g_strdup_printf ("mousetweaks %s", + run_daemon ? "" : "-s"); + else + return; + + if (run_daemon) + manager->priv->mousetweaks_daemon_running = TRUE; + + if (! g_spawn_command_line_async (comm, &error)) { + if (error->code == G_SPAWN_ERROR_NOENT && run_daemon) { + GtkWidget *dialog; + + if (dwell_click_enabled) { + g_settings_set_boolean (manager->priv->mouse_a11y_settings, + KEY_DWELL_CLICK_ENABLED, FALSE); + } else if (secondary_click_enabled) { + g_settings_set_boolean (manager->priv->mouse_a11y_settings, + KEY_SECONDARY_CLICK_ENABLED, FALSE); + } + + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + _("Could not enable mouse accessibility features")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + _("Mouse accessibility requires Mousetweaks " + "to be installed on your system.")); + gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), + "preferences-desktop-accessibility"); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + g_error_free (error); + } + g_free (comm); +} + +static gboolean +get_touchpad_handedness (GsdMouseManager *manager, gboolean mouse_left_handed) +{ + switch (g_settings_get_enum (manager->priv->touchpad_settings, KEY_LEFT_HANDED)) { + case GSD_TOUCHPAD_HANDEDNESS_RIGHT: + return FALSE; + case GSD_TOUCHPAD_HANDEDNESS_LEFT: + return TRUE; + case GSD_TOUCHPAD_HANDEDNESS_MOUSE: + return mouse_left_handed; + default: + g_assert_not_reached (); + } +} + +static void +set_mouse_settings (GsdMouseManager *manager, + GdkDevice *device) +{ + gboolean mouse_left_handed, touchpad_left_handed; + + mouse_left_handed = g_settings_get_boolean (manager->priv->mouse_settings, KEY_LEFT_HANDED); + touchpad_left_handed = get_touchpad_handedness (manager, mouse_left_handed); + set_left_handed (manager, device, mouse_left_handed, touchpad_left_handed); + + set_motion (manager, device); + set_middle_button (manager, device, g_settings_get_boolean (manager->priv->mouse_settings, KEY_MIDDLE_BUTTON_EMULATION)); + + set_tap_to_click (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TAP_TO_CLICK), touchpad_left_handed); + set_edge_scroll (device, g_settings_get_enum (manager->priv->touchpad_settings, KEY_SCROLL_METHOD)); + set_horiz_scroll (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_PAD_HORIZ_SCROLL)); + set_natural_scroll (manager, device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_NATURAL_SCROLL_ENABLED)); + if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED) == FALSE) + set_touchpad_disabled (device); +} + +static void +set_natural_scroll (GsdMouseManager *manager, + GdkDevice *device, + gboolean natural_scroll) +{ + XDevice *xdevice; + Atom scrolling_distance, act_type; + int rc, act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + glong *ptr; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("Trying to set %s for \"%s\"", + natural_scroll ? "natural (reverse) scroll" : "normal scroll", + gdk_device_get_name (device)); + + scrolling_distance = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "Synaptics Scrolling Distance", False); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + scrolling_distance, 0, 2, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + + if (rc == Success && act_type == XA_INTEGER && act_format == 32 && nitems >= 2) { + ptr = (glong *) data; + + if (natural_scroll) { + ptr[0] = -abs(ptr[0]); + ptr[1] = -abs(ptr[1]); + } else { + ptr[0] = abs(ptr[0]); + ptr[1] = abs(ptr[1]); + } + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + scrolling_distance, XA_INTEGER, act_format, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error setting %s for \"%s\"", + natural_scroll ? "natural (reverse) scroll" : "normal scroll", + gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +mouse_callback (GSettings *settings, + const gchar *key, + GsdMouseManager *manager) +{ + GList *devices, *l; + + if (g_str_equal (key, KEY_DWELL_CLICK_ENABLED) || + g_str_equal (key, KEY_SECONDARY_CLICK_ENABLED)) { + set_mousetweaks_daemon (manager, + g_settings_get_boolean (settings, KEY_DWELL_CLICK_ENABLED), + g_settings_get_boolean (settings, KEY_SECONDARY_CLICK_ENABLED)); + return; + } else if (g_str_equal (key, KEY_LOCATE_POINTER)) { + set_locate_pointer (manager, g_settings_get_boolean (settings, KEY_LOCATE_POINTER)); + return; + } + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (g_str_equal (key, KEY_LEFT_HANDED)) { + gboolean mouse_left_handed; + mouse_left_handed = g_settings_get_boolean (settings, KEY_LEFT_HANDED); + set_left_handed (manager, device, mouse_left_handed, get_touchpad_handedness (manager, mouse_left_handed)); + } else if (g_str_equal (key, KEY_MOTION_ACCELERATION) || + g_str_equal (key, KEY_MOTION_THRESHOLD)) { + set_motion (manager, device); + } else if (g_str_equal (key, KEY_MIDDLE_BUTTON_EMULATION)) { + set_middle_button (manager, device, g_settings_get_boolean (settings, KEY_MIDDLE_BUTTON_EMULATION)); + } + } + g_list_free (devices); +} + +static void +touchpad_callback (GSettings *settings, + const gchar *key, + GsdMouseManager *manager) +{ + GList *devices, *l; + + if (g_str_equal (key, KEY_TOUCHPAD_DISABLE_W_TYPING)) { + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, key)); + return; + } + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (g_str_equal (key, KEY_TAP_TO_CLICK)) { + set_tap_to_click (device, g_settings_get_boolean (settings, key), + g_settings_get_boolean (manager->priv->touchpad_settings, KEY_LEFT_HANDED)); + } else if (g_str_equal (key, KEY_SCROLL_METHOD)) { + set_edge_scroll (device, g_settings_get_enum (settings, key)); + set_horiz_scroll (device, g_settings_get_boolean (settings, KEY_PAD_HORIZ_SCROLL)); + } else if (g_str_equal (key, KEY_PAD_HORIZ_SCROLL)) { + set_horiz_scroll (device, g_settings_get_boolean (settings, key)); + } else if (g_str_equal (key, KEY_TOUCHPAD_ENABLED)) { + if (g_settings_get_boolean (settings, key) == FALSE) + set_touchpad_disabled (device); + else + set_touchpad_enabled (gdk_x11_device_get_id (device)); + } else if (g_str_equal (key, KEY_MOTION_ACCELERATION) || + g_str_equal (key, KEY_MOTION_THRESHOLD)) { + set_motion (manager, device); + } else if (g_str_equal (key, KEY_LEFT_HANDED)) { + gboolean mouse_left_handed; + mouse_left_handed = g_settings_get_boolean (manager->priv->mouse_settings, KEY_LEFT_HANDED); + set_left_handed (manager, device, mouse_left_handed, get_touchpad_handedness (manager, mouse_left_handed)); + } else if (g_str_equal (key, KEY_NATURAL_SCROLL_ENABLED)) { + set_natural_scroll (manager, device, g_settings_get_boolean (settings, key)); + } + } + g_list_free (devices); + + if (g_str_equal (key, KEY_TOUCHPAD_ENABLED) && + g_settings_get_boolean (settings, key)) { + devices = get_disabled_devices (manager->priv->device_manager); + for (l = devices; l != NULL; l = l->next) { + int device_id; + + device_id = GPOINTER_TO_INT (l->data); + set_touchpad_enabled (device_id); + } + g_list_free (devices); + } +} + +static void +device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdMouseManager *manager) +{ + if (device_is_ignored (manager, device) == FALSE) { + if (run_custom_command (device, COMMAND_DEVICE_ADDED) == FALSE) { + set_mouse_settings (manager, device); + } else { + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_insert (manager->priv->blacklist, + GINT_TO_POINTER (id), GINT_TO_POINTER (1)); + } + + /* If a touchpad was to appear... */ + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + } +} + +static void +device_removed_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdMouseManager *manager) +{ + int id; + + /* Remove the device from the hash table so that + * device_is_ignored () doesn't check for blacklisted devices */ + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_remove (manager->priv->blacklist, + GINT_TO_POINTER (id)); + + if (device_is_ignored (manager, device) == FALSE) { + run_custom_command (device, COMMAND_DEVICE_REMOVED); + + /* If a touchpad was to disappear... */ + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + } +} + +static void +set_devicepresence_handler (GsdMouseManager *manager) +{ + GdkDeviceManager *device_manager; + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + + manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (device_added_cb), manager); + manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", + G_CALLBACK (device_removed_cb), manager); + manager->priv->device_manager = device_manager; +} + +static void +gsd_mouse_manager_init (GsdMouseManager *manager) +{ + manager->priv = GSD_MOUSE_MANAGER_GET_PRIVATE (manager); + manager->priv->blacklist = g_hash_table_new (g_direct_hash, g_direct_equal); +} + +static gboolean +gsd_mouse_manager_idle_cb (GsdMouseManager *manager) +{ + GList *devices, *l; + + gnome_settings_profile_start (NULL); + + set_devicepresence_handler (manager); + + manager->priv->mouse_settings = g_settings_new (SETTINGS_MOUSE_DIR); + g_signal_connect (manager->priv->mouse_settings, "changed", + G_CALLBACK (mouse_callback), manager); + + manager->priv->mouse_a11y_settings = g_settings_new ("org.gnome.desktop.a11y.mouse"); + g_signal_connect (manager->priv->mouse_a11y_settings, "changed", + G_CALLBACK (mouse_callback), manager); + + manager->priv->touchpad_settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + g_signal_connect (manager->priv->touchpad_settings, "changed", + G_CALLBACK (touchpad_callback), manager); + + manager->priv->syndaemon_spawned = FALSE; + + set_locate_pointer (manager, g_settings_get_boolean (manager->priv->mouse_settings, KEY_LOCATE_POINTER)); + set_mousetweaks_daemon (manager, + g_settings_get_boolean (manager->priv->mouse_a11y_settings, KEY_DWELL_CLICK_ENABLED), + g_settings_get_boolean (manager->priv->mouse_a11y_settings, KEY_SECONDARY_CLICK_ENABLED)); + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (run_custom_command (device, COMMAND_DEVICE_PRESENT) == FALSE) { + set_mouse_settings (manager, device); + } else { + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_insert (manager->priv->blacklist, + GINT_TO_POINTER (id), GINT_TO_POINTER (1)); + } + } + g_list_free (devices); + + if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED)) { + devices = get_disabled_devices (manager->priv->device_manager); + for (l = devices; l != NULL; l = l->next) { + int device_id; + + device_id = GPOINTER_TO_INT (l->data); + set_touchpad_enabled (device_id); + } + g_list_free (devices); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_mouse_manager_start (GsdMouseManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + if (!supports_xinput_devices ()) { + g_debug ("XInput is not supported, not applying any settings"); + return TRUE; + } + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_mouse_manager_stop (GsdMouseManager *manager) +{ + GsdMouseManagerPrivate *p = manager->priv; + + g_debug ("Stopping mouse manager"); + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); + g_signal_handler_disconnect (p->device_manager, p->device_removed_id); + p->device_manager = NULL; + } + + if (p->mouse_a11y_settings != NULL) { + g_object_unref (p->mouse_a11y_settings); + p->mouse_a11y_settings = NULL; + } + + if (p->mouse_settings != NULL) { + g_object_unref (p->mouse_settings); + p->mouse_settings = NULL; + } + + if (p->touchpad_settings != NULL) { + g_object_unref (p->touchpad_settings); + p->touchpad_settings = NULL; + } + + set_locate_pointer (manager, FALSE); +} + +static void +gsd_mouse_manager_finalize (GObject *object) +{ + GsdMouseManager *mouse_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MOUSE_MANAGER (object)); + + mouse_manager = GSD_MOUSE_MANAGER (object); + + g_return_if_fail (mouse_manager->priv != NULL); + + if (mouse_manager->priv->blacklist != NULL) + g_hash_table_destroy (mouse_manager->priv->blacklist); + + if (mouse_manager->priv->start_idle_id != 0) + g_source_remove (mouse_manager->priv->start_idle_id); + + if (mouse_manager->priv->device_manager != NULL) { + g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_added_id); + g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_removed_id); + } + + if (mouse_manager->priv->mouse_settings != NULL) + g_object_unref (mouse_manager->priv->mouse_settings); + + if (mouse_manager->priv->mouse_a11y_settings != NULL) + g_object_unref (mouse_manager->priv->mouse_a11y_settings); + + if (mouse_manager->priv->touchpad_settings != NULL) + g_object_unref (mouse_manager->priv->touchpad_settings); + + G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->finalize (object); +} + +GsdMouseManager * +gsd_mouse_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MOUSE_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MOUSE_MANAGER (manager_object); +} diff --git a/.pc/16_use_synchronous_notifications.patch/configure.ac b/.pc/16_use_synchronous_notifications.patch/configure.ac new file mode 100644 index 00000000..d1739c4e --- /dev/null +++ b/.pc/16_use_synchronous_notifications.patch/configure.ac @@ -0,0 +1,581 @@ +AC_PREREQ([2.60]) + +AC_INIT([gnome-settings-daemon], + [3.6.4], + [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon]) + +AC_CONFIG_SRCDIR([gnome-settings-daemon/gnome-settings-manager.c]) + +AM_INIT_AUTOMAKE([1.9 tar-ustar dist-xz no-dist-gzip check-news]) +AM_MAINTAINER_MODE([enable]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +m4_define([gsd_api_version_major],[3]) +m4_define([gsd_api_version_minor],[0]) +m4_define([gsd_api_version],[gsd_api_version_major.gsd_api_version_minor]) +GSD_API_VERSION="gsd_api_version" +AC_SUBST(GSD_API_VERSION) + +AC_STDC_HEADERS +AC_PROG_CXX +AM_PROG_CC_C_O +AC_PROG_LIBTOOL + +AC_HEADER_STDC + +AC_SUBST(VERSION) + +AC_CONFIG_HEADERS([config.h]) + +IT_PROG_INTLTOOL([0.37.1]) + +GETTEXT_PACKAGE=gnome-settings-daemon +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain]) + +AM_GLIB_GNU_GETTEXT + +GSD_INTLTOOL_PLUGIN_RULE='%.gnome-settings-plugin: %.gnome-settings-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +AC_SUBST([GSD_INTLTOOL_PLUGIN_RULE]) + +dnl --------------------------------------------------------------------------- +dnl - Dependencies +dnl --------------------------------------------------------------------------- + +GLIB_REQUIRED_VERSION=2.31.0 +GTK_REQUIRED_VERSION=3.3.18 +GCONF_REQUIRED_VERSION=2.6.1 +GIO_REQUIRED_VERSION=2.26.0 +GNOME_DESKTOP_REQUIRED_VERSION=3.5.3 +LIBNOTIFY_REQUIRED_VERSION=0.7.3 +UPOWER_GLIB_REQUIRED_VERSION=0.9.1 +PA_REQUIRED_VERSION=0.9.16 +LIBWACOM_REQUIRED_VERSION=0.6 +UPOWER_REQUIRED_VERSION=0.9.11 +IBUS_REQUIRED_VERSION=1.4.99 + +EXTRA_COMPILE_WARNINGS(yes) + +PKG_CHECK_MODULES(SETTINGS_DAEMON, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +) + +PKG_CHECK_MODULES(SETTINGS_PLUGIN, + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +) + +GSD_PLUGIN_LDFLAGS="-export_dynamic -module -avoid-version -no-undefined" +case $host_os in + darwin*) + GSD_PLUGIN_LDFLAGS="${GSD_PLUGIN_LDFLAGS} -Wl,-bundle_loader,\$(top_builddir)/gnome-settings-daemon/gnome-settings-daemon" + ;; +esac +AC_SUBST([GSD_PLUGIN_LDFLAGS]) + +AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + +dnl ================================================================ +dnl GSettings stuff +dnl ================================================================ + +GLIB_GSETTINGS + +dnl --------------------------------------------------------------------------- +dnl - Check for gnome-desktop +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Check for LCMS2 +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2, have_new_lcms=yes, have_new_lcms=no) +if test x$have_new_lcms = xyes; then + AC_DEFINE(HAVE_NEW_LCMS,1,[Got new lcms2]) +else + PKG_CHECK_MODULES(LCMS, lcms2) +fi + +dnl --------------------------------------------------------------------------- +dnl - Check for libnotify +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_libnotify=yes], have_libnotify=no) +if test "x$have_libnotify" = xno ; then + AC_MSG_ERROR([libnotify is required to build gnome-settings-daemon]) +fi +AC_SUBST(LIBNOTIFY_CFLAGS) +AC_SUBST(LIBNOTIFY_LIBS) + +dnl --------------------------------------------------------------------------- +dnl - GUdev integration (default enabled) +dnl --------------------------------------------------------------------------- +GUDEV_PKG="" +AC_ARG_ENABLE(gudev, AS_HELP_STRING([--disable-gudev],[Disable GUdev support (not optional on Linux platforms)]), enable_gudev=$enableval) +if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(GUDEV, gudev-1.0, have_gudev="yes", have_gudev="no") + if test "x$have_gudev" = "xyes"; then + AC_DEFINE(HAVE_GUDEV, 1, [define if GUdev is available]) + GUDEV_PKG="gudev-1.0" + else + if test x$enable_gudev = xyes; then + AC_MSG_ERROR([GUdev enabled but not found]) + fi + fi +else + have_gudev=no +fi +AM_CONDITIONAL(HAVE_GUDEV, test x$have_gudev = xyes) + +dnl --------------------------------------------------------------------------- +dnl - common +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COMMON, x11 kbproto xi) + +dnl --------------------------------------------------------------------------- +dnl - automount +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(AUTOMOUNT, x11 kbproto) + +dnl --------------------------------------------------------------------------- +dnl - background +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(BACKGROUND, x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - mouse +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MOUSE, x11 xi) + +dnl --------------------------------------------------------------------------- +dnl - cursor +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(CURSOR, xfixes) + +dnl --------------------------------------------------------------------------- +dnl - xsettings +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XSETTINGS, fontconfig) + +dnl --------------------------------------------------------------------------- +dnl - Keyboard plugin stuff +dnl --------------------------------------------------------------------------- + +AC_ARG_ENABLE(ibus, + AS_HELP_STRING([--disable-ibus], + [Disable IBus support]), + enable_ibus=$enableval, + enable_ibus=yes) + +if test "x$enable_ibus" = "xyes" ; then + IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" + AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled]) +else + IBUS_MODULE= +fi +AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes") + +PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Housekeeping plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(GIOUNIX, [gio-unix-2.0]) + +dnl --------------------------------------------------------------------------- +dnl - media-keys plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra]) + +dnl --------------------------------------------------------------------------- +dnl - xrandr plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XRANDR, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION]) + +dnl --------------------------------------------------------------------------- +dnl - orientation plugin stuff +dnl --------------------------------------------------------------------------- + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(ORIENTATION, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0]) +fi + +dnl --------------------------------------------------------------------------- +dnl - sound plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(SOUND, [libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION]) + +# --------------------------------------------------------------------------- +# Power +# --------------------------------------------------------------------------- +PKG_CHECK_MODULES(POWER, upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext) + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(BACKLIGHT_HELPER, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ) +fi + +dnl --------------------------------------------------------------------------- +dnl - color +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COLOR, [colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3]) + +dnl --------------------------------------------------------------------------- +dnl - wacom (disabled for s390/s390x and non Linux platforms) +dnl --------------------------------------------------------------------------- + +case $host_os in + linux*) + if test "$host_cpu" = s390 -o "$host_cpu" = s390x; then + have_wacom=no + else + if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(WACOM, [libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom]) + else + AC_MSG_ERROR([GUdev is necessary to compile Wacom support]) + fi + have_wacom=yes + fi + ;; + *) + have_wacom=no + ;; +esac +AM_CONDITIONAL(HAVE_WACOM, test x$have_wacom = xyes) + +dnl ============================================== +dnl PackageKit section +dnl ============================================== + +have_packagekit=false +AC_ARG_ENABLE(packagekit, + AC_HELP_STRING([--disable-packagekit], + [turn off PackageKit support]), + [case "${enableval}" in + yes) WANT_PACKAGEKIT=yes ;; + no) WANT_PACKAGEKIT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-packagekit) ;; + esac], + [WANT_PACKAGEKIT=yes]) dnl Default value + +if test x$WANT_PACKAGEKIT = xyes ; then + PK_REQUIRED_VERSION=0.7.4 + PKG_CHECK_MODULES(PACKAGEKIT, glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_packagekit=true + AC_DEFINE(HAVE_PACKAGEKIT, 1, [Define if PackageKit should be used])], + [have_packagekit=false]) +fi +AM_CONDITIONAL(HAVE_PACKAGEKIT, test "x$have_packagekit" = "xtrue") + +AC_SUBST(PACKAGEKIT_CFLAGS) +AC_SUBST(PACKAGEKIT_LIBS) + +dnl ============================================== +dnl smartcard section +dnl ============================================== +have_smartcard_support=false +AC_ARG_ENABLE(smartcard-support, + AC_HELP_STRING([--disable-smartcard-support], + [turn off smartcard support]), + [case "${enableval}" in + yes) WANT_SMARTCARD_SUPPORT=yes ;; + no) WANT_SMARTCARD_SUPPORT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-smartcard-support) ;; + esac], + [WANT_SMARTCARD_SUPPORT=yes]) + +if test x$WANT_SMARTCARD_SUPPORT = xyes ; then + NSS_REQUIRED_VERSION=3.11.2 + PKG_CHECK_MODULES(NSS, nss >= $NSS_REQUIRED_VERSION, + [have_smartcard_support=true + AC_DEFINE(SMARTCARD_SUPPORT, 1, [Define if smartcard support should be enabled])], + [have_smartcard_support=false]) +fi +AM_CONDITIONAL(SMARTCARD_SUPPORT, test "x$have_smartcard_support" = "xtrue") + +AC_SUBST(NSS_CFLAGS) +AC_SUBST(NSS_LIBS) + +AC_ARG_WITH(nssdb, + AC_HELP_STRING([--with-nssdb], + [where system NSS database is])) + +NSS_DATABASE="" +if test "x$have_smartcard_support" = "xtrue"; then + if ! test -z "$with_nssdb" ; then + NSS_DATABASE="$with_nssdb" + else + NSS_DATABASE="${sysconfdir}/pki/nssdb" + fi +else + if ! test -z "$with_nssdb" ; then + AC_MSG_WARN([nssdb specified when smartcard support is disabled]) + fi +fi + +AC_SUBST(NSS_DATABASE) + + +dnl ============================================== +dnl systemd check +dnl ============================================== + +AC_ARG_ENABLE([systemd], + AS_HELP_STRING([--enable-systemd], [Use systemd for session tracking]), + [with_systemd=$enableval], + [with_systemd=no]) +if test "$with_systemd" = "yes" ; then + PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login]) + AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking]) + SESSION_TRACKING=systemd +else + SESSION_TRACKING=ConsoleKit +fi + +AC_SUBST(SYSTEMD_CFLAGS) +AC_SUBST(SYSTEMD_LIBS) + +AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = "yes"], [Using systemd]) + +# --------------------------------------------------------------------------- +# CUPS +# --------------------------------------------------------------------------- + +AC_ARG_ENABLE(cups, + AS_HELP_STRING([--disable-cups], [disable CUPS support (default: enabled)]),, + enable_cups=yes) + +if test x"$enable_cups" != x"no" ; then + AC_PROG_SED + + AC_PATH_PROG(CUPS_CONFIG, cups-config) + + if test x$CUPS_CONFIG = x; then + AC_MSG_ERROR([cups-config not found but CUPS support requested]) + fi + + CUPS_API_VERSION=`$CUPS_CONFIG --api-version` + CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 1` + CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 2` + + AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h],, + AC_MSG_ERROR([CUPS headers not found but CUPS support requested])) + + if ! test $CUPS_API_MAJOR -gt 1 -o \ + $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4 ; then + AC_MSG_ERROR([CUPS 1.4 or newer not found, but CUPS support requested]) + fi + + CUPS_CFLAGS=`$CUPS_CONFIG --cflags | $SED -e 's/-O\w*//g' -e 's/-m\w*//g'` + CUPS_LIBS=`$CUPS_CONFIG --libs` + AC_SUBST(CUPS_CFLAGS) + AC_SUBST(CUPS_LIBS) +fi + +AM_CONDITIONAL(BUILD_PRINT_NOTIFICATIONS, [test x"$enable_cups" = x"yes"]) + +# --------------------------------------------------------------------------- +# Enable Profiling +# --------------------------------------------------------------------------- +AC_ARG_ENABLE(profiling, + [AC_HELP_STRING([--enable-profiling], + [turn on profiling])], + , enable_profiling=no) +if test "x$enable_profiling" = "xyes"; then + AC_DEFINE(ENABLE_PROFILING,1,[enable profiling]) +fi + + +# --------------------------------------------------------------------------- +# Plugins +# --------------------------------------------------------------------------- + +plugindir='$(libdir)/gnome-settings-daemon-gsd_api_version' +AC_SUBST([plugindir]) + +PLUGIN_CFLAGS="-DG_LOG_DOMAIN=\"\\\"\$(plugin_name)-plugin\\\"\" -DPLUGIN_NAME=\"\\\"\$(plugin_name)\\\"\" " +AC_SUBST(PLUGIN_CFLAGS) + +AC_ARG_ENABLE(man, + [AS_HELP_STRING([--enable-man], + [generate man pages [default=yes]])],, + enable_man=yes) +if test "$enable_man" != no; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test -z "$XSLTPROC"; then + AC_MSG_ERROR([xsltproc is required for --enable-man]) + fi +fi +AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) + +dnl --------------------------------------------------------------------------- +dnl - Finish +dnl --------------------------------------------------------------------------- + + +# Turn on the additional warnings last, so warnings don't affect other tests. + +AC_ARG_ENABLE(more-warnings, + [AC_HELP_STRING([--enable-more-warnings], + [Maximum compiler warnings])], + set_more_warnings="$enableval",[ + if test -d $srcdir/.git; then + set_more_warnings=yes + else + set_more_warnings=no + fi + ]) +AC_MSG_CHECKING(for more warnings) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + CFLAGS="\ + -Wall \ + -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ + -Wnested-externs -Wpointer-arith \ + -Wcast-align -Wsign-compare \ + $CFLAGS" + + for option in -Wno-strict-aliasing -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + AC_MSG_RESULT($has_option) + unset has_option + unset SAVE_CFLAGS + done + unset option +else + AC_MSG_RESULT(no) +fi + +# +# Enable Debug +# +AC_ARG_ENABLE(debug, + [AC_HELP_STRING([--enable-debug], + [turn on debugging])], + , enable_debug=yes) +if test "$enable_debug" = "yes"; then + DEBUG_CFLAGS="-DG_ENABLE_DEBUG" +else + if test "x$enable_debug" = "xno"; then + DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" + else + DEBUG_CFLAGS="" + fi +fi +AC_SUBST(DEBUG_CFLAGS) + +AC_OUTPUT([ +Makefile +gnome-settings-daemon/Makefile +plugins/Makefile +plugins/a11y-keyboard/Makefile +plugins/a11y-settings/Makefile +plugins/automount/Makefile +plugins/background/Makefile +plugins/clipboard/Makefile +plugins/color/Makefile +plugins/common/Makefile +plugins/cursor/Makefile +plugins/dummy/Makefile +plugins/power/Makefile +plugins/housekeeping/Makefile +plugins/keyboard/Makefile +plugins/media-keys/Makefile +plugins/media-keys/cut-n-paste/Makefile +plugins/mouse/Makefile +plugins/orientation/Makefile +plugins/print-notifications/Makefile +plugins/screensaver-proxy/Makefile +plugins/smartcard/Makefile +plugins/sound/Makefile +plugins/updates/Makefile +plugins/wacom/Makefile +plugins/xrandr/Makefile +plugins/xsettings/Makefile +data/Makefile +data/gnome-settings-daemon.pc +data/gnome-settings-daemon-uninstalled.pc +data/org.gnome.settings-daemon.plugins.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in +data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in +data/org.gnome.settings-daemon.plugins.power.gschema.xml.in +data/org.gnome.settings-daemon.plugins.color.gschema.xml.in +data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.gschema.xml.in +data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in +data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in +data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in +data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in +po/Makefile.in +man/Makefile +]) + +dnl --------------------------------------------------------------------------- +dnl - Show summary +dnl --------------------------------------------------------------------------- + +echo " + gnome-settings-daemon $VERSION + ============================= + + prefix: ${prefix} + exec_prefix: ${exec_prefix} + libdir: ${libdir} + bindir: ${bindir} + sbindir: ${sbindir} + sysconfdir: ${sysconfdir} + sysconfsubdir: ${sysconfsubdir} + localstatedir: ${localstatedir} + plugindir: ${plugindir} + datadir: ${datadir} + source code location: ${srcdir} + compiler: ${CC} + cflags: ${CFLAGS} + Maintainer mode: ${USE_MAINTAINER_MODE} + + Session tracking: ${SESSION_TRACKING} + LCMS DICT support: ${have_new_lcms} + IBus support: ${enable_ibus} + Libnotify support: ${have_libnotify} + PackageKit support: ${have_packagekit} + Smartcard support: ${have_smartcard_support} + Cups support: ${enable_cups} + Wacom support: ${have_wacom} +${NSS_DATABASE:+\ + System nssdb: ${NSS_DATABASE} +}\ + Profiling support: ${enable_profiling} +" diff --git a/.pc/16_use_synchronous_notifications.patch/plugins/media-keys/gsd-media-keys-manager.c b/.pc/16_use_synchronous_notifications.patch/plugins/media-keys/gsd-media-keys-manager.c new file mode 100644 index 00000000..ef97cd78 --- /dev/null +++ b/.pc/16_use_synchronous_notifications.patch/plugins/media-keys/gsd-media-keys-manager.c @@ -0,0 +1,2548 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GUDEV +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-marshal.h" +#include "gsd-media-keys-manager.h" + +#include "shortcuts-list.h" +#include "gsd-osd-window.h" +#include "gsd-input-helper.h" +#include "gsd-power-helper.h" +#include "gsd-enums.h" + +#include +#include +#include "gvc-mixer-control.h" + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" +#define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +#define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +#define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring" +#define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon" +#define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon" + +#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +#define SETTINGS_INTERFACE_DIR "org.gnome.desktop.interface" +#define SETTINGS_POWER_DIR "org.gnome.settings-daemon.plugins.power" +#define SETTINGS_XSETTINGS_DIR "org.gnome.settings-daemon.plugins.xsettings" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" +#define TOUCHPAD_ENABLED_KEY "touchpad-enabled" +#define HIGH_CONTRAST "HighContrast" + +#define VOLUME_STEP 6 /* percents for one volume button press */ +#define MAX_VOLUME 65536.0 + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" + +#define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + +typedef struct { + char *application; + char *name; + guint32 time; + guint watch_id; +} MediaPlayer; + +typedef struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; + char *custom_path; + char *custom_command; + Key *key; +} MediaKey; + +struct GsdMediaKeysManagerPrivate +{ + /* Volume bits */ + GvcMixerControl *volume; + GvcMixerStream *stream; + ca_context *ca; + GtkSettings *gtksettings; +#ifdef HAVE_GUDEV + GHashTable *streams; /* key = X device ID, value = stream id */ + GUdevClient *udev_client; +#endif /* HAVE_GUDEV */ + + GtkWidget *dialog; + GSettings *settings; + GHashTable *custom_settings; + + GPtrArray *keys; + + /* HighContrast theme settings */ + GSettings *interface_settings; + char *icon_theme; + char *gtk_theme; + + /* Power stuff */ + GSettings *power_settings; + GDBusProxy *upower_proxy; + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; + int opcode; + + GList *media_players; + + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + guint start_idle_id; +}; + +static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +static void gsd_media_keys_manager_init (GsdMediaKeysManager *media_keys_manager); +static void gsd_media_keys_manager_finalize (GObject *object); +static void register_manager (GsdMediaKeysManager *manager); +static void custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager); +G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + + +static void +init_screens (GsdMediaKeysManager *manager) +{ + GdkDisplay *display; + int i; + + display = gdk_display_get_default (); + for (i = 0; i < gdk_display_get_n_screens (display); i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + if (screen == NULL) { + continue; + } + manager->priv->screens = g_slist_append (manager->priv->screens, screen); + } + + manager->priv->current_screen = manager->priv->screens->data; +} + +static void +media_key_free (MediaKey *key) +{ + if (key == NULL) + return; + g_free (key->custom_path); + g_free (key->custom_command); + free_key (key->key); + g_free (key); +} + +static char * +get_term_command (GsdMediaKeysManager *manager) +{ + char *cmd_term, *cmd_args;; + char *cmd = NULL; + GSettings *settings; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + cmd_term = g_settings_get_string (settings, "exec"); + if (cmd_term[0] == '\0') + cmd_term = g_strdup ("gnome-terminal"); + + cmd_args = g_settings_get_string (settings, "exec-arg"); + if (strcmp (cmd_term, "") != 0) { + cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args); + } else { + cmd = g_strdup_printf ("%s -e", cmd_term); + } + + g_free (cmd_args); + g_free (cmd_term); + g_object_unref (settings); + + return cmd; +} + +static char ** +get_keyring_env (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant, *item; + GVariantIter *iter; + char **envp; + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_KEYRING_DBUS_NAME, + GNOME_KEYRING_DBUS_PATH, + GNOME_KEYRING_DBUS_INTERFACE, + "GetEnvironment", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call GetEnvironment on keyring daemon: %s", error->message); + g_error_free (error); + return NULL; + } + + envp = g_get_environ (); + + g_variant_get (variant, "(a{ss})", &iter); + + while ((item = g_variant_iter_next_value (iter))) { + char *key; + char *value; + + g_variant_get (item, + "{ss}", + &key, + &value); + + envp = g_environ_setenv (envp, key, value, TRUE); + + g_variant_unref (item); + g_free (key); + g_free (value); + } + + g_variant_iter_free (iter); + g_variant_unref (variant); + + return envp; +} + +static void +execute (GsdMediaKeysManager *manager, + char *cmd, + gboolean need_term) +{ + gboolean retval; + char **argv; + int argc; + char *exec; + char *term = NULL; + GError *error = NULL; + + retval = FALSE; + + if (need_term) + term = get_term_command (manager); + + if (term) { + exec = g_strdup_printf ("%s %s", term, cmd); + g_free (term); + } else { + exec = g_strdup (cmd); + } + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + char **envp; + + envp = get_keyring_env (manager); + + retval = g_spawn_async (g_get_home_dir (), + argv, + envp, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + &error); + + g_strfreev (argv); + g_strfreev (envp); + } + + if (retval == FALSE) { + g_warning ("Couldn't execute command: %s: %s", exec, error->message); + g_error_free (error); + } + g_free (exec); +} + +static void +dialog_init (GsdMediaKeysManager *manager) +{ + if (manager->priv->dialog != NULL + && !gsd_osd_window_is_valid (GSD_OSD_WINDOW (manager->priv->dialog))) { + gtk_widget_destroy (manager->priv->dialog); + manager->priv->dialog = NULL; + } + + if (manager->priv->dialog == NULL) { + manager->priv->dialog = gsd_osd_window_new (); + } +} + +static void +print_key_parse_error (MediaKey *key, + const char *str) +{ + if (str == NULL || *str == '\0') + return; + if (key->settings_key != NULL) + g_debug ("Unable to parse key '%s' for GSettings entry '%s'", str, key->settings_key); + else + g_debug ("Unable to parse hard-coded key '%s'", key->hard_coded); +} + +static char * +get_key_string (GsdMediaKeysManager *manager, + MediaKey *key) +{ + if (key->settings_key != NULL) + return g_settings_get_string (manager->priv->settings, key->settings_key); + else if (key->hard_coded != NULL) + return g_strdup (key->hard_coded); + else if (key->custom_path != NULL) { + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->custom_settings, + key->custom_path); + return g_settings_get_string (settings, "binding"); + } else + g_assert_not_reached (); +} + +static gboolean +grab_media_key (MediaKey *key, + GsdMediaKeysManager *manager) +{ + char *tmp; + gboolean need_flush; + + need_flush = FALSE; + + if (key->key != NULL) { + need_flush = TRUE; + ungrab_key_unsafe (key->key, manager->priv->screens); + } + + free_key (key->key); + key->key = NULL; + + tmp = get_key_string (manager, key); + + key->key = parse_key (tmp); + if (key->key == NULL) { + print_key_parse_error (key, tmp); + g_free (tmp); + return need_flush; + } + + grab_key_unsafe (key->key, GSD_KEYGRAB_NORMAL, manager->priv->screens); + + g_free (tmp); + + return TRUE; +} + +static void +gsettings_changed_cb (GSettings *settings, + const gchar *settings_key, + GsdMediaKeysManager *manager) +{ + int i; + gboolean need_flush = TRUE; + + /* handled in gsettings_custom_changed_cb() */ + if (g_str_equal (settings_key, "custom-keybindings")) + return; + + gdk_error_trap_push (); + + /* Find the key that was modified */ + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + /* Skip over hard-coded and GConf keys */ + if (key->settings_key == NULL) + continue; + if (strcmp (settings_key, key->settings_key) == 0) { + if (grab_media_key (key, manager)) + need_flush = TRUE; + break; + } + } + + if (need_flush) + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); +} + +static MediaKey * +media_key_new_for_path (GsdMediaKeysManager *manager, + char *path) +{ + GSettings *settings; + char *command, *binding; + MediaKey *key; + + g_debug ("media_key_new_for_path: %s", path); + + settings = g_hash_table_lookup (manager->priv->custom_settings, path); + if (settings == NULL) { + settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path); + + g_signal_connect (settings, "changed", + G_CALLBACK (custom_binding_changed), manager); + g_hash_table_insert (manager->priv->custom_settings, + g_strdup (path), settings); + } + + command = g_settings_get_string (settings, "command"); + binding = g_settings_get_string (settings, "binding"); + + if (*command == '\0' && *binding == '\0') { + g_debug ("Key binding (%s) is incomplete", path); + g_free (command); + g_free (binding); + return NULL; + } + g_free (binding); + + key = g_new0 (MediaKey, 1); + key->key_type = CUSTOM_KEY; + key->custom_path = g_strdup (path); + key->custom_command = command; + + return key; +} + +static void +update_custom_binding (GsdMediaKeysManager *manager, + char *path) +{ + MediaKey *key; + int i; + + /* Remove the existing key */ + for (i = 0; i < manager->priv->keys->len; i++) { + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->custom_path == NULL) + continue; + if (strcmp (key->custom_path, path) == 0) { + g_debug ("Removing custom key binding %s", path); + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", path); + } + g_ptr_array_remove_index_fast (manager->priv->keys, i); + break; + } + } + + /* And create a new one! */ + key = media_key_new_for_path (manager, path); + if (key) { + g_debug ("Adding new custom key binding %s", path); + g_ptr_array_add (manager->priv->keys, key); + + gdk_error_trap_push (); + + grab_media_key (key, manager); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for custom key '%s'", + key->custom_path); + } +} + +static void +custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char *path; + + if (strcmp (settings_key, "name") == 0) + return; /* we don't care */ + + g_object_get (settings, "path", &path, NULL); + update_custom_binding (manager, path); + g_free (path); +} + +static void +gsettings_custom_changed_cb (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char **bindings; + int i, j, n_bindings; + + bindings = g_settings_get_strv (settings, settings_key); + n_bindings = g_strv_length (bindings); + + /* Handle additions */ + for (i = 0; i < n_bindings; i++) { + if (g_hash_table_lookup (manager->priv->custom_settings, + bindings[i])) + continue; + update_custom_binding (manager, bindings[i]); + } + + /* Handle removals */ + for (i = 0; i < manager->priv->keys->len; i++) { + gboolean found = FALSE; + MediaKey *key = g_ptr_array_index (manager->priv->keys, i); + if (key->key_type != CUSTOM_KEY) + continue; + + for (j = 0; j < n_bindings && !found; j++) + found = strcmp (bindings[j], key->custom_path) == 0; + + if (found) + continue; + + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", key->custom_path); + } + g_hash_table_remove (manager->priv->custom_settings, + key->custom_path); + g_ptr_array_remove_index_fast (manager->priv->keys, i); + --i; /* make up for the removed key */ + } + g_strfreev (bindings); +} + +static void +add_key (GsdMediaKeysManager *manager, guint i) +{ + MediaKey *key; + + key = g_new0 (MediaKey, 1); + key->key_type = media_keys[i].key_type; + key->settings_key = media_keys[i].settings_key; + key->hard_coded = media_keys[i].hard_coded; + + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); +} + +static void +init_kbd (GsdMediaKeysManager *manager) +{ + char **custom_paths; + int i; + + gnome_settings_profile_start (NULL); + + gdk_error_trap_push (); + + manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free); + + /* Media keys + * Add hard-coded shortcuts first so that they can't be preempted */ + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded) + add_key (manager, i); + } + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded == NULL) + add_key (manager, i); + } + + /* Custom shortcuts */ + custom_paths = g_settings_get_strv (manager->priv->settings, + "custom-keybindings"); + + for (i = 0; i < g_strv_length (custom_paths); i++) { + MediaKey *key; + + g_debug ("Setting up custom keybinding %s", custom_paths[i]); + + key = media_key_new_for_path (manager, custom_paths[i]); + if (!key) { + continue; + } + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); + } + g_strfreev (custom_paths); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); + + gnome_settings_profile_end (NULL); +} + +static void +dialog_show (GsdMediaKeysManager *manager) +{ + int orig_w; + int orig_h; + int screen_w; + int screen_h; + int x; + int y; + GdkRectangle geometry; + int monitor; + + gtk_window_set_screen (GTK_WINDOW (manager->priv->dialog), + manager->priv->current_screen); + + /* + * get the window size + * if the window hasn't been mapped, it doesn't necessarily + * know its true size, yet, so we need to jump through hoops + */ + gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h); + + monitor = gdk_screen_get_primary_monitor (manager->priv->current_screen); + + gdk_screen_get_monitor_geometry (manager->priv->current_screen, + monitor, + &geometry); + + screen_w = geometry.width; + screen_h = geometry.height; + + x = ((screen_w - orig_w) / 2) + geometry.x; + y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; + + gtk_window_move (GTK_WINDOW (manager->priv->dialog), x, y); + + gtk_widget_show (manager->priv->dialog); + + gdk_display_sync (gdk_screen_get_display (manager->priv->current_screen)); +} + +static void +launch_app (GAppInfo *app_info, + gint64 timestamp) +{ + GError *error = NULL; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + if (!g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) { + g_warning ("Could not launch '%s': %s", + g_app_info_get_commandline (app_info), + error->message); + g_error_free (error); + } + g_object_unref (launch_context); +} + +static void +do_url_action (GsdMediaKeysManager *manager, + const char *scheme, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_uri_scheme (scheme); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' scheme", scheme); + } +} + +static void +do_media_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg"); + } +} + +static void +gnome_session_shutdown (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + /* Shouldn't happen, but you never know */ + if (manager->priv->connection == NULL) { + execute (manager, "gnome-session-quit --logout", FALSE); + return; + } + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + "Shutdown", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call Shutdown on session manager: %s", error->message); + g_error_free (error); + return; + } + g_variant_unref (variant); +} + +static void +do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + g_drive_eject_with_operation_finish (drive, res, NULL); +} + +#define NO_SCORE 0 +#define SCORE_CAN_EJECT 50 +#define SCORE_HAS_MEDIA 100 +static void +do_eject_action (GsdMediaKeysManager *manager) +{ + GList *drives, *l; + GDrive *fav_drive; + guint score; + GVolumeMonitor *volume_monitor; + + volume_monitor = g_volume_monitor_get (); + + + /* Find the best drive to eject */ + fav_drive = NULL; + score = NO_SCORE; + drives = g_volume_monitor_get_connected_drives (volume_monitor); + for (l = drives; l != NULL; l = l->next) { + GDrive *drive = l->data; + + if (g_drive_can_eject (drive) == FALSE) + continue; + if (g_drive_is_media_removable (drive) == FALSE) + continue; + if (score < SCORE_CAN_EJECT) { + fav_drive = drive; + score = SCORE_CAN_EJECT; + } + if (g_drive_has_media (drive) == FALSE) + continue; + if (score < SCORE_HAS_MEDIA) { + fav_drive = drive; + score = SCORE_HAS_MEDIA; + break; + } + } + + /* Show the dialogue */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "media-eject-symbolic", + FALSE); + dialog_show (manager); + + /* Clean up the drive selection and exit if no suitable + * drives are found */ + if (fav_drive != NULL) + fav_drive = g_object_ref (fav_drive); + + g_list_foreach (drives, (GFunc) g_object_unref, NULL); + if (fav_drive == NULL) + return; + + /* Eject! */ + g_drive_eject_with_operation (fav_drive, G_MOUNT_UNMOUNT_FORCE, + NULL, NULL, + (GAsyncReadyCallback) do_eject_action_cb, + manager); + g_object_unref (fav_drive); + g_object_unref (volume_monitor); +} + +static void +do_home_key_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GFile *file; + GError *error = NULL; + char *uri; + + file = g_file_new_for_path (g_get_home_dir ()); + uri = g_file_get_uri (file); + g_object_unref (file); + + if (gtk_show_uri (NULL, uri, timestamp, &error) == FALSE) { + g_warning ("Failed to launch '%s': %s", uri, error->message); + g_error_free (error); + } + g_free (uri); +} + +static void +do_execute_desktop (GsdMediaKeysManager *manager, + const char *desktop, + gint64 timestamp) +{ + GDesktopAppInfo *app_info; + + app_info = g_desktop_app_info_new (desktop); + if (app_info != NULL) { + launch_app (G_APP_INFO (app_info), timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find application '%s'", desktop); + } +} + +static void +do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) +{ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", + FALSE); + dialog_show (manager); +} + +static void +do_touchpad_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + gboolean state; + + if (touchpad_is_present () == FALSE) { + do_touchpad_osd_action (manager, FALSE); + return; + } + + settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY); + + do_touchpad_osd_action (manager, !state); + + g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state); + g_object_unref (settings); +} + +static void +update_dialog (GsdMediaKeysManager *manager, + GvcMixerStream *stream, + guint vol, + gboolean muted, + gboolean sound_changed, + gboolean quiet) +{ + if (!muted) { + vol = (int) (100 * (double) vol / PA_VOLUME_NORM); + vol = CLAMP (vol, 0, 100); + } else { + vol = 0.0; + } + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), + muted); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), vol); + gsd_osd_window_set_action (GSD_OSD_WINDOW (manager->priv->dialog), + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); + ca_context_play (manager->priv->ca, 1, + CA_PROP_EVENT_ID, "audio-volume-change", + CA_PROP_EVENT_DESCRIPTION, "volume changed through key press", + CA_PROP_CANBERRA_CACHE_CONTROL, "permanent", + NULL); + } +} + +#ifdef HAVE_GUDEV +/* PulseAudio gives us /devices/... paths, when udev + * expects /sys/devices/... paths. */ +static GUdevDevice * +get_udev_device_for_sysfs_path (GsdMediaKeysManager *manager, + const char *sysfs_path) +{ + char *path; + GUdevDevice *dev; + + path = g_strdup_printf ("/sys%s", sysfs_path); + dev = g_udev_client_query_by_sysfs_path (manager->priv->udev_client, path); + g_free (path); + + return dev; +} + +static GvcMixerStream * +get_stream_for_device_id (GsdMediaKeysManager *manager, + guint deviceid) +{ + char *devnode; + gpointer id_ptr; + GvcMixerStream *res; + GUdevDevice *dev, *parent; + GSList *sinks, *l; + + id_ptr = g_hash_table_lookup (manager->priv->streams, GUINT_TO_POINTER (deviceid)); + if (id_ptr != NULL) { + if (GPOINTER_TO_UINT (id_ptr) == (guint) -1) + return NULL; + else + return gvc_mixer_control_lookup_stream_id (manager->priv->volume, GPOINTER_TO_UINT (id_ptr)); + } + + devnode = xdevice_get_device_node (deviceid); + if (devnode == NULL) { + g_debug ("Could not find device node for XInput device %d", deviceid); + return NULL; + } + + dev = g_udev_client_query_by_device_file (manager->priv->udev_client, devnode); + if (dev == NULL) { + g_debug ("Could not find udev device for device path '%s'", devnode); + g_free (devnode); + return NULL; + } + g_free (devnode); + + if (g_strcmp0 (g_udev_device_get_property (dev, "ID_BUS"), "usb") != 0) { + g_debug ("Not handling XInput device %d, not USB", deviceid); + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + g_object_unref (dev); + return NULL; + } + + parent = g_udev_device_get_parent_with_subsystem (dev, "usb", "usb_device"); + if (parent == NULL) { + g_warning ("No USB device parent for XInput device %d even though it's USB", deviceid); + g_object_unref (dev); + return NULL; + } + + res = NULL; + sinks = gvc_mixer_control_get_sinks (manager->priv->volume); + for (l = sinks; l; l = l->next) { + GvcMixerStream *stream = l->data; + const char *sysfs_path; + GUdevDevice *sink_dev, *sink_parent; + + sysfs_path = gvc_mixer_stream_get_sysfs_path (stream); + sink_dev = get_udev_device_for_sysfs_path (manager, sysfs_path); + if (sink_dev == NULL) + continue; + sink_parent = g_udev_device_get_parent_with_subsystem (sink_dev, "usb", "usb_device"); + g_object_unref (sink_dev); + if (sink_parent == NULL) + continue; + + if (g_strcmp0 (g_udev_device_get_sysfs_path (sink_parent), + g_udev_device_get_sysfs_path (parent)) == 0) { + res = stream; + } + g_object_unref (sink_parent); + if (res != NULL) + break; + } + + if (res) + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER (gvc_mixer_stream_get_id (res))); + else + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + + return res; +} +#endif /* HAVE_GUDEV */ + +static void +do_sound_action (GsdMediaKeysManager *manager, + guint deviceid, + int type, + gboolean quiet) +{ + GvcMixerStream *stream; + gboolean old_muted, new_muted; + guint old_vol, new_vol, norm_vol_step; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +#ifdef HAVE_GUDEV + stream = get_stream_for_device_id (manager, deviceid); + if (stream == NULL) +#endif /* HAVE_GUDEV */ + stream = manager->priv->stream; + if (stream == NULL) + return; + + norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100; + + /* FIXME: this is racy */ + new_vol = old_vol = gvc_mixer_stream_get_volume (stream); + new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream); + sound_changed = FALSE; + + switch (type) { + case MUTE_KEY: + new_muted = !old_muted; + break; + case VOLUME_DOWN_KEY: + if (old_vol <= norm_vol_step) { + new_vol = 0; + new_muted = TRUE; + } else { + new_vol = old_vol - norm_vol_step; + } + break; + case VOLUME_UP_KEY: + new_muted = FALSE; + /* When coming out of mute only increase the volume if it was 0 */ + if (!old_muted || old_vol == 0) + new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME); + break; + } + + if (old_muted != new_muted) { + gvc_mixer_stream_change_is_muted (stream, new_muted); + sound_changed = TRUE; + } + + if (old_vol != new_vol) { + if (gvc_mixer_stream_set_volume (stream, new_vol) != FALSE) { + gvc_mixer_stream_push_volume (stream); + sound_changed = TRUE; + } + } + + update_dialog (manager, stream, new_vol, new_muted, sound_changed, quiet); +} + +static void +sound_theme_changed (GtkSettings *settings, + GParamSpec *pspec, + GsdMediaKeysManager *manager) +{ + char *theme_name; + + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); +} + +static void +update_default_sink (GsdMediaKeysManager *manager) +{ + GvcMixerStream *stream; + + stream = gvc_mixer_control_get_default_sink (manager->priv->volume); + if (stream == manager->priv->stream) + return; + + if (manager->priv->stream != NULL) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + + if (stream != NULL) { + manager->priv->stream = g_object_ref (stream); + } else { + g_warning ("Unable to get default sink"); + } +} + +static void +on_control_state_changed (GvcMixerControl *control, + GvcMixerControlState new_state, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +static void +on_control_default_sink_changed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +#ifdef HAVE_GUDEV +static gboolean +remove_stream (gpointer key, + gpointer value, + gpointer id) +{ + if (GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (id)) + return TRUE; + return FALSE; +} +#endif /* HAVE_GUDEV */ + +static void +on_control_stream_removed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + if (manager->priv->stream != NULL) { + if (gvc_mixer_stream_get_id (manager->priv->stream) == id) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + } + +#ifdef HAVE_GUDEV + g_hash_table_foreach_remove (manager->priv->streams, (GHRFunc) remove_stream, GUINT_TO_POINTER (id)); +#endif +} + +static void +free_media_player (MediaPlayer *player) +{ + if (player->watch_id > 0) { + g_bus_unwatch_name (player->watch_id); + player->watch_id = 0; + } + g_free (player->application); + g_free (player->name); + g_free (player); +} + +static gint +find_by_application (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->application, b); +} + +static gint +find_by_name (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->name, b); +} + +static gint +find_by_time (gconstpointer a, + gconstpointer b) +{ + return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time; +} + +static void +name_vanished_handler (GDBusConnection *connection, + const gchar *name, + GsdMediaKeysManager *manager) +{ + GList *iter; + + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering vanished %s (name: %s)", player->application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +/* + * Register a new media player. Most applications will want to call + * this with time = GDK_CURRENT_TIME. This way, the last registered + * player will receive media events. In some cases, applications + * may want to register with a lower priority (usually 1), to grab + * events only nobody is interested. + */ +static void +gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name, + guint32 time) +{ + GList *iter; + MediaPlayer *media_player; + guint watch_id; + + if (time == GDK_CURRENT_TIME) { + GTimeVal tv; + + g_get_current_time (&tv); + time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + } + + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + + if (iter != NULL) { + if (((MediaPlayer *)iter->data)->time < time) { + MediaPlayer *player = iter->data; + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } else { + return; + } + } + + watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_handler, + manager, + NULL); + + g_debug ("Registering %s at %u", application, time); + media_player = g_new0 (MediaPlayer, 1); + media_player->application = g_strdup (application); + media_player->name = g_strdup (name); + media_player->time = time; + media_player->watch_id = watch_id; + + manager->priv->media_players = g_list_insert_sorted (manager->priv->media_players, + media_player, + find_by_time); +} + +static void +gsd_media_keys_manager_release_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name) +{ + GList *iter = NULL; + + g_return_if_fail (application != NULL || name != NULL); + + if (application != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + } + + if (iter == NULL && name != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + } + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering %s (name: %s)", application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +static gboolean +gsd_media_player_key_pressed (GsdMediaKeysManager *manager, + const char *key) +{ + const char *application; + gboolean have_listeners; + GError *error = NULL; + MediaPlayer *player; + + g_return_val_if_fail (key != NULL, FALSE); + + g_debug ("Media key '%s' pressed", key); + + have_listeners = (manager->priv->media_players != NULL); + + if (!have_listeners) { + /* Popup a dialog with an (/) icon */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "action-unavailable-symbolic", + FALSE); + dialog_show (manager); + return TRUE; + } + + player = manager->priv->media_players->data; + application = player->application; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + player->name, + GSD_MEDIA_KEYS_DBUS_PATH, + GSD_MEDIA_KEYS_DBUS_NAME, + "MediaPlayerKeyPressed", + g_variant_new ("(ss)", application ? application : "", key), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + + return !have_listeners; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdMediaKeysManager *manager = (GsdMediaKeysManager *) user_data; + + g_debug ("Calling method '%s' for media-keys", method_name); + + if (g_strcmp0 (method_name, "ReleaseMediaPlayerKeys") == 0) { + const char *app_name; + + g_variant_get (parameters, "(&s)", &app_name); + gsd_media_keys_manager_release_media_player_keys (manager, app_name, sender); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "GrabMediaPlayerKeys") == 0) { + const char *app_name; + guint32 time; + + g_variant_get (parameters, "(&su)", &app_name, &time); + gsd_media_keys_manager_grab_media_player_keys (manager, app_name, sender, time); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static gboolean +do_multimedia_player_action (GsdMediaKeysManager *manager, + const char *key) +{ + return gsd_media_player_key_pressed (manager, key); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + char *action; + + action = g_object_get_data (G_OBJECT (source_object), + "gsd-media-keys-manager-xrandr-action"); + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call '%s': %s", action, error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } + + g_free (action); +} + +static void +do_xrandr_action (GsdMediaKeysManager *manager, + const char *action, + gint64 timestamp) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + priv->cancellable = g_cancellable_new (); + + g_object_set_data (G_OBJECT (priv->xrandr_proxy), + "gsd-media-keys-manager-xrandr-action", + g_strdup (action)); + + g_dbus_proxy_call (priv->xrandr_proxy, + action, + g_variant_new ("(x)", timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static gboolean +do_video_out_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "VideoModeSwitch", timestamp); + return FALSE; +} + +static gboolean +do_video_rotate_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "Rotate", timestamp); + return FALSE; +} + +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + +static void +do_text_size_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + gdouble factor, best, distance; + guint i; + + /* Same values used in the Seeing tab of the Universal Access panel */ + static gdouble factors[] = { + 0.75, + 1.0, + 1.25, + 1.5 + }; + + /* Figure out the current DPI scaling factor */ + factor = g_settings_get_double (manager->priv->interface_settings, "text-scaling-factor"); + factor += (type == INCREASE_TEXT_KEY ? 0.25 : -0.25); + + /* Try to find a matching value */ + distance = 1e6; + best = 1.0; + for (i = 0; i < G_N_ELEMENTS(factors); i++) { + gdouble d; + d = fabs (factor - factors[i]); + if (d < distance) { + best = factors[i]; + distance = d; + } + } + + if (best == 1.0) + g_settings_reset (manager->priv->interface_settings, "text-scaling-factor"); + else + g_settings_set_double (manager->priv->interface_settings, "text-scaling-factor", best); +} + +static void +do_magnifier_zoom_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + gdouble offset, value; + + if (type == MAGNIFIER_ZOOM_IN_KEY) + offset = 1.0; + else + offset = -1.0; + + settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + value = g_settings_get_double (settings, "mag-factor"); + value += offset; + value = roundl (value); + g_settings_set_double (settings, "mag-factor", value); + g_object_unref (settings); +} + +static void +do_toggle_contrast_action (GsdMediaKeysManager *manager) +{ + gboolean high_contrast; + char *theme; + + /* Are we using HighContrast now? */ + theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + high_contrast = g_str_equal (theme, HIGH_CONTRAST); + g_free (theme); + + if (high_contrast != FALSE) { + if (manager->priv->gtk_theme == NULL) + g_settings_reset (manager->priv->interface_settings, "gtk-theme"); + else + g_settings_set (manager->priv->interface_settings, "gtk-theme", manager->priv->gtk_theme); + g_settings_set (manager->priv->interface_settings, "icon-theme", manager->priv->icon_theme); + } else { + g_settings_set (manager->priv->interface_settings, "gtk-theme", HIGH_CONTRAST); + g_settings_set (manager->priv->interface_settings, "icon-theme", HIGH_CONTRAST); + } +} + +static void +do_config_power_action (GsdMediaKeysManager *manager, + const gchar *config_key) +{ + GsdPowerActionType action_type; + + action_type = g_settings_get_enum (manager->priv->power_settings, + config_key); + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + case GSD_POWER_ACTION_SHUTDOWN: + gnome_session_shutdown (manager); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_BLANK: + case GSD_POWER_ACTION_NOTHING: + /* these actions cannot be handled by media-keys and + * are not used in this context */ + break; + } +} + +static void +update_screen_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "display-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + g_variant_unref (new_percentage); +} + +static void +do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + if (manager->priv->connection == NULL || + manager->priv->power_screen_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_screen_proxy, + type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_screen_cb, + manager); +} + +static void +update_keyboard_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new keyboard percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "keyboard-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + g_variant_unref (new_percentage); +} + +static void +do_keyboard_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + const char *cmd; + + if (manager->priv->connection == NULL || + manager->priv->power_keyboard_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + switch (type) { + case KEYBOARD_BRIGHTNESS_UP_KEY: + cmd = "StepUp"; + break; + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + cmd = "StepDown"; + break; + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + cmd = "Toggle"; + break; + default: + g_assert_not_reached (); + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_keyboard_proxy, + cmd, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_keyboard_cb, + manager); +} + +static void +do_switch_input_source_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + GVariant *sources; + gint i, n; + + settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + + n = g_variant_n_children (sources); + if (n < 2) + goto out; + + i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); + + if (type == SWITCH_INPUT_SOURCE_KEY) + i += 1; + else + i -= 1; + + if (i < 0) + i = n - 1; + else if (i >= n) + i = 0; + + g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); + + out: + g_variant_unref (sources); + g_object_unref (settings); +} + +static void +do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +{ + execute (manager, key->custom_command, FALSE); +} + +static gboolean +do_action (GsdMediaKeysManager *manager, + guint deviceid, + MediaKeyType type, + gint64 timestamp) +{ + char *cmd; + + g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid); + + switch (type) { + case TOUCHPAD_KEY: + do_touchpad_action (manager); + break; + case TOUCHPAD_ON_KEY: + do_touchpad_osd_action (manager, TRUE); + break; + case TOUCHPAD_OFF_KEY: + do_touchpad_osd_action (manager, FALSE); + break; + case MUTE_KEY: + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + do_sound_action (manager, deviceid, type, FALSE); + break; + case MUTE_QUIET_KEY: + do_sound_action (manager, deviceid, MUTE_KEY, TRUE); + break; + case VOLUME_DOWN_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_DOWN_KEY, TRUE); + break; + case VOLUME_UP_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: + gnome_session_shutdown (manager); + break; + case EJECT_KEY: + do_eject_action (manager); + break; + case HOME_KEY: + do_home_key_action (manager, timestamp); + break; + case SEARCH_KEY: + cmd = NULL; + if ((cmd = g_find_program_in_path ("tracker-search-tool"))) + do_execute_desktop (manager, "tracker-needle.desktop", timestamp); + else + do_execute_desktop (manager, "gnome-search-tool.desktop", timestamp); + g_free (cmd); + break; + case EMAIL_KEY: + do_url_action (manager, "mailto", timestamp); + break; + case SCREENSAVER_KEY: + execute (manager, "gnome-screensaver-command --lock", FALSE); + break; + case HELP_KEY: + do_url_action (manager, "ghelp", timestamp); + break; + case SCREENSHOT_KEY: + execute (manager, "gnome-screenshot", FALSE); + break; + case WINDOW_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --window", FALSE); + break; + case AREA_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --area", FALSE); + break; + case SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --clipboard", FALSE); + break; + case WINDOW_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --window --clipboard", FALSE); + break; + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; + case MEDIA_KEY: + do_media_action (manager, timestamp); + break; + case CALCULATOR_KEY: + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: + return do_multimedia_player_action (manager, "Play"); + case PAUSE_KEY: + return do_multimedia_player_action (manager, "Pause"); + case STOP_KEY: + return do_multimedia_player_action (manager, "Stop"); + case PREVIOUS_KEY: + return do_multimedia_player_action (manager, "Previous"); + case NEXT_KEY: + return do_multimedia_player_action (manager, "Next"); + case REWIND_KEY: + return do_multimedia_player_action (manager, "Rewind"); + case FORWARD_KEY: + return do_multimedia_player_action (manager, "FastForward"); + case REPEAT_KEY: + return do_multimedia_player_action (manager, "Repeat"); + case RANDOM_KEY: + return do_multimedia_player_action (manager, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; + case ROTATE_VIDEO_KEY: + do_video_rotate_action (manager, timestamp); + break; + case MAGNIFIER_KEY: + do_magnifier_action (manager); + break; + case SCREENREADER_KEY: + do_screenreader_action (manager); + break; + case ON_SCREEN_KEYBOARD_KEY: + do_on_screen_keyboard_action (manager); + break; + case INCREASE_TEXT_KEY: + case DECREASE_TEXT_KEY: + do_text_size_action (manager, type); + break; + case MAGNIFIER_ZOOM_IN_KEY: + case MAGNIFIER_ZOOM_OUT_KEY: + do_magnifier_zoom_action (manager, type); + break; + case TOGGLE_CONTRAST_KEY: + do_toggle_contrast_action (manager); + break; + case POWER_KEY: + do_config_power_action (manager, "button-power"); + break; + case SLEEP_KEY: + do_config_power_action (manager, "button-sleep"); + break; + case SUSPEND_KEY: + do_config_power_action (manager, "button-suspend"); + break; + case HIBERNATE_KEY: + do_config_power_action (manager, "button-hibernate"); + break; + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + do_screen_brightness_action (manager, type); + break; + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + do_keyboard_brightness_action (manager, type); + break; + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; + case SWITCH_INPUT_SOURCE_KEY: + case SWITCH_INPUT_SOURCE_BACKWARD_KEY: + do_switch_input_source_action (manager, type); + break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); + } + + return FALSE; +} + +static GdkScreen * +get_screen_from_root (GsdMediaKeysManager *manager, + Window root) +{ + GSList *l; + + /* Look for which screen we're receiving events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + GdkScreen *screen = (GdkScreen *) l->data; + GdkWindow *window = gdk_screen_get_root_window (screen); + + if (GDK_WINDOW_XID (window) == root) + return screen; + } + + return NULL; +} + +static GdkFilterReturn +filter_key_events (XEvent *xevent, + GdkEvent *event, + GsdMediaKeysManager *manager) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XGenericEventCookie *cookie; + guint i; + guint deviceid; + + /* verify we have a key event */ + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + cookie = &xevent->xcookie; + if (cookie->extension != manager->priv->opcode) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + deviceid = xev->sourceid; + + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (match_xi2_key (key->key, xev)) { + switch (key->key_type) { + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + /* auto-repeatable keys */ + if (xiev->evtype != XI_KeyPress) + return GDK_FILTER_CONTINUE; + break; + default: + if (xiev->evtype != XI_KeyRelease) { + return GDK_FILTER_CONTINUE; + } + } + + manager->priv->current_screen = get_screen_from_root (manager, xev->root); + + if (key->key_type == CUSTOM_KEY) { + do_custom_action (manager, key, xev->time); + return GDK_FILTER_REMOVE; + } + + if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +update_theme_settings (GSettings *settings, + const char *key, + GsdMediaKeysManager *manager) +{ + char *theme; + + theme = g_settings_get_string (manager->priv->interface_settings, key); + if (g_str_equal (theme, HIGH_CONTRAST)) { + g_free (theme); + } else { + if (g_str_equal (key, "gtk-theme")) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = theme; + } else { + g_free (manager->priv->icon_theme); + manager->priv->icon_theme = theme; + } + } +} + +static gboolean +start_media_keys_idle_cb (GsdMediaKeysManager *manager) +{ + GSList *l; + char *theme_name; + + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::custom-keybindings", + G_CALLBACK (gsettings_custom_changed_cb), manager); + + manager->priv->custom_settings = + g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + /* Sound events */ + ca_context_create (&manager->priv->ca); + ca_context_set_driver (manager->priv->ca, "pulse"); + ca_context_change_props (manager->priv->ca, 0, + CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", + NULL); + manager->priv->gtksettings = gtk_settings_get_for_screen (gdk_screen_get_default ()); + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); + g_signal_connect (manager->priv->gtksettings, "notify::gtk-sound-theme-name", + G_CALLBACK (sound_theme_changed), manager); + + /* for the power plugin interface code */ + manager->priv->power_settings = g_settings_new (SETTINGS_POWER_DIR); + + /* Logic from http://git.gnome.org/browse/gnome-shell/tree/js/ui/status/accessibility.js#n163 */ + manager->priv->interface_settings = g_settings_new (SETTINGS_INTERFACE_DIR); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::gtk-theme", + G_CALLBACK (update_theme_settings), manager); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::icon-theme", + G_CALLBACK (update_theme_settings), manager); + manager->priv->gtk_theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + if (g_str_equal (manager->priv->gtk_theme, HIGH_CONTRAST)) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = NULL; + } + manager->priv->icon_theme = g_settings_get_string (manager->priv->interface_settings, "icon-theme"); + + init_screens (manager); + init_kbd (manager); + + /* Start filtering the events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + gnome_settings_profile_start ("gdk_window_add_filter"); + + g_debug ("adding key filter for screen: %d", + gdk_screen_get_number (l->data)); + + gdk_window_add_filter (gdk_screen_get_root_window (l->data), + (GdkFilterFunc) filter_key_events, + manager); + gnome_settings_profile_end ("gdk_window_add_filter"); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error) +{ + const char * const subsystems[] = { "input", "usb", "sound", NULL }; + + gnome_settings_profile_start (NULL); + + if (supports_xinput2_devices (&manager->priv->opcode) == FALSE) { + g_debug ("No Xinput2 support, disabling plugin"); + return TRUE; + } + +#ifdef HAVE_GUDEV + manager->priv->streams = g_hash_table_new (g_direct_hash, g_direct_equal); + manager->priv->udev_client = g_udev_client_new (subsystems); +#endif + + /* initialise Volume handler + * + * We do this one here to force checking gstreamer cache, etc. + * The rest (grabbing and setting the keys) can happen in an + * idle. + */ + gnome_settings_profile_start ("gvc_mixer_control_new"); + + manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys"); + + g_signal_connect (manager->priv->volume, + "state-changed", + G_CALLBACK (on_control_state_changed), + manager); + g_signal_connect (manager->priv->volume, + "default-sink-changed", + G_CALLBACK (on_control_default_sink_changed), + manager); + g_signal_connect (manager->priv->volume, + "stream-removed", + G_CALLBACK (on_control_stream_removed), + manager); + + gvc_mixer_control_open (manager->priv->volume); + + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); + + register_manager (manager_object); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_media_keys_manager_stop (GsdMediaKeysManager *manager) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + GSList *ls; + GList *l; + int i; + + g_debug ("Stopping media_keys manager"); + + if (priv->bus_cancellable != NULL) { + g_cancellable_cancel (priv->bus_cancellable); + g_object_unref (priv->bus_cancellable); + priv->bus_cancellable = NULL; + } + + for (ls = priv->screens; ls != NULL; ls = ls->next) { + gdk_window_remove_filter (gdk_screen_get_root_window (ls->data), + (GdkFilterFunc) filter_key_events, + manager); + } + + if (manager->priv->gtksettings != NULL) { + g_signal_handlers_disconnect_by_func (manager->priv->gtksettings, sound_theme_changed, manager); + manager->priv->gtksettings = NULL; + } + + if (manager->priv->ca) { + ca_context_destroy (manager->priv->ca); + manager->priv->ca = NULL; + } + +#ifdef HAVE_GUDEV + if (priv->streams) { + g_hash_table_destroy (priv->streams); + priv->streams = NULL; + } + if (priv->udev_client) { + g_object_unref (priv->udev_client); + priv->udev_client = NULL; + } +#endif /* HAVE_GUDEV */ + + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; + } + + if (priv->power_settings) { + g_object_unref (priv->power_settings); + priv->power_settings = NULL; + } + + if (priv->power_screen_proxy) { + g_object_unref (priv->power_screen_proxy); + priv->power_screen_proxy = NULL; + } + + if (priv->power_keyboard_proxy) { + g_object_unref (priv->power_keyboard_proxy); + priv->power_keyboard_proxy = NULL; + } + + if (priv->upower_proxy) { + g_object_unref (priv->upower_proxy); + priv->upower_proxy = NULL; + } + + if (priv->cancellable != NULL) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + + if (priv->introspection_data) { + g_dbus_node_info_unref (priv->introspection_data); + priv->introspection_data = NULL; + } + + if (priv->connection != NULL) { + g_object_unref (priv->connection); + priv->connection = NULL; + } + + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->key) + ungrab_key_unsafe (key->key, priv->screens); + } + g_ptr_array_free (priv->keys, TRUE); + priv->keys = NULL; + + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (priv->screens != NULL) { + g_slist_free (priv->screens); + priv->screens = NULL; + } + + if (priv->stream) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + if (priv->volume) { + g_object_unref (priv->volume); + priv->volume = NULL; + } + + if (priv->dialog != NULL) { + gtk_widget_destroy (priv->dialog); + priv->dialog = NULL; + } + + if (priv->media_players != NULL) { + for (l = priv->media_players; l; l = l->next) { + MediaPlayer *mp = l->data; + g_free (mp->application); + g_free (mp); + } + g_list_free (priv->media_players); + priv->media_players = NULL; + } +} + +static GObject * +gsd_media_keys_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMediaKeysManager *media_keys_manager; + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (media_keys_manager); +} + +static void +gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_media_keys_manager_constructor; + object_class->finalize = gsd_media_keys_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysManagerPrivate)); +} + +static void +gsd_media_keys_manager_init (GsdMediaKeysManager *manager) +{ + manager->priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_media_keys_manager_finalize (GObject *object) +{ + GsdMediaKeysManager *media_keys_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_MANAGER (object)); + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (object); + + g_return_if_fail (media_keys_manager->priv != NULL); + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object); +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +upower_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->upower_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Failed to get proxy for upower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_screen_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_screen_proxy == NULL) { + g_warning ("Failed to get proxy for power (screen): %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_keyboard_proxy == NULL) { + g_warning ("Failed to get proxy for power (keyboard): %s", + error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MEDIA_KEYS_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Screen", + NULL, + (GAsyncReadyCallback) power_screen_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Keyboard", + NULL, + (GAsyncReadyCallback) power_keyboard_ready_cb, + manager); +} + +static void +register_manager (GsdMediaKeysManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + NULL, + (GAsyncReadyCallback) upower_ready_cb, + manager); +} + +GsdMediaKeysManager * +gsd_media_keys_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MEDIA_KEYS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MEDIA_KEYS_MANAGER (manager_object); +} diff --git a/.pc/43_disable_locale_settings.patch/gnome-settings-daemon/main.c b/.pc/43_disable_locale_settings.patch/gnome-settings-daemon/main.c new file mode 100644 index 00000000..d251fb8e --- /dev/null +++ b/.pc/43_disable_locale_settings.patch/gnome-settings-daemon/main.c @@ -0,0 +1,559 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "gnome-settings-manager.h" +#include "gnome-settings-profile.h" + +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_OBJECT "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE "org.gnome.SessionManager.ClientPrivate" + +static gboolean debug = FALSE; +static gboolean do_timed_exit = FALSE; +static int term_signal_pipe_fds[2]; +static guint name_id = 0; +static GnomeSettingsManager *manager = NULL; + +static GOptionEntry entries[] = { + {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL }, + { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, + {NULL} +}; + +static gboolean +timed_exit_cb (void) +{ + g_debug ("Doing timed exit"); + gtk_main_quit (); + return FALSE; +} + +static void +stop_manager (GnomeSettingsManager *manager) +{ + gnome_settings_manager_stop (manager); + gtk_main_quit (); +} + +static void +on_session_over (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + if (g_strcmp0 (signal_name, "SessionOver") == 0) { + g_debug ("Got a SessionOver signal - stopping"); + stop_manager (manager); + } +} + +static void +respond_to_end_session (GDBusProxy *proxy) +{ + /* we must answer with "EndSessionResponse" */ + g_dbus_proxy_call (proxy, "EndSessionResponse", + g_variant_new ("(bs)", + TRUE, ""), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); +} + +static void +client_proxy_signal_cb (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + if (g_strcmp0 (signal_name, "QueryEndSession") == 0) { + g_debug ("Got QueryEndSession signal"); + respond_to_end_session (proxy); + } else if (g_strcmp0 (signal_name, "EndSession") == 0) { + g_debug ("Got EndSession signal"); + respond_to_end_session (proxy); + } else if (g_strcmp0 (signal_name, "Stop") == 0) { + g_debug ("Got Stop signal"); + stop_manager (manager); + } +} + +static void +got_client_proxy (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + GDBusProxy *client_proxy; + GError *error = NULL; + + client_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + + if (error != NULL) { + g_debug ("Unable to get the session client proxy: %s", error->message); + g_error_free (error); + return; + } + + g_signal_connect (client_proxy, "g-signal", + G_CALLBACK (client_proxy_signal_cb), manager); +} + +static void +on_client_registered (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *variant; + GError *error = NULL; + gchar *object_path = NULL; + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (error != NULL) { + g_warning ("Unable to register client: %s", error->message); + g_error_free (error); + } else { + g_variant_get (variant, "(o)", &object_path); + + g_debug ("Registered client at path %s", object_path); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, 0, NULL, + GNOME_SESSION_DBUS_NAME, + object_path, + GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE, + NULL, + got_client_proxy, + manager); + + g_free (object_path); + g_variant_unref (variant); + } +} + +static void +session_env_done (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (result == NULL) { + g_debug ("Failed to set the environment: %s", error->message); + g_error_free (error); + return; + } + + g_variant_unref (result); +} + +static void +set_session_env (GDBusProxy *proxy, + const gchar *name, + const gchar *value) +{ + g_dbus_proxy_call (proxy, + "Setenv", + g_variant_new ("(ss)", name, value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) session_env_done, + NULL); +} + +static void +set_locale (GDBusProxy *proxy) +{ + GSettings *locale_settings; + gchar *region; + + /* Set locale environment */ + locale_settings = g_settings_new ("org.gnome.system.locale"); + region = g_settings_get_string (locale_settings, "region"); + if (region[0]) { + /* Only set the locale settings if the user has ever customized them */ + set_session_env (proxy, "LC_TIME", region); + set_session_env (proxy, "LC_NUMERIC", region); + set_session_env (proxy, "LC_MONETARY", region); + set_session_env (proxy, "LC_MEASUREMENT", region); + } + g_free (region); + + g_object_unref (locale_settings); +} + +static void +register_with_gnome_session (GDBusProxy *proxy) +{ + const char *startup_id; + + g_signal_connect (G_OBJECT (proxy), "g-signal", + G_CALLBACK (on_session_over), NULL); + startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); + g_dbus_proxy_call (proxy, + "RegisterClient", + g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) on_client_registered, + manager); +} + +#ifdef HAVE_IBUS +static gboolean +is_program_in_path (const char *binary) +{ + char *path; + + path = g_find_program_in_path (binary); + if (path == NULL) + return FALSE; + g_free (path); + return TRUE; +} + +static gboolean +keyboard_plugin_is_enabled (void) +{ + GSettings *settings; + gboolean enabled; + + settings = g_settings_new ("org.gnome.settings-daemon.plugins.keyboard"); + enabled = g_settings_get_boolean (settings, "active"); + g_object_unref (settings); + + return enabled; +} + +static void +got_session_name (GObject *object, + GAsyncResult *res, + gpointer data) +{ + GDBusProxy *proxy; + GVariant *result, *variant; + const gchar *session_name = NULL; + GError *error = NULL; + + proxy = G_DBUS_PROXY (object); + + result = g_dbus_proxy_call_finish (proxy, res, &error); + if (!result) { + g_debug ("Failed to get session name: %s", error->message); + g_error_free (error); + register_with_gnome_session (proxy); + return; + } + + g_variant_get (result, "(v)", &variant); + g_variant_unref (result); + + g_variant_get (variant, "&s", &session_name); + + if (g_strcmp0 (session_name, "gnome") == 0 && + is_program_in_path ("ibus-daemon") && + keyboard_plugin_is_enabled ()) { + set_session_env (proxy, "QT_IM_MODULE", "ibus"); + set_session_env (proxy, "XMODIFIERS", "@im=ibus"); + } + + g_variant_unref (variant); + + /* Finally we can register. */ + register_with_gnome_session (proxy); +} + +static void +set_legacy_ibus_env_vars (GDBusProxy *proxy) +{ + g_dbus_proxy_call (proxy, + "org.freedesktop.DBus.Properties.Get", + g_variant_new ("(ss)", + "org.gnome.SessionManager", + "SessionName"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + got_session_name, + NULL); +} +#endif + +static void +got_session_proxy (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GDBusProxy *proxy; + GError *error = NULL; + + proxy = g_dbus_proxy_new_finish (res, &error); + if (proxy == NULL) { + g_debug ("Could not connect to the Session manager: %s", error->message); + g_error_free (error); + } else { + /* Always call this first, as Setenv can only be called before + any client registers */ + set_locale (proxy); +#ifdef HAVE_IBUS + /* This will register with gnome-session after calling Setenv. */ + set_legacy_ibus_env_vars (proxy); +#else + register_with_gnome_session (proxy); +#endif + } +} + +static gboolean +on_term_signal_pipe_closed (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + term_signal_pipe_fds[0] = -1; + + g_debug ("Received SIGTERM - shutting down"); + /* Got SIGTERM, time to clean up and get out + */ + gtk_main_quit (); + + return FALSE; +} + +static void +on_term_signal (int signal) +{ + /* Wake up main loop to tell it to shutdown */ + close (term_signal_pipe_fds[1]); + term_signal_pipe_fds[1] = -1; +} + +static void +watch_for_term_signal (GnomeSettingsManager *manager) +{ + GIOChannel *channel; + + if (-1 == pipe (term_signal_pipe_fds) || + -1 == fcntl (term_signal_pipe_fds[0], F_SETFD, FD_CLOEXEC) || + -1 == fcntl (term_signal_pipe_fds[1], F_SETFD, FD_CLOEXEC)) { + g_error ("Could not create pipe: %s", g_strerror (errno)); + exit (EXIT_FAILURE); + } + + channel = g_io_channel_unix_new (term_signal_pipe_fds[0]); + g_io_channel_set_encoding (channel, NULL, NULL); + g_io_channel_set_buffered (channel, FALSE); + g_io_add_watch (channel, G_IO_HUP, on_term_signal_pipe_closed, manager); + g_io_channel_unref (channel); + + signal (SIGTERM, on_term_signal); +} + +static void +set_session_over_handler (GDBusConnection *bus) +{ + g_assert (bus != NULL); + + g_dbus_proxy_new (bus, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_OBJECT, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + (GAsyncReadyCallback) got_session_proxy, + NULL); + + watch_for_term_signal (manager); +} + +static void +name_acquired_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + set_session_over_handler (connection); +} + +static void +name_lost_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + /* Name was already taken, or the bus went away */ + + g_warning ("Name taken or bus went away - shutting down"); + gtk_main_quit (); +} + +static void +bus_register (void) +{ + name_id = g_bus_own_name (G_BUS_TYPE_SESSION, + GSD_DBUS_NAME, + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, + (GBusNameAcquiredCallback) name_acquired_handler, + (GBusNameLostCallback) name_lost_handler, + NULL, + NULL); +} + +static void +gsd_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data) +{ + /* filter out DEBUG messages if debug isn't set */ + if ((log_level & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG + && ! debug) { + return; + } + + g_log_default_handler (log_domain, + log_level, + message, + unused_data); +} + +static void +parse_args (int *argc, char ***argv) +{ + GError *error; + GOptionContext *context; + + gnome_settings_profile_start (NULL); + + + context = g_option_context_new (NULL); + + g_option_context_add_main_entries (context, entries, NULL); + g_option_context_add_group (context, gtk_get_option_group (FALSE)); + + error = NULL; + if (!g_option_context_parse (context, argc, argv, &error)) { + if (error != NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } else { + g_warning ("Unable to initialize GTK+"); + } + exit (EXIT_FAILURE); + } + + g_option_context_free (context); + + gnome_settings_profile_end (NULL); + + if (debug) + g_setenv ("G_MESSAGES_DEBUG", "all", FALSE); +} + +int +main (int argc, char *argv[]) +{ + + gboolean res; + GError *error; + + gnome_settings_profile_start (NULL); + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + setlocale (LC_ALL, ""); + + parse_args (&argc, &argv); + + g_type_init (); + + gnome_settings_profile_start ("opening gtk display"); + if (! gtk_init_check (NULL, NULL)) { + g_warning ("Unable to initialize GTK+"); + exit (EXIT_FAILURE); + } + gnome_settings_profile_end ("opening gtk display"); + + g_log_set_default_handler (gsd_log_default_handler, NULL); + + notify_init ("gnome-settings-daemon"); + + bus_register (); + + gnome_settings_profile_start ("gnome_settings_manager_new"); + manager = gnome_settings_manager_new (); + gnome_settings_profile_end ("gnome_settings_manager_new"); + if (manager == NULL) { + g_warning ("Unable to register object"); + goto out; + } + + error = NULL; + res = gnome_settings_manager_start (manager, &error); + if (! res) { + g_warning ("Unable to start: %s", error->message); + g_error_free (error); + goto out; + } + + if (do_timed_exit) { + g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL); + } + + gtk_main (); + + g_debug ("Shutting down"); + +out: + if (name_id > 0) { + g_bus_unown_name (name_id); + name_id = 0; + } + + if (manager != NULL) { + g_object_unref (manager); + } + + g_debug ("SettingsDaemon finished"); + gnome_settings_profile_end (NULL); + + return 0; +} diff --git a/.pc/45_suppress-printer-may-not-be-connected-notification.patch/plugins/print-notifications/gsd-print-notifications-manager.c b/.pc/45_suppress-printer-may-not-be-connected-notification.patch/plugins/print-notifications/gsd-print-notifications-manager.c new file mode 100644 index 00000000..c191e5c4 --- /dev/null +++ b/.pc/45_suppress-printer-may-not-be-connected-notification.patch/plugins/print-notifications/gsd-print-notifications-manager.c @@ -0,0 +1,1231 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Red Hat, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-print-notifications-manager.h" + +#define GSD_PRINT_NOTIFICATIONS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerPrivate)) + +#define CUPS_DBUS_NAME "org.cups.cupsd.Notifier" +#define CUPS_DBUS_PATH "/org/cups/cupsd/Notifier" +#define CUPS_DBUS_INTERFACE "org.cups.cupsd.Notifier" + +#define RENEW_INTERVAL 3500 +#define SUBSCRIPTION_DURATION 3600 +#define CONNECTING_TIMEOUT 60 +#define REASON_TIMEOUT 15000 +#define CUPS_CONNECTION_TEST_INTERVAL 300 + +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) +#define HAVE_CUPS_1_6 1 +#endif + +#ifndef HAVE_CUPS_1_6 +#define ippGetStatusCode(ipp) ipp->request.status.status_code +#define ippGetInteger(attr, element) attr->values[element].integer +#define ippGetString(attr, element, language) attr->values[element].string.text +#endif + +struct GsdPrintNotificationsManagerPrivate +{ + GDBusConnection *cups_bus_connection; + gint subscription_id; + cups_dest_t *dests; + gint num_dests; + gboolean scp_handler_spawned; + GPid scp_handler_pid; + GList *timeouts; + GHashTable *printing_printers; + GList *active_notifications; + guint cups_connection_timeout_id; +}; + +enum { + PROP_0, +}; + +static void gsd_print_notifications_manager_class_init (GsdPrintNotificationsManagerClass *klass); +static void gsd_print_notifications_manager_init (GsdPrintNotificationsManager *print_notifications_manager); +static void gsd_print_notifications_manager_finalize (GObject *object); +static gboolean cups_connection_test (gpointer user_data); + +G_DEFINE_TYPE (GsdPrintNotificationsManager, gsd_print_notifications_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static char * +get_dest_attr (const char *dest_name, + const char *attr, + cups_dest_t *dests, + int num_dests) +{ + cups_dest_t *dest; + const char *value; + char *ret; + + if (dest_name == NULL) + return NULL; + + ret = NULL; + + dest = cupsGetDest (dest_name, NULL, num_dests, dests); + if (dest == NULL) { + g_debug ("Unable to find a printer named '%s'", dest_name); + goto out; + } + + value = cupsGetOption (attr, dest->num_options, dest->options); + if (value == NULL) { + g_debug ("Unable to get %s for '%s'", attr, dest_name); + goto out; + } + ret = g_strdup (value); + out: + return ret; +} + +static gboolean +is_local_dest (const char *name, + cups_dest_t *dests, + int num_dests) +{ + char *type_str; + cups_ptype_t type; + gboolean is_remote; + + is_remote = TRUE; + + type_str = get_dest_attr (name, "printer-type", dests, num_dests); + if (type_str == NULL) { + goto out; + } + + type = atoi (type_str); + is_remote = type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT); + g_free (type_str); + out: + return !is_remote; +} + +static int +strcmp0(const void *a, const void *b) +{ + return g_strcmp0 (*((gchar **) a), *((gchar **) b)); +} + +struct +{ + gchar *printer_name; + gchar *primary_text; + gchar *secondary_text; + guint timeout_id; + GsdPrintNotificationsManager *manager; +} typedef TimeoutData; + +struct +{ + gchar *printer_name; + gchar *reason; + NotifyNotification *notification; + gulong notification_close_id; + GsdPrintNotificationsManager *manager; +} typedef ReasonData; + +static void +free_timeout_data (gpointer user_data) +{ + TimeoutData *data = (TimeoutData *) user_data; + + if (data) { + g_free (data->printer_name); + g_free (data->primary_text); + g_free (data->secondary_text); + g_free (data); + } +} + +static void +free_reason_data (gpointer user_data) +{ + ReasonData *data = (ReasonData *) user_data; + + if (data) { + if (data->notification_close_id > 0 && + g_signal_handler_is_connected (data->notification, + data->notification_close_id)) + g_signal_handler_disconnect (data->notification, data->notification_close_id); + + g_object_unref (data->notification); + + g_free (data->printer_name); + g_free (data->reason); + + g_free (data); + } +} + +static void +notification_closed_cb (NotifyNotification *notification, + gpointer user_data) +{ + ReasonData *data = (ReasonData *) user_data; + + if (data) { + data->manager->priv->active_notifications = + g_list_remove (data->manager->priv->active_notifications, data); + + free_reason_data (data); + } +} + +static gboolean +show_notification (gpointer user_data) +{ + NotifyNotification *notification; + TimeoutData *data = (TimeoutData *) user_data; + ReasonData *reason_data; + GList *tmp; + + if (!data) + return FALSE; + + notification = notify_notification_new (data->primary_text, + data->secondary_text, + "printer-symbolic"); + + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, + "resident", + g_variant_new_boolean (TRUE)); + notify_notification_set_timeout (notification, REASON_TIMEOUT); + + reason_data = g_new0 (ReasonData, 1); + reason_data->printer_name = g_strdup (data->printer_name); + reason_data->reason = g_strdup ("connecting-to-device"); + reason_data->notification = notification; + reason_data->manager = data->manager; + + reason_data->notification_close_id = + g_signal_connect (notification, + "closed", + G_CALLBACK (notification_closed_cb), + reason_data); + + reason_data->manager->priv->active_notifications = + g_list_append (reason_data->manager->priv->active_notifications, reason_data); + + notify_notification_show (notification, NULL); + + tmp = g_list_find (data->manager->priv->timeouts, data); + if (tmp) { + data->manager->priv->timeouts = g_list_remove_link (data->manager->priv->timeouts, tmp); + g_list_free_full (tmp, free_timeout_data); + } + + return FALSE; +} + +static gboolean +reason_is_blacklisted (const gchar *reason) { + if (g_str_equal (reason, "none")) + return TRUE; + if (g_str_equal (reason, "other")) + return TRUE; + if (g_str_equal (reason, "com.apple.print.recoverable")) + return TRUE; + /* https://bugzilla.redhat.com/show_bug.cgi?id=883401 */ + if (g_str_has_prefix (reason, "cups-remote-")) + return TRUE; + return FALSE; +} + +static void +on_cups_notification (GDBusConnection *connection, + const char *sender_name, + const char *object_path, + const char *interface_name, + const char *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; + gboolean printer_is_accepting_jobs; + gboolean my_job = FALSE; + gboolean known_reason; + http_t *http; + gchar *printer_name = NULL; + gchar *primary_text = NULL; + gchar *secondary_text = NULL; + gchar *text = NULL; + gchar *printer_uri = NULL; + gchar *printer_state_reasons = NULL; + gchar *job_state_reasons = NULL; + gchar *job_name = NULL; + gchar *job_uri = NULL; + guint job_id; + ipp_t *request, *response; + gint printer_state; + gint job_state; + gint job_impressions_completed; + static const char * const reasons[] = { + "toner-low", + "toner-empty", + "connecting-to-device", + "cover-open", + "cups-missing-filter", + "door-open", + "marker-supply-low", + "marker-supply-empty", + "media-low", + "media-empty", + "offline", + "other"}; + + static const char * statuses_first[] = { + /* Translators: The printer is low on toner (same as in system-config-printer) */ + N_("Toner low"), + /* Translators: The printer has no toner left (same as in system-config-printer) */ + N_("Toner empty"), + /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ + N_("Not connected?"), + /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ + N_("Cover open"), + /* Translators: A filter or backend is not installed (same as in system-config-printer) */ + N_("Printer configuration error"), + /* Translators: One or more doors on the printer are open (same as in system-config-printer) */ + N_("Door open"), + /* Translators: "marker" is one color bin of the printer */ + N_("Marker supply low"), + /* Translators: "marker" is one color bin of the printer */ + N_("Out of a marker supply"), + /* Translators: At least one input tray is low on media (same as in system-config-printer) */ + N_("Paper low"), + /* Translators: At least one input tray is empty (same as in system-config-printer) */ + N_("Out of paper"), + /* Translators: The printer is offline (same as in system-config-printer) */ + N_("Printer off-line"), + /* Translators: The printer has detected an error (same as in system-config-printer) */ + N_("Printer error") }; + + static const char * statuses_second[] = { + /* Translators: The printer is low on toner (same as in system-config-printer) */ + N_("Printer '%s' is low on toner."), + /* Translators: The printer has no toner left (same as in system-config-printer) */ + N_("Printer '%s' has no toner left."), + /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ + N_("Printer '%s' may not be connected."), + /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ + N_("The cover is open on printer '%s'."), + /* Translators: A filter or backend is not installed (same as in system-config-printer) */ + N_("There is a missing print filter for " + "printer '%s'."), + /* Translators: One or more doors on the printer are open (same as in system-config-printer) */ + N_("The door is open on printer '%s'."), + /* Translators: "marker" is one color bin of the printer */ + N_("Printer '%s' is low on a marker supply."), + /* Translators: "marker" is one color bin of the printer */ + N_("Printer '%s' is out of a marker supply."), + /* Translators: At least one input tray is low on media (same as in system-config-printer) */ + N_("Printer '%s' is low on paper."), + /* Translators: At least one input tray is empty (same as in system-config-printer) */ + N_("Printer '%s' is out of paper."), + /* Translators: The printer is offline (same as in system-config-printer) */ + N_("Printer '%s' is currently off-line."), + /* Translators: The printer has detected an error (same as in system-config-printer) */ + N_("There is a problem on printer '%s'.") }; + + if (g_strcmp0 (signal_name, "PrinterAdded") != 0 && + g_strcmp0 (signal_name, "PrinterDeleted") != 0 && + g_strcmp0 (signal_name, "PrinterStateChanged") != 0 && + g_strcmp0 (signal_name, "JobCompleted") != 0 && + g_strcmp0 (signal_name, "JobState") != 0 && + g_strcmp0 (signal_name, "JobCreated") != 0) + return; + + if (g_variant_n_children (parameters) == 1) { + g_variant_get (parameters, "(&s)", &text); + } else if (g_variant_n_children (parameters) == 6) { + g_variant_get (parameters, "(&s&s&su&sb)", + &text, + &printer_uri, + &printer_name, + &printer_state, + &printer_state_reasons, + &printer_is_accepting_jobs); + } else if (g_variant_n_children (parameters) == 11) { + ipp_attribute_t *attr; + + g_variant_get (parameters, "(&s&s&su&sbuu&s&su)", + &text, + &printer_uri, + &printer_name, + &printer_state, + &printer_state_reasons, + &printer_is_accepting_jobs, + &job_id, + &job_state, + &job_state_reasons, + &job_name, + &job_impressions_completed); + + if ((http = httpConnectEncrypt (cupsServer (), ippPort (), + cupsEncryption ())) == NULL) { + g_debug ("Connection to CUPS server \'%s\' failed.", cupsServer ()); + } + else { + job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", job_id); + + request = ippNewRequest (IPP_GET_JOB_ATTRIBUTES); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "job-uri", NULL, job_uri); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "job-originating-user-name"); + response = cupsDoRequest (http, request, "/"); + + if (response) { + if (ippGetStatusCode (response) <= IPP_OK_CONFLICT && + (attr = ippFindAttribute(response, "job-originating-user-name", + IPP_TAG_NAME))) { + if (g_strcmp0 (ippGetString (attr, 0, NULL), cupsUser ()) == 0) + my_job = TRUE; + } + ippDelete(response); + } + g_free (job_uri); + } + } + else { + g_warning ("Invalid number of parameters for signal '%s'", signal_name); + return; + } + + if (g_strcmp0 (signal_name, "PrinterAdded") == 0) { + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + + /* Translators: New printer has been added */ + if (is_local_dest (printer_name, + manager->priv->dests, + manager->priv->num_dests)) { + primary_text = g_strdup (_("Printer added")); + secondary_text = g_strdup (printer_name); + } + } else if (g_strcmp0 (signal_name, "PrinterDeleted") == 0) { + /* Translators: A printer has been removed */ + if (is_local_dest (printer_name, + manager->priv->dests, + manager->priv->num_dests)) { + primary_text = g_strdup (_("Printer removed")); + secondary_text = g_strdup (printer_name); + } + + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + } else if (g_strcmp0 (signal_name, "JobCompleted") == 0 && my_job) { + g_hash_table_remove (manager->priv->printing_printers, + printer_name); + + switch (job_state) { + case IPP_JOB_PENDING: + case IPP_JOB_HELD: + case IPP_JOB_PROCESSING: + break; + case IPP_JOB_STOPPED: + /* Translators: A print job has been stopped */ + primary_text = g_strdup (_("Printing stopped")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_CANCELED: + /* Translators: A print job has been canceled */ + primary_text = g_strdup (_("Printing canceled")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_ABORTED: + /* Translators: A print job has been aborted */ + primary_text = g_strdup (_("Printing aborted")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_COMPLETED: + /* Translators: A print job has been completed */ + primary_text = g_strdup (_("Printing completed")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + } + } else if (g_strcmp0 (signal_name, "JobState") == 0 && my_job) { + switch (job_state) { + case IPP_JOB_PROCESSING: + g_hash_table_insert (manager->priv->printing_printers, + g_strdup (printer_name), NULL); + + /* Translators: A job is printing */ + primary_text = g_strdup (_("Printing")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_STOPPED: + case IPP_JOB_CANCELED: + case IPP_JOB_ABORTED: + case IPP_JOB_COMPLETED: + g_hash_table_remove (manager->priv->printing_printers, + printer_name); + break; + default: + break; + } + } else if (g_strcmp0 (signal_name, "JobCreated") == 0 && my_job) { + if (job_state == IPP_JOB_PROCESSING) { + g_hash_table_insert (manager->priv->printing_printers, + g_strdup (printer_name), NULL); + + /* Translators: A job is printing */ + primary_text = g_strdup (_("Printing")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + } + } else if (g_strcmp0 (signal_name, "PrinterStateChanged") == 0) { + cups_dest_t *dest = NULL; + const gchar *tmp_printer_state_reasons = NULL; + GSList *added_reasons = NULL; + GSList *tmp_list = NULL; + GList *tmp; + gchar **old_state_reasons = NULL; + gchar **new_state_reasons = NULL; + gint i, j; + + /* Remove timeout which shows notification about possible disconnection of printer + * if "connecting-to-device" has vanished. + */ + if (printer_state_reasons == NULL || + g_strrstr (printer_state_reasons, "connecting-to-device") == NULL) { + TimeoutData *data; + + for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) { + data = (TimeoutData *) tmp->data; + if (g_strcmp0 (printer_name, data->printer_name) == 0) { + g_source_remove (data->timeout_id); + manager->priv->timeouts = g_list_remove_link (manager->priv->timeouts, tmp); + g_list_free_full (tmp, free_timeout_data); + break; + } + } + } + + for (tmp = manager->priv->active_notifications; tmp; tmp = g_list_next (tmp)) { + ReasonData *reason_data = (ReasonData *) tmp->data; + GList *remove_list; + + if (printer_state_reasons == NULL || + (g_strcmp0 (printer_name, reason_data->printer_name) == 0 && + g_strrstr (printer_state_reasons, reason_data->reason) == NULL)) { + + if (reason_data->notification_close_id > 0 && + g_signal_handler_is_connected (reason_data->notification, + reason_data->notification_close_id)) { + g_signal_handler_disconnect (reason_data->notification, + reason_data->notification_close_id); + reason_data->notification_close_id = 0; + } + + notify_notification_close (reason_data->notification, NULL); + + remove_list = tmp; + tmp = g_list_next (tmp); + manager->priv->active_notifications = + g_list_remove_link (manager->priv->active_notifications, remove_list); + + g_list_free_full (remove_list, free_reason_data); + } + } + + /* Check whether we are printing on this printer right now. */ + if (g_hash_table_lookup_extended (manager->priv->printing_printers, printer_name, NULL, NULL)) { + dest = cupsGetDest (printer_name, + NULL, + manager->priv->num_dests, + manager->priv->dests); + if (dest) + tmp_printer_state_reasons = cupsGetOption ("printer-state-reasons", + dest->num_options, + dest->options); + + if (tmp_printer_state_reasons) + old_state_reasons = g_strsplit (tmp_printer_state_reasons, ",", -1); + + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + + dest = cupsGetDest (printer_name, + NULL, + manager->priv->num_dests, + manager->priv->dests); + if (dest) + tmp_printer_state_reasons = cupsGetOption ("printer-state-reasons", + dest->num_options, + dest->options); + + if (tmp_printer_state_reasons) + new_state_reasons = g_strsplit (tmp_printer_state_reasons, ",", -1); + + if (new_state_reasons) + qsort (new_state_reasons, + g_strv_length (new_state_reasons), + sizeof (gchar *), + strcmp0); + + if (old_state_reasons) { + qsort (old_state_reasons, + g_strv_length (old_state_reasons), + sizeof (gchar *), + strcmp0); + + j = 0; + for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) { + while (old_state_reasons[j] && + g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) < 0) + j++; + + if (old_state_reasons[j] == NULL || + g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) != 0) + added_reasons = g_slist_append (added_reasons, + new_state_reasons[i]); + } + } + else { + for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) { + added_reasons = g_slist_append (added_reasons, + new_state_reasons[i]); + } + } + + for (tmp_list = added_reasons; tmp_list; tmp_list = tmp_list->next) { + gchar *data = (gchar *) tmp_list->data; + known_reason = FALSE; + for (j = 0; j < G_N_ELEMENTS (reasons); j++) { + if (strncmp (data, + reasons[j], + strlen (reasons[j])) == 0) { + NotifyNotification *notification; + known_reason = TRUE; + + if (g_strcmp0 (reasons[j], "connecting-to-device") == 0) { + TimeoutData *data; + + data = g_new0 (TimeoutData, 1); + data->printer_name = g_strdup (printer_name); + data->primary_text = g_strdup (statuses_first[j]); + data->secondary_text = g_strdup_printf (statuses_second[j], printer_name); + data->manager = manager; + + data->timeout_id = g_timeout_add_seconds (CONNECTING_TIMEOUT, show_notification, data); + manager->priv->timeouts = g_list_append (manager->priv->timeouts, data); + } + else { + ReasonData *reason_data; + gchar *second_row = g_strdup_printf (statuses_second[j], printer_name); + + notification = notify_notification_new (statuses_first[j], + second_row, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, + "resident", + g_variant_new_boolean (TRUE)); + notify_notification_set_timeout (notification, REASON_TIMEOUT); + + reason_data = g_new0 (ReasonData, 1); + reason_data->printer_name = g_strdup (printer_name); + reason_data->reason = g_strdup (reasons[j]); + reason_data->notification = notification; + reason_data->manager = manager; + + reason_data->notification_close_id = + g_signal_connect (notification, + "closed", + G_CALLBACK (notification_closed_cb), + reason_data); + + manager->priv->active_notifications = + g_list_append (manager->priv->active_notifications, reason_data); + + notify_notification_show (notification, NULL); + + g_free (second_row); + } + } + } + + if (!known_reason && + !reason_is_blacklisted (data)) { + NotifyNotification *notification; + ReasonData *reason_data; + gchar *first_row; + gchar *second_row; + gchar *text = NULL; + gchar *ppd_file_name; + ppd_file_t *ppd_file; + char buffer[8192]; + + ppd_file_name = g_strdup (cupsGetPPD (printer_name)); + if (ppd_file_name) { + ppd_file = ppdOpenFile (ppd_file_name); + if (ppd_file) { + gchar **tmpv; + static const char * const schemes[] = { + "text", "http", "help", "file" + }; + + tmpv = g_new0 (gchar *, G_N_ELEMENTS (schemes) + 1); + i = 0; + for (j = 0; j < G_N_ELEMENTS (schemes); j++) { + if (ppdLocalizeIPPReason (ppd_file, data, schemes[j], buffer, sizeof (buffer))) { + tmpv[i++] = g_strdup (buffer); + } + } + + if (i > 0) + text = g_strjoinv (", ", tmpv); + g_strfreev (tmpv); + + ppdClose (ppd_file); + } + + g_unlink (ppd_file_name); + g_free (ppd_file_name); + } + + + if (g_str_has_suffix (data, "-report")) + /* Translators: This is a title of a report notification for a printer */ + first_row = g_strdup (_("Printer report")); + else if (g_str_has_suffix (data, "-warning")) + /* Translators: This is a title of a warning notification for a printer */ + first_row = g_strdup (_("Printer warning")); + else + /* Translators: This is a title of an error notification for a printer */ + first_row = g_strdup (_("Printer error")); + + + if (text == NULL) + text = g_strdup (data); + + /* Translators: "Printer 'MyPrinterName': 'Description of the report/warning/error from a PPD file'." */ + second_row = g_strdup_printf (_("Printer '%s': '%s'."), printer_name, text); + g_free (text); + + + notification = notify_notification_new (first_row, + second_row, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, + "resident", + g_variant_new_boolean (TRUE)); + notify_notification_set_timeout (notification, REASON_TIMEOUT); + + reason_data = g_new0 (ReasonData, 1); + reason_data->printer_name = g_strdup (printer_name); + reason_data->reason = g_strdup (data); + reason_data->notification = notification; + reason_data->manager = manager; + + reason_data->notification_close_id = + g_signal_connect (notification, + "closed", + G_CALLBACK (notification_closed_cb), + reason_data); + + manager->priv->active_notifications = + g_list_append (manager->priv->active_notifications, reason_data); + + notify_notification_show (notification, NULL); + + g_free (first_row); + g_free (second_row); + } + } + g_slist_free (added_reasons); + } + + if (new_state_reasons) + g_strfreev (new_state_reasons); + + if (old_state_reasons) + g_strfreev (old_state_reasons); + } + + + if (primary_text) { + NotifyNotification *notification; + notification = notify_notification_new (primary_text, + secondary_text, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); + notify_notification_show (notification, NULL); + g_object_unref (notification); + g_free (primary_text); + g_free (secondary_text); + } +} + +static void +scp_handler (GsdPrintNotificationsManager *manager, + gboolean start) +{ + if (start) { + GError *error = NULL; + char *args[2]; + + if (manager->priv->scp_handler_spawned) + return; + + args[0] = LIBEXECDIR "/gsd-printer"; + args[1] = NULL; + + g_spawn_async (NULL, args, NULL, + 0, NULL, NULL, + &manager->priv->scp_handler_pid, &error); + + manager->priv->scp_handler_spawned = (error == NULL); + + if (error) { + g_warning ("Could not execute system-config-printer-udev handler: %s", + error->message); + g_error_free (error); + } + } + else if (manager->priv->scp_handler_spawned) { + kill (manager->priv->scp_handler_pid, SIGHUP); + g_spawn_close_pid (manager->priv->scp_handler_pid); + manager->priv->scp_handler_spawned = FALSE; + } +} + +static void +cancel_subscription (gint id) +{ + http_t *http; + ipp_t *request; + + if (id >= 0 && + ((http = httpConnectEncrypt (cupsServer (), ippPort (), + cupsEncryption ())) != NULL)) { + request = ippNewRequest (IPP_CANCEL_SUBSCRIPTION); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, "/"); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, + "notify-subscription-id", id); + ippDelete (cupsDoRequest (http, request, "/")); + } +} + +static gboolean +renew_subscription (gpointer data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) data; + ipp_attribute_t *attr = NULL; + http_t *http; + ipp_t *request; + ipp_t *response; + gint num_events = 7; + static const char * const events[] = { + "job-created", + "job-completed", + "job-state-changed", + "job-state", + "printer-added", + "printer-deleted", + "printer-state-changed"}; + + if ((http = httpConnectEncrypt (cupsServer (), ippPort (), + cupsEncryption ())) == NULL) { + g_debug ("Connection to CUPS server \'%s\' failed.", cupsServer ()); + } + else { + if (manager->priv->subscription_id >= 0) { + request = ippNewRequest (IPP_RENEW_SUBSCRIPTION); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, "/"); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, + "notify-subscription-id", manager->priv->subscription_id); + ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, + "notify-lease-duration", SUBSCRIPTION_DURATION); + ippDelete (cupsDoRequest (http, request, "/")); + } + else { + request = ippNewRequest (IPP_CREATE_PRINTER_SUBSCRIPTION); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, + "/"); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddStrings (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, + "notify-events", num_events, NULL, events); + ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, + "notify-pull-method", NULL, "ippget"); + ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI, + "notify-recipient-uri", NULL, "dbus://"); + ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, + "notify-lease-duration", SUBSCRIPTION_DURATION); + response = cupsDoRequest (http, request, "/"); + + if (response != NULL && ippGetStatusCode (response) <= IPP_OK_CONFLICT) { + if ((attr = ippFindAttribute (response, "notify-subscription-id", + IPP_TAG_INTEGER)) == NULL) + g_debug ("No notify-subscription-id in response!\n"); + else + manager->priv->subscription_id = ippGetInteger (attr, 0); + } + + if (response) + ippDelete (response); + } + httpClose (http); + } + return TRUE; +} + +static void +renew_subscription_with_connection_test_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GSocketConnection *connection; + GError *error = NULL; + + connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object), + res, + &error); + + if (connection) { + g_debug ("Test connection to CUPS server \'%s:%d\' succeeded.", cupsServer (), ippPort ()); + + g_io_stream_close (G_IO_STREAM (connection), NULL, NULL); + g_object_unref (connection); + + renew_subscription (user_data); + } + else { + g_debug ("Test connection to CUPS server \'%s:%d\' failed.", cupsServer (), ippPort ()); + } +} + +static gboolean +renew_subscription_with_connection_test (gpointer user_data) +{ + GSocketClient *client; + gchar *address; + + address = g_strdup_printf ("%s:%d", cupsServer (), ippPort ()); + + if (address && address[0] != '/') { + client = g_socket_client_new (); + + g_debug ("Initiating test connection to CUPS server \'%s:%d\'.", cupsServer (), ippPort ()); + + g_socket_client_connect_to_host_async (client, + address, + 631, + NULL, + renew_subscription_with_connection_test_cb, + user_data); + + g_object_unref (client); + } + else { + renew_subscription (user_data); + } + + g_free (address); + + return TRUE; +} + +static void +cups_connection_test_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; + GSocketConnection *connection; + GError *error = NULL; + + connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object), + res, + &error); + + if (connection) { + g_debug ("Test connection to CUPS server \'%s:%d\' succeeded.", cupsServer (), ippPort ()); + + g_io_stream_close (G_IO_STREAM (connection), NULL, NULL); + g_object_unref (connection); + + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + gnome_settings_profile_msg ("got dests"); + + renew_subscription (user_data); + g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription_with_connection_test, manager); + } + else { + g_debug ("Test connection to CUPS server \'%s:%d\' failed.", cupsServer (), ippPort ()); + if (manager->priv->cups_connection_timeout_id == 0) + manager->priv->cups_connection_timeout_id = + g_timeout_add_seconds (CUPS_CONNECTION_TEST_INTERVAL, cups_connection_test, manager); + } +} + +static gboolean +cups_connection_test (gpointer user_data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; + GSocketClient *client; + gchar *address; + + if (!manager->priv->dests) { + address = g_strdup_printf ("%s:%d", cupsServer (), ippPort ()); + + if (address && address[0] != '/') { + client = g_socket_client_new (); + + g_debug ("Initiating test connection to CUPS server \'%s:%d\'.", cupsServer (), ippPort ()); + + g_socket_client_connect_to_host_async (client, + address, + 631, + NULL, + cups_connection_test_cb, + manager); + + g_object_unref (client); + } + else { + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + gnome_settings_profile_msg ("got dests"); + + renew_subscription (user_data); + g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription_with_connection_test, manager); + } + + g_free (address); + } + + if (manager->priv->dests) { + manager->priv->cups_connection_timeout_id = 0; + + return FALSE; + } + else { + return TRUE; + } +} + +static gboolean +gsd_print_notifications_manager_start_idle (gpointer data) +{ + GsdPrintNotificationsManager *manager = data; + + gnome_settings_profile_start (NULL); + + manager->priv->printing_printers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + + cups_connection_test (manager); + + manager->priv->cups_bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + + g_dbus_connection_signal_subscribe (manager->priv->cups_bus_connection, + NULL, + CUPS_DBUS_INTERFACE, + NULL, + CUPS_DBUS_PATH, + NULL, + 0, + on_cups_notification, + manager, + NULL); + + scp_handler (manager, TRUE); + + gnome_settings_profile_end (NULL); + + return G_SOURCE_REMOVE; +} + +gboolean +gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager, + GError **error) +{ + g_debug ("Starting print-notifications manager"); + + gnome_settings_profile_start (NULL); + + manager->priv->subscription_id = -1; + manager->priv->dests = NULL; + manager->priv->num_dests = 0; + manager->priv->scp_handler_spawned = FALSE; + manager->priv->timeouts = NULL; + manager->priv->printing_printers = NULL; + manager->priv->active_notifications = NULL; + manager->priv->cups_bus_connection = NULL; + manager->priv->cups_connection_timeout_id = 0; + + g_idle_add (gsd_print_notifications_manager_start_idle, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager) +{ + TimeoutData *data; + ReasonData *reason_data; + GList *tmp; + + g_debug ("Stopping print-notifications manager"); + + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = 0; + manager->priv->dests = NULL; + + if (manager->priv->subscription_id >= 0) + cancel_subscription (manager->priv->subscription_id); + + if (manager->priv->printing_printers) + g_hash_table_destroy (manager->priv->printing_printers); + + g_clear_object (&manager->priv->cups_bus_connection); + + for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) { + data = (TimeoutData *) tmp->data; + if (data) + g_source_remove (data->timeout_id); + } + g_list_free_full (manager->priv->timeouts, free_timeout_data); + + for (tmp = manager->priv->active_notifications; tmp; tmp = g_list_next (tmp)) { + reason_data = (ReasonData *) tmp->data; + if (reason_data) { + if (reason_data->notification_close_id > 0 && + g_signal_handler_is_connected (reason_data->notification, + reason_data->notification_close_id)) { + g_signal_handler_disconnect (reason_data->notification, + reason_data->notification_close_id); + reason_data->notification_close_id = 0; + } + + notify_notification_close (reason_data->notification, NULL); + } + } + g_list_free_full (manager->priv->active_notifications, free_reason_data); + + scp_handler (manager, FALSE); +} + +static GObject * +gsd_print_notifications_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdPrintNotificationsManager *print_notifications_manager; + + print_notifications_manager = GSD_PRINT_NOTIFICATIONS_MANAGER (G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (print_notifications_manager); +} + +static void +gsd_print_notifications_manager_class_init (GsdPrintNotificationsManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_print_notifications_manager_constructor; + object_class->finalize = gsd_print_notifications_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPrintNotificationsManagerPrivate)); +} + +static void +gsd_print_notifications_manager_init (GsdPrintNotificationsManager *manager) +{ + manager->priv = GSD_PRINT_NOTIFICATIONS_MANAGER_GET_PRIVATE (manager); + +} + +static void +gsd_print_notifications_manager_finalize (GObject *object) +{ + GsdPrintNotificationsManager *manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_PRINT_NOTIFICATIONS_MANAGER (object)); + + manager = GSD_PRINT_NOTIFICATIONS_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->finalize (object); +} + +GsdPrintNotificationsManager * +gsd_print_notifications_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_PRINT_NOTIFICATIONS_MANAGER (manager_object); +} diff --git a/.pc/47_delay_pa_connect_to_idle.patch/plugins/media-keys/gsd-media-keys-manager.c b/.pc/47_delay_pa_connect_to_idle.patch/plugins/media-keys/gsd-media-keys-manager.c new file mode 100644 index 00000000..0f6ae725 --- /dev/null +++ b/.pc/47_delay_pa_connect_to_idle.patch/plugins/media-keys/gsd-media-keys-manager.c @@ -0,0 +1,2769 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GUDEV +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-marshal.h" +#include "gsd-media-keys-manager.h" + +#include "shortcuts-list.h" +#include "gsd-osd-window.h" +#include "gsd-input-helper.h" +#include "gsd-power-helper.h" +#include "gsd-enums.h" + +#include +#include +#include "gvc-mixer-control.h" + +#include + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" +#define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +#define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +#define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring" +#define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon" +#define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon" + +#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +#define SETTINGS_INTERFACE_DIR "org.gnome.desktop.interface" +#define SETTINGS_POWER_DIR "org.gnome.settings-daemon.plugins.power" +#define SETTINGS_XSETTINGS_DIR "org.gnome.settings-daemon.plugins.xsettings" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" +#define TOUCHPAD_ENABLED_KEY "touchpad-enabled" +#define HIGH_CONTRAST "HighContrast" + +#define VOLUME_STEP 6 /* percents for one volume button press */ +#define MAX_VOLUME 65536.0 + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" + +#define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + +typedef struct { + char *application; + char *name; + guint32 time; + guint watch_id; +} MediaPlayer; + +typedef struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; + char *custom_path; + char *custom_command; + Key *key; +} MediaKey; + +struct GsdMediaKeysManagerPrivate +{ + /* Volume bits */ + GvcMixerControl *volume; + GvcMixerStream *stream; + ca_context *ca; + GtkSettings *gtksettings; +#ifdef HAVE_GUDEV + GHashTable *streams; /* key = X device ID, value = stream id */ + GUdevClient *udev_client; +#endif /* HAVE_GUDEV */ + + GtkWidget *dialog; + GSettings *settings; + GHashTable *custom_settings; + + GPtrArray *keys; + + /* HighContrast theme settings */ + GSettings *interface_settings; + char *icon_theme; + char *gtk_theme; + + /* Power stuff */ + GSettings *power_settings; + GDBusProxy *upower_proxy; + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; + int opcode; + + GList *media_players; + + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + guint start_idle_id; + + /* Ubuntu notifications */ + NotifyNotification *volume_notification; + NotifyNotification *brightness_notification; + NotifyNotification *kb_backlight_notification; +}; + +static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +static void gsd_media_keys_manager_init (GsdMediaKeysManager *media_keys_manager); +static void gsd_media_keys_manager_finalize (GObject *object); +static void register_manager (GsdMediaKeysManager *manager); +static void custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager); +G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous" +#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only" +#define NOTIFY_HINT_TRUE "true" + +typedef struct { + GsdMediaKeysManager *manager; + MediaKeyType type; + guint old_percentage; + +} GsdBrightnessActionData; + +static const char *volume_icons[] = { + "notification-audio-volume-muted", + "notification-audio-volume-low", + "notification-audio-volume-medium", + "notification-audio-volume-high", + NULL +}; + +static const char *brightness_icons[] = { + "notification-display-brightness-off", + "notification-display-brightness-low", + "notification-display-brightness-medium", + "notification-display-brightness-high", + "notification-display-brightness-full", + NULL +}; + +static const char *kb_backlight_icons[] = { + "notification-keyboard-brightness-off", + "notification-keyboard-brightness-low", + "notification-keyboard-brightness-medium", + "notification-keyboard-brightness-high", + "notification-keyboard-brightness-full", + NULL +}; + +static const char * +calculate_icon_name (gint value, const char **icon_names) +{ + value = CLAMP (value, 0, 100); + gint length = g_strv_length (icon_names); + gint s = (length - 1) * value / 100 + 1; + s = CLAMP (s, 1, length - 1); + + return icon_names[s]; +} + +static gboolean +ubuntu_osd_notification_is_supported (void) +{ + GList *caps; + gboolean has_cap; + + caps = notify_get_server_caps (); + has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL); + g_list_foreach (caps, (GFunc) g_free, NULL); + g_list_free (caps); + + return has_cap; +} + +static gboolean +ubuntu_osd_notification_show_icon (const char *icon, + const char *hint) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + NotifyNotification *notification = notify_notification_new (" ", "", icon); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE); + + gboolean res = notify_notification_show (notification, NULL); + g_object_unref (notification); + + return res; +} + +static gboolean +ubuntu_osd_do_notification (NotifyNotification **notification, + const char *hint, + gint value, + gboolean muted, + const char **icon_names) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + if (!*notification) { + *notification = notify_notification_new (" ", "", NULL); + notify_notification_set_hint_string (*notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + } + + value = CLAMP (value, -1, 101); + const char *icon = muted ? icon_names[0] : calculate_icon_name (value, icon_names); + notify_notification_set_hint_int32 (*notification, "value", value); + notify_notification_update (*notification, " ", "", icon); + + return notify_notification_show (*notification, NULL); +} + +static gboolean +ubuntu_osd_notification_show_volume (GsdMediaKeysManager *manager, + gint value, + gboolean muted) +{ + return ubuntu_osd_do_notification (&manager->priv->volume_notification, + "volume", value, muted, volume_icons); +} + +static gboolean +ubuntu_osd_notification_show_brightness (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->brightness_notification, + "brightness", value, value <= 0, brightness_icons); +} + +static gboolean +ubuntu_osd_notification_show_kb_backlight (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->kb_backlight_notification, + "keyboard", value, value <= 0, kb_backlight_icons); +} + +static void +init_screens (GsdMediaKeysManager *manager) +{ + GdkDisplay *display; + int i; + + display = gdk_display_get_default (); + for (i = 0; i < gdk_display_get_n_screens (display); i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + if (screen == NULL) { + continue; + } + manager->priv->screens = g_slist_append (manager->priv->screens, screen); + } + + manager->priv->current_screen = manager->priv->screens->data; +} + +static void +media_key_free (MediaKey *key) +{ + if (key == NULL) + return; + g_free (key->custom_path); + g_free (key->custom_command); + free_key (key->key); + g_free (key); +} + +static char * +get_term_command (GsdMediaKeysManager *manager) +{ + char *cmd_term, *cmd_args;; + char *cmd = NULL; + GSettings *settings; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + cmd_term = g_settings_get_string (settings, "exec"); + if (cmd_term[0] == '\0') + cmd_term = g_strdup ("gnome-terminal"); + + cmd_args = g_settings_get_string (settings, "exec-arg"); + if (strcmp (cmd_term, "") != 0) { + cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args); + } else { + cmd = g_strdup_printf ("%s -e", cmd_term); + } + + g_free (cmd_args); + g_free (cmd_term); + g_object_unref (settings); + + return cmd; +} + +static char ** +get_keyring_env (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant, *item; + GVariantIter *iter; + char **envp; + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_KEYRING_DBUS_NAME, + GNOME_KEYRING_DBUS_PATH, + GNOME_KEYRING_DBUS_INTERFACE, + "GetEnvironment", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call GetEnvironment on keyring daemon: %s", error->message); + g_error_free (error); + return NULL; + } + + envp = g_get_environ (); + + g_variant_get (variant, "(a{ss})", &iter); + + while ((item = g_variant_iter_next_value (iter))) { + char *key; + char *value; + + g_variant_get (item, + "{ss}", + &key, + &value); + + envp = g_environ_setenv (envp, key, value, TRUE); + + g_variant_unref (item); + g_free (key); + g_free (value); + } + + g_variant_iter_free (iter); + g_variant_unref (variant); + + return envp; +} + +static void +execute (GsdMediaKeysManager *manager, + char *cmd, + gboolean need_term) +{ + gboolean retval; + char **argv; + int argc; + char *exec; + char *term = NULL; + GError *error = NULL; + + retval = FALSE; + + if (need_term) + term = get_term_command (manager); + + if (term) { + exec = g_strdup_printf ("%s %s", term, cmd); + g_free (term); + } else { + exec = g_strdup (cmd); + } + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + char **envp; + + envp = get_keyring_env (manager); + + retval = g_spawn_async (g_get_home_dir (), + argv, + envp, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + &error); + + g_strfreev (argv); + g_strfreev (envp); + } + + if (retval == FALSE) { + g_warning ("Couldn't execute command: %s: %s", exec, error->message); + g_error_free (error); + } + g_free (exec); +} + +static void +dialog_init (GsdMediaKeysManager *manager) +{ + if (manager->priv->dialog != NULL + && !gsd_osd_window_is_valid (GSD_OSD_WINDOW (manager->priv->dialog))) { + gtk_widget_destroy (manager->priv->dialog); + manager->priv->dialog = NULL; + } + + if (manager->priv->dialog == NULL) { + manager->priv->dialog = gsd_osd_window_new (); + } +} + +static void +print_key_parse_error (MediaKey *key, + const char *str) +{ + if (str == NULL || *str == '\0') + return; + if (key->settings_key != NULL) + g_debug ("Unable to parse key '%s' for GSettings entry '%s'", str, key->settings_key); + else + g_debug ("Unable to parse hard-coded key '%s'", key->hard_coded); +} + +static char * +get_key_string (GsdMediaKeysManager *manager, + MediaKey *key) +{ + if (key->settings_key != NULL) + return g_settings_get_string (manager->priv->settings, key->settings_key); + else if (key->hard_coded != NULL) + return g_strdup (key->hard_coded); + else if (key->custom_path != NULL) { + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->custom_settings, + key->custom_path); + return g_settings_get_string (settings, "binding"); + } else + g_assert_not_reached (); +} + +static gboolean +grab_media_key (MediaKey *key, + GsdMediaKeysManager *manager) +{ + char *tmp; + gboolean need_flush; + + need_flush = FALSE; + + if (key->key != NULL) { + need_flush = TRUE; + ungrab_key_unsafe (key->key, manager->priv->screens); + } + + free_key (key->key); + key->key = NULL; + + tmp = get_key_string (manager, key); + + key->key = parse_key (tmp); + if (key->key == NULL) { + print_key_parse_error (key, tmp); + g_free (tmp); + return need_flush; + } + + grab_key_unsafe (key->key, GSD_KEYGRAB_NORMAL, manager->priv->screens); + + g_free (tmp); + + return TRUE; +} + +static void +gsettings_changed_cb (GSettings *settings, + const gchar *settings_key, + GsdMediaKeysManager *manager) +{ + int i; + gboolean need_flush = TRUE; + + /* handled in gsettings_custom_changed_cb() */ + if (g_str_equal (settings_key, "custom-keybindings")) + return; + + gdk_error_trap_push (); + + /* Find the key that was modified */ + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + /* Skip over hard-coded and GConf keys */ + if (key->settings_key == NULL) + continue; + if (strcmp (settings_key, key->settings_key) == 0) { + if (grab_media_key (key, manager)) + need_flush = TRUE; + break; + } + } + + if (need_flush) + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); +} + +static MediaKey * +media_key_new_for_path (GsdMediaKeysManager *manager, + char *path) +{ + GSettings *settings; + char *command, *binding; + MediaKey *key; + + g_debug ("media_key_new_for_path: %s", path); + + settings = g_hash_table_lookup (manager->priv->custom_settings, path); + if (settings == NULL) { + settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path); + + g_signal_connect (settings, "changed", + G_CALLBACK (custom_binding_changed), manager); + g_hash_table_insert (manager->priv->custom_settings, + g_strdup (path), settings); + } + + command = g_settings_get_string (settings, "command"); + binding = g_settings_get_string (settings, "binding"); + + if (*command == '\0' && *binding == '\0') { + g_debug ("Key binding (%s) is incomplete", path); + g_free (command); + g_free (binding); + return NULL; + } + g_free (binding); + + key = g_new0 (MediaKey, 1); + key->key_type = CUSTOM_KEY; + key->custom_path = g_strdup (path); + key->custom_command = command; + + return key; +} + +static void +update_custom_binding (GsdMediaKeysManager *manager, + char *path) +{ + MediaKey *key; + int i; + + /* Remove the existing key */ + for (i = 0; i < manager->priv->keys->len; i++) { + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->custom_path == NULL) + continue; + if (strcmp (key->custom_path, path) == 0) { + g_debug ("Removing custom key binding %s", path); + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", path); + } + g_ptr_array_remove_index_fast (manager->priv->keys, i); + break; + } + } + + /* And create a new one! */ + key = media_key_new_for_path (manager, path); + if (key) { + g_debug ("Adding new custom key binding %s", path); + g_ptr_array_add (manager->priv->keys, key); + + gdk_error_trap_push (); + + grab_media_key (key, manager); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for custom key '%s'", + key->custom_path); + } +} + +static void +custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char *path; + + if (strcmp (settings_key, "name") == 0) + return; /* we don't care */ + + g_object_get (settings, "path", &path, NULL); + update_custom_binding (manager, path); + g_free (path); +} + +static void +gsettings_custom_changed_cb (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char **bindings; + int i, j, n_bindings; + + bindings = g_settings_get_strv (settings, settings_key); + n_bindings = g_strv_length (bindings); + + /* Handle additions */ + for (i = 0; i < n_bindings; i++) { + if (g_hash_table_lookup (manager->priv->custom_settings, + bindings[i])) + continue; + update_custom_binding (manager, bindings[i]); + } + + /* Handle removals */ + for (i = 0; i < manager->priv->keys->len; i++) { + gboolean found = FALSE; + MediaKey *key = g_ptr_array_index (manager->priv->keys, i); + if (key->key_type != CUSTOM_KEY) + continue; + + for (j = 0; j < n_bindings && !found; j++) + found = strcmp (bindings[j], key->custom_path) == 0; + + if (found) + continue; + + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", key->custom_path); + } + g_hash_table_remove (manager->priv->custom_settings, + key->custom_path); + g_ptr_array_remove_index_fast (manager->priv->keys, i); + --i; /* make up for the removed key */ + } + g_strfreev (bindings); +} + +static void +add_key (GsdMediaKeysManager *manager, guint i) +{ + MediaKey *key; + + key = g_new0 (MediaKey, 1); + key->key_type = media_keys[i].key_type; + key->settings_key = media_keys[i].settings_key; + key->hard_coded = media_keys[i].hard_coded; + + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); +} + +static void +init_kbd (GsdMediaKeysManager *manager) +{ + char **custom_paths; + int i; + + gnome_settings_profile_start (NULL); + + gdk_error_trap_push (); + + manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free); + + /* Media keys + * Add hard-coded shortcuts first so that they can't be preempted */ + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded) + add_key (manager, i); + } + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded == NULL) + add_key (manager, i); + } + + /* Custom shortcuts */ + custom_paths = g_settings_get_strv (manager->priv->settings, + "custom-keybindings"); + + for (i = 0; i < g_strv_length (custom_paths); i++) { + MediaKey *key; + + g_debug ("Setting up custom keybinding %s", custom_paths[i]); + + key = media_key_new_for_path (manager, custom_paths[i]); + if (!key) { + continue; + } + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); + } + g_strfreev (custom_paths); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); + + gnome_settings_profile_end (NULL); +} + +static void +dialog_show (GsdMediaKeysManager *manager) +{ + int orig_w; + int orig_h; + int screen_w; + int screen_h; + int x; + int y; + GdkRectangle geometry; + int monitor; + + gtk_window_set_screen (GTK_WINDOW (manager->priv->dialog), + manager->priv->current_screen); + + /* + * get the window size + * if the window hasn't been mapped, it doesn't necessarily + * know its true size, yet, so we need to jump through hoops + */ + gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h); + + monitor = gdk_screen_get_primary_monitor (manager->priv->current_screen); + + gdk_screen_get_monitor_geometry (manager->priv->current_screen, + monitor, + &geometry); + + screen_w = geometry.width; + screen_h = geometry.height; + + x = ((screen_w - orig_w) / 2) + geometry.x; + y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; + + gtk_window_move (GTK_WINDOW (manager->priv->dialog), x, y); + + gtk_widget_show (manager->priv->dialog); + + gdk_display_sync (gdk_screen_get_display (manager->priv->current_screen)); +} + +static void +launch_app (GAppInfo *app_info, + gint64 timestamp) +{ + GError *error = NULL; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + if (!g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) { + g_warning ("Could not launch '%s': %s", + g_app_info_get_commandline (app_info), + error->message); + g_error_free (error); + } + g_object_unref (launch_context); +} + +static void +do_url_action (GsdMediaKeysManager *manager, + const char *scheme, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_uri_scheme (scheme); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' scheme", scheme); + } +} + +static void +do_media_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg"); + } +} + +static void +gnome_session_shutdown (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + /* Shouldn't happen, but you never know */ + if (manager->priv->connection == NULL) { + execute (manager, "gnome-session-quit --logout", FALSE); + return; + } + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + "Shutdown", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call Shutdown on session manager: %s", error->message); + g_error_free (error); + return; + } + g_variant_unref (variant); +} + +static void +do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + g_drive_eject_with_operation_finish (drive, res, NULL); +} + +#define NO_SCORE 0 +#define SCORE_CAN_EJECT 50 +#define SCORE_HAS_MEDIA 100 +static void +do_eject_action (GsdMediaKeysManager *manager) +{ + GList *drives, *l; + GDrive *fav_drive; + guint score; + GVolumeMonitor *volume_monitor; + + volume_monitor = g_volume_monitor_get (); + + + /* Find the best drive to eject */ + fav_drive = NULL; + score = NO_SCORE; + drives = g_volume_monitor_get_connected_drives (volume_monitor); + for (l = drives; l != NULL; l = l->next) { + GDrive *drive = l->data; + + if (g_drive_can_eject (drive) == FALSE) + continue; + if (g_drive_is_media_removable (drive) == FALSE) + continue; + if (score < SCORE_CAN_EJECT) { + fav_drive = drive; + score = SCORE_CAN_EJECT; + } + if (g_drive_has_media (drive) == FALSE) + continue; + if (score < SCORE_HAS_MEDIA) { + fav_drive = drive; + score = SCORE_HAS_MEDIA; + break; + } + } + + /* Show the dialogue */ + if (!ubuntu_osd_notification_show_icon ("notification-device-eject", "Eject")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "media-eject-symbolic", + FALSE); + dialog_show (manager); + } + + /* Clean up the drive selection and exit if no suitable + * drives are found */ + if (fav_drive != NULL) + fav_drive = g_object_ref (fav_drive); + + g_list_foreach (drives, (GFunc) g_object_unref, NULL); + if (fav_drive == NULL) + return; + + /* Eject! */ + g_drive_eject_with_operation (fav_drive, G_MOUNT_UNMOUNT_FORCE, + NULL, NULL, + (GAsyncReadyCallback) do_eject_action_cb, + manager); + g_object_unref (fav_drive); + g_object_unref (volume_monitor); +} + +static void +do_home_key_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GFile *file; + GError *error = NULL; + char *uri; + + file = g_file_new_for_path (g_get_home_dir ()); + uri = g_file_get_uri (file); + g_object_unref (file); + + if (gtk_show_uri (NULL, uri, timestamp, &error) == FALSE) { + g_warning ("Failed to launch '%s': %s", uri, error->message); + g_error_free (error); + } + g_free (uri); +} + +static void +do_execute_desktop (GsdMediaKeysManager *manager, + const char *desktop, + gint64 timestamp) +{ + GDesktopAppInfo *app_info; + + app_info = g_desktop_app_info_new (desktop); + if (app_info != NULL) { + launch_app (G_APP_INFO (app_info), timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find application '%s'", desktop); + } +} + +static void +do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) +{ + if (!ubuntu_osd_notification_show_icon ((!state) ? "touchpad-disabled-symbolic" : "input-touchpad-symbolic", "Touchpad")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", + FALSE); + dialog_show (manager); + } +} + +static void +do_touchpad_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + gboolean state; + + if (touchpad_is_present () == FALSE) { + do_touchpad_osd_action (manager, FALSE); + return; + } + + settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY); + + do_touchpad_osd_action (manager, !state); + + g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state); + g_object_unref (settings); +} + +static void +update_dialog (GsdMediaKeysManager *manager, + GvcMixerStream *stream, + guint vol, + gboolean muted, + gboolean sound_changed, + gboolean quiet) +{ + if (ubuntu_osd_notification_show_volume (manager, vol, muted)) + goto done; + + vol = CLAMP (vol, 0, 100); + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), + muted); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), vol); + gsd_osd_window_set_action (GSD_OSD_WINDOW (manager->priv->dialog), + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + +done: + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); + ca_context_play (manager->priv->ca, 1, + CA_PROP_EVENT_ID, "audio-volume-change", + CA_PROP_EVENT_DESCRIPTION, "volume changed through key press", + CA_PROP_CANBERRA_CACHE_CONTROL, "permanent", + NULL); + } +} + +#ifdef HAVE_GUDEV +/* PulseAudio gives us /devices/... paths, when udev + * expects /sys/devices/... paths. */ +static GUdevDevice * +get_udev_device_for_sysfs_path (GsdMediaKeysManager *manager, + const char *sysfs_path) +{ + char *path; + GUdevDevice *dev; + + path = g_strdup_printf ("/sys%s", sysfs_path); + dev = g_udev_client_query_by_sysfs_path (manager->priv->udev_client, path); + g_free (path); + + return dev; +} + +static GvcMixerStream * +get_stream_for_device_id (GsdMediaKeysManager *manager, + guint deviceid) +{ + char *devnode; + gpointer id_ptr; + GvcMixerStream *res; + GUdevDevice *dev, *parent; + GSList *sinks, *l; + + id_ptr = g_hash_table_lookup (manager->priv->streams, GUINT_TO_POINTER (deviceid)); + if (id_ptr != NULL) { + if (GPOINTER_TO_UINT (id_ptr) == (guint) -1) + return NULL; + else + return gvc_mixer_control_lookup_stream_id (manager->priv->volume, GPOINTER_TO_UINT (id_ptr)); + } + + devnode = xdevice_get_device_node (deviceid); + if (devnode == NULL) { + g_debug ("Could not find device node for XInput device %d", deviceid); + return NULL; + } + + dev = g_udev_client_query_by_device_file (manager->priv->udev_client, devnode); + if (dev == NULL) { + g_debug ("Could not find udev device for device path '%s'", devnode); + g_free (devnode); + return NULL; + } + g_free (devnode); + + if (g_strcmp0 (g_udev_device_get_property (dev, "ID_BUS"), "usb") != 0) { + g_debug ("Not handling XInput device %d, not USB", deviceid); + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + g_object_unref (dev); + return NULL; + } + + parent = g_udev_device_get_parent_with_subsystem (dev, "usb", "usb_device"); + if (parent == NULL) { + g_warning ("No USB device parent for XInput device %d even though it's USB", deviceid); + g_object_unref (dev); + return NULL; + } + + res = NULL; + sinks = gvc_mixer_control_get_sinks (manager->priv->volume); + for (l = sinks; l; l = l->next) { + GvcMixerStream *stream = l->data; + const char *sysfs_path; + GUdevDevice *sink_dev, *sink_parent; + + sysfs_path = gvc_mixer_stream_get_sysfs_path (stream); + sink_dev = get_udev_device_for_sysfs_path (manager, sysfs_path); + if (sink_dev == NULL) + continue; + sink_parent = g_udev_device_get_parent_with_subsystem (sink_dev, "usb", "usb_device"); + g_object_unref (sink_dev); + if (sink_parent == NULL) + continue; + + if (g_strcmp0 (g_udev_device_get_sysfs_path (sink_parent), + g_udev_device_get_sysfs_path (parent)) == 0) { + res = stream; + } + g_object_unref (sink_parent); + if (res != NULL) + break; + } + + if (res) + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER (gvc_mixer_stream_get_id (res))); + else + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + + return res; +} +#endif /* HAVE_GUDEV */ + +static void +do_sound_action (GsdMediaKeysManager *manager, + guint deviceid, + int type, + gboolean quiet) +{ + GvcMixerStream *stream; + gboolean old_muted, new_muted; + guint old_vol, new_vol, norm_vol_step, osd_vol; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +#ifdef HAVE_GUDEV + stream = get_stream_for_device_id (manager, deviceid); + if (stream == NULL) +#endif /* HAVE_GUDEV */ + stream = manager->priv->stream; + if (stream == NULL) + return; + + norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100; + + /* FIXME: this is racy */ + new_vol = old_vol = gvc_mixer_stream_get_volume (stream); + new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream); + sound_changed = FALSE; + + switch (type) { + case MUTE_KEY: + new_muted = !old_muted; + break; + case VOLUME_DOWN_KEY: + if (old_vol <= norm_vol_step) { + new_vol = 0; + new_muted = TRUE; + } else { + new_vol = old_vol - norm_vol_step; + } + break; + case VOLUME_UP_KEY: + new_muted = FALSE; + /* When coming out of mute only increase the volume if it was 0 */ + if (!old_muted || old_vol == 0) + new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME); + break; + } + + if (old_muted != new_muted) { + gvc_mixer_stream_change_is_muted (stream, new_muted); + sound_changed = TRUE; + } + + if (old_vol != new_vol) { + if (gvc_mixer_stream_set_volume (stream, new_vol) != FALSE) { + gvc_mixer_stream_push_volume (stream); + sound_changed = TRUE; + } + } + + if (type == VOLUME_DOWN_KEY && old_vol == 0 && old_muted) + osd_vol = -1; + else if (type == VOLUME_UP_KEY && old_vol == PA_VOLUME_NORM && !old_muted) + osd_vol = 101; + else if (!new_muted) + osd_vol = (int) (100 * (double) new_vol / PA_VOLUME_NORM); + else + osd_vol = 0; + + update_dialog (manager, stream, osd_vol, new_muted, sound_changed, quiet); +} + +static void +sound_theme_changed (GtkSettings *settings, + GParamSpec *pspec, + GsdMediaKeysManager *manager) +{ + char *theme_name; + + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); +} + +static void +update_default_sink (GsdMediaKeysManager *manager) +{ + GvcMixerStream *stream; + + stream = gvc_mixer_control_get_default_sink (manager->priv->volume); + if (stream == manager->priv->stream) + return; + + if (manager->priv->stream != NULL) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + + if (stream != NULL) { + manager->priv->stream = g_object_ref (stream); + } else { + g_warning ("Unable to get default sink"); + } +} + +static void +on_control_state_changed (GvcMixerControl *control, + GvcMixerControlState new_state, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +static void +on_control_default_sink_changed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +#ifdef HAVE_GUDEV +static gboolean +remove_stream (gpointer key, + gpointer value, + gpointer id) +{ + if (GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (id)) + return TRUE; + return FALSE; +} +#endif /* HAVE_GUDEV */ + +static void +on_control_stream_removed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + if (manager->priv->stream != NULL) { + if (gvc_mixer_stream_get_id (manager->priv->stream) == id) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + } + +#ifdef HAVE_GUDEV + g_hash_table_foreach_remove (manager->priv->streams, (GHRFunc) remove_stream, GUINT_TO_POINTER (id)); +#endif +} + +static void +free_media_player (MediaPlayer *player) +{ + if (player->watch_id > 0) { + g_bus_unwatch_name (player->watch_id); + player->watch_id = 0; + } + g_free (player->application); + g_free (player->name); + g_free (player); +} + +static gint +find_by_application (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->application, b); +} + +static gint +find_by_name (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->name, b); +} + +static gint +find_by_time (gconstpointer a, + gconstpointer b) +{ + return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time; +} + +static void +name_vanished_handler (GDBusConnection *connection, + const gchar *name, + GsdMediaKeysManager *manager) +{ + GList *iter; + + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering vanished %s (name: %s)", player->application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +/* + * Register a new media player. Most applications will want to call + * this with time = GDK_CURRENT_TIME. This way, the last registered + * player will receive media events. In some cases, applications + * may want to register with a lower priority (usually 1), to grab + * events only nobody is interested. + */ +static void +gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name, + guint32 time) +{ + GList *iter; + MediaPlayer *media_player; + guint watch_id; + + if (time == GDK_CURRENT_TIME) { + GTimeVal tv; + + g_get_current_time (&tv); + time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + } + + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + + if (iter != NULL) { + if (((MediaPlayer *)iter->data)->time < time) { + MediaPlayer *player = iter->data; + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } else { + return; + } + } + + watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_handler, + manager, + NULL); + + g_debug ("Registering %s at %u", application, time); + media_player = g_new0 (MediaPlayer, 1); + media_player->application = g_strdup (application); + media_player->name = g_strdup (name); + media_player->time = time; + media_player->watch_id = watch_id; + + manager->priv->media_players = g_list_insert_sorted (manager->priv->media_players, + media_player, + find_by_time); +} + +static void +gsd_media_keys_manager_release_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name) +{ + GList *iter = NULL; + + g_return_if_fail (application != NULL || name != NULL); + + if (application != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + } + + if (iter == NULL && name != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + } + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering %s (name: %s)", application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +static gboolean +gsd_media_player_key_pressed (GsdMediaKeysManager *manager, + const char *key) +{ + const char *application; + gboolean have_listeners; + GError *error = NULL; + MediaPlayer *player; + + g_return_val_if_fail (key != NULL, FALSE); + + g_debug ("Media key '%s' pressed", key); + + have_listeners = (manager->priv->media_players != NULL); + + if (!have_listeners) { + /* Popup a dialog with an (/) icon */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "action-unavailable-symbolic", + FALSE); + dialog_show (manager); + return TRUE; + } + + player = manager->priv->media_players->data; + application = player->application; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + player->name, + GSD_MEDIA_KEYS_DBUS_PATH, + GSD_MEDIA_KEYS_DBUS_NAME, + "MediaPlayerKeyPressed", + g_variant_new ("(ss)", application ? application : "", key), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + + return !have_listeners; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdMediaKeysManager *manager = (GsdMediaKeysManager *) user_data; + + g_debug ("Calling method '%s' for media-keys", method_name); + + if (g_strcmp0 (method_name, "ReleaseMediaPlayerKeys") == 0) { + const char *app_name; + + g_variant_get (parameters, "(&s)", &app_name); + gsd_media_keys_manager_release_media_player_keys (manager, app_name, sender); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "GrabMediaPlayerKeys") == 0) { + const char *app_name; + guint32 time; + + g_variant_get (parameters, "(&su)", &app_name, &time); + gsd_media_keys_manager_grab_media_player_keys (manager, app_name, sender, time); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static gboolean +do_multimedia_player_action (GsdMediaKeysManager *manager, + const char *icon, + const char *key) +{ + if (icon != NULL) + ubuntu_osd_notification_show_icon (icon, key); + return gsd_media_player_key_pressed (manager, key); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + char *action; + + action = g_object_get_data (G_OBJECT (source_object), + "gsd-media-keys-manager-xrandr-action"); + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call '%s': %s", action, error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } + + g_free (action); +} + +static void +do_xrandr_action (GsdMediaKeysManager *manager, + const char *action, + gint64 timestamp) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + priv->cancellable = g_cancellable_new (); + + g_object_set_data (G_OBJECT (priv->xrandr_proxy), + "gsd-media-keys-manager-xrandr-action", + g_strdup (action)); + + g_dbus_proxy_call (priv->xrandr_proxy, + action, + g_variant_new ("(x)", timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static gboolean +do_video_out_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "VideoModeSwitch", timestamp); + return FALSE; +} + +static gboolean +do_video_rotate_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "Rotate", timestamp); + return FALSE; +} + +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + +static void +do_text_size_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + gdouble factor, best, distance; + guint i; + + /* Same values used in the Seeing tab of the Universal Access panel */ + static gdouble factors[] = { + 0.75, + 1.0, + 1.25, + 1.5 + }; + + /* Figure out the current DPI scaling factor */ + factor = g_settings_get_double (manager->priv->interface_settings, "text-scaling-factor"); + factor += (type == INCREASE_TEXT_KEY ? 0.25 : -0.25); + + /* Try to find a matching value */ + distance = 1e6; + best = 1.0; + for (i = 0; i < G_N_ELEMENTS(factors); i++) { + gdouble d; + d = fabs (factor - factors[i]); + if (d < distance) { + best = factors[i]; + distance = d; + } + } + + if (best == 1.0) + g_settings_reset (manager->priv->interface_settings, "text-scaling-factor"); + else + g_settings_set_double (manager->priv->interface_settings, "text-scaling-factor", best); +} + +static void +do_magnifier_zoom_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + gdouble offset, value; + + if (type == MAGNIFIER_ZOOM_IN_KEY) + offset = 1.0; + else + offset = -1.0; + + settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + value = g_settings_get_double (settings, "mag-factor"); + value += offset; + value = roundl (value); + g_settings_set_double (settings, "mag-factor", value); + g_object_unref (settings); +} + +static void +do_toggle_contrast_action (GsdMediaKeysManager *manager) +{ + gboolean high_contrast; + char *theme; + + /* Are we using HighContrast now? */ + theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + high_contrast = g_str_equal (theme, HIGH_CONTRAST); + g_free (theme); + + if (high_contrast != FALSE) { + if (manager->priv->gtk_theme == NULL) + g_settings_reset (manager->priv->interface_settings, "gtk-theme"); + else + g_settings_set (manager->priv->interface_settings, "gtk-theme", manager->priv->gtk_theme); + g_settings_set (manager->priv->interface_settings, "icon-theme", manager->priv->icon_theme); + } else { + g_settings_set (manager->priv->interface_settings, "gtk-theme", HIGH_CONTRAST); + g_settings_set (manager->priv->interface_settings, "icon-theme", HIGH_CONTRAST); + } +} + +static void +do_config_power_action (GsdMediaKeysManager *manager, + const gchar *config_key) +{ + GsdPowerActionType action_type; + + action_type = g_settings_get_enum (manager->priv->power_settings, + config_key); + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + case GSD_POWER_ACTION_SHUTDOWN: + gnome_session_shutdown (manager); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_BLANK: + case GSD_POWER_ACTION_NOTHING: + /* these actions cannot be handled by media-keys and + * are not used in this context */ + break; + } +} + +static void +update_screen_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); + g_free (data); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + guint osd_percentage; + + if (data->old_percentage == 100 && data->type == SCREEN_BRIGHTNESS_UP_KEY) + osd_percentage = 101; + else if (data->old_percentage == 0 && data->type == SCREEN_BRIGHTNESS_DOWN_KEY) + osd_percentage = -1; + else + osd_percentage = CLAMP (percentage, 0, 100); + + if (!ubuntu_osd_notification_show_brightness (manager, osd_percentage)) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "display-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_free (data); + g_variant_unref (new_percentage); +} + +static void +do_screen_brightness_action_real (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + GError *error = NULL; + + GVariant *old_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (old_percentage == NULL) { + g_warning ("Failed to get old screen percentage: %s", error->message); + g_error_free (error); + g_free (data); + return; + } + + g_variant_get (old_percentage, "(u)", &data->old_percentage); + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_screen_proxy, + data->type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_screen_cb, + data); + + g_variant_unref (old_percentage); +} + +static void +do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + if (manager->priv->connection == NULL || + manager->priv->power_screen_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + GsdBrightnessActionData *data = g_new0 (GsdBrightnessActionData, 1); + data->manager = manager; + data->type = type; + + g_dbus_proxy_call (manager->priv->power_screen_proxy, + "GetPercentage", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + do_screen_brightness_action_real, + data); +} + +static void +update_keyboard_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new keyboard percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + + /* FIXME: No overshoot effect for keyboard, as the power plugin has no interface + * to get the old brightness */ + if (!ubuntu_osd_notification_show_kb_backlight (manager, CLAMP (percentage, 0, 100))) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "keyboard-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_variant_unref (new_percentage); +} + +static void +do_keyboard_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + const char *cmd; + + if (manager->priv->connection == NULL || + manager->priv->power_keyboard_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + switch (type) { + case KEYBOARD_BRIGHTNESS_UP_KEY: + cmd = "StepUp"; + break; + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + cmd = "StepDown"; + break; + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + cmd = "Toggle"; + break; + default: + g_assert_not_reached (); + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_keyboard_proxy, + cmd, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_keyboard_cb, + manager); +} + +static void +do_switch_input_source_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + GVariant *sources; + gint i, n; + + settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + + n = g_variant_n_children (sources); + if (n < 2) + goto out; + + i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); + + if (type == SWITCH_INPUT_SOURCE_KEY) + i += 1; + else + i -= 1; + + if (i < 0) + i = n - 1; + else if (i >= n) + i = 0; + + g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); + + out: + g_variant_unref (sources); + g_object_unref (settings); +} + +static void +do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +{ + execute (manager, key->custom_command, FALSE); +} + +static gboolean +do_action (GsdMediaKeysManager *manager, + guint deviceid, + MediaKeyType type, + gint64 timestamp) +{ + char *cmd; + + g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid); + + switch (type) { + case TOUCHPAD_KEY: + do_touchpad_action (manager); + break; + case TOUCHPAD_ON_KEY: + do_touchpad_osd_action (manager, TRUE); + break; + case TOUCHPAD_OFF_KEY: + do_touchpad_osd_action (manager, FALSE); + break; + case MUTE_KEY: + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + do_sound_action (manager, deviceid, type, FALSE); + break; + case MUTE_QUIET_KEY: + do_sound_action (manager, deviceid, MUTE_KEY, TRUE); + break; + case VOLUME_DOWN_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_DOWN_KEY, TRUE); + break; + case VOLUME_UP_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: + gnome_session_shutdown (manager); + break; + case EJECT_KEY: + do_eject_action (manager); + break; + case HOME_KEY: + do_home_key_action (manager, timestamp); + break; + case SEARCH_KEY: + cmd = NULL; + if ((cmd = g_find_program_in_path ("tracker-search-tool"))) + do_execute_desktop (manager, "tracker-needle.desktop", timestamp); + else + do_execute_desktop (manager, "gnome-search-tool.desktop", timestamp); + g_free (cmd); + break; + case EMAIL_KEY: + do_url_action (manager, "mailto", timestamp); + break; + case SCREENSAVER_KEY: + execute (manager, "gnome-screensaver-command --lock", FALSE); + break; + case HELP_KEY: + do_url_action (manager, "ghelp", timestamp); + break; + case SCREENSHOT_KEY: + execute (manager, "gnome-screenshot", FALSE); + break; + case WINDOW_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --window", FALSE); + break; + case AREA_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --area", FALSE); + break; + case SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --clipboard", FALSE); + break; + case WINDOW_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --window --clipboard", FALSE); + break; + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; + case MEDIA_KEY: + do_media_action (manager, timestamp); + break; + case CALCULATOR_KEY: + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: + return do_multimedia_player_action (manager, NULL, "Play"); + case PAUSE_KEY: + return do_multimedia_player_action (manager, NULL, "Pause"); + case STOP_KEY: + return do_multimedia_player_action (manager, NULL, "Stop"); + case PREVIOUS_KEY: + return do_multimedia_player_action (manager, NULL, "Previous"); + case NEXT_KEY: + return do_multimedia_player_action (manager, NULL, "Next"); + case REWIND_KEY: + return do_multimedia_player_action (manager, NULL, "Rewind"); + case FORWARD_KEY: + return do_multimedia_player_action (manager, NULL, "FastForward"); + case REPEAT_KEY: + return do_multimedia_player_action (manager, NULL, "Repeat"); + case RANDOM_KEY: + return do_multimedia_player_action (manager, NULL, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; + case ROTATE_VIDEO_KEY: + do_video_rotate_action (manager, timestamp); + break; + case MAGNIFIER_KEY: + do_magnifier_action (manager); + break; + case SCREENREADER_KEY: + do_screenreader_action (manager); + break; + case ON_SCREEN_KEYBOARD_KEY: + do_on_screen_keyboard_action (manager); + break; + case INCREASE_TEXT_KEY: + case DECREASE_TEXT_KEY: + do_text_size_action (manager, type); + break; + case MAGNIFIER_ZOOM_IN_KEY: + case MAGNIFIER_ZOOM_OUT_KEY: + do_magnifier_zoom_action (manager, type); + break; + case TOGGLE_CONTRAST_KEY: + do_toggle_contrast_action (manager); + break; + case POWER_KEY: + do_config_power_action (manager, "button-power"); + break; + case SLEEP_KEY: + do_config_power_action (manager, "button-sleep"); + break; + case SUSPEND_KEY: + do_config_power_action (manager, "button-suspend"); + break; + case HIBERNATE_KEY: + do_config_power_action (manager, "button-hibernate"); + break; + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + do_screen_brightness_action (manager, type); + break; + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + do_keyboard_brightness_action (manager, type); + break; + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; + case SWITCH_INPUT_SOURCE_KEY: + case SWITCH_INPUT_SOURCE_BACKWARD_KEY: + do_switch_input_source_action (manager, type); + break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); + } + + return FALSE; +} + +static GdkScreen * +get_screen_from_root (GsdMediaKeysManager *manager, + Window root) +{ + GSList *l; + + /* Look for which screen we're receiving events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + GdkScreen *screen = (GdkScreen *) l->data; + GdkWindow *window = gdk_screen_get_root_window (screen); + + if (GDK_WINDOW_XID (window) == root) + return screen; + } + + return NULL; +} + +static GdkFilterReturn +filter_key_events (XEvent *xevent, + GdkEvent *event, + GsdMediaKeysManager *manager) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XGenericEventCookie *cookie; + guint i; + guint deviceid; + + /* verify we have a key event */ + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + cookie = &xevent->xcookie; + if (cookie->extension != manager->priv->opcode) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + deviceid = xev->sourceid; + + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (match_xi2_key (key->key, xev)) { + switch (key->key_type) { + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + /* auto-repeatable keys */ + if (xiev->evtype != XI_KeyPress) + return GDK_FILTER_CONTINUE; + break; + default: + if (xiev->evtype != XI_KeyRelease) { + return GDK_FILTER_CONTINUE; + } + } + + manager->priv->current_screen = get_screen_from_root (manager, xev->root); + + if (key->key_type == CUSTOM_KEY) { + do_custom_action (manager, key, xev->time); + return GDK_FILTER_REMOVE; + } + + if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +update_theme_settings (GSettings *settings, + const char *key, + GsdMediaKeysManager *manager) +{ + char *theme; + + theme = g_settings_get_string (manager->priv->interface_settings, key); + if (g_str_equal (theme, HIGH_CONTRAST)) { + g_free (theme); + } else { + if (g_str_equal (key, "gtk-theme")) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = theme; + } else { + g_free (manager->priv->icon_theme); + manager->priv->icon_theme = theme; + } + } +} + +static gboolean +start_media_keys_idle_cb (GsdMediaKeysManager *manager) +{ + GSList *l; + char *theme_name; + + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::custom-keybindings", + G_CALLBACK (gsettings_custom_changed_cb), manager); + + manager->priv->custom_settings = + g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + /* Sound events */ + ca_context_create (&manager->priv->ca); + ca_context_set_driver (manager->priv->ca, "pulse"); + ca_context_change_props (manager->priv->ca, 0, + CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", + NULL); + manager->priv->gtksettings = gtk_settings_get_for_screen (gdk_screen_get_default ()); + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); + g_signal_connect (manager->priv->gtksettings, "notify::gtk-sound-theme-name", + G_CALLBACK (sound_theme_changed), manager); + + /* for the power plugin interface code */ + manager->priv->power_settings = g_settings_new (SETTINGS_POWER_DIR); + + /* Logic from http://git.gnome.org/browse/gnome-shell/tree/js/ui/status/accessibility.js#n163 */ + manager->priv->interface_settings = g_settings_new (SETTINGS_INTERFACE_DIR); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::gtk-theme", + G_CALLBACK (update_theme_settings), manager); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::icon-theme", + G_CALLBACK (update_theme_settings), manager); + manager->priv->gtk_theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + if (g_str_equal (manager->priv->gtk_theme, HIGH_CONTRAST)) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = NULL; + } + manager->priv->icon_theme = g_settings_get_string (manager->priv->interface_settings, "icon-theme"); + + init_screens (manager); + init_kbd (manager); + + /* Start filtering the events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + gnome_settings_profile_start ("gdk_window_add_filter"); + + g_debug ("adding key filter for screen: %d", + gdk_screen_get_number (l->data)); + + gdk_window_add_filter (gdk_screen_get_root_window (l->data), + (GdkFilterFunc) filter_key_events, + manager); + gnome_settings_profile_end ("gdk_window_add_filter"); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error) +{ + const char * const subsystems[] = { "input", "usb", "sound", NULL }; + + gnome_settings_profile_start (NULL); + + if (supports_xinput2_devices (&manager->priv->opcode) == FALSE) { + g_debug ("No Xinput2 support, disabling plugin"); + return TRUE; + } + +#ifdef HAVE_GUDEV + manager->priv->streams = g_hash_table_new (g_direct_hash, g_direct_equal); + manager->priv->udev_client = g_udev_client_new (subsystems); +#endif + + /* initialise Volume handler + * + * We do this one here to force checking gstreamer cache, etc. + * The rest (grabbing and setting the keys) can happen in an + * idle. + */ + gnome_settings_profile_start ("gvc_mixer_control_new"); + + manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys"); + + g_signal_connect (manager->priv->volume, + "state-changed", + G_CALLBACK (on_control_state_changed), + manager); + g_signal_connect (manager->priv->volume, + "default-sink-changed", + G_CALLBACK (on_control_default_sink_changed), + manager); + g_signal_connect (manager->priv->volume, + "stream-removed", + G_CALLBACK (on_control_stream_removed), + manager); + + gvc_mixer_control_open (manager->priv->volume); + + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); + + register_manager (manager_object); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_media_keys_manager_stop (GsdMediaKeysManager *manager) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + GSList *ls; + GList *l; + int i; + + g_debug ("Stopping media_keys manager"); + + if (priv->bus_cancellable != NULL) { + g_cancellable_cancel (priv->bus_cancellable); + g_object_unref (priv->bus_cancellable); + priv->bus_cancellable = NULL; + } + + for (ls = priv->screens; ls != NULL; ls = ls->next) { + gdk_window_remove_filter (gdk_screen_get_root_window (ls->data), + (GdkFilterFunc) filter_key_events, + manager); + } + + if (manager->priv->gtksettings != NULL) { + g_signal_handlers_disconnect_by_func (manager->priv->gtksettings, sound_theme_changed, manager); + manager->priv->gtksettings = NULL; + } + + if (manager->priv->ca) { + ca_context_destroy (manager->priv->ca); + manager->priv->ca = NULL; + } + +#ifdef HAVE_GUDEV + if (priv->streams) { + g_hash_table_destroy (priv->streams); + priv->streams = NULL; + } + if (priv->udev_client) { + g_object_unref (priv->udev_client); + priv->udev_client = NULL; + } +#endif /* HAVE_GUDEV */ + + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; + } + + if (priv->power_settings) { + g_object_unref (priv->power_settings); + priv->power_settings = NULL; + } + + if (priv->power_screen_proxy) { + g_object_unref (priv->power_screen_proxy); + priv->power_screen_proxy = NULL; + } + + if (priv->power_keyboard_proxy) { + g_object_unref (priv->power_keyboard_proxy); + priv->power_keyboard_proxy = NULL; + } + + if (priv->upower_proxy) { + g_object_unref (priv->upower_proxy); + priv->upower_proxy = NULL; + } + + if (priv->cancellable != NULL) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + + if (priv->introspection_data) { + g_dbus_node_info_unref (priv->introspection_data); + priv->introspection_data = NULL; + } + + if (priv->connection != NULL) { + g_object_unref (priv->connection); + priv->connection = NULL; + } + + if (priv->volume_notification != NULL) { + notify_notification_close (priv->volume_notification, NULL); + g_object_unref (priv->volume_notification); + priv->volume_notification = NULL; + } + + if (priv->brightness_notification != NULL) { + notify_notification_close (priv->brightness_notification, NULL); + g_object_unref (priv->brightness_notification); + priv->brightness_notification = NULL; + } + + if (priv->kb_backlight_notification != NULL) { + notify_notification_close (priv->kb_backlight_notification, NULL); + g_object_unref (priv->kb_backlight_notification); + priv->kb_backlight_notification = NULL; + } + + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->key) + ungrab_key_unsafe (key->key, priv->screens); + } + g_ptr_array_free (priv->keys, TRUE); + priv->keys = NULL; + + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (priv->screens != NULL) { + g_slist_free (priv->screens); + priv->screens = NULL; + } + + if (priv->stream) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + if (priv->volume) { + g_object_unref (priv->volume); + priv->volume = NULL; + } + + if (priv->dialog != NULL) { + gtk_widget_destroy (priv->dialog); + priv->dialog = NULL; + } + + if (priv->media_players != NULL) { + for (l = priv->media_players; l; l = l->next) { + MediaPlayer *mp = l->data; + g_free (mp->application); + g_free (mp); + } + g_list_free (priv->media_players); + priv->media_players = NULL; + } +} + +static GObject * +gsd_media_keys_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMediaKeysManager *media_keys_manager; + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (media_keys_manager); +} + +static void +gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_media_keys_manager_constructor; + object_class->finalize = gsd_media_keys_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysManagerPrivate)); +} + +static void +gsd_media_keys_manager_init (GsdMediaKeysManager *manager) +{ + manager->priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_media_keys_manager_finalize (GObject *object) +{ + GsdMediaKeysManager *media_keys_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_MANAGER (object)); + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (object); + + g_return_if_fail (media_keys_manager->priv != NULL); + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object); +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +upower_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->upower_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Failed to get proxy for upower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_screen_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_screen_proxy == NULL) { + g_warning ("Failed to get proxy for power (screen): %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_keyboard_proxy == NULL) { + g_warning ("Failed to get proxy for power (keyboard): %s", + error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MEDIA_KEYS_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Screen", + NULL, + (GAsyncReadyCallback) power_screen_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Keyboard", + NULL, + (GAsyncReadyCallback) power_keyboard_ready_cb, + manager); +} + +static void +register_manager (GsdMediaKeysManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + NULL, + (GAsyncReadyCallback) upower_ready_cb, + manager); +} + +GsdMediaKeysManager * +gsd_media_keys_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MEDIA_KEYS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MEDIA_KEYS_MANAGER (manager_object); +} diff --git a/.pc/48_register_client_before_idle_callbacks.patch/gnome-settings-daemon/main.c b/.pc/48_register_client_before_idle_callbacks.patch/gnome-settings-daemon/main.c new file mode 100644 index 00000000..6e0af555 --- /dev/null +++ b/.pc/48_register_client_before_idle_callbacks.patch/gnome-settings-daemon/main.c @@ -0,0 +1,556 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "gnome-settings-manager.h" +#include "gnome-settings-profile.h" + +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_OBJECT "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE "org.gnome.SessionManager.ClientPrivate" + +static gboolean debug = FALSE; +static gboolean do_timed_exit = FALSE; +static int term_signal_pipe_fds[2]; +static guint name_id = 0; +static GnomeSettingsManager *manager = NULL; + +static GOptionEntry entries[] = { + {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL }, + { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, + {NULL} +}; + +static gboolean +timed_exit_cb (void) +{ + g_debug ("Doing timed exit"); + gtk_main_quit (); + return FALSE; +} + +static void +stop_manager (GnomeSettingsManager *manager) +{ + gnome_settings_manager_stop (manager); + gtk_main_quit (); +} + +static void +on_session_over (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + if (g_strcmp0 (signal_name, "SessionOver") == 0) { + g_debug ("Got a SessionOver signal - stopping"); + stop_manager (manager); + } +} + +static void +respond_to_end_session (GDBusProxy *proxy) +{ + /* we must answer with "EndSessionResponse" */ + g_dbus_proxy_call (proxy, "EndSessionResponse", + g_variant_new ("(bs)", + TRUE, ""), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); +} + +static void +client_proxy_signal_cb (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + if (g_strcmp0 (signal_name, "QueryEndSession") == 0) { + g_debug ("Got QueryEndSession signal"); + respond_to_end_session (proxy); + } else if (g_strcmp0 (signal_name, "EndSession") == 0) { + g_debug ("Got EndSession signal"); + respond_to_end_session (proxy); + } else if (g_strcmp0 (signal_name, "Stop") == 0) { + g_debug ("Got Stop signal"); + stop_manager (manager); + } +} + +static void +got_client_proxy (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + GDBusProxy *client_proxy; + GError *error = NULL; + + client_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + + if (error != NULL) { + g_debug ("Unable to get the session client proxy: %s", error->message); + g_error_free (error); + return; + } + + g_signal_connect (client_proxy, "g-signal", + G_CALLBACK (client_proxy_signal_cb), manager); +} + +static void +on_client_registered (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *variant; + GError *error = NULL; + gchar *object_path = NULL; + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (error != NULL) { + g_warning ("Unable to register client: %s", error->message); + g_error_free (error); + } else { + g_variant_get (variant, "(o)", &object_path); + + g_debug ("Registered client at path %s", object_path); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, 0, NULL, + GNOME_SESSION_DBUS_NAME, + object_path, + GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE, + NULL, + got_client_proxy, + manager); + + g_free (object_path); + g_variant_unref (variant); + } +} + +static void +session_env_done (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (result == NULL) { + g_debug ("Failed to set the environment: %s", error->message); + g_error_free (error); + return; + } + + g_variant_unref (result); +} + +static void +set_session_env (GDBusProxy *proxy, + const gchar *name, + const gchar *value) +{ + g_dbus_proxy_call (proxy, + "Setenv", + g_variant_new ("(ss)", name, value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) session_env_done, + NULL); +} + +static void +set_locale (GDBusProxy *proxy) +{ + GSettings *locale_settings; + gchar *region; + + /* Set locale environment */ + locale_settings = g_settings_new ("org.gnome.system.locale"); + region = g_settings_get_string (locale_settings, "region"); + if (region[0]) { + /* Only set the locale settings if the user has ever customized them */ + set_session_env (proxy, "LC_TIME", region); + set_session_env (proxy, "LC_NUMERIC", region); + set_session_env (proxy, "LC_MONETARY", region); + set_session_env (proxy, "LC_MEASUREMENT", region); + } + g_free (region); + + g_object_unref (locale_settings); +} + +static void +register_with_gnome_session (GDBusProxy *proxy) +{ + const char *startup_id; + + g_signal_connect (G_OBJECT (proxy), "g-signal", + G_CALLBACK (on_session_over), NULL); + startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); + g_dbus_proxy_call (proxy, + "RegisterClient", + g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) on_client_registered, + manager); +} + +#ifdef HAVE_IBUS +static gboolean +is_program_in_path (const char *binary) +{ + char *path; + + path = g_find_program_in_path (binary); + if (path == NULL) + return FALSE; + g_free (path); + return TRUE; +} + +static gboolean +keyboard_plugin_is_enabled (void) +{ + GSettings *settings; + gboolean enabled; + + settings = g_settings_new ("org.gnome.settings-daemon.plugins.keyboard"); + enabled = g_settings_get_boolean (settings, "active"); + g_object_unref (settings); + + return enabled; +} + +static void +got_session_name (GObject *object, + GAsyncResult *res, + gpointer data) +{ + GDBusProxy *proxy; + GVariant *result, *variant; + const gchar *session_name = NULL; + GError *error = NULL; + + proxy = G_DBUS_PROXY (object); + + result = g_dbus_proxy_call_finish (proxy, res, &error); + if (!result) { + g_debug ("Failed to get session name: %s", error->message); + g_error_free (error); + register_with_gnome_session (proxy); + return; + } + + g_variant_get (result, "(v)", &variant); + g_variant_unref (result); + + g_variant_get (variant, "&s", &session_name); + + if (g_strcmp0 (session_name, "gnome") == 0 && + is_program_in_path ("ibus-daemon") && + keyboard_plugin_is_enabled ()) { + set_session_env (proxy, "QT_IM_MODULE", "ibus"); + set_session_env (proxy, "XMODIFIERS", "@im=ibus"); + } + + g_variant_unref (variant); + + /* Finally we can register. */ + register_with_gnome_session (proxy); +} + +static void +set_legacy_ibus_env_vars (GDBusProxy *proxy) +{ + g_dbus_proxy_call (proxy, + "org.freedesktop.DBus.Properties.Get", + g_variant_new ("(ss)", + "org.gnome.SessionManager", + "SessionName"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + got_session_name, + NULL); +} +#endif + +static void +got_session_proxy (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GDBusProxy *proxy; + GError *error = NULL; + + proxy = g_dbus_proxy_new_finish (res, &error); + if (proxy == NULL) { + g_debug ("Could not connect to the Session manager: %s", error->message); + g_error_free (error); + } else { +#ifdef HAVE_IBUS + /* This will register with gnome-session after calling Setenv. */ + set_legacy_ibus_env_vars (proxy); +#else + register_with_gnome_session (proxy); +#endif + } +} + +static gboolean +on_term_signal_pipe_closed (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + term_signal_pipe_fds[0] = -1; + + g_debug ("Received SIGTERM - shutting down"); + /* Got SIGTERM, time to clean up and get out + */ + gtk_main_quit (); + + return FALSE; +} + +static void +on_term_signal (int signal) +{ + /* Wake up main loop to tell it to shutdown */ + close (term_signal_pipe_fds[1]); + term_signal_pipe_fds[1] = -1; +} + +static void +watch_for_term_signal (GnomeSettingsManager *manager) +{ + GIOChannel *channel; + + if (-1 == pipe (term_signal_pipe_fds) || + -1 == fcntl (term_signal_pipe_fds[0], F_SETFD, FD_CLOEXEC) || + -1 == fcntl (term_signal_pipe_fds[1], F_SETFD, FD_CLOEXEC)) { + g_error ("Could not create pipe: %s", g_strerror (errno)); + exit (EXIT_FAILURE); + } + + channel = g_io_channel_unix_new (term_signal_pipe_fds[0]); + g_io_channel_set_encoding (channel, NULL, NULL); + g_io_channel_set_buffered (channel, FALSE); + g_io_add_watch (channel, G_IO_HUP, on_term_signal_pipe_closed, manager); + g_io_channel_unref (channel); + + signal (SIGTERM, on_term_signal); +} + +static void +set_session_over_handler (GDBusConnection *bus) +{ + g_assert (bus != NULL); + + g_dbus_proxy_new (bus, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_OBJECT, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + (GAsyncReadyCallback) got_session_proxy, + NULL); + + watch_for_term_signal (manager); +} + +static void +name_acquired_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + set_session_over_handler (connection); +} + +static void +name_lost_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + /* Name was already taken, or the bus went away */ + + g_warning ("Name taken or bus went away - shutting down"); + gtk_main_quit (); +} + +static void +bus_register (void) +{ + name_id = g_bus_own_name (G_BUS_TYPE_SESSION, + GSD_DBUS_NAME, + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, + (GBusNameAcquiredCallback) name_acquired_handler, + (GBusNameLostCallback) name_lost_handler, + NULL, + NULL); +} + +static void +gsd_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data) +{ + /* filter out DEBUG messages if debug isn't set */ + if ((log_level & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG + && ! debug) { + return; + } + + g_log_default_handler (log_domain, + log_level, + message, + unused_data); +} + +static void +parse_args (int *argc, char ***argv) +{ + GError *error; + GOptionContext *context; + + gnome_settings_profile_start (NULL); + + + context = g_option_context_new (NULL); + + g_option_context_add_main_entries (context, entries, NULL); + g_option_context_add_group (context, gtk_get_option_group (FALSE)); + + error = NULL; + if (!g_option_context_parse (context, argc, argv, &error)) { + if (error != NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } else { + g_warning ("Unable to initialize GTK+"); + } + exit (EXIT_FAILURE); + } + + g_option_context_free (context); + + gnome_settings_profile_end (NULL); + + if (debug) + g_setenv ("G_MESSAGES_DEBUG", "all", FALSE); +} + +int +main (int argc, char *argv[]) +{ + + gboolean res; + GError *error; + + gnome_settings_profile_start (NULL); + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + setlocale (LC_ALL, ""); + + parse_args (&argc, &argv); + + g_type_init (); + + gnome_settings_profile_start ("opening gtk display"); + if (! gtk_init_check (NULL, NULL)) { + g_warning ("Unable to initialize GTK+"); + exit (EXIT_FAILURE); + } + gnome_settings_profile_end ("opening gtk display"); + + g_log_set_default_handler (gsd_log_default_handler, NULL); + + notify_init ("gnome-settings-daemon"); + + bus_register (); + + gnome_settings_profile_start ("gnome_settings_manager_new"); + manager = gnome_settings_manager_new (); + gnome_settings_profile_end ("gnome_settings_manager_new"); + if (manager == NULL) { + g_warning ("Unable to register object"); + goto out; + } + + error = NULL; + res = gnome_settings_manager_start (manager, &error); + if (! res) { + g_warning ("Unable to start: %s", error->message); + g_error_free (error); + goto out; + } + + if (do_timed_exit) { + g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL); + } + + gtk_main (); + + g_debug ("Shutting down"); + +out: + if (name_id > 0) { + g_bus_unown_name (name_id); + name_id = 0; + } + + if (manager != NULL) { + g_object_unref (manager); + } + + g_debug ("SettingsDaemon finished"); + gnome_settings_profile_end (NULL); + + return 0; +} diff --git a/.pc/51_lock_screen_on_suspend.patch/plugins/power/gsd-power-manager.c b/.pc/51_lock_screen_on_suspend.patch/plugins/power/gsd-power-manager.c new file mode 100644 index 00000000..4181a4a3 --- /dev/null +++ b/.pc/51_lock_screen_on_suspend.patch/plugins/power/gsd-power-manager.c @@ -0,0 +1,4365 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * Copyright (C) 2011 Ritesh Khadgaray + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gpm-common.h" +#include "gpm-phone.h" +#include "gpm-idletime.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-enums.h" +#include "gsd-power-manager.h" +#include "gsd-power-helper.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_PATH_PRESENCE "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE_PRESENCE "org.gnome.SessionManager.Presence" + +#define UPOWER_DBUS_NAME "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_PATH_KBDBACKLIGHT "/org/freedesktop/UPower/KbdBacklight" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DBUS_INTERFACE_KBDBACKLIGHT "org.freedesktop.UPower.KbdBacklight" + +#define GSD_POWER_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power" + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_POWER_DBUS_PATH GSD_DBUS_PATH "/Power" +#define GSD_POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#define GSD_POWER_DBUS_INTERFACE_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_POWER_DBUS_INTERFACE_KEYBOARD "org.gnome.SettingsDaemon.Power.Keyboard" + +#define GS_DBUS_NAME "org.gnome.ScreenSaver" +#define GS_DBUS_PATH "/org/gnome/ScreenSaver" +#define GS_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER 0 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */ + +#define GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ +#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */ +#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + +/* Keep this in sync with gnome-shell */ +#define SCREENSAVER_FADE_TIME 10 /* seconds */ + +#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */ + +enum { + GSD_POWER_IDLETIME_NULL_ID, + GSD_POWER_IDLETIME_DIM_ID, + GSD_POWER_IDLETIME_BLANK_ID, + GSD_POWER_IDLETIME_SLEEP_ID +}; + +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +/* on ACPI machines we have 4-16 levels, on others it's ~150 */ +#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) + +/* take a discrete value with offset and convert to percentage */ +static int +abs_to_percentage (int min, int max, int value) +{ + g_return_val_if_fail (max > min, -1); + g_return_val_if_fail (value >= min, -1); + g_return_val_if_fail (value <= max, -1); + return (((value - min) * 100) / (max - min)); +} +#define ABS_TO_PERCENTAGE(min, max, value) abs_to_percentage(min, max, value) +#define PERCENTAGE_TO_ABS(min, max, value) (min + (((max - min) * value) / 100)) + +#define GSD_POWER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerPrivate)) + +typedef enum { + GSD_POWER_IDLE_MODE_NORMAL, + GSD_POWER_IDLE_MODE_DIM, + GSD_POWER_IDLE_MODE_BLANK, + GSD_POWER_IDLE_MODE_SLEEP +} GsdPowerIdleMode; + +struct GsdPowerManagerPrivate +{ + GnomeSettingsSession *session; + gboolean lid_is_closed; + GSettings *settings; + GSettings *settings_screensaver; + UpClient *up_client; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *upower_proxy; + GDBusProxy *upower_kdb_proxy; + gint kbd_brightness_now; + gint kbd_brightness_max; + gint kbd_brightness_old; + gint kbd_brightness_pre_dim; + GnomeRRScreen *x11_screen; + gboolean use_time_primary; + gchar *previous_summary; + GIcon *previous_icon; + GpmPhone *phone; + GPtrArray *devices_array; + guint action_percentage; + guint action_time; + guint critical_percentage; + guint critical_time; + guint low_percentage; + guint low_time; + gint pre_dim_brightness; /* level, not percentage */ + UpDevice *device_composite; + NotifyNotification *notification_discharging; + NotifyNotification *notification_low; + ca_context *canberra_context; + ca_proplist *critical_alert_loop_props; + guint32 critical_alert_timeout_id; + GDBusProxy *screensaver_proxy; + GDBusProxy *session_proxy; + GDBusProxy *session_presence_proxy; + GpmIdletime *idletime; + GsdPowerIdleMode current_idle_mode; + guint lid_close_safety_timer_id; + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; +}; + +enum { + PROP_0, +}; + +static void gsd_power_manager_class_init (GsdPowerManagerClass *klass); +static void gsd_power_manager_init (GsdPowerManager *power_manager); +static void gsd_power_manager_finalize (GObject *object); + +static UpDevice *engine_get_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static UpDevice *engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static GIcon *engine_get_icon (GsdPowerManager *manager); +static gchar *engine_get_summary (GsdPowerManager *manager); +static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type); +static void do_lid_closed_action (GsdPowerManager *manager); +static void lock_screensaver (GsdPowerManager *manager); +static void kill_lid_close_safety_timer (GsdPowerManager *manager); + +G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gsd_power_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_power_manager_error"); + return quark; +} + +static gboolean +play_loop_timeout_cb (GsdPowerManager *manager) +{ + ca_context *context; + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play_full (context, 0, + manager->priv->critical_alert_loop_props, + NULL, + NULL); + return TRUE; +} + +static gboolean +play_loop_stop (GsdPowerManager *manager) +{ + if (manager->priv->critical_alert_timeout_id == 0) { + g_warning ("no sound loop present to stop"); + return FALSE; + } + + g_source_remove (manager->priv->critical_alert_timeout_id); + ca_proplist_destroy (manager->priv->critical_alert_loop_props); + + manager->priv->critical_alert_loop_props = NULL; + manager->priv->critical_alert_timeout_id = 0; + + return TRUE; +} + +static gboolean +play_loop_start (GsdPowerManager *manager, + const gchar *id, + const gchar *desc, + gboolean force, + guint timeout) +{ + ca_context *context; + + if (timeout == 0) { + g_warning ("received invalid timeout"); + return FALSE; + } + + /* if a sound loop is already running, stop the existing loop */ + if (manager->priv->critical_alert_timeout_id != 0) { + g_warning ("was instructed to play a sound loop with one already playing"); + play_loop_stop (manager); + } + + ca_proplist_create (&(manager->priv->critical_alert_loop_props)); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_ID, id); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_DESCRIPTION, desc); + + manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout, + (GSourceFunc) play_loop_timeout_cb, + manager); + g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, + "[GsdPowerManager] play-loop"); + + /* play the sound, using sounds from the naming spec */ + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play (context, 0, + CA_PROP_EVENT_ID, id, + CA_PROP_EVENT_DESCRIPTION, desc, NULL); + return TRUE; +} + +static void +notify_close_if_showing (NotifyNotification *notification) +{ + gboolean ret; + GError *error = NULL; + + if (notification == NULL) + return; + ret = notify_notification_close (notification, &error); + if (!ret) { + g_warning ("failed to close notification: %s", + error->message); + g_error_free (error); + } +} + +static const gchar * +get_first_themed_icon_name (GIcon *icon) +{ + const gchar* const *icon_names; + const gchar *icon_name = NULL; + + /* no icon */ + if (icon == NULL) + goto out; + + /* just use the first icon */ + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + if (icon_names != NULL) + icon_name = icon_names[0]; +out: + return icon_name; +} + +typedef enum { + WARNING_NONE = 0, + WARNING_DISCHARGING = 1, + WARNING_LOW = 2, + WARNING_CRITICAL = 3, + WARNING_ACTION = 4 +} GsdPowerManagerWarning; + +static GVariant * +engine_get_icon_property_variant (GsdPowerManager *manager) +{ + GIcon *icon; + GVariant *retval; + + icon = engine_get_icon (manager); + if (icon != NULL) { + char *str; + str = g_icon_to_string (icon); + g_object_unref (icon); + retval = g_variant_new_string (str); + g_free (str); + } else { + retval = g_variant_new_string (""); + } + return retval; +} + +static GVariant * +engine_get_tooltip_property_variant (GsdPowerManager *manager) +{ + char *tooltip; + GVariant *retval; + + tooltip = engine_get_summary (manager); + retval = g_variant_new_string (tooltip != NULL ? tooltip : ""); + g_free (tooltip); + + return retval; +} + +static void +engine_emit_changed (GsdPowerManager *manager, + gboolean icon_changed, + gboolean state_changed) +{ + GVariantBuilder props_builder; + GVariant *props_changed = NULL; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + + g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}")); + + if (icon_changed) + g_variant_builder_add (&props_builder, "{sv}", "Icon", + engine_get_icon_property_variant (manager)); + if (state_changed) + g_variant_builder_add (&props_builder, "{sv}", "Tooltip", + engine_get_tooltip_property_variant (manager)); + + props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE, + g_variant_builder_end (&props_builder), + g_variant_new_strv (NULL, 0)); + g_variant_ref_sink (props_changed); + + if (!g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_POWER_DBUS_PATH, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + props_changed, + &error)) + goto out; + + out: + if (error) { + g_warning ("%s", error->message); + g_clear_error (&error); + } + if (props_changed) + g_variant_unref (props_changed); +} + +static GsdPowerManagerWarning +engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage < 26.0f) + return WARNING_LOW; + else if (percentage < 13.0f) + return WARNING_CRITICAL; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage <= manager->priv->action_percentage) + return WARNING_ACTION; + if (percentage <= manager->priv->critical_percentage) + return WARNING_CRITICAL; + if (percentage <= manager->priv->low_percentage) + return WARNING_LOW; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_time (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "time-to-empty", &time_to_empty, + NULL); + + /* this is probably an error condition */ + if (time_to_empty == 0) { + g_debug ("time zero, falling back to percentage for %s", + up_device_kind_to_string (kind)); + return engine_get_warning_percentage (manager, device); + } + + if (time_to_empty <= manager->priv->action_time) + return WARNING_ACTION; + if (time_to_empty <= manager->priv->critical_time) + return WARNING_CRITICAL; + if (time_to_empty <= manager->priv->low_time) + return WARNING_LOW; + return WARNING_NONE; +} + +/** + * This gets the possible engine state for the device according to the + * policy, which could be per-percent, or per-time. + **/ +static GsdPowerManagerWarning +engine_get_warning (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + UpDeviceState state; + GsdPowerManagerWarning warning_type; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + NULL); + + /* default to no engine */ + warning_type = WARNING_NONE; + + /* if the device in question is on ac, don't give a warning */ + if (state == UP_DEVICE_STATE_CHARGING) + goto out; + + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + + warning_type = engine_get_warning_csr (manager, device); + + } else if (kind == UP_DEVICE_KIND_UPS || +#if UP_CHECK_VERSION(0,9,5) + kind == UP_DEVICE_KIND_MEDIA_PLAYER || + kind == UP_DEVICE_KIND_TABLET || + kind == UP_DEVICE_KIND_COMPUTER || +#endif + kind == UP_DEVICE_KIND_PDA) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_BATTERY) { + /* only use the time when it is accurate, and settings is not disabled */ + if (manager->priv->use_time_primary) + warning_type = engine_get_warning_time (manager, device); + else + warning_type = engine_get_warning_percentage (manager, device); + } + + /* If we have no important engines, we should test for discharging */ + if (warning_type == WARNING_NONE) { + if (state == UP_DEVICE_STATE_DISCHARGING) + warning_type = WARNING_DISCHARGING; + } + + out: + return warning_type; +} + +static gchar * +engine_get_summary (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + GString *tooltip = NULL; + gchar *part; + gboolean is_present; + + + /* need to get AC state */ + tooltip = g_string_new (""); + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "is-present", &is_present, + "state", &state, + NULL); + if (!is_present) + continue; + if (state == UP_DEVICE_STATE_EMPTY) + continue; + part = gpm_upower_get_device_summary (device); + if (part != NULL) + g_string_append_printf (tooltip, "%s\n", part); + g_free (part); + } + + /* remove the last \n */ + g_string_truncate (tooltip, tooltip->len-1); + + g_debug ("tooltip: %s", tooltip->str); + + return g_string_free (tooltip, FALSE); +} + +static GIcon * +engine_get_icon_priv (GsdPowerManager *manager, + UpDeviceKind device_kind, + GsdPowerManagerWarning warning, + gboolean use_state) +{ + guint i; + GPtrArray *array; + UpDevice *device; + GsdPowerManagerWarning warning_temp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) + device = engine_get_composite_device (manager, device); + + warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), + "engine-warning-old")); + if (kind == device_kind && is_present) { + if (warning != WARNING_NONE) { + if (warning_temp == warning) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + if (use_state) { + if (state == UP_DEVICE_STATE_CHARGING || + state == UP_DEVICE_STATE_DISCHARGING) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + return gpm_upower_get_device_icon (device, TRUE); + } + } + return NULL; +} + +static GIcon * +engine_get_icon (GsdPowerManager *manager) +{ + GIcon *icon = NULL; + + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + + /* we try (DIS)CHARGING: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + + /* we try PRESENT: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + + /* do not show an icon */ + return NULL; +} + +static gboolean +engine_recalculate_state_icon (GsdPowerManager *manager) +{ + GIcon *icon; + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, icon != NULL); + + if (icon == NULL) { + /* none before, now none */ + if (manager->priv->previous_icon == NULL) + return FALSE; + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = NULL; + return TRUE; + } + + /* no icon before, now icon */ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + /* icon before, now different */ + if (!g_icon_equal (manager->priv->previous_icon, icon)) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + g_debug ("no change"); + /* nothing to do */ + g_object_unref (icon); + return FALSE; +} + +static gboolean +engine_recalculate_state_summary (GsdPowerManager *manager) +{ + gchar *summary; + + summary = engine_get_summary (manager); + if (manager->priv->previous_summary == NULL) { + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + + if (strcmp (manager->priv->previous_summary, summary) != 0) { + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + g_debug ("no change"); + /* nothing to do */ + g_free (summary); + return FALSE; +} + +static void +engine_recalculate_state (GsdPowerManager *manager) +{ + gboolean icon_changed = FALSE; + gboolean state_changed = FALSE; + + icon_changed = engine_recalculate_state_icon (manager); + state_changed = engine_recalculate_state_summary (manager); + + /* only emit if the icon or summary has changed */ + if (icon_changed || state_changed) + engine_emit_changed (manager, icon_changed, state_changed); +} + +static UpDevice * +engine_get_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint battery_devices = 0; + GPtrArray *array; + UpDevice *device; + UpDeviceKind kind; + UpDeviceKind original_kind; + guint i; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* find out how many batteries in the system */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + NULL); + if (kind == original_kind) + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices <= 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use the composite device */ + device = manager->priv->device_composite; +out: + /* return composite device or original device */ + return device; +} + +static UpDevice * +engine_update_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint i; + gdouble percentage = 0.0; + gdouble energy = 0.0; + gdouble energy_full = 0.0; + gdouble energy_rate = 0.0; + gdouble energy_total = 0.0; + gdouble energy_full_total = 0.0; + gdouble energy_rate_total = 0.0; + gint64 time_to_empty = 0; + gint64 time_to_full = 0; + guint battery_devices = 0; + gboolean is_charging = FALSE; + gboolean is_discharging = FALSE; + gboolean is_fully_charged = TRUE; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + UpDeviceKind kind; + UpDeviceKind original_kind; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* update the composite device */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + "state", &state, + "energy", &energy, + "energy-full", &energy_full, + "energy-rate", &energy_rate, + NULL); + if (kind != original_kind) + continue; + + /* one of these will be charging or discharging */ + if (state == UP_DEVICE_STATE_CHARGING) + is_charging = TRUE; + if (state == UP_DEVICE_STATE_DISCHARGING) + is_discharging = TRUE; + if (state != UP_DEVICE_STATE_FULLY_CHARGED) + is_fully_charged = FALSE; + + /* sum up composite */ + energy_total += energy; + energy_full_total += energy_full; + energy_rate_total += energy_rate; + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices == 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use percentage weighted for each battery capacity */ + if (energy_full_total > 0.0) + percentage = 100.0 * energy_total / energy_full_total; + + /* set composite state */ + if (is_charging) + state = UP_DEVICE_STATE_CHARGING; + else if (is_discharging) + state = UP_DEVICE_STATE_DISCHARGING; + else if (is_fully_charged) + state = UP_DEVICE_STATE_FULLY_CHARGED; + else + state = UP_DEVICE_STATE_UNKNOWN; + + /* calculate a quick and dirty time remaining value */ + if (energy_rate_total > 0) { + if (state == UP_DEVICE_STATE_DISCHARGING) + time_to_empty = 3600 * (energy_total / energy_rate_total); + else if (state == UP_DEVICE_STATE_CHARGING) + time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total); + } + + /* okay, we can use the composite device */ + device = manager->priv->device_composite; + + g_debug ("printing composite device"); + g_object_set (device, + "energy", energy, + "energy-full", energy_full, + "energy-rate", energy_rate, + "time-to-empty", time_to_empty, + "time-to-full", time_to_full, + "percentage", percentage, + "state", state, + NULL); + + /* force update of icon */ + if (engine_recalculate_state_icon (manager)) + engine_emit_changed (manager, TRUE, FALSE); +out: + /* return composite device or original device */ + return device; +} + +typedef struct { + GsdPowerManager *manager; + UpDevice *device; +} GsdPowerManagerRecallData; + +static void +device_perhaps_recall_response_cb (GtkDialog *dialog, + gint response_id, + GsdPowerManagerRecallData *recall_data) +{ + GdkScreen *screen; + GtkWidget *dialog_error; + GError *error = NULL; + gboolean ret; + gchar *website = NULL; + + /* don't show this again */ + if (response_id == GTK_RESPONSE_CANCEL) { + g_settings_set_boolean (recall_data->manager->priv->settings, + "notify-perhaps-recall", + FALSE); + goto out; + } + + /* visit recall website */ + if (response_id == GTK_RESPONSE_OK) { + + g_object_get (recall_data->device, + "recall-url", &website, + NULL); + + screen = gdk_screen_get_default(); + ret = gtk_show_uri (screen, + website, + gtk_get_current_event_time (), + &error); + if (!ret) { + dialog_error = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Failed to show url %s", + error->message); + gtk_dialog_run (GTK_DIALOG (dialog_error)); + g_error_free (error); + } + } +out: + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (recall_data->device); + g_object_unref (recall_data->manager); + g_free (recall_data); + g_free (website); + return; +} + +static gboolean +device_perhaps_recall_delay_cb (gpointer user_data) +{ + gchar *vendor; + const gchar *title = NULL; + GString *message = NULL; + GtkWidget *dialog; + GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data; + + g_object_get (recall_data->device, + "recall-vendor", &vendor, + NULL); + + /* TRANSLATORS: the battery may be recalled by its vendor */ + title = _("Battery may be recalled"); + message = g_string_new (""); + g_string_append_printf (message, + _("A battery in your computer may have been " + "recalled by %s and you may be at risk."), vendor); + g_string_append (message, "\n\n"); + g_string_append (message, _("For more information visit the battery recall website.")); + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + title); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", message->str); + + /* TRANSLATORS: button text, visit the manufacturers recall website */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), + GTK_RESPONSE_OK); + + /* TRANSLATORS: button text, do not show this bubble again */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), + GTK_RESPONSE_CANCEL); + + gtk_widget_show (dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (device_perhaps_recall_response_cb), + recall_data); + + g_string_free (message, TRUE); + g_free (vendor); + return FALSE; +} + +static void +device_perhaps_recall (GsdPowerManager *manager, UpDevice *device) +{ + gboolean ret; + guint timer_id; + GsdPowerManagerRecallData *recall_data; + + /* don't show when running under GDM */ + if (g_getenv ("RUNNING_UNDER_GDM") != NULL) { + g_debug ("running under gdm, so no notification"); + return; + } + + /* already shown, and dismissed */ + ret = g_settings_get_boolean (manager->priv->settings, + "notify-perhaps-recall"); + if (!ret) { + g_debug ("settings prevents recall notification"); + return; + } + + recall_data = g_new0 (GsdPowerManagerRecallData, 1); + recall_data->manager = g_object_ref (manager); + recall_data->device = g_object_ref (device); + + /* delay by a few seconds so the session can load */ + timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY, + device_perhaps_recall_delay_cb, + recall_data); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall"); +} + +static void +engine_device_add (GsdPowerManager *manager, UpDevice *device) +{ + gboolean recall_notice; + GsdPowerManagerWarning warning; + UpDeviceState state; + UpDeviceKind kind; + UpDevice *composite; + + /* assign warning */ + warning = engine_get_warning (manager, device); + g_object_set_data (G_OBJECT(device), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "recall-notice", &recall_notice, + NULL); + + /* add old state for transitions */ + g_debug ("adding %s with state %s", + up_device_get_object_path (device), up_device_state_to_string (state)); + g_object_set_data (G_OBJECT(device), + "engine-state-old", + GUINT_TO_POINTER(state)); + + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because we added a device"); + composite = engine_update_composite_device (manager, device); + + /* get the same values for the composite device */ + warning = engine_get_warning (manager, composite); + g_object_set_data (G_OBJECT(composite), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + g_object_get (composite, "state", &state, NULL); + g_object_set_data (G_OBJECT(composite), + "engine-state-old", + GUINT_TO_POINTER(state)); + } + + /* the device is recalled */ + if (recall_notice) + device_perhaps_recall (manager, device); +} + +static gboolean +engine_check_recall (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gboolean recall_notice = FALSE; + gchar *recall_vendor = NULL; + gchar *recall_url = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "recall-notice", &recall_notice, + "recall-vendor", &recall_vendor, + "recall-url", &recall_url, + NULL); + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + goto out; + + /* no recall data */ + if (!recall_notice) + goto out; + + /* emit signal for manager */ + g_debug ("** EMIT: perhaps-recall"); + g_debug ("%s-%s", recall_vendor, recall_url); +out: + g_free (recall_vendor); + g_free (recall_url); + return recall_notice; +} + +static gboolean +engine_coldplug (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array = NULL; + UpDevice *device; + gboolean ret; + GError *error = NULL; + + /* get devices from UPower */ + ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error); + if (!ret) { + g_warning ("failed to get device list: %s", error->message); + g_error_free (error); + goto out; + } + + /* connected mobile phones */ + gpm_phone_coldplug (manager->priv->phone); + + engine_recalculate_state (manager); + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); + /* never repeat */ + return FALSE; +} + +static void +engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + /* add to list */ + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_check_recall (manager, device); + + engine_recalculate_state (manager); +} + +static void +engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + gboolean ret; + ret = g_ptr_array_remove (manager->priv->devices_array, device); + if (!ret) + return; + engine_recalculate_state (manager); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +create_notification (const char *summary, + const char *body, + const char *icon, + NotifyNotification **weak_pointer_location) +{ + NotifyNotification *notification; + + notification = notify_notification_new (summary, body, icon); + *weak_pointer_location = notification; + g_object_add_weak_pointer (G_OBJECT (notification), + (gpointer *) weak_pointer_location); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); +} + +static void +engine_ups_discharging (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title; + gboolean ret; + gchar *remaining_text = NULL; + gdouble percentage; + GError *error = NULL; + GIcon *icon = NULL; + gint64 time_to_empty; + GString *message; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + if (kind != UP_DEVICE_KIND_UPS) + return; + + /* only show text if there is a valid time */ + if (time_to_empty > 0) + remaining_text = gpm_get_timestring (time_to_empty); + + /* TRANSLATORS: UPS is now discharging */ + title = _("UPS Discharging"); + + message = g_string_new (""); + if (remaining_text != NULL) { + /* TRANSLATORS: tell the user how much time they have got */ + g_string_append_printf (message, _("%s of UPS backup power remaining"), + remaining_text); + } else { + g_string_append (message, gpm_device_to_localised_string (device)); + } + g_string_append_printf (message, " (%.0f%%)", percentage); + + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_discharging); + + /* create a new notification */ + create_notification (title, message->str, + get_first_themed_icon_name (icon), + &manager->priv->notification_discharging); + notify_notification_set_timeout (manager->priv->notification_discharging, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_discharging, + NOTIFY_URGENCY_NORMAL); + /* TRANSLATORS: this is the notification application name */ + notify_notification_set_app_name (manager->priv->notification_discharging, _("Power")); + notify_notification_set_hint (manager->priv->notification_discharging, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_discharging, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_discharging); + } + g_string_free (message, TRUE); + if (icon != NULL) + g_object_unref (icon); + g_free (remaining_text); +} + +static GsdPowerActionType +manager_critical_action_get (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType policy; + + policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action"); + if (policy == GSD_POWER_ACTION_SUSPEND) { + if (is_ups == FALSE && + up_client_get_can_suspend (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_can_hibernate (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } + + return policy; +} + +static gboolean +manager_critical_action_do (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType action_type; + + /* stop playing the alert as it's too late to do anything now */ + if (manager->priv->critical_alert_timeout_id > 0) + play_loop_stop (manager); + + action_type = manager_critical_action_get (manager, is_ups); + do_power_action_type (manager, action_type); + + return FALSE; +} + +static gboolean +manager_critical_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, FALSE); + return FALSE; +} + +static gboolean +manager_critical_ups_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, TRUE); + return FALSE; +} + +static gboolean +engine_just_laptop_battery (GsdPowerManager *manager) +{ + UpDevice *device; + UpDeviceKind kind; + GPtrArray *array; + gboolean ret = TRUE; + guint i; + + /* find if there are any other device types that mean we have to + * be more specific in our wording */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, "kind", &kind, NULL); + if (kind != UP_DEVICE_KIND_BATTERY) { + ret = FALSE; + break; + } + } + return ret; +} + +static void +engine_charge_low (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gchar *tmp; + gchar *remaining_text; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery low, and we only have one battery */ + title = _("Battery low"); + } else { + /* TRANSLATORS: laptop battery low, and we have more than one kind of battery */ + title = _("Laptop battery low"); + } + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage); + g_free (remaining_text); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is starting to get a little low */ + title = _("UPS low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s of remaining UPS backup power (%.0f%%)"), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: mouse is getting a little low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless mouse is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: keyboard is getting a little low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless keyboard is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PDA) { + /* TRANSLATORS: PDA is getting a little low */ + title = _("PDA battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("PDA is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + /* TRANSLATORS: cell phone (mobile) is getting a little low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + /* TRANSLATORS: media player, e.g. mp3 is getting a little low */ + title = _("Media player battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_TABLET) { + /* TRANSLATORS: graphics tablet, e.g. wacom is getting a little low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + /* TRANSLATORS: computer, e.g. ipad is getting a little low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_NORMAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + notify_notification_set_hint (manager->priv->notification_low, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-low", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL); + +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_critical (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + GsdPowerActionType policy; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */ + title = _("Battery critically low"); + } else { + /* TRANSLATORS: laptop battery critically low, and we have more than one type of battery */ + title = _("Laptop battery critically low"); + } + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */ + message = g_strdup (_("Plug in your AC adapter to avoid losing data.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in.")); + } + + } else if (kind == UP_DEVICE_KIND_UPS) { + gchar *remaining_text; + gchar *tmp; + + /* TRANSLATORS: the UPS is very low */ + title = _("UPS critically low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Approximately %s of remaining UPS power (%.0f%%). " + "Restore AC power to your computer to avoid losing data."), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: the mouse battery is very low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless mouse is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: the keyboard battery is very low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless keyboard is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_PDA) { + + /* TRANSLATORS: the PDA battery is very low */ + title = _("PDA battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("PDA is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Media player is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_TABLET) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Attached computer is very low in power (%.0f%%). " + "The device will soon shutdown if not charged."), + percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + switch (kind) { + + case UP_DEVICE_KIND_BATTERY: + case UP_DEVICE_KIND_UPS: + g_debug ("critical charge level reached, starting sound loop"); + play_loop_start (manager, + "battery-caution", + _("Battery is critically low"), + TRUE, + GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT); + break; + + default: + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); + break; + } +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_action (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + GError *error = NULL; + GIcon *icon = NULL; + GsdPowerActionType policy; + guint timer_id; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* TRANSLATORS: laptop battery is really, really, low */ + title = _("Laptop battery critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("The battery is below the critical level and " + "this computer will power-off when the " + "battery becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: computer will suspend */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to suspend.\n" + "NOTE: A small amount of power is required " + "to keep your computer in a suspended state.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action"); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is really, really, low */ + title = _("UPS critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, TRUE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("UPS is below the critical level and " + "this computer will power-off when the " + "UPS becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_ups_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action"); + } + + /* not all types have actions */ + if (title == NULL) + return; + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + UpDeviceKind kind; + UpDeviceState state; + UpDeviceState state_old; + GsdPowerManagerWarning warning_old; + GsdPowerManagerWarning warning; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because %s changed", up_device_get_object_path (device)); + device = engine_update_composite_device (manager, device); + } + + /* get device properties (may be composite) */ + g_object_get (device, + "state", &state, + NULL); + + g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state)); + + /* see if any interesting state changes have happened */ + state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old")); + if (state_old != state) { + if (state == UP_DEVICE_STATE_DISCHARGING) { + g_debug ("discharging"); + engine_ups_discharging (manager, device); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED || + state == UP_DEVICE_STATE_CHARGING) { + g_debug ("fully charged or charging, hiding notifications if any"); + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + } + + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state)); + } + + /* check the warning state has not changed */ + warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old")); + warning = engine_get_warning (manager, device); + if (warning != warning_old) { + if (warning == WARNING_LOW) { + g_debug ("** EMIT: charge-low"); + engine_charge_low (manager, device); + } else if (warning == WARNING_CRITICAL) { + g_debug ("** EMIT: charge-critical"); + engine_charge_critical (manager, device); + } else if (warning == WARNING_ACTION) { + g_debug ("charge-action"); + engine_charge_action (manager, device); + } + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning)); + } + + engine_recalculate_state (manager); +} + +static UpDevice * +engine_get_primary_device (GsdPowerManager *manager) +{ + guint i; + UpDevice *device = NULL; + UpDevice *device_tmp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + for (i=0; ipriv->devices_array->len; i++) { + device_tmp = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device_tmp, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* not present */ + if (!is_present) + continue; + + /* not discharging */ + if (state != UP_DEVICE_STATE_DISCHARGING) + continue; + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + + /* use composite device to cope with multiple batteries */ + device = g_object_ref (engine_get_composite_device (manager, device_tmp)); + break; + } + return device; +} + +static void +phone_device_added_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + UpDevice *device; + device = up_device_new (); + + g_debug ("phone added %i", idx); + + /* get device properties */ + g_object_set (device, + "kind", UP_DEVICE_KIND_PHONE, + "is-rechargeable", TRUE, + "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "is-present", TRUE, + NULL); + + /* state changed */ + engine_device_add (manager, device); + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_recalculate_state (manager); +} + +static void +phone_device_removed_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + + g_debug ("phone removed %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + g_ptr_array_remove_index (manager->priv->devices_array, i); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +phone_device_refresh_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + + g_debug ("phone refresh %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + is_present = gpm_phone_get_present (phone, idx); + state = gpm_phone_get_on_ac (phone, idx) ? UP_DEVICE_STATE_CHARGING : UP_DEVICE_STATE_DISCHARGING; + percentage = gpm_phone_get_percentage (phone, idx); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +gnome_session_shutdown_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't shutdown using gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +gnome_session_shutdown (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* ask gnome-session to show the shutdown dialog with a timeout */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to gnome-session: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Shutdown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gnome_session_shutdown_cb, NULL); + g_object_unref (proxy); +} + +static void +do_power_action_type (GsdPowerManager *manager, + GsdPowerActionType action_type) +{ + gboolean ret; + GError *error = NULL; + + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + gnome_session_shutdown (); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_SHUTDOWN: + /* this is only used on critically low battery where + * hibernate is not available and is marginally better + * than just powering down the computer mid-write */ + gsd_power_poweroff (); + break; + case GSD_POWER_ACTION_BLANK: + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off for policy action: %s", + error->message); + g_error_free (error); + } + break; + case GSD_POWER_ACTION_NOTHING: + break; + } +} + +static gboolean +upower_kbd_set_brightness (GsdPowerManager *manager, guint value, GError **error) +{ + GVariant *retval; + + /* same as before */ + if (manager->priv->kbd_brightness_now == value) + return TRUE; + + /* update h/w value */ + retval = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "SetBrightness", + g_variant_new ("(i)", (gint) value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + error); + if (retval == NULL) + return FALSE; + + /* save new value */ + manager->priv->kbd_brightness_now = value; + g_variant_unref (retval); + return TRUE; +} + +static gboolean +upower_kbd_toggle (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + if (manager->priv->kbd_brightness_old >= 0) { + g_debug ("keyboard toggle off"); + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_old, + error); + if (ret) { + /* succeeded, set to -1 since now no old value */ + manager->priv->kbd_brightness_old = -1; + } + } else { + g_debug ("keyboard toggle on"); + /* save the current value to restore later when untoggling */ + manager->priv->kbd_brightness_old = manager->priv->kbd_brightness_now; + ret = upower_kbd_set_brightness (manager, 0, error); + if (!ret) { + /* failed, reset back to -1 */ + manager->priv->kbd_brightness_old = -1; + } + } + + return ret; +} + +static void +do_lid_open_action (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-open", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been opened"), + NULL); + + /* ensure we turn the panel back on after lid open */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after lid open: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy != NULL && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_error_free (error); + } + } + + kill_lid_close_safety_timer (manager); +} + +static gboolean +is_on (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + + crtc = gnome_rr_output_get_crtc (output); + if (!crtc) + return FALSE; + return gnome_rr_crtc_get_current_mode (crtc) != NULL; +} + +static gboolean +non_laptop_outputs_are_all_off (GnomeRRScreen *screen) +{ + GnomeRROutput **outputs; + int i; + + outputs = gnome_rr_screen_list_outputs (screen); + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_laptop (outputs[i])) + continue; + + if (is_on (outputs[i])) + return FALSE; + } + + return TRUE; +} + +/* Timeout callback used to check conditions when the laptop's lid is closed but + * the machine is not suspended yet. We try to suspend again, so that the laptop + * won't overheat if placed in a backpack. + */ +static gboolean +lid_close_safety_timer_cb (GsdPowerManager *manager) +{ + manager->priv->lid_close_safety_timer_id = 0; + + g_debug ("lid has been closed for a while; trying to suspend again"); + do_lid_closed_action (manager); + + return FALSE; +} + +/* Sets up a timer to be triggered some seconds after closing the laptop lid + * when the laptop is *not* suspended for some reason. We'll check conditions + * again in the timeout handler to see if we can suspend then. + */ +static void +setup_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) + return; + + manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT, + (GSourceFunc) lid_close_safety_timer_cb, + manager); + g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer"); +} + +static void +kill_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) { + g_source_remove (manager->priv->lid_close_safety_timer_id); + manager->priv->lid_close_safety_timer_id = 0; + } +} + +static void +suspend_with_lid_closed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + GsdPowerActionType action_type; + + /* maybe lock the screen if the lid is closed */ + lock_screensaver (manager); + + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-battery-action"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-ac-action"); + } + + /* check we won't melt when the lid is closed */ + if (action_type != GSD_POWER_ACTION_SUSPEND && + action_type != GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_lid_force_sleep (manager->priv->up_client)) { + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; + } + } + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off after lid close: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + do_power_action_type (manager, action_type); +} + +static void +do_lid_closed_action (GsdPowerManager *manager) +{ + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-close", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been closed"), + NULL); + + /* refresh RANDR so we get an accurate view of what monitors are plugged in when the lid is closed */ + gnome_rr_screen_refresh (manager->priv->x11_screen, NULL); /* NULL-GError */ + + /* perform policy action */ + if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor") + || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) { + g_debug ("lid is closed; suspending or hibernating"); + suspend_with_lid_closed (manager); + } else { + g_debug ("lid is closed; not suspending nor hibernating since some external monitor outputs are still active"); + setup_lid_close_safety_timer (manager); + } +} + + +static void +up_client_changed_cb (UpClient *client, GsdPowerManager *manager) +{ + gboolean tmp; + + if (!up_client_get_on_battery (client)) { + /* if we are playing a critical charge sound loop on AC, stop it */ + if (manager->priv->critical_alert_timeout_id > 0) { + g_debug ("stopping alert loop due to ac being present"); + play_loop_stop (manager); + } + notify_close_if_showing (manager->priv->notification_low); + } + + /* same state */ + tmp = up_client_get_lid_is_closed (manager->priv->up_client); + if (manager->priv->lid_is_closed == tmp) + return; + manager->priv->lid_is_closed = tmp; + + /* fake a keypress */ + if (tmp) + do_lid_closed_action (manager); + else + do_lid_open_action (manager); +} + +typedef enum { + SESSION_STATUS_CODE_AVAILABLE = 0, + SESSION_STATUS_CODE_INVISIBLE, + SESSION_STATUS_CODE_BUSY, + SESSION_STATUS_CODE_IDLE, + SESSION_STATUS_CODE_UNKNOWN +} SessionStatusCode; + +typedef enum { + SESSION_INHIBIT_MASK_LOGOUT = 1, + SESSION_INHIBIT_MASK_SWITCH = 2, + SESSION_INHIBIT_MASK_SUSPEND = 4, + SESSION_INHIBIT_MASK_IDLE = 8 +} SessionInhibitMask; + +static const gchar * +idle_mode_to_string (GsdPowerIdleMode mode) +{ + if (mode == GSD_POWER_IDLE_MODE_NORMAL) + return "normal"; + if (mode == GSD_POWER_IDLE_MODE_DIM) + return "dim"; + if (mode == GSD_POWER_IDLE_MODE_BLANK) + return "blank"; + if (mode == GSD_POWER_IDLE_MODE_SLEEP) + return "sleep"; + return "unknown"; +} + +static GnomeRROutput * +get_primary_output (GsdPowerManager *manager) +{ + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + guint i; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL) + goto out; + + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i]) && + gnome_rr_output_is_laptop (outputs[i]) && + gnome_rr_output_get_backlight_min (outputs[i]) >= 0 && + gnome_rr_output_get_backlight_max (outputs[i]) > 0) { + output = outputs[i]; + break; + } + } +out: + return output; +} + +/** + * backlight_helper_get_value: + * + * Gets a brightness value from the PolicyKit helper. + * + * Return value: the signed integer value from the helper, or -1 + * for failure. If -1 then @error is set. + **/ +static gint64 +backlight_helper_get_value (const gchar *argument, GError **error) +{ + gboolean ret; + gchar *stdout_data = NULL; + gint exit_status = 0; + gint64 value = -1; + gchar *command = NULL; + gchar *endptr = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf (LIBEXECDIR "/gsd-backlight-helper --%s", + argument); + ret = g_spawn_command_line_sync (command, + &stdout_data, + NULL, + &exit_status, + error); + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret) + goto out; + + if (WEXITSTATUS (exit_status) != 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "gsd-backlight-helper failed: %s", + stdout_data ? stdout_data : "No reason"); + goto out; + } + + /* parse */ + value = g_ascii_strtoll (stdout_data, &endptr, 10); + + /* parsing error */ + if (endptr == stdout_data) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to parse value: %s", + stdout_data); + goto out; + } + + /* out of range */ + if (value > G_MAXINT) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value out of range: %s", + stdout_data); + goto out; + } + + /* Fetching the value failed, for some other reason */ + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value negative, but helper did not fail: %s", + stdout_data); + goto out; + } + +out: + g_free (command); + g_free (stdout_data); + return value; +} + +/** + * backlight_helper_set_value: + * + * Sets a brightness value using the PolicyKit helper. + * + * Return value: Success. If FALSE then @error is set. + **/ +static gboolean +backlight_helper_set_value (const gchar *argument, + gint value, + GError **error) +{ + gboolean ret; + gint exit_status = 0; + gchar *command = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-backlight-helper --%s %i", + argument, value); + ret = g_spawn_command_line_sync (command, + NULL, + NULL, + &exit_status, + error); + + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret || WEXITSTATUS (exit_status) != 0) + goto out; + +out: + g_free (command); + return ret; +} + +static gint +backlight_get_abs (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + return gnome_rr_output_get_backlight (output, + error); + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-brightness", error); +} + +static gint +backlight_get_percentage (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gint now; + gint value = -1; + gint min = 0; + gint max; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); +out: + return value; +} + +static gint +backlight_get_min (GsdPowerManager *manager) +{ + GnomeRROutput *output; + + /* if we have no xbacklight device, then hardcode zero as sysfs + * offsets everything to 0 as min */ + output = get_primary_output (manager); + if (output == NULL) + return 0; + + /* get xbacklight value, which maybe non-zero */ + return gnome_rr_output_get_backlight_min (output); +} + +static gint +backlight_get_max (GsdPowerManager *manager, GError **error) +{ + gint value; + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + value = gnome_rr_output_get_backlight_max (output); + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to get backlight max"); + } + return value; + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-max-brightness", error); +} + +static void +backlight_emit_changed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + ret = g_dbus_connection_emit_signal (manager->priv->connection, + GSD_DBUS_SERVICE, + GSD_POWER_DBUS_PATH, + GSD_POWER_DBUS_INTERFACE_SCREEN, + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit Changed: %s", error->message); + g_error_free (error); + } +} + +static gboolean +backlight_set_percentage (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint min = 0; + gint max; + guint discrete; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + if (min < 0 || max < 0) { + g_warning ("no xrandr backlight capability"); + goto out; + } + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gint +backlight_step_up (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_step_down (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_set_abs (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + ret = gnome_rr_output_set_backlight (output, + value, + error); + goto out; + } + + /* fall back to the polkit helper */ + ret = backlight_helper_set_value ("set-brightness", + value, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gboolean +display_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gint min; + gint max; + gint now; + gint idle; + gboolean ret = FALSE; + + now = backlight_get_abs (manager, error); + if (now < 0) { + goto out; + } + + /* is the dim brightness actually *dimmer* than the + * brightness we have now? */ + min = backlight_get_min (manager); + max = backlight_get_max (manager, error); + if (max < 0) { + goto out; + } + idle = PERCENTAGE_TO_ABS (min, max, idle_percentage); + if (idle > now) { + g_debug ("brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + ret = TRUE; + goto out; + } + ret = backlight_set_abs (manager, + idle, + FALSE, + error); + if (!ret) { + goto out; + } + + /* save for undim */ + manager->priv->pre_dim_brightness = now; + +out: + return ret; +} + +static gboolean +kbd_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gboolean ret; + gint idle; + gint max; + gint now; + + if (manager->priv->upower_kdb_proxy == NULL) + return TRUE; + + now = manager->priv->kbd_brightness_now; + max = manager->priv->kbd_brightness_max; + idle = PERCENTAGE_TO_ABS (0, max, idle_percentage); + if (idle > now) { + g_debug ("kbd brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + return TRUE; + } + ret = upower_kbd_set_brightness (manager, idle, error); + if (!ret) + return FALSE; + + /* save for undim */ + manager->priv->kbd_brightness_pre_dim = now; + return TRUE; +} + +static void +idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode) +{ + gboolean ret = FALSE; + GError *error = NULL; + gint idle_percentage; + GsdPowerActionType action_type; + GnomeSettingsSessionState state; + + if (mode == manager->priv->current_idle_mode) + return; + + /* Ignore attempts to set "less idle" modes */ + if (mode < manager->priv->current_idle_mode && + mode != GSD_POWER_IDLE_MODE_NORMAL) + return; + + /* ensure we're still on an active console */ + state = gnome_settings_session_get_state (manager->priv->session); + if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) { + g_debug ("ignoring state transition to %s as inactive", + idle_mode_to_string (mode)); + return; + } + + manager->priv->current_idle_mode = mode; + g_debug ("Doing a state transition: %s", idle_mode_to_string (mode)); + + /* don't do any power saving if we're a VM */ + if (manager->priv->is_virtual_machine) { + g_debug ("ignoring state transition to %s as virtual machine", + idle_mode_to_string (mode)); + return; + } + + /* save current brightness, and set dim level */ + if (mode == GSD_POWER_IDLE_MODE_DIM) { + + /* have we disabled the action */ + if (up_client_get_on_battery (manager->priv->up_client)) { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-battery"); + } else { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-ac"); + } + if (!ret) { + g_debug ("not dimming due to policy"); + return; + } + + /* display backlight */ + idle_percentage = g_settings_get_int (manager->priv->settings, + "idle-brightness"); + ret = display_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* keyboard backlight */ + ret = kbd_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim kbd backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* turn off screen and kbd */ + } else if (mode == GSD_POWER_IDLE_MODE_BLANK) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + /* sleep */ + } else if (mode == GSD_POWER_IDLE_MODE_SLEEP) { + + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-battery-type"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-ac-type"); + } + do_power_action_type (manager, action_type); + + /* turn on screen and restore user-selected brightness level */ + } else if (mode == GSD_POWER_IDLE_MODE_NORMAL) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on: %s", + error->message); + g_clear_error (&error); + } + + /* reset brightness if we dimmed */ + if (manager->priv->pre_dim_brightness >= 0) { + ret = backlight_set_abs (manager, + manager->priv->pre_dim_brightness, + FALSE, + &error); + if (!ret) { + g_warning ("failed to restore backlight to %i: %s", + manager->priv->pre_dim_brightness, + error->message); + g_clear_error (&error); + } else { + manager->priv->pre_dim_brightness = -1; + } + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_clear_error (&error); + } + } + + /* reset kbd brightness if we dimmed */ + if (manager->priv->kbd_brightness_pre_dim >= 0) { + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_pre_dim, + &error); + if (!ret) { + g_warning ("failed to restore kbd backlight to %i: %s", + manager->priv->kbd_brightness_pre_dim, + error->message); + g_error_free (error); + } + manager->priv->kbd_brightness_pre_dim = -1; + } + + } +} + +static gboolean +idle_is_session_idle (GsdPowerManager *manager) +{ + gboolean ret; + GVariant *result; + guint status; + + /* not yet connected to gnome-session */ + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("session idleness not available, gnome-session is not available"); + return FALSE; + } + + /* get the session status */ + result = g_dbus_proxy_get_cached_property (manager->priv->session_presence_proxy, + "status"); + if (result == NULL) { + g_warning ("no readable status property on %s", + g_dbus_proxy_get_interface_name (manager->priv->session_presence_proxy)); + return FALSE; + } + + g_variant_get (result, "u", &status); + ret = (status == SESSION_STATUS_CODE_IDLE); + g_variant_unref (result); + + return ret; +} + +static gboolean +idle_is_session_inhibited (GsdPowerManager *manager, guint mask) +{ + gboolean ret; + GVariant *retval = NULL; + GError *error = NULL; + + /* not yet connected to gnome-session */ + if (manager->priv->session_proxy == NULL) { + g_warning ("session inhibition not available, gnome-session is not available"); + return FALSE; + } + + retval = g_dbus_proxy_call_sync (manager->priv->session_proxy, + "IsInhibited", + g_variant_new ("(u)", + mask), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + &error); + if (retval == NULL) { + /* abort as the DBUS method failed */ + g_warning ("IsInhibited failed: %s", error->message); + g_error_free (error); + return FALSE; + } + + g_variant_get (retval, "(b)", &ret); + g_variant_unref (retval); + + return ret; +} + +/** + * idle_adjust_timeout: + * @idle_time: Current idle time, in seconds. + * @timeout: The new timeout we want to set, in seconds. + * + * On slow machines, or machines that have lots to load duing login, + * the current idle time could be bigger than the requested timeout. + * In this case the scheduled idle timeout will never fire, unless + * some user activity (keyboard, mouse) resets the current idle time. + * Instead of relying on user activity to correct this issue, we need + * to adjust timeout, as related to current idle time, so the idle + * timeout will fire as designed. + * + * Return value: timeout to set, adjusted acccording to current idle time. + **/ +static guint +idle_adjust_timeout (guint idle_time, guint timeout) +{ + /* allow 2 sec margin for messaging delay. */ + idle_time += 2; + + /* Double timeout until it's larger than current idle time. + * Give up for ultra slow machines. (86400 sec = 24 hours) */ + while (timeout < idle_time && + timeout < 86400 && + timeout > 0) { + timeout *= 2; + } + return timeout; +} + +/** + * idle_adjust_timeout_blank: + * @idle_time: current idle time, in seconds. + * @timeout: the new timeout we want to set, in seconds. + * + * Same as idle_adjust_timeout(), but also accounts for the duration + * of the fading animation in the screensaver (so that blanking happens + * exactly at the end of it, if configured with the same timeouts) + */ +static guint +idle_adjust_timeout_blank (guint idle_time, guint timeout) +{ + return idle_adjust_timeout (idle_time, + timeout + SCREENSAVER_FADE_TIME); +} + +static void +idle_configure (GsdPowerManager *manager) +{ + gboolean is_idle_inhibited; + guint current_idle_time; + guint timeout_blank; + guint timeout_sleep; + gboolean on_battery; + + /* are we inhibited from going idle */ + is_idle_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_IDLE); + if (is_idle_inhibited) { + g_debug ("inhibited, so using normal state"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); + + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + return; + } + + current_idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + + /* set up blank callback even when session is not idle, + * but only if we actually want to blank. */ + on_battery = up_client_get_on_battery (manager->priv->up_client); + if (on_battery) { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-battery"); + } else { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-ac"); + } + if (timeout_blank != 0) { + g_debug ("setting up blank callback for %is", timeout_blank); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID, + idle_adjust_timeout_blank (current_idle_time, timeout_blank) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + } + + /* only do the sleep timeout when the session is idle + * and we aren't inhibited from sleeping */ + if (on_battery) { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-battery-timeout"); + } else { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-ac-timeout"); + } + if (timeout_sleep != 0) { + g_debug ("setting up sleep callback %is", timeout_sleep); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID, + idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + } +} + +/** + * @timeout: The new timeout we want to set, in seconds + **/ +static gboolean +idle_set_timeout_dim (GsdPowerManager *manager, guint timeout) +{ + guint idle_time; + + idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + if (idle_time == 0) + return FALSE; + + g_debug ("Setting dim idle timeout: %ds", timeout); + if (timeout > 0) { + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID, + idle_adjust_timeout (idle_time, timeout) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID); + } + return TRUE; +} + +static void +refresh_idle_dim_settings (GsdPowerManager *manager) +{ + gint timeout_dim; + timeout_dim = g_settings_get_int (manager->priv->settings, + "idle-dim-time"); + g_debug ("idle dim set with timeout %i", timeout_dim); + idle_set_timeout_dim (manager, timeout_dim); +} + +static void +gsd_power_manager_class_init (GsdPowerManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_power_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPowerManagerPrivate)); +} + +static void +sleep_cb_screensaver_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->screensaver_proxy == NULL) { + g_warning ("Could not connect to gnome-screensaver: %s", + error->message); + g_error_free (error); + return; + } + + /* Finish the upower_notify_sleep_cb() call by locking the screen */ + g_debug ("gnome-screensaver activated, doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); +} + +static void +idle_dbus_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 || + g_strcmp0 (signal_name, "InhibitorRemoved") == 0) { + g_debug ("Received gnome session inhibitor change"); + idle_configure (manager); + } + if (g_strcmp0 (signal_name, "StatusChanged") == 0) { + guint status; + + g_variant_get (parameters, "(u)", &status); + g_dbus_proxy_set_cached_property (proxy, "status", + g_variant_new ("u", status)); + g_debug ("Received gnome session status change"); + idle_configure (manager); + } +} + +static void +session_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_proxy == NULL) { + g_warning ("Could not connect to gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (manager->priv->session_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); + } + + idle_configure (manager); +} + +static void +session_presence_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_presence_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("Could not connect to gnome-sesson: %s", + error->message); + g_error_free (error); + return; + } + g_signal_connect (manager->priv->session_presence_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); +} + +static void +power_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *k_now = NULL; + GVariant *k_max = NULL; + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_kdb_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_kdb_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + goto out; + } + + k_now = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_now == NULL) { + if (error->domain != G_DBUS_ERROR || + error->code != G_DBUS_ERROR_UNKNOWN_METHOD) { + g_warning ("Failed to get brightness: %s", + error->message); + } + g_error_free (error); + goto out; + } + + k_max = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetMaxBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_max == NULL) { + g_warning ("Failed to get max brightness: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (k_now, "(i)", &manager->priv->kbd_brightness_now); + g_variant_get (k_max, "(i)", &manager->priv->kbd_brightness_max); + + /* set brightness to max if not currently set so is something + * sensible */ + if (manager->priv->kbd_brightness_now <= 0) { + gboolean ret; + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_max, + &error); + if (!ret) { + g_warning ("failed to initialize kbd backlight to %i: %s", + manager->priv->kbd_brightness_max, + error->message); + g_error_free (error); + } + } +out: + if (k_now != NULL) + g_variant_unref (k_now); + if (k_max != NULL) + g_variant_unref (k_max); +} + +static void +lock_screensaver (GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "lock-enabled"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_sleep_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + lock_screensaver (manager); +} + +static void +upower_notify_resume_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* this displays the unlock dialogue so the user doesn't have + * to move the mouse or press any key before the window comes up */ + if (manager->priv->screensaver_proxy != NULL) { + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "SimulateUserActivity", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + } + + /* close existing notifications on resume, the system power + * state is probably different now */ + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after resume: %s", + error->message); + g_error_free (error); + } +} + +static void +idle_send_to_sleep (GsdPowerManager *manager) +{ + gboolean is_inhibited; + gboolean is_idle; + + /* check the session is not now inhibited */ + is_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_SUSPEND); + if (is_inhibited) { + g_debug ("suspend inhibited"); + return; + } + + /* check the session is really idle*/ + is_idle = idle_is_session_idle (manager); + if (!is_idle) { + g_debug ("session is not idle, cannot SLEEP"); + return; + } + + /* send to sleep, and cancel timeout */ + g_debug ("sending to SLEEP"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP); +} + +static void +idle_idletime_alarm_expired_cb (GpmIdletime *idletime, + guint alarm_id, + GsdPowerManager *manager) +{ + g_debug ("idletime alarm: %i", alarm_id); + + switch (alarm_id) { + case GSD_POWER_IDLETIME_DIM_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM); + break; + case GSD_POWER_IDLETIME_BLANK_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK); + break; + case GSD_POWER_IDLETIME_SLEEP_ID: + idle_send_to_sleep (manager); + break; + } +} + +static void +idle_idletime_reset_cb (GpmIdletime *idletime, + GsdPowerManager *manager) +{ + g_debug ("idletime reset"); + + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +static void +engine_settings_key_changed_cb (GSettings *settings, + const gchar *key, + GsdPowerManager *manager) +{ + if (g_strcmp0 (key, "use-time-for-policy") == 0) { + manager->priv->use_time_primary = g_settings_get_boolean (settings, key); + return; + } + if (g_strcmp0 (key, "idle-dim-time") == 0) { + refresh_idle_dim_settings (manager); + return; + } + if (g_str_has_prefix (key, "sleep-inactive") || + g_str_has_prefix (key, "sleep-display")) { + idle_configure (manager); + return; + } +} + +static void +engine_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdPowerManager *manager) +{ + /* when doing the fast-user-switch into a new account, + * ensure the new account is undimmed and with the backlight on */ + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +/* This timer goes off every few minutes, whether the user is idle or not, + to try and clean up anything that has gone wrong. + + It calls disable_builtin_screensaver() so that if xset has been used, + or some other program (like xlock) has messed with the XSetScreenSaver() + settings, they will be set back to sensible values (if a server extension + is in use, messing with xlock can cause the screensaver to never get a wakeup + event, and could cause monitor power-saving to occur, and all manner of + heinousness.) + + This code was originally part of gnome-screensaver, see + http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530 + */ +static gboolean +disable_builtin_screensaver (gpointer unused) +{ + int current_server_timeout, current_server_interval; + int current_prefer_blank, current_allow_exp; + int desired_server_timeout, desired_server_interval; + int desired_prefer_blank, desired_allow_exp; + + XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + ¤t_server_timeout, + ¤t_server_interval, + ¤t_prefer_blank, + ¤t_allow_exp); + + desired_server_timeout = current_server_timeout; + desired_server_interval = current_server_interval; + desired_prefer_blank = current_prefer_blank; + desired_allow_exp = current_allow_exp; + + desired_server_interval = 0; + + /* I suspect (but am not sure) that DontAllowExposures might have + something to do with powering off the monitor as well, at least + on some systems that don't support XDPMS? Who know... */ + desired_allow_exp = AllowExposures; + + /* When we're not using an extension, set the server-side timeout to 0, + so that the server never gets involved with screen blanking, and we + do it all ourselves. (However, when we *are* using an extension, + we tell the server when to notify us, and rather than blanking the + screen, the server will send us an X event telling us to blank.) + */ + desired_server_timeout = 0; + + if (desired_server_timeout != current_server_timeout + || desired_server_interval != current_server_interval + || desired_prefer_blank != current_prefer_blank + || desired_allow_exp != current_allow_exp) { + + g_debug ("disabling server builtin screensaver:" + " (xset s %d %d; xset s %s; xset s %s)", + desired_server_timeout, + desired_server_interval, + (desired_prefer_blank ? "blank" : "noblank"), + (desired_allow_exp ? "expose" : "noexpose")); + + XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + desired_server_timeout, + desired_server_interval, + desired_prefer_blank, + desired_allow_exp); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + } + + return TRUE; +} + +static gboolean +is_hardware_a_virtual_machine (void) +{ + const gchar *str; + gboolean ret = FALSE; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.systemd1.Manager", + "Virtualization"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Virtualization", error->message); + g_error_free (error); + goto out; + } + + /* on bare-metal hardware this is the empty string, + * otherwise an identifier such as "kvm", "vmware", etc. */ + g_variant_get (variant, "(v)", &inner); + str = g_variant_get_string (inner, NULL); + if (str != NULL && str[0] != '\0') + ret = TRUE; +out: + if (connection != NULL) + g_object_unref (connection); + if (variant != NULL) + g_variant_unref (variant); + return ret; +} + +gboolean +gsd_power_manager_start (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting power manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (manager->priv->x11_screen == NULL) + return FALSE; + + /* track the active session */ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (engine_session_active_changed_cb), + manager); + + manager->priv->kbd_brightness_old = -1; + manager->priv->kbd_brightness_pre_dim = -1; + manager->priv->pre_dim_brightness = -1; + manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA); + g_signal_connect (manager->priv->settings, "changed", + G_CALLBACK (engine_settings_key_changed_cb), manager); + manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver"); + manager->priv->up_client = up_client_new (); + g_signal_connect (manager->priv->up_client, "notify-sleep", + G_CALLBACK (upower_notify_sleep_cb), manager); + g_signal_connect (manager->priv->up_client, "notify-resume", + G_CALLBACK (upower_notify_resume_cb), manager); + manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client); + g_signal_connect (manager->priv->up_client, "device-added", + G_CALLBACK (engine_device_added_cb), manager); + g_signal_connect (manager->priv->up_client, "device-removed", + G_CALLBACK (engine_device_removed_cb), manager); + g_signal_connect (manager->priv->up_client, "device-changed", + G_CALLBACK (engine_device_changed_cb), manager); + g_signal_connect_after (manager->priv->up_client, "changed", + G_CALLBACK (up_client_changed_cb), manager); + + /* use the fallback name from gnome-power-manager so the shell + * blocks this, and uses the power extension instead */ + manager->priv->status_icon = gtk_status_icon_new (); + gtk_status_icon_set_name (manager->priv->status_icon, + "gnome-power-manager"); + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH, + UPOWER_DBUS_INTERFACE, + NULL, + power_proxy_ready_cb, + manager); + + /* connect to UPower for keyboard backlight control */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH_KBDBACKLIGHT, + UPOWER_DBUS_INTERFACE_KBDBACKLIGHT, + NULL, + power_keyboard_proxy_ready_cb, + manager); + + /* connect to the session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + session_proxy_ready_cb, + manager); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + 0, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH_PRESENCE, + GNOME_SESSION_DBUS_INTERFACE_PRESENCE, + NULL, + session_presence_proxy_ready_cb, + manager); + + manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref); + manager->priv->canberra_context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + + manager->priv->phone = gpm_phone_new (); + g_signal_connect (manager->priv->phone, "device-added", + G_CALLBACK (phone_device_added_cb), manager); + g_signal_connect (manager->priv->phone, "device-removed", + G_CALLBACK (phone_device_removed_cb), manager); + g_signal_connect (manager->priv->phone, "device-refresh", + G_CALLBACK (phone_device_refresh_cb), manager); + + /* create a fake virtual composite battery */ + manager->priv->device_composite = up_device_new (); + g_object_set (manager->priv->device_composite, + "kind", UP_DEVICE_KIND_BATTERY, + "is-rechargeable", TRUE, + "native-path", "dummy:composite_battery", + "power-supply", TRUE, + "is-present", TRUE, + NULL); + + /* get percentage policy */ + manager->priv->low_percentage = g_settings_get_int (manager->priv->settings, + "percentage-low"); + manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings, + "percentage-critical"); + manager->priv->action_percentage = g_settings_get_int (manager->priv->settings, + "percentage-action"); + + /* get time policy */ + manager->priv->low_time = g_settings_get_int (manager->priv->settings, + "time-low"); + manager->priv->critical_time = g_settings_get_int (manager->priv->settings, + "time-critical"); + manager->priv->action_time = g_settings_get_int (manager->priv->settings, + "time-action"); + + /* we can disable this if the time remaining is inaccurate or just plain wrong */ + manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings, + "use-time-for-policy"); + + /* create IDLETIME watcher */ + manager->priv->idletime = gpm_idletime_new (); + g_signal_connect (manager->priv->idletime, "reset", + G_CALLBACK (idle_idletime_reset_cb), manager); + g_signal_connect (manager->priv->idletime, "alarm-expired", + G_CALLBACK (idle_idletime_alarm_expired_cb), manager); + + /* ensure the default dpms timeouts are cleared */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + error); + if (!ret) { + g_warning ("Failed set DPMS mode: %s", (*error)->message); + g_clear_error (error); + } + + /* coldplug the engine */ + engine_coldplug (manager); + + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); + /* don't blank inside a VM */ + manager->priv->is_virtual_machine = is_hardware_a_virtual_machine (); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_power_manager_stop (GsdPowerManager *manager) +{ + g_debug ("Stopping power manager"); + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + kill_lid_close_safety_timer (manager); + + g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager); + + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->session); + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->settings_screensaver); + g_clear_object (&manager->priv->up_client); + g_clear_object (&manager->priv->x11_screen); + + g_ptr_array_unref (manager->priv->devices_array); + manager->priv->devices_array = NULL; + g_clear_object (&manager->priv->phone); + g_clear_object (&manager->priv->device_composite); + g_clear_object (&manager->priv->previous_icon); + + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = NULL; + + g_clear_object (&manager->priv->upower_proxy); + g_clear_object (&manager->priv->session_proxy); + g_clear_object (&manager->priv->session_presence_proxy); + + if (manager->priv->critical_alert_timeout_id > 0) { + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); + + if (manager->priv->xscreensaver_watchdog_timer_id > 0) { + g_source_remove (manager->priv->xscreensaver_watchdog_timer_id); + manager->priv->xscreensaver_watchdog_timer_id = 0; + } +} + +static void +gsd_power_manager_init (GsdPowerManager *manager) +{ + manager->priv = GSD_POWER_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_power_manager_finalize (GObject *object) +{ + GsdPowerManager *manager; + + manager = GSD_POWER_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + + G_OBJECT_CLASS (gsd_power_manager_parent_class)->finalize (object); +} + +/* returns new level */ +static void +handle_method_call_keyboard (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint step; + gint value = -1; + gboolean ret; + guint percentage; + GError *error = NULL; + + if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("keyboard step up"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MIN (manager->priv->kbd_brightness_now + step, + manager->priv->kbd_brightness_max); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("keyboard step down"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MAX (manager->priv->kbd_brightness_now - step, 0); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "Toggle") == 0) { + ret = upower_kbd_toggle (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (!ret) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + percentage = ABS_TO_PERCENTAGE (0, + manager->priv->kbd_brightness_max, + value); + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + percentage)); + } +} + +static void +handle_method_call_screen (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gboolean ret = FALSE; + gint value = -1; + guint value_tmp; + GError *error = NULL; + + if (g_strcmp0 (method_name, "GetPercentage") == 0) { + g_debug ("screen get percentage"); + value = backlight_get_percentage (manager, &error); + + } else if (g_strcmp0 (method_name, "SetPercentage") == 0) { + g_debug ("screen set percentage"); + g_variant_get (parameters, "(u)", &value_tmp); + ret = backlight_set_percentage (manager, value_tmp, TRUE, &error); + if (ret) + value = value_tmp; + + } else if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("screen step up"); + value = backlight_step_up (manager, &error); + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("screen step down"); + value = backlight_step_down (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (value < 0) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + value)); + } +} + +static GVariant * +device_to_variant_blob (UpDevice *device) +{ + const gchar *object_path; + gchar *device_icon; + gdouble percentage; + GIcon *icon; + guint64 time_empty, time_full; + guint64 time_state = 0; + GVariant *value; + UpDeviceKind kind; + UpDeviceState state; + + icon = gpm_upower_get_device_icon (device, TRUE); + device_icon = g_icon_to_string (icon); + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "state", &state, + "time-to-empty", &time_empty, + "time-to-full", &time_full, + NULL); + + /* only return time for these simple states */ + if (state == UP_DEVICE_STATE_DISCHARGING) + time_state = time_empty; + else if (state == UP_DEVICE_STATE_CHARGING) + time_state = time_full; + + /* get an object path, even for the composite device */ + object_path = up_device_get_object_path (device); + if (object_path == NULL) + object_path = GSD_DBUS_PATH; + + /* format complex object */ + value = g_variant_new ("(susdut)", + object_path, + kind, + device_icon, + percentage, + state, + time_state); + g_free (device_icon); + g_object_unref (icon); + return value; +} + +static void +handle_method_call_main (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GPtrArray *array; + guint i; + GVariantBuilder *builder; + GVariant *tuple = NULL; + GVariant *value = NULL; + UpDevice *device; + + /* return object */ + if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) { + + /* get the virtual device */ + device = engine_get_primary_device (manager); + if (device == NULL) { + g_dbus_method_invocation_return_dbus_error (invocation, + "org.gnome.SettingsDaemon.Power.Failed", + "There is no primary device."); + return; + } + + /* return the value */ + value = device_to_variant_blob (device); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_object_unref (device); + return; + } + + /* return array */ + if (g_strcmp0 (method_name, "GetDevices") == 0) { + + /* create builder */ + builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)")); + + /* add each tuple to the array */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + value = device_to_variant_blob (device); + g_variant_builder_add_value (builder, value); + } + + /* return the value */ + value = g_variant_builder_end (builder); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_variant_builder_unref (builder); + return; + } + + g_assert_not_reached (); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for Power", + interface_name, method_name); + + if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE) == 0) { + handle_method_call_main (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_SCREEN) == 0) { + handle_method_call_screen (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_KEYBOARD) == 0) { + handle_method_call_keyboard (manager, + method_name, + parameters, + invocation); + } else { + g_warning ("not recognised interface: %s", interface_name); + } +} + +static GVariant * +handle_get_property (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + GVariant *retval = NULL; + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return NULL; + } + + if (g_strcmp0 (property_name, "Icon") == 0) { + retval = engine_get_icon_property_variant (manager); + } else if (g_strcmp0 (property_name, "Tooltip") == 0) { + retval = engine_get_tooltip_property_variant (manager); + } + + return retval; +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdPowerManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + guint i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_POWER_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdPowerManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdPowerManager * +gsd_power_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_POWER_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + return GSD_POWER_MANAGER (manager_object); +} diff --git a/.pc/52_sync_background_to_accountsservice.patch/plugins/background/gsd-background-manager.c b/.pc/52_sync_background_to_accountsservice.patch/plugins/background/gsd-background-manager.c new file mode 100644 index 00000000..10ed1284 --- /dev/null +++ b/.pc/52_sync_background_to_accountsservice.patch/plugins/background/gsd-background-manager.c @@ -0,0 +1,536 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann + * Copyright 2007 Red Hat, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-background-manager.h" + +#define GSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerPrivate)) + +struct GsdBackgroundManagerPrivate +{ + GSettings *settings; + GnomeBG *bg; + + GnomeBGCrossfade *fade; + + GDBusProxy *proxy; + guint proxy_signal_id; +}; + +static void gsd_background_manager_class_init (GsdBackgroundManagerClass *klass); +static void gsd_background_manager_init (GsdBackgroundManager *background_manager); +static void gsd_background_manager_finalize (GObject *object); + +static void setup_bg (GsdBackgroundManager *manager); +static void connect_screen_signals (GsdBackgroundManager *manager); + +G_DEFINE_TYPE (GsdBackgroundManager, gsd_background_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static gboolean +dont_draw_background (GsdBackgroundManager *manager) +{ + return !g_settings_get_boolean (manager->priv->settings, + "draw-background"); +} + +static gboolean +nautilus_is_drawing_background (GsdBackgroundManager *manager) +{ + Atom window_id_atom; + Window nautilus_xid; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char *data; + Atom wmclass_atom; + gboolean running; + gint error; + gboolean show_desktop_icons; + + show_desktop_icons = g_settings_get_boolean (manager->priv->settings, + "show-desktop-icons"); + if (! show_desktop_icons) { + return FALSE; + } + + window_id_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "NAUTILUS_DESKTOP_WINDOW_ID", True); + + if (window_id_atom == None) { + return FALSE; + } + + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + GDK_ROOT_WINDOW (), + window_id_atom, + 0, + 1, + False, + XA_WINDOW, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data); + + if (data != NULL) { + nautilus_xid = *(Window *) data; + XFree (data); + } else { + return FALSE; + } + + if (actual_type != XA_WINDOW) { + return FALSE; + } + if (actual_format != 32) { + return FALSE; + } + + wmclass_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "WM_CLASS", False); + + gdk_error_trap_push (); + + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + nautilus_xid, + wmclass_atom, + 0, + 24, + False, + XA_STRING, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data); + + error = gdk_error_trap_pop (); + + if (error == BadWindow) { + return FALSE; + } + + if (actual_type == XA_STRING && + nitems == 24 && + bytes_after == 0 && + actual_format == 8 && + data != NULL && + !strcmp ((char *)data, "desktop_window") && + !strcmp ((char *)data + strlen ((char *)data) + 1, "Nautilus")) { + running = TRUE; + } else { + running = FALSE; + } + + if (data != NULL) { + XFree (data); + } + + return running; +} + +static void +on_crossfade_finished (GsdBackgroundManager *manager) +{ + g_object_unref (manager->priv->fade); + manager->priv->fade = NULL; +} + +static void +draw_background (GsdBackgroundManager *manager, + gboolean use_crossfade) +{ + GdkDisplay *display; + int n_screens; + int i; + + + if (nautilus_is_drawing_background (manager) || + dont_draw_background (manager)) { + return; + } + + gnome_settings_profile_start (NULL); + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (i = 0; i < n_screens; ++i) { + GdkScreen *screen; + GdkWindow *root_window; + cairo_surface_t *surface; + + screen = gdk_display_get_screen (display, i); + + root_window = gdk_screen_get_root_window (screen); + + surface = gnome_bg_create_surface (manager->priv->bg, + root_window, + gdk_screen_get_width (screen), + gdk_screen_get_height (screen), + TRUE); + + if (use_crossfade) { + + if (manager->priv->fade != NULL) { + g_object_unref (manager->priv->fade); + } + + manager->priv->fade = gnome_bg_set_surface_as_root_with_crossfade (screen, surface); + g_signal_connect_swapped (manager->priv->fade, "finished", + G_CALLBACK (on_crossfade_finished), + manager); + } else { + gnome_bg_set_surface_as_root (screen, surface); + } + + cairo_surface_destroy (surface); + } + + gnome_settings_profile_end (NULL); +} + +static void +on_bg_transitioned (GnomeBG *bg, + GsdBackgroundManager *manager) +{ + draw_background (manager, FALSE); +} + +static gboolean +settings_change_event_cb (GSettings *settings, + gpointer keys, + gint n_keys, + GsdBackgroundManager *manager) +{ + gnome_bg_load_from_preferences (manager->priv->bg, + manager->priv->settings); + return FALSE; +} + +static void +on_screen_size_changed (GdkScreen *screen, + GsdBackgroundManager *manager) +{ + draw_background (manager, FALSE); +} + +static void +watch_bg_preferences (GsdBackgroundManager *manager) +{ + g_signal_connect (manager->priv->settings, + "change-event", + G_CALLBACK (settings_change_event_cb), + manager); +} + +static void +on_bg_changed (GnomeBG *bg, + GsdBackgroundManager *manager) +{ + draw_background (manager, TRUE); +} + +static void +setup_bg (GsdBackgroundManager *manager) +{ + g_return_if_fail (manager->priv->bg == NULL); + + manager->priv->bg = gnome_bg_new (); + + g_signal_connect (manager->priv->bg, + "changed", + G_CALLBACK (on_bg_changed), + manager); + + g_signal_connect (manager->priv->bg, + "transitioned", + G_CALLBACK (on_bg_transitioned), + manager); + + connect_screen_signals (manager); + watch_bg_preferences (manager); + gnome_bg_load_from_preferences (manager->priv->bg, + manager->priv->settings); +} + +static void +setup_bg_and_draw_background (GsdBackgroundManager *manager) +{ + setup_bg (manager); + draw_background (manager, FALSE); +} + +static void +disconnect_session_manager_listener (GsdBackgroundManager *manager) +{ + if (manager->priv->proxy && manager->priv->proxy_signal_id) { + g_signal_handler_disconnect (manager->priv->proxy, + manager->priv->proxy_signal_id); + manager->priv->proxy_signal_id = 0; + } +} + +static void +on_session_manager_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdBackgroundManager *manager = GSD_BACKGROUND_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "SessionRunning") == 0) { + setup_bg_and_draw_background (manager); + disconnect_session_manager_listener (manager); + } +} + +static void +draw_background_after_session_loads (GsdBackgroundManager *manager) +{ + GError *error = NULL; + GDBusProxyFlags flags; + + flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; + manager->priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + flags, + NULL, /* GDBusInterfaceInfo */ + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager", + NULL, /* GCancellable */ + &error); + if (manager->priv->proxy == NULL) { + g_warning ("Could not listen to session manager: %s", + error->message); + g_error_free (error); + return; + } + + manager->priv->proxy_signal_id = g_signal_connect (manager->priv->proxy, + "g-signal", + G_CALLBACK (on_session_manager_signal), + manager); +} + + +static void +disconnect_screen_signals (GsdBackgroundManager *manager) +{ + GdkDisplay *display; + int i; + int n_screens; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (i = 0; i < n_screens; ++i) { + GdkScreen *screen; + screen = gdk_display_get_screen (display, i); + g_signal_handlers_disconnect_by_func (screen, + G_CALLBACK (on_screen_size_changed), + manager); + } +} + +static void +connect_screen_signals (GsdBackgroundManager *manager) +{ + GdkDisplay *display; + int i; + int n_screens; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (i = 0; i < n_screens; ++i) { + GdkScreen *screen; + screen = gdk_display_get_screen (display, i); + g_signal_connect (screen, + "monitors-changed", + G_CALLBACK (on_screen_size_changed), + manager); + g_signal_connect (screen, + "size-changed", + G_CALLBACK (on_screen_size_changed), + manager); + } +} + +static void +draw_background_changed (GSettings *settings, + const char *key, + GsdBackgroundManager *manager) +{ + if (dont_draw_background (manager) == FALSE) + setup_bg_and_draw_background (manager); +} + +gboolean +gsd_background_manager_start (GsdBackgroundManager *manager, + GError **error) +{ + gboolean show_desktop_icons; + + g_debug ("Starting background manager"); + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new ("org.gnome.desktop.background"); + g_signal_connect (manager->priv->settings, "changed::draw-background", + G_CALLBACK (draw_background_changed), manager); + + /* If this is set, nautilus will draw the background and is + * almost definitely in our session. however, it may not be + * running yet (so is_nautilus_running() will fail). so, on + * startup, just don't do anything if this key is set so we + * don't waste time setting the background only to have + * nautilus overwrite it. + */ + show_desktop_icons = g_settings_get_boolean (manager->priv->settings, + "show-desktop-icons"); + + if (!show_desktop_icons) { + setup_bg (manager); + } else { + draw_background_after_session_loads (manager); + } + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_background_manager_stop (GsdBackgroundManager *manager) +{ + GsdBackgroundManagerPrivate *p = manager->priv; + + g_debug ("Stopping background manager"); + + disconnect_screen_signals (manager); + + if (manager->priv->proxy) { + disconnect_session_manager_listener (manager); + g_object_unref (manager->priv->proxy); + } + + g_signal_handlers_disconnect_by_func (manager->priv->settings, + settings_change_event_cb, + manager); + + if (p->settings != NULL) { + g_object_unref (p->settings); + p->settings = NULL; + } + + if (p->bg != NULL) { + g_object_unref (p->bg); + p->bg = NULL; + } +} + +static GObject * +gsd_background_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdBackgroundManager *background_manager; + + background_manager = GSD_BACKGROUND_MANAGER (G_OBJECT_CLASS (gsd_background_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (background_manager); +} + +static void +gsd_background_manager_class_init (GsdBackgroundManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_background_manager_constructor; + object_class->finalize = gsd_background_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdBackgroundManagerPrivate)); +} + +static void +gsd_background_manager_init (GsdBackgroundManager *manager) +{ + manager->priv = GSD_BACKGROUND_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_background_manager_finalize (GObject *object) +{ + GsdBackgroundManager *background_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_BACKGROUND_MANAGER (object)); + + background_manager = GSD_BACKGROUND_MANAGER (object); + + g_return_if_fail (background_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_background_manager_parent_class)->finalize (object); +} + +GsdBackgroundManager * +gsd_background_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_BACKGROUND_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_BACKGROUND_MANAGER (manager_object); +} diff --git a/.pc/60_unity_hide_status_icon.patch/plugins/power/gsd-power-manager.c b/.pc/60_unity_hide_status_icon.patch/plugins/power/gsd-power-manager.c new file mode 100644 index 00000000..7b5c7ee7 --- /dev/null +++ b/.pc/60_unity_hide_status_icon.patch/plugins/power/gsd-power-manager.c @@ -0,0 +1,4389 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * Copyright (C) 2011 Ritesh Khadgaray + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gpm-common.h" +#include "gpm-phone.h" +#include "gpm-idletime.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-enums.h" +#include "gsd-power-manager.h" +#include "gsd-power-helper.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_PATH_PRESENCE "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE_PRESENCE "org.gnome.SessionManager.Presence" + +#define UPOWER_DBUS_NAME "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_PATH_KBDBACKLIGHT "/org/freedesktop/UPower/KbdBacklight" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DBUS_INTERFACE_KBDBACKLIGHT "org.freedesktop.UPower.KbdBacklight" + +#define GSD_POWER_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power" + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_POWER_DBUS_PATH GSD_DBUS_PATH "/Power" +#define GSD_POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#define GSD_POWER_DBUS_INTERFACE_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_POWER_DBUS_INTERFACE_KEYBOARD "org.gnome.SettingsDaemon.Power.Keyboard" + +#define GS_DBUS_NAME "org.gnome.ScreenSaver" +#define GS_DBUS_PATH "/org/gnome/ScreenSaver" +#define GS_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER 0 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */ + +#define GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ +#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */ +#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + +/* Keep this in sync with gnome-shell */ +#define SCREENSAVER_FADE_TIME 10 /* seconds */ + +#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */ + +enum { + GSD_POWER_IDLETIME_NULL_ID, + GSD_POWER_IDLETIME_DIM_ID, + GSD_POWER_IDLETIME_BLANK_ID, + GSD_POWER_IDLETIME_SLEEP_ID +}; + +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +/* on ACPI machines we have 4-16 levels, on others it's ~150 */ +#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) + +/* take a discrete value with offset and convert to percentage */ +static int +abs_to_percentage (int min, int max, int value) +{ + g_return_val_if_fail (max > min, -1); + g_return_val_if_fail (value >= min, -1); + g_return_val_if_fail (value <= max, -1); + return (((value - min) * 100) / (max - min)); +} +#define ABS_TO_PERCENTAGE(min, max, value) abs_to_percentage(min, max, value) +#define PERCENTAGE_TO_ABS(min, max, value) (min + (((max - min) * value) / 100)) + +#define GSD_POWER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerPrivate)) + +typedef enum { + GSD_POWER_IDLE_MODE_NORMAL, + GSD_POWER_IDLE_MODE_DIM, + GSD_POWER_IDLE_MODE_BLANK, + GSD_POWER_IDLE_MODE_SLEEP +} GsdPowerIdleMode; + +struct GsdPowerManagerPrivate +{ + GnomeSettingsSession *session; + gboolean lid_is_closed; + GSettings *settings; + GSettings *settings_screensaver; + UpClient *up_client; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *upower_proxy; + GDBusProxy *upower_kdb_proxy; + gint kbd_brightness_now; + gint kbd_brightness_max; + gint kbd_brightness_old; + gint kbd_brightness_pre_dim; + GnomeRRScreen *x11_screen; + gboolean use_time_primary; + gchar *previous_summary; + GIcon *previous_icon; + GpmPhone *phone; + GPtrArray *devices_array; + guint action_percentage; + guint action_time; + guint critical_percentage; + guint critical_time; + guint low_percentage; + guint low_time; + gint pre_dim_brightness; /* level, not percentage */ + UpDevice *device_composite; + NotifyNotification *notification_discharging; + NotifyNotification *notification_low; + ca_context *canberra_context; + ca_proplist *critical_alert_loop_props; + guint32 critical_alert_timeout_id; + GDBusProxy *screensaver_proxy; + GDBusProxy *session_proxy; + GDBusProxy *session_presence_proxy; + GpmIdletime *idletime; + GsdPowerIdleMode current_idle_mode; + guint lid_close_safety_timer_id; + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; +}; + +enum { + PROP_0, +}; + +static void gsd_power_manager_class_init (GsdPowerManagerClass *klass); +static void gsd_power_manager_init (GsdPowerManager *power_manager); +static void gsd_power_manager_finalize (GObject *object); + +static UpDevice *engine_get_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static UpDevice *engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static GIcon *engine_get_icon (GsdPowerManager *manager); +static gchar *engine_get_summary (GsdPowerManager *manager); +static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type); +static void do_lid_closed_action (GsdPowerManager *manager); +static void lock_screensaver (GsdPowerManager *manager); +static void kill_lid_close_safety_timer (GsdPowerManager *manager); + +G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gsd_power_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_power_manager_error"); + return quark; +} + +static gboolean +play_loop_timeout_cb (GsdPowerManager *manager) +{ + ca_context *context; + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play_full (context, 0, + manager->priv->critical_alert_loop_props, + NULL, + NULL); + return TRUE; +} + +static gboolean +play_loop_stop (GsdPowerManager *manager) +{ + if (manager->priv->critical_alert_timeout_id == 0) { + g_warning ("no sound loop present to stop"); + return FALSE; + } + + g_source_remove (manager->priv->critical_alert_timeout_id); + ca_proplist_destroy (manager->priv->critical_alert_loop_props); + + manager->priv->critical_alert_loop_props = NULL; + manager->priv->critical_alert_timeout_id = 0; + + return TRUE; +} + +static gboolean +play_loop_start (GsdPowerManager *manager, + const gchar *id, + const gchar *desc, + gboolean force, + guint timeout) +{ + ca_context *context; + + if (timeout == 0) { + g_warning ("received invalid timeout"); + return FALSE; + } + + /* if a sound loop is already running, stop the existing loop */ + if (manager->priv->critical_alert_timeout_id != 0) { + g_warning ("was instructed to play a sound loop with one already playing"); + play_loop_stop (manager); + } + + ca_proplist_create (&(manager->priv->critical_alert_loop_props)); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_ID, id); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_DESCRIPTION, desc); + + manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout, + (GSourceFunc) play_loop_timeout_cb, + manager); + g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, + "[GsdPowerManager] play-loop"); + + /* play the sound, using sounds from the naming spec */ + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play (context, 0, + CA_PROP_EVENT_ID, id, + CA_PROP_EVENT_DESCRIPTION, desc, NULL); + return TRUE; +} + +static void +notify_close_if_showing (NotifyNotification *notification) +{ + gboolean ret; + GError *error = NULL; + + if (notification == NULL) + return; + ret = notify_notification_close (notification, &error); + if (!ret) { + g_warning ("failed to close notification: %s", + error->message); + g_error_free (error); + } +} + +static const gchar * +get_first_themed_icon_name (GIcon *icon) +{ + const gchar* const *icon_names; + const gchar *icon_name = NULL; + + /* no icon */ + if (icon == NULL) + goto out; + + /* just use the first icon */ + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + if (icon_names != NULL) + icon_name = icon_names[0]; +out: + return icon_name; +} + +typedef enum { + WARNING_NONE = 0, + WARNING_DISCHARGING = 1, + WARNING_LOW = 2, + WARNING_CRITICAL = 3, + WARNING_ACTION = 4 +} GsdPowerManagerWarning; + +static GVariant * +engine_get_icon_property_variant (GsdPowerManager *manager) +{ + GIcon *icon; + GVariant *retval; + + icon = engine_get_icon (manager); + if (icon != NULL) { + char *str; + str = g_icon_to_string (icon); + g_object_unref (icon); + retval = g_variant_new_string (str); + g_free (str); + } else { + retval = g_variant_new_string (""); + } + return retval; +} + +static GVariant * +engine_get_tooltip_property_variant (GsdPowerManager *manager) +{ + char *tooltip; + GVariant *retval; + + tooltip = engine_get_summary (manager); + retval = g_variant_new_string (tooltip != NULL ? tooltip : ""); + g_free (tooltip); + + return retval; +} + +static void +engine_emit_changed (GsdPowerManager *manager, + gboolean icon_changed, + gboolean state_changed) +{ + GVariantBuilder props_builder; + GVariant *props_changed = NULL; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + + g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}")); + + if (icon_changed) + g_variant_builder_add (&props_builder, "{sv}", "Icon", + engine_get_icon_property_variant (manager)); + if (state_changed) + g_variant_builder_add (&props_builder, "{sv}", "Tooltip", + engine_get_tooltip_property_variant (manager)); + + props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE, + g_variant_builder_end (&props_builder), + g_variant_new_strv (NULL, 0)); + g_variant_ref_sink (props_changed); + + if (!g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_POWER_DBUS_PATH, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + props_changed, + &error)) + goto out; + + out: + if (error) { + g_warning ("%s", error->message); + g_clear_error (&error); + } + if (props_changed) + g_variant_unref (props_changed); +} + +static GsdPowerManagerWarning +engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage < 26.0f) + return WARNING_LOW; + else if (percentage < 13.0f) + return WARNING_CRITICAL; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage <= manager->priv->action_percentage) + return WARNING_ACTION; + if (percentage <= manager->priv->critical_percentage) + return WARNING_CRITICAL; + if (percentage <= manager->priv->low_percentage) + return WARNING_LOW; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_time (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "time-to-empty", &time_to_empty, + NULL); + + /* this is probably an error condition */ + if (time_to_empty == 0) { + g_debug ("time zero, falling back to percentage for %s", + up_device_kind_to_string (kind)); + return engine_get_warning_percentage (manager, device); + } + + if (time_to_empty <= manager->priv->action_time) + return WARNING_ACTION; + if (time_to_empty <= manager->priv->critical_time) + return WARNING_CRITICAL; + if (time_to_empty <= manager->priv->low_time) + return WARNING_LOW; + return WARNING_NONE; +} + +/** + * This gets the possible engine state for the device according to the + * policy, which could be per-percent, or per-time. + **/ +static GsdPowerManagerWarning +engine_get_warning (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + UpDeviceState state; + GsdPowerManagerWarning warning_type; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + NULL); + + /* default to no engine */ + warning_type = WARNING_NONE; + + /* if the device in question is on ac, don't give a warning */ + if (state == UP_DEVICE_STATE_CHARGING) + goto out; + + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + + warning_type = engine_get_warning_csr (manager, device); + + } else if (kind == UP_DEVICE_KIND_UPS || +#if UP_CHECK_VERSION(0,9,5) + kind == UP_DEVICE_KIND_MEDIA_PLAYER || + kind == UP_DEVICE_KIND_TABLET || + kind == UP_DEVICE_KIND_COMPUTER || +#endif + kind == UP_DEVICE_KIND_PDA) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_BATTERY) { + /* only use the time when it is accurate, and settings is not disabled */ + if (manager->priv->use_time_primary) + warning_type = engine_get_warning_time (manager, device); + else + warning_type = engine_get_warning_percentage (manager, device); + } + + /* If we have no important engines, we should test for discharging */ + if (warning_type == WARNING_NONE) { + if (state == UP_DEVICE_STATE_DISCHARGING) + warning_type = WARNING_DISCHARGING; + } + + out: + return warning_type; +} + +static gchar * +engine_get_summary (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + GString *tooltip = NULL; + gchar *part; + gboolean is_present; + + + /* need to get AC state */ + tooltip = g_string_new (""); + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "is-present", &is_present, + "state", &state, + NULL); + if (!is_present) + continue; + if (state == UP_DEVICE_STATE_EMPTY) + continue; + part = gpm_upower_get_device_summary (device); + if (part != NULL) + g_string_append_printf (tooltip, "%s\n", part); + g_free (part); + } + + /* remove the last \n */ + g_string_truncate (tooltip, tooltip->len-1); + + g_debug ("tooltip: %s", tooltip->str); + + return g_string_free (tooltip, FALSE); +} + +static GIcon * +engine_get_icon_priv (GsdPowerManager *manager, + UpDeviceKind device_kind, + GsdPowerManagerWarning warning, + gboolean use_state) +{ + guint i; + GPtrArray *array; + UpDevice *device; + GsdPowerManagerWarning warning_temp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) + device = engine_get_composite_device (manager, device); + + warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), + "engine-warning-old")); + if (kind == device_kind && is_present) { + if (warning != WARNING_NONE) { + if (warning_temp == warning) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + if (use_state) { + if (state == UP_DEVICE_STATE_CHARGING || + state == UP_DEVICE_STATE_DISCHARGING) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + return gpm_upower_get_device_icon (device, TRUE); + } + } + return NULL; +} + +static GIcon * +engine_get_icon (GsdPowerManager *manager) +{ + GIcon *icon = NULL; + + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + + /* we try (DIS)CHARGING: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + + /* we try PRESENT: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + + /* do not show an icon */ + return NULL; +} + +static gboolean +engine_recalculate_state_icon (GsdPowerManager *manager) +{ + GIcon *icon; + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, icon != NULL); + + if (icon == NULL) { + /* none before, now none */ + if (manager->priv->previous_icon == NULL) + return FALSE; + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = NULL; + return TRUE; + } + + /* no icon before, now icon */ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + /* icon before, now different */ + if (!g_icon_equal (manager->priv->previous_icon, icon)) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + g_debug ("no change"); + /* nothing to do */ + g_object_unref (icon); + return FALSE; +} + +static gboolean +engine_recalculate_state_summary (GsdPowerManager *manager) +{ + gchar *summary; + + summary = engine_get_summary (manager); + if (manager->priv->previous_summary == NULL) { + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + + if (strcmp (manager->priv->previous_summary, summary) != 0) { + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + g_debug ("no change"); + /* nothing to do */ + g_free (summary); + return FALSE; +} + +static void +engine_recalculate_state (GsdPowerManager *manager) +{ + gboolean icon_changed = FALSE; + gboolean state_changed = FALSE; + + icon_changed = engine_recalculate_state_icon (manager); + state_changed = engine_recalculate_state_summary (manager); + + /* only emit if the icon or summary has changed */ + if (icon_changed || state_changed) + engine_emit_changed (manager, icon_changed, state_changed); +} + +static UpDevice * +engine_get_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint battery_devices = 0; + GPtrArray *array; + UpDevice *device; + UpDeviceKind kind; + UpDeviceKind original_kind; + guint i; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* find out how many batteries in the system */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + NULL); + if (kind == original_kind) + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices <= 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use the composite device */ + device = manager->priv->device_composite; +out: + /* return composite device or original device */ + return device; +} + +static UpDevice * +engine_update_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint i; + gdouble percentage = 0.0; + gdouble energy = 0.0; + gdouble energy_full = 0.0; + gdouble energy_rate = 0.0; + gdouble energy_total = 0.0; + gdouble energy_full_total = 0.0; + gdouble energy_rate_total = 0.0; + gint64 time_to_empty = 0; + gint64 time_to_full = 0; + guint battery_devices = 0; + gboolean is_charging = FALSE; + gboolean is_discharging = FALSE; + gboolean is_fully_charged = TRUE; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + UpDeviceKind kind; + UpDeviceKind original_kind; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* update the composite device */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + "state", &state, + "energy", &energy, + "energy-full", &energy_full, + "energy-rate", &energy_rate, + NULL); + if (kind != original_kind) + continue; + + /* one of these will be charging or discharging */ + if (state == UP_DEVICE_STATE_CHARGING) + is_charging = TRUE; + if (state == UP_DEVICE_STATE_DISCHARGING) + is_discharging = TRUE; + if (state != UP_DEVICE_STATE_FULLY_CHARGED) + is_fully_charged = FALSE; + + /* sum up composite */ + energy_total += energy; + energy_full_total += energy_full; + energy_rate_total += energy_rate; + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices == 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use percentage weighted for each battery capacity */ + if (energy_full_total > 0.0) + percentage = 100.0 * energy_total / energy_full_total; + + /* set composite state */ + if (is_charging) + state = UP_DEVICE_STATE_CHARGING; + else if (is_discharging) + state = UP_DEVICE_STATE_DISCHARGING; + else if (is_fully_charged) + state = UP_DEVICE_STATE_FULLY_CHARGED; + else + state = UP_DEVICE_STATE_UNKNOWN; + + /* calculate a quick and dirty time remaining value */ + if (energy_rate_total > 0) { + if (state == UP_DEVICE_STATE_DISCHARGING) + time_to_empty = 3600 * (energy_total / energy_rate_total); + else if (state == UP_DEVICE_STATE_CHARGING) + time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total); + } + + /* okay, we can use the composite device */ + device = manager->priv->device_composite; + + g_debug ("printing composite device"); + g_object_set (device, + "energy", energy, + "energy-full", energy_full, + "energy-rate", energy_rate, + "time-to-empty", time_to_empty, + "time-to-full", time_to_full, + "percentage", percentage, + "state", state, + NULL); + + /* force update of icon */ + if (engine_recalculate_state_icon (manager)) + engine_emit_changed (manager, TRUE, FALSE); +out: + /* return composite device or original device */ + return device; +} + +typedef struct { + GsdPowerManager *manager; + UpDevice *device; +} GsdPowerManagerRecallData; + +static void +device_perhaps_recall_response_cb (GtkDialog *dialog, + gint response_id, + GsdPowerManagerRecallData *recall_data) +{ + GdkScreen *screen; + GtkWidget *dialog_error; + GError *error = NULL; + gboolean ret; + gchar *website = NULL; + + /* don't show this again */ + if (response_id == GTK_RESPONSE_CANCEL) { + g_settings_set_boolean (recall_data->manager->priv->settings, + "notify-perhaps-recall", + FALSE); + goto out; + } + + /* visit recall website */ + if (response_id == GTK_RESPONSE_OK) { + + g_object_get (recall_data->device, + "recall-url", &website, + NULL); + + screen = gdk_screen_get_default(); + ret = gtk_show_uri (screen, + website, + gtk_get_current_event_time (), + &error); + if (!ret) { + dialog_error = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Failed to show url %s", + error->message); + gtk_dialog_run (GTK_DIALOG (dialog_error)); + g_error_free (error); + } + } +out: + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (recall_data->device); + g_object_unref (recall_data->manager); + g_free (recall_data); + g_free (website); + return; +} + +static gboolean +device_perhaps_recall_delay_cb (gpointer user_data) +{ + gchar *vendor; + const gchar *title = NULL; + GString *message = NULL; + GtkWidget *dialog; + GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data; + + g_object_get (recall_data->device, + "recall-vendor", &vendor, + NULL); + + /* TRANSLATORS: the battery may be recalled by its vendor */ + title = _("Battery may be recalled"); + message = g_string_new (""); + g_string_append_printf (message, + _("A battery in your computer may have been " + "recalled by %s and you may be at risk."), vendor); + g_string_append (message, "\n\n"); + g_string_append (message, _("For more information visit the battery recall website.")); + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + title); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", message->str); + + /* TRANSLATORS: button text, visit the manufacturers recall website */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), + GTK_RESPONSE_OK); + + /* TRANSLATORS: button text, do not show this bubble again */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), + GTK_RESPONSE_CANCEL); + + gtk_widget_show (dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (device_perhaps_recall_response_cb), + recall_data); + + g_string_free (message, TRUE); + g_free (vendor); + return FALSE; +} + +static void +device_perhaps_recall (GsdPowerManager *manager, UpDevice *device) +{ + gboolean ret; + guint timer_id; + GsdPowerManagerRecallData *recall_data; + + /* don't show when running under GDM */ + if (g_getenv ("RUNNING_UNDER_GDM") != NULL) { + g_debug ("running under gdm, so no notification"); + return; + } + + /* already shown, and dismissed */ + ret = g_settings_get_boolean (manager->priv->settings, + "notify-perhaps-recall"); + if (!ret) { + g_debug ("settings prevents recall notification"); + return; + } + + recall_data = g_new0 (GsdPowerManagerRecallData, 1); + recall_data->manager = g_object_ref (manager); + recall_data->device = g_object_ref (device); + + /* delay by a few seconds so the session can load */ + timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY, + device_perhaps_recall_delay_cb, + recall_data); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall"); +} + +static void +engine_device_add (GsdPowerManager *manager, UpDevice *device) +{ + gboolean recall_notice; + GsdPowerManagerWarning warning; + UpDeviceState state; + UpDeviceKind kind; + UpDevice *composite; + + /* assign warning */ + warning = engine_get_warning (manager, device); + g_object_set_data (G_OBJECT(device), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "recall-notice", &recall_notice, + NULL); + + /* add old state for transitions */ + g_debug ("adding %s with state %s", + up_device_get_object_path (device), up_device_state_to_string (state)); + g_object_set_data (G_OBJECT(device), + "engine-state-old", + GUINT_TO_POINTER(state)); + + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because we added a device"); + composite = engine_update_composite_device (manager, device); + + /* get the same values for the composite device */ + warning = engine_get_warning (manager, composite); + g_object_set_data (G_OBJECT(composite), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + g_object_get (composite, "state", &state, NULL); + g_object_set_data (G_OBJECT(composite), + "engine-state-old", + GUINT_TO_POINTER(state)); + } + + /* the device is recalled */ + if (recall_notice) + device_perhaps_recall (manager, device); +} + +static gboolean +engine_check_recall (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gboolean recall_notice = FALSE; + gchar *recall_vendor = NULL; + gchar *recall_url = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "recall-notice", &recall_notice, + "recall-vendor", &recall_vendor, + "recall-url", &recall_url, + NULL); + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + goto out; + + /* no recall data */ + if (!recall_notice) + goto out; + + /* emit signal for manager */ + g_debug ("** EMIT: perhaps-recall"); + g_debug ("%s-%s", recall_vendor, recall_url); +out: + g_free (recall_vendor); + g_free (recall_url); + return recall_notice; +} + +static gboolean +engine_coldplug (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array = NULL; + UpDevice *device; + gboolean ret; + GError *error = NULL; + + /* get devices from UPower */ + ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error); + if (!ret) { + g_warning ("failed to get device list: %s", error->message); + g_error_free (error); + goto out; + } + + /* connected mobile phones */ + gpm_phone_coldplug (manager->priv->phone); + + engine_recalculate_state (manager); + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); + /* never repeat */ + return FALSE; +} + +static void +engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + /* add to list */ + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_check_recall (manager, device); + + engine_recalculate_state (manager); +} + +static void +engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + gboolean ret; + ret = g_ptr_array_remove (manager->priv->devices_array, device); + if (!ret) + return; + engine_recalculate_state (manager); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +create_notification (const char *summary, + const char *body, + const char *icon, + NotifyNotification **weak_pointer_location) +{ + NotifyNotification *notification; + + notification = notify_notification_new (summary, body, icon); + *weak_pointer_location = notification; + g_object_add_weak_pointer (G_OBJECT (notification), + (gpointer *) weak_pointer_location); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); +} + +static void +engine_ups_discharging (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title; + gboolean ret; + gchar *remaining_text = NULL; + gdouble percentage; + GError *error = NULL; + GIcon *icon = NULL; + gint64 time_to_empty; + GString *message; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + if (kind != UP_DEVICE_KIND_UPS) + return; + + /* only show text if there is a valid time */ + if (time_to_empty > 0) + remaining_text = gpm_get_timestring (time_to_empty); + + /* TRANSLATORS: UPS is now discharging */ + title = _("UPS Discharging"); + + message = g_string_new (""); + if (remaining_text != NULL) { + /* TRANSLATORS: tell the user how much time they have got */ + g_string_append_printf (message, _("%s of UPS backup power remaining"), + remaining_text); + } else { + g_string_append (message, gpm_device_to_localised_string (device)); + } + g_string_append_printf (message, " (%.0f%%)", percentage); + + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_discharging); + + /* create a new notification */ + create_notification (title, message->str, + get_first_themed_icon_name (icon), + &manager->priv->notification_discharging); + notify_notification_set_timeout (manager->priv->notification_discharging, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_discharging, + NOTIFY_URGENCY_NORMAL); + /* TRANSLATORS: this is the notification application name */ + notify_notification_set_app_name (manager->priv->notification_discharging, _("Power")); + notify_notification_set_hint (manager->priv->notification_discharging, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_discharging, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_discharging); + } + g_string_free (message, TRUE); + if (icon != NULL) + g_object_unref (icon); + g_free (remaining_text); +} + +static GsdPowerActionType +manager_critical_action_get (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType policy; + + policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action"); + if (policy == GSD_POWER_ACTION_SUSPEND) { + if (is_ups == FALSE && + up_client_get_can_suspend (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_can_hibernate (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } + + return policy; +} + +static gboolean +manager_critical_action_do (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType action_type; + + /* stop playing the alert as it's too late to do anything now */ + if (manager->priv->critical_alert_timeout_id > 0) + play_loop_stop (manager); + + action_type = manager_critical_action_get (manager, is_ups); + do_power_action_type (manager, action_type); + + return FALSE; +} + +static gboolean +manager_critical_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, FALSE); + return FALSE; +} + +static gboolean +manager_critical_ups_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, TRUE); + return FALSE; +} + +static gboolean +engine_just_laptop_battery (GsdPowerManager *manager) +{ + UpDevice *device; + UpDeviceKind kind; + GPtrArray *array; + gboolean ret = TRUE; + guint i; + + /* find if there are any other device types that mean we have to + * be more specific in our wording */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, "kind", &kind, NULL); + if (kind != UP_DEVICE_KIND_BATTERY) { + ret = FALSE; + break; + } + } + return ret; +} + +static void +engine_charge_low (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gchar *tmp; + gchar *remaining_text; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery low, and we only have one battery */ + title = _("Battery low"); + } else { + /* TRANSLATORS: laptop battery low, and we have more than one kind of battery */ + title = _("Laptop battery low"); + } + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage); + g_free (remaining_text); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is starting to get a little low */ + title = _("UPS low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s of remaining UPS backup power (%.0f%%)"), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: mouse is getting a little low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless mouse is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: keyboard is getting a little low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless keyboard is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PDA) { + /* TRANSLATORS: PDA is getting a little low */ + title = _("PDA battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("PDA is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + /* TRANSLATORS: cell phone (mobile) is getting a little low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + /* TRANSLATORS: media player, e.g. mp3 is getting a little low */ + title = _("Media player battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_TABLET) { + /* TRANSLATORS: graphics tablet, e.g. wacom is getting a little low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + /* TRANSLATORS: computer, e.g. ipad is getting a little low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_NORMAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + notify_notification_set_hint (manager->priv->notification_low, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-low", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL); + +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_critical (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + GsdPowerActionType policy; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */ + title = _("Battery critically low"); + } else { + /* TRANSLATORS: laptop battery critically low, and we have more than one type of battery */ + title = _("Laptop battery critically low"); + } + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */ + message = g_strdup (_("Plug in your AC adapter to avoid losing data.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in.")); + } + + } else if (kind == UP_DEVICE_KIND_UPS) { + gchar *remaining_text; + gchar *tmp; + + /* TRANSLATORS: the UPS is very low */ + title = _("UPS critically low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Approximately %s of remaining UPS power (%.0f%%). " + "Restore AC power to your computer to avoid losing data."), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: the mouse battery is very low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless mouse is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: the keyboard battery is very low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless keyboard is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_PDA) { + + /* TRANSLATORS: the PDA battery is very low */ + title = _("PDA battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("PDA is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Media player is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_TABLET) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Attached computer is very low in power (%.0f%%). " + "The device will soon shutdown if not charged."), + percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + switch (kind) { + + case UP_DEVICE_KIND_BATTERY: + case UP_DEVICE_KIND_UPS: + g_debug ("critical charge level reached, starting sound loop"); + play_loop_start (manager, + "battery-caution", + _("Battery is critically low"), + TRUE, + GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT); + break; + + default: + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); + break; + } +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_action (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + GError *error = NULL; + GIcon *icon = NULL; + GsdPowerActionType policy; + guint timer_id; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* TRANSLATORS: laptop battery is really, really, low */ + title = _("Laptop battery critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("The battery is below the critical level and " + "this computer will power-off when the " + "battery becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: computer will suspend */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to suspend.\n" + "NOTE: A small amount of power is required " + "to keep your computer in a suspended state.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action"); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is really, really, low */ + title = _("UPS critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, TRUE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("UPS is below the critical level and " + "this computer will power-off when the " + "UPS becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_ups_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action"); + } + + /* not all types have actions */ + if (title == NULL) + return; + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + UpDeviceKind kind; + UpDeviceState state; + UpDeviceState state_old; + GsdPowerManagerWarning warning_old; + GsdPowerManagerWarning warning; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because %s changed", up_device_get_object_path (device)); + device = engine_update_composite_device (manager, device); + } + + /* get device properties (may be composite) */ + g_object_get (device, + "state", &state, + NULL); + + g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state)); + + /* see if any interesting state changes have happened */ + state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old")); + if (state_old != state) { + if (state == UP_DEVICE_STATE_DISCHARGING) { + g_debug ("discharging"); + engine_ups_discharging (manager, device); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED || + state == UP_DEVICE_STATE_CHARGING) { + g_debug ("fully charged or charging, hiding notifications if any"); + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + } + + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state)); + } + + /* check the warning state has not changed */ + warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old")); + warning = engine_get_warning (manager, device); + if (warning != warning_old) { + if (warning == WARNING_LOW) { + g_debug ("** EMIT: charge-low"); + engine_charge_low (manager, device); + } else if (warning == WARNING_CRITICAL) { + g_debug ("** EMIT: charge-critical"); + engine_charge_critical (manager, device); + } else if (warning == WARNING_ACTION) { + g_debug ("charge-action"); + engine_charge_action (manager, device); + } + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning)); + } + + engine_recalculate_state (manager); +} + +static UpDevice * +engine_get_primary_device (GsdPowerManager *manager) +{ + guint i; + UpDevice *device = NULL; + UpDevice *device_tmp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + for (i=0; ipriv->devices_array->len; i++) { + device_tmp = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device_tmp, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* not present */ + if (!is_present) + continue; + + /* not discharging */ + if (state != UP_DEVICE_STATE_DISCHARGING) + continue; + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + + /* use composite device to cope with multiple batteries */ + device = g_object_ref (engine_get_composite_device (manager, device_tmp)); + break; + } + return device; +} + +static void +phone_device_added_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + UpDevice *device; + device = up_device_new (); + + g_debug ("phone added %i", idx); + + /* get device properties */ + g_object_set (device, + "kind", UP_DEVICE_KIND_PHONE, + "is-rechargeable", TRUE, + "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "is-present", TRUE, + NULL); + + /* state changed */ + engine_device_add (manager, device); + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_recalculate_state (manager); +} + +static void +phone_device_removed_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + + g_debug ("phone removed %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + g_ptr_array_remove_index (manager->priv->devices_array, i); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +phone_device_refresh_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + + g_debug ("phone refresh %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + is_present = gpm_phone_get_present (phone, idx); + state = gpm_phone_get_on_ac (phone, idx) ? UP_DEVICE_STATE_CHARGING : UP_DEVICE_STATE_DISCHARGING; + percentage = gpm_phone_get_percentage (phone, idx); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +gnome_session_shutdown_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't shutdown using gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +gnome_session_shutdown (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* ask gnome-session to show the shutdown dialog with a timeout */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to gnome-session: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Shutdown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gnome_session_shutdown_cb, NULL); + g_object_unref (proxy); +} + +static void +do_power_action_type (GsdPowerManager *manager, + GsdPowerActionType action_type) +{ + gboolean ret; + GError *error = NULL; + + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + gnome_session_shutdown (); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_SHUTDOWN: + /* this is only used on critically low battery where + * hibernate is not available and is marginally better + * than just powering down the computer mid-write */ + gsd_power_poweroff (); + break; + case GSD_POWER_ACTION_BLANK: + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off for policy action: %s", + error->message); + g_error_free (error); + } + break; + case GSD_POWER_ACTION_NOTHING: + break; + } +} + +static gboolean +upower_kbd_set_brightness (GsdPowerManager *manager, guint value, GError **error) +{ + GVariant *retval; + + /* same as before */ + if (manager->priv->kbd_brightness_now == value) + return TRUE; + + /* update h/w value */ + retval = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "SetBrightness", + g_variant_new ("(i)", (gint) value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + error); + if (retval == NULL) + return FALSE; + + /* save new value */ + manager->priv->kbd_brightness_now = value; + g_variant_unref (retval); + return TRUE; +} + +static gboolean +upower_kbd_toggle (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + if (manager->priv->kbd_brightness_old >= 0) { + g_debug ("keyboard toggle off"); + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_old, + error); + if (ret) { + /* succeeded, set to -1 since now no old value */ + manager->priv->kbd_brightness_old = -1; + } + } else { + g_debug ("keyboard toggle on"); + /* save the current value to restore later when untoggling */ + manager->priv->kbd_brightness_old = manager->priv->kbd_brightness_now; + ret = upower_kbd_set_brightness (manager, 0, error); + if (!ret) { + /* failed, reset back to -1 */ + manager->priv->kbd_brightness_old = -1; + } + } + + return ret; +} + +static void +do_lid_open_action (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-open", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been opened"), + NULL); + + /* ensure we turn the panel back on after lid open */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after lid open: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy != NULL && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_error_free (error); + } + } + + kill_lid_close_safety_timer (manager); +} + +static gboolean +is_on (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + + crtc = gnome_rr_output_get_crtc (output); + if (!crtc) + return FALSE; + return gnome_rr_crtc_get_current_mode (crtc) != NULL; +} + +static gboolean +non_laptop_outputs_are_all_off (GnomeRRScreen *screen) +{ + GnomeRROutput **outputs; + int i; + + outputs = gnome_rr_screen_list_outputs (screen); + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_laptop (outputs[i])) + continue; + + if (is_on (outputs[i])) + return FALSE; + } + + return TRUE; +} + +/* Timeout callback used to check conditions when the laptop's lid is closed but + * the machine is not suspended yet. We try to suspend again, so that the laptop + * won't overheat if placed in a backpack. + */ +static gboolean +lid_close_safety_timer_cb (GsdPowerManager *manager) +{ + manager->priv->lid_close_safety_timer_id = 0; + + g_debug ("lid has been closed for a while; trying to suspend again"); + do_lid_closed_action (manager); + + return FALSE; +} + +/* Sets up a timer to be triggered some seconds after closing the laptop lid + * when the laptop is *not* suspended for some reason. We'll check conditions + * again in the timeout handler to see if we can suspend then. + */ +static void +setup_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) + return; + + manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT, + (GSourceFunc) lid_close_safety_timer_cb, + manager); + g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer"); +} + +static void +kill_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) { + g_source_remove (manager->priv->lid_close_safety_timer_id); + manager->priv->lid_close_safety_timer_id = 0; + } +} + +static void +suspend_with_lid_closed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + GsdPowerActionType action_type; + + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-battery-action"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-ac-action"); + } + + /* check we won't melt when the lid is closed */ + if (action_type != GSD_POWER_ACTION_SUSPEND && + action_type != GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_lid_force_sleep (manager->priv->up_client)) { + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; + } else { + /* maybe lock the screen if the lid is closed */ + lock_screensaver (manager); + } + } + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off after lid close: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + do_power_action_type (manager, action_type); +} + +static void +do_lid_closed_action (GsdPowerManager *manager) +{ + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-close", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been closed"), + NULL); + + /* refresh RANDR so we get an accurate view of what monitors are plugged in when the lid is closed */ + gnome_rr_screen_refresh (manager->priv->x11_screen, NULL); /* NULL-GError */ + + /* perform policy action */ + if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor") + || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) { + g_debug ("lid is closed; suspending or hibernating"); + suspend_with_lid_closed (manager); + } else { + g_debug ("lid is closed; not suspending nor hibernating since some external monitor outputs are still active"); + setup_lid_close_safety_timer (manager); + } +} + + +static void +up_client_changed_cb (UpClient *client, GsdPowerManager *manager) +{ + gboolean tmp; + + if (!up_client_get_on_battery (client)) { + /* if we are playing a critical charge sound loop on AC, stop it */ + if (manager->priv->critical_alert_timeout_id > 0) { + g_debug ("stopping alert loop due to ac being present"); + play_loop_stop (manager); + } + notify_close_if_showing (manager->priv->notification_low); + } + + /* same state */ + tmp = up_client_get_lid_is_closed (manager->priv->up_client); + if (manager->priv->lid_is_closed == tmp) + return; + manager->priv->lid_is_closed = tmp; + + /* fake a keypress */ + if (tmp) + do_lid_closed_action (manager); + else + do_lid_open_action (manager); +} + +typedef enum { + SESSION_STATUS_CODE_AVAILABLE = 0, + SESSION_STATUS_CODE_INVISIBLE, + SESSION_STATUS_CODE_BUSY, + SESSION_STATUS_CODE_IDLE, + SESSION_STATUS_CODE_UNKNOWN +} SessionStatusCode; + +typedef enum { + SESSION_INHIBIT_MASK_LOGOUT = 1, + SESSION_INHIBIT_MASK_SWITCH = 2, + SESSION_INHIBIT_MASK_SUSPEND = 4, + SESSION_INHIBIT_MASK_IDLE = 8 +} SessionInhibitMask; + +static const gchar * +idle_mode_to_string (GsdPowerIdleMode mode) +{ + if (mode == GSD_POWER_IDLE_MODE_NORMAL) + return "normal"; + if (mode == GSD_POWER_IDLE_MODE_DIM) + return "dim"; + if (mode == GSD_POWER_IDLE_MODE_BLANK) + return "blank"; + if (mode == GSD_POWER_IDLE_MODE_SLEEP) + return "sleep"; + return "unknown"; +} + +static GnomeRROutput * +get_primary_output (GsdPowerManager *manager) +{ + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + guint i; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL) + goto out; + + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i]) && + gnome_rr_output_is_laptop (outputs[i]) && + gnome_rr_output_get_backlight_min (outputs[i]) >= 0 && + gnome_rr_output_get_backlight_max (outputs[i]) > 0) { + output = outputs[i]; + break; + } + } +out: + return output; +} + +/** + * backlight_helper_get_value: + * + * Gets a brightness value from the PolicyKit helper. + * + * Return value: the signed integer value from the helper, or -1 + * for failure. If -1 then @error is set. + **/ +static gint64 +backlight_helper_get_value (const gchar *argument, GError **error) +{ + gboolean ret; + gchar *stdout_data = NULL; + gint exit_status = 0; + gint64 value = -1; + gchar *command = NULL; + gchar *endptr = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf (LIBEXECDIR "/gsd-backlight-helper --%s", + argument); + ret = g_spawn_command_line_sync (command, + &stdout_data, + NULL, + &exit_status, + error); + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret) + goto out; + + if (WEXITSTATUS (exit_status) != 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "gsd-backlight-helper failed: %s", + stdout_data ? stdout_data : "No reason"); + goto out; + } + + /* parse */ + value = g_ascii_strtoll (stdout_data, &endptr, 10); + + /* parsing error */ + if (endptr == stdout_data) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to parse value: %s", + stdout_data); + goto out; + } + + /* out of range */ + if (value > G_MAXINT) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value out of range: %s", + stdout_data); + goto out; + } + + /* Fetching the value failed, for some other reason */ + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value negative, but helper did not fail: %s", + stdout_data); + goto out; + } + +out: + g_free (command); + g_free (stdout_data); + return value; +} + +/** + * backlight_helper_set_value: + * + * Sets a brightness value using the PolicyKit helper. + * + * Return value: Success. If FALSE then @error is set. + **/ +static gboolean +backlight_helper_set_value (const gchar *argument, + gint value, + GError **error) +{ + gboolean ret; + gint exit_status = 0; + gchar *command = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-backlight-helper --%s %i", + argument, value); + ret = g_spawn_command_line_sync (command, + NULL, + NULL, + &exit_status, + error); + + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret || WEXITSTATUS (exit_status) != 0) + goto out; + +out: + g_free (command); + return ret; +} + +static gint +backlight_get_abs (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + return gnome_rr_output_get_backlight (output, + error); + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-brightness", error); +} + +static gint +backlight_get_percentage (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gint now; + gint value = -1; + gint min = 0; + gint max; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); +out: + return value; +} + +static gint +backlight_get_min (GsdPowerManager *manager) +{ + GnomeRROutput *output; + + /* if we have no xbacklight device, then hardcode zero as sysfs + * offsets everything to 0 as min */ + output = get_primary_output (manager); + if (output == NULL) + return 0; + + /* get xbacklight value, which maybe non-zero */ + return gnome_rr_output_get_backlight_min (output); +} + +static gint +backlight_get_max (GsdPowerManager *manager, GError **error) +{ + gint value; + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + value = gnome_rr_output_get_backlight_max (output); + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to get backlight max"); + } + return value; + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-max-brightness", error); +} + +static void +backlight_emit_changed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + ret = g_dbus_connection_emit_signal (manager->priv->connection, + GSD_DBUS_SERVICE, + GSD_POWER_DBUS_PATH, + GSD_POWER_DBUS_INTERFACE_SCREEN, + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit Changed: %s", error->message); + g_error_free (error); + } +} + +static gboolean +backlight_set_percentage (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint min = 0; + gint max; + guint discrete; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + if (min < 0 || max < 0) { + g_warning ("no xrandr backlight capability"); + goto out; + } + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gint +backlight_step_up (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_step_down (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_set_abs (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + ret = gnome_rr_output_set_backlight (output, + value, + error); + goto out; + } + + /* fall back to the polkit helper */ + ret = backlight_helper_set_value ("set-brightness", + value, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gboolean +display_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gint min; + gint max; + gint now; + gint idle; + gboolean ret = FALSE; + + now = backlight_get_abs (manager, error); + if (now < 0) { + goto out; + } + + /* is the dim brightness actually *dimmer* than the + * brightness we have now? */ + min = backlight_get_min (manager); + max = backlight_get_max (manager, error); + if (max < 0) { + goto out; + } + idle = PERCENTAGE_TO_ABS (min, max, idle_percentage); + if (idle > now) { + g_debug ("brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + ret = TRUE; + goto out; + } + ret = backlight_set_abs (manager, + idle, + FALSE, + error); + if (!ret) { + goto out; + } + + /* save for undim */ + manager->priv->pre_dim_brightness = now; + +out: + return ret; +} + +static gboolean +kbd_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gboolean ret; + gint idle; + gint max; + gint now; + + if (manager->priv->upower_kdb_proxy == NULL) + return TRUE; + + now = manager->priv->kbd_brightness_now; + max = manager->priv->kbd_brightness_max; + idle = PERCENTAGE_TO_ABS (0, max, idle_percentage); + if (idle > now) { + g_debug ("kbd brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + return TRUE; + } + ret = upower_kbd_set_brightness (manager, idle, error); + if (!ret) + return FALSE; + + /* save for undim */ + manager->priv->kbd_brightness_pre_dim = now; + return TRUE; +} + +static void +idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode) +{ + gboolean ret = FALSE; + GError *error = NULL; + gint idle_percentage; + GsdPowerActionType action_type; + GnomeSettingsSessionState state; + + if (mode == manager->priv->current_idle_mode) + return; + + /* Ignore attempts to set "less idle" modes */ + if (mode < manager->priv->current_idle_mode && + mode != GSD_POWER_IDLE_MODE_NORMAL) + return; + + /* ensure we're still on an active console */ + state = gnome_settings_session_get_state (manager->priv->session); + if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) { + g_debug ("ignoring state transition to %s as inactive", + idle_mode_to_string (mode)); + return; + } + + manager->priv->current_idle_mode = mode; + g_debug ("Doing a state transition: %s", idle_mode_to_string (mode)); + + /* don't do any power saving if we're a VM */ + if (manager->priv->is_virtual_machine) { + g_debug ("ignoring state transition to %s as virtual machine", + idle_mode_to_string (mode)); + return; + } + + /* save current brightness, and set dim level */ + if (mode == GSD_POWER_IDLE_MODE_DIM) { + + /* have we disabled the action */ + if (up_client_get_on_battery (manager->priv->up_client)) { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-battery"); + } else { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-ac"); + } + if (!ret) { + g_debug ("not dimming due to policy"); + return; + } + + /* display backlight */ + idle_percentage = g_settings_get_int (manager->priv->settings, + "idle-brightness"); + ret = display_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* keyboard backlight */ + ret = kbd_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim kbd backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* turn off screen and kbd */ + } else if (mode == GSD_POWER_IDLE_MODE_BLANK) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + /* sleep */ + } else if (mode == GSD_POWER_IDLE_MODE_SLEEP) { + + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-battery-type"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-ac-type"); + } + do_power_action_type (manager, action_type); + + /* turn on screen and restore user-selected brightness level */ + } else if (mode == GSD_POWER_IDLE_MODE_NORMAL) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on: %s", + error->message); + g_clear_error (&error); + } + + /* reset brightness if we dimmed */ + if (manager->priv->pre_dim_brightness >= 0) { + ret = backlight_set_abs (manager, + manager->priv->pre_dim_brightness, + FALSE, + &error); + if (!ret) { + g_warning ("failed to restore backlight to %i: %s", + manager->priv->pre_dim_brightness, + error->message); + g_clear_error (&error); + } else { + manager->priv->pre_dim_brightness = -1; + } + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_clear_error (&error); + } + } + + /* reset kbd brightness if we dimmed */ + if (manager->priv->kbd_brightness_pre_dim >= 0) { + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_pre_dim, + &error); + if (!ret) { + g_warning ("failed to restore kbd backlight to %i: %s", + manager->priv->kbd_brightness_pre_dim, + error->message); + g_error_free (error); + } + manager->priv->kbd_brightness_pre_dim = -1; + } + + } +} + +static gboolean +idle_is_session_idle (GsdPowerManager *manager) +{ + gboolean ret; + GVariant *result; + guint status; + + /* not yet connected to gnome-session */ + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("session idleness not available, gnome-session is not available"); + return FALSE; + } + + /* get the session status */ + result = g_dbus_proxy_get_cached_property (manager->priv->session_presence_proxy, + "status"); + if (result == NULL) { + g_warning ("no readable status property on %s", + g_dbus_proxy_get_interface_name (manager->priv->session_presence_proxy)); + return FALSE; + } + + g_variant_get (result, "u", &status); + ret = (status == SESSION_STATUS_CODE_IDLE); + g_variant_unref (result); + + return ret; +} + +static gboolean +idle_is_session_inhibited (GsdPowerManager *manager, guint mask) +{ + gboolean ret; + GVariant *retval = NULL; + GError *error = NULL; + + /* not yet connected to gnome-session */ + if (manager->priv->session_proxy == NULL) { + g_warning ("session inhibition not available, gnome-session is not available"); + return FALSE; + } + + retval = g_dbus_proxy_call_sync (manager->priv->session_proxy, + "IsInhibited", + g_variant_new ("(u)", + mask), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + &error); + if (retval == NULL) { + /* abort as the DBUS method failed */ + g_warning ("IsInhibited failed: %s", error->message); + g_error_free (error); + return FALSE; + } + + g_variant_get (retval, "(b)", &ret); + g_variant_unref (retval); + + return ret; +} + +/** + * idle_adjust_timeout: + * @idle_time: Current idle time, in seconds. + * @timeout: The new timeout we want to set, in seconds. + * + * On slow machines, or machines that have lots to load duing login, + * the current idle time could be bigger than the requested timeout. + * In this case the scheduled idle timeout will never fire, unless + * some user activity (keyboard, mouse) resets the current idle time. + * Instead of relying on user activity to correct this issue, we need + * to adjust timeout, as related to current idle time, so the idle + * timeout will fire as designed. + * + * Return value: timeout to set, adjusted acccording to current idle time. + **/ +static guint +idle_adjust_timeout (guint idle_time, guint timeout) +{ + /* allow 2 sec margin for messaging delay. */ + idle_time += 2; + + /* Double timeout until it's larger than current idle time. + * Give up for ultra slow machines. (86400 sec = 24 hours) */ + while (timeout < idle_time && + timeout < 86400 && + timeout > 0) { + timeout *= 2; + } + return timeout; +} + +/** + * idle_adjust_timeout_blank: + * @idle_time: current idle time, in seconds. + * @timeout: the new timeout we want to set, in seconds. + * + * Same as idle_adjust_timeout(), but also accounts for the duration + * of the fading animation in the screensaver (so that blanking happens + * exactly at the end of it, if configured with the same timeouts) + */ +static guint +idle_adjust_timeout_blank (guint idle_time, guint timeout) +{ + return idle_adjust_timeout (idle_time, + timeout + SCREENSAVER_FADE_TIME); +} + +static void +idle_configure (GsdPowerManager *manager) +{ + gboolean is_idle_inhibited; + guint current_idle_time; + guint timeout_blank; + guint timeout_sleep; + gboolean on_battery; + + /* are we inhibited from going idle */ + is_idle_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_IDLE); + if (is_idle_inhibited) { + g_debug ("inhibited, so using normal state"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); + + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + return; + } + + current_idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + + /* set up blank callback even when session is not idle, + * but only if we actually want to blank. */ + on_battery = up_client_get_on_battery (manager->priv->up_client); + if (on_battery) { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-battery"); + } else { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-ac"); + } + if (timeout_blank != 0) { + g_debug ("setting up blank callback for %is", timeout_blank); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID, + idle_adjust_timeout_blank (current_idle_time, timeout_blank) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + } + + /* only do the sleep timeout when the session is idle + * and we aren't inhibited from sleeping */ + if (on_battery) { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-battery-timeout"); + } else { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-ac-timeout"); + } + if (timeout_sleep != 0) { + g_debug ("setting up sleep callback %is", timeout_sleep); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID, + idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + } +} + +/** + * @timeout: The new timeout we want to set, in seconds + **/ +static gboolean +idle_set_timeout_dim (GsdPowerManager *manager, guint timeout) +{ + guint idle_time; + + idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + if (idle_time == 0) + return FALSE; + + g_debug ("Setting dim idle timeout: %ds", timeout); + if (timeout > 0) { + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID, + idle_adjust_timeout (idle_time, timeout) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID); + } + return TRUE; +} + +static void +refresh_idle_dim_settings (GsdPowerManager *manager) +{ + gint timeout_dim; + timeout_dim = g_settings_get_int (manager->priv->settings, + "idle-dim-time"); + g_debug ("idle dim set with timeout %i", timeout_dim); + idle_set_timeout_dim (manager, timeout_dim); +} + +static void +gsd_power_manager_class_init (GsdPowerManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_power_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPowerManagerPrivate)); +} + +static void +sleep_cb_screensaver_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->screensaver_proxy == NULL) { + g_warning ("Could not connect to gnome-screensaver: %s", + error->message); + g_error_free (error); + return; + } + + /* Finish the upower_notify_sleep_cb() call by locking the screen */ + g_debug ("gnome-screensaver activated, doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); +} + +static void +idle_dbus_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 || + g_strcmp0 (signal_name, "InhibitorRemoved") == 0) { + g_debug ("Received gnome session inhibitor change"); + idle_configure (manager); + } + if (g_strcmp0 (signal_name, "StatusChanged") == 0) { + guint status; + + g_variant_get (parameters, "(u)", &status); + g_dbus_proxy_set_cached_property (proxy, "status", + g_variant_new ("u", status)); + g_debug ("Received gnome session status change"); + idle_configure (manager); + } +} + +static void +session_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_proxy == NULL) { + g_warning ("Could not connect to gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (manager->priv->session_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); + } + + idle_configure (manager); +} + +static void +session_presence_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_presence_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("Could not connect to gnome-sesson: %s", + error->message); + g_error_free (error); + return; + } + g_signal_connect (manager->priv->session_presence_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); +} + +static void +power_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *k_now = NULL; + GVariant *k_max = NULL; + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_kdb_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_kdb_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + goto out; + } + + k_now = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_now == NULL) { + if (error->domain != G_DBUS_ERROR || + error->code != G_DBUS_ERROR_UNKNOWN_METHOD) { + g_warning ("Failed to get brightness: %s", + error->message); + } + g_error_free (error); + goto out; + } + + k_max = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetMaxBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_max == NULL) { + g_warning ("Failed to get max brightness: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (k_now, "(i)", &manager->priv->kbd_brightness_now); + g_variant_get (k_max, "(i)", &manager->priv->kbd_brightness_max); + + /* set brightness to max if not currently set so is something + * sensible */ + if (manager->priv->kbd_brightness_now <= 0) { + gboolean ret; + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_max, + &error); + if (!ret) { + g_warning ("failed to initialize kbd backlight to %i: %s", + manager->priv->kbd_brightness_max, + error->message); + g_error_free (error); + } + } +out: + if (k_now != NULL) + g_variant_unref (k_now); + if (k_max != NULL) + g_variant_unref (k_max); +} + +static void +lock_screensaver (GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "lock-enabled"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_sleep_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "ubuntu-lock-on-suspend"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_resume_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* this displays the unlock dialogue so the user doesn't have + * to move the mouse or press any key before the window comes up */ + if (manager->priv->screensaver_proxy != NULL) { + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "SimulateUserActivity", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + } + + /* close existing notifications on resume, the system power + * state is probably different now */ + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after resume: %s", + error->message); + g_error_free (error); + } +} + +static void +idle_send_to_sleep (GsdPowerManager *manager) +{ + gboolean is_inhibited; + gboolean is_idle; + + /* check the session is not now inhibited */ + is_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_SUSPEND); + if (is_inhibited) { + g_debug ("suspend inhibited"); + return; + } + + /* check the session is really idle*/ + is_idle = idle_is_session_idle (manager); + if (!is_idle) { + g_debug ("session is not idle, cannot SLEEP"); + return; + } + + /* send to sleep, and cancel timeout */ + g_debug ("sending to SLEEP"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP); +} + +static void +idle_idletime_alarm_expired_cb (GpmIdletime *idletime, + guint alarm_id, + GsdPowerManager *manager) +{ + g_debug ("idletime alarm: %i", alarm_id); + + switch (alarm_id) { + case GSD_POWER_IDLETIME_DIM_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM); + break; + case GSD_POWER_IDLETIME_BLANK_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK); + break; + case GSD_POWER_IDLETIME_SLEEP_ID: + idle_send_to_sleep (manager); + break; + } +} + +static void +idle_idletime_reset_cb (GpmIdletime *idletime, + GsdPowerManager *manager) +{ + g_debug ("idletime reset"); + + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +static void +engine_settings_key_changed_cb (GSettings *settings, + const gchar *key, + GsdPowerManager *manager) +{ + if (g_strcmp0 (key, "use-time-for-policy") == 0) { + manager->priv->use_time_primary = g_settings_get_boolean (settings, key); + return; + } + if (g_strcmp0 (key, "idle-dim-time") == 0) { + refresh_idle_dim_settings (manager); + return; + } + if (g_str_has_prefix (key, "sleep-inactive") || + g_str_has_prefix (key, "sleep-display")) { + idle_configure (manager); + return; + } +} + +static void +engine_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdPowerManager *manager) +{ + /* when doing the fast-user-switch into a new account, + * ensure the new account is undimmed and with the backlight on */ + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +/* This timer goes off every few minutes, whether the user is idle or not, + to try and clean up anything that has gone wrong. + + It calls disable_builtin_screensaver() so that if xset has been used, + or some other program (like xlock) has messed with the XSetScreenSaver() + settings, they will be set back to sensible values (if a server extension + is in use, messing with xlock can cause the screensaver to never get a wakeup + event, and could cause monitor power-saving to occur, and all manner of + heinousness.) + + This code was originally part of gnome-screensaver, see + http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530 + */ +static gboolean +disable_builtin_screensaver (gpointer unused) +{ + int current_server_timeout, current_server_interval; + int current_prefer_blank, current_allow_exp; + int desired_server_timeout, desired_server_interval; + int desired_prefer_blank, desired_allow_exp; + + XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + ¤t_server_timeout, + ¤t_server_interval, + ¤t_prefer_blank, + ¤t_allow_exp); + + desired_server_timeout = current_server_timeout; + desired_server_interval = current_server_interval; + desired_prefer_blank = current_prefer_blank; + desired_allow_exp = current_allow_exp; + + desired_server_interval = 0; + + /* I suspect (but am not sure) that DontAllowExposures might have + something to do with powering off the monitor as well, at least + on some systems that don't support XDPMS? Who know... */ + desired_allow_exp = AllowExposures; + + /* When we're not using an extension, set the server-side timeout to 0, + so that the server never gets involved with screen blanking, and we + do it all ourselves. (However, when we *are* using an extension, + we tell the server when to notify us, and rather than blanking the + screen, the server will send us an X event telling us to blank.) + */ + desired_server_timeout = 0; + + if (desired_server_timeout != current_server_timeout + || desired_server_interval != current_server_interval + || desired_prefer_blank != current_prefer_blank + || desired_allow_exp != current_allow_exp) { + + g_debug ("disabling server builtin screensaver:" + " (xset s %d %d; xset s %s; xset s %s)", + desired_server_timeout, + desired_server_interval, + (desired_prefer_blank ? "blank" : "noblank"), + (desired_allow_exp ? "expose" : "noexpose")); + + XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + desired_server_timeout, + desired_server_interval, + desired_prefer_blank, + desired_allow_exp); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + } + + return TRUE; +} + +static gboolean +is_hardware_a_virtual_machine (void) +{ + const gchar *str; + gboolean ret = FALSE; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.systemd1.Manager", + "Virtualization"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Virtualization", error->message); + g_error_free (error); + goto out; + } + + /* on bare-metal hardware this is the empty string, + * otherwise an identifier such as "kvm", "vmware", etc. */ + g_variant_get (variant, "(v)", &inner); + str = g_variant_get_string (inner, NULL); + if (str != NULL && str[0] != '\0') + ret = TRUE; +out: + if (connection != NULL) + g_object_unref (connection); + if (variant != NULL) + g_variant_unref (variant); + return ret; +} + +gboolean +gsd_power_manager_start (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting power manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (manager->priv->x11_screen == NULL) + return FALSE; + + /* track the active session */ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (engine_session_active_changed_cb), + manager); + + manager->priv->kbd_brightness_old = -1; + manager->priv->kbd_brightness_pre_dim = -1; + manager->priv->pre_dim_brightness = -1; + manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA); + g_signal_connect (manager->priv->settings, "changed", + G_CALLBACK (engine_settings_key_changed_cb), manager); + manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver"); + manager->priv->up_client = up_client_new (); + g_signal_connect (manager->priv->up_client, "notify-sleep", + G_CALLBACK (upower_notify_sleep_cb), manager); + g_signal_connect (manager->priv->up_client, "notify-resume", + G_CALLBACK (upower_notify_resume_cb), manager); + manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client); + g_signal_connect (manager->priv->up_client, "device-added", + G_CALLBACK (engine_device_added_cb), manager); + g_signal_connect (manager->priv->up_client, "device-removed", + G_CALLBACK (engine_device_removed_cb), manager); + g_signal_connect (manager->priv->up_client, "device-changed", + G_CALLBACK (engine_device_changed_cb), manager); + g_signal_connect_after (manager->priv->up_client, "changed", + G_CALLBACK (up_client_changed_cb), manager); + + /* use the fallback name from gnome-power-manager so the shell + * blocks this, and uses the power extension instead */ + manager->priv->status_icon = gtk_status_icon_new (); + gtk_status_icon_set_name (manager->priv->status_icon, + "gnome-power-manager"); + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH, + UPOWER_DBUS_INTERFACE, + NULL, + power_proxy_ready_cb, + manager); + + /* connect to UPower for keyboard backlight control */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH_KBDBACKLIGHT, + UPOWER_DBUS_INTERFACE_KBDBACKLIGHT, + NULL, + power_keyboard_proxy_ready_cb, + manager); + + /* connect to the session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + session_proxy_ready_cb, + manager); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + 0, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH_PRESENCE, + GNOME_SESSION_DBUS_INTERFACE_PRESENCE, + NULL, + session_presence_proxy_ready_cb, + manager); + + manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref); + manager->priv->canberra_context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + + manager->priv->phone = gpm_phone_new (); + g_signal_connect (manager->priv->phone, "device-added", + G_CALLBACK (phone_device_added_cb), manager); + g_signal_connect (manager->priv->phone, "device-removed", + G_CALLBACK (phone_device_removed_cb), manager); + g_signal_connect (manager->priv->phone, "device-refresh", + G_CALLBACK (phone_device_refresh_cb), manager); + + /* create a fake virtual composite battery */ + manager->priv->device_composite = up_device_new (); + g_object_set (manager->priv->device_composite, + "kind", UP_DEVICE_KIND_BATTERY, + "is-rechargeable", TRUE, + "native-path", "dummy:composite_battery", + "power-supply", TRUE, + "is-present", TRUE, + NULL); + + /* get percentage policy */ + manager->priv->low_percentage = g_settings_get_int (manager->priv->settings, + "percentage-low"); + manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings, + "percentage-critical"); + manager->priv->action_percentage = g_settings_get_int (manager->priv->settings, + "percentage-action"); + + /* get time policy */ + manager->priv->low_time = g_settings_get_int (manager->priv->settings, + "time-low"); + manager->priv->critical_time = g_settings_get_int (manager->priv->settings, + "time-critical"); + manager->priv->action_time = g_settings_get_int (manager->priv->settings, + "time-action"); + + /* we can disable this if the time remaining is inaccurate or just plain wrong */ + manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings, + "use-time-for-policy"); + + /* create IDLETIME watcher */ + manager->priv->idletime = gpm_idletime_new (); + g_signal_connect (manager->priv->idletime, "reset", + G_CALLBACK (idle_idletime_reset_cb), manager); + g_signal_connect (manager->priv->idletime, "alarm-expired", + G_CALLBACK (idle_idletime_alarm_expired_cb), manager); + + /* ensure the default dpms timeouts are cleared */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + error); + if (!ret) { + g_warning ("Failed set DPMS mode: %s", (*error)->message); + g_clear_error (error); + } + + /* coldplug the engine */ + engine_coldplug (manager); + + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); + /* don't blank inside a VM */ + manager->priv->is_virtual_machine = is_hardware_a_virtual_machine (); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_power_manager_stop (GsdPowerManager *manager) +{ + g_debug ("Stopping power manager"); + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + kill_lid_close_safety_timer (manager); + + g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager); + + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->session); + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->settings_screensaver); + g_clear_object (&manager->priv->up_client); + g_clear_object (&manager->priv->x11_screen); + + g_ptr_array_unref (manager->priv->devices_array); + manager->priv->devices_array = NULL; + g_clear_object (&manager->priv->phone); + g_clear_object (&manager->priv->device_composite); + g_clear_object (&manager->priv->previous_icon); + + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = NULL; + + g_clear_object (&manager->priv->upower_proxy); + g_clear_object (&manager->priv->session_proxy); + g_clear_object (&manager->priv->session_presence_proxy); + + if (manager->priv->critical_alert_timeout_id > 0) { + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); + + if (manager->priv->xscreensaver_watchdog_timer_id > 0) { + g_source_remove (manager->priv->xscreensaver_watchdog_timer_id); + manager->priv->xscreensaver_watchdog_timer_id = 0; + } +} + +static void +gsd_power_manager_init (GsdPowerManager *manager) +{ + manager->priv = GSD_POWER_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_power_manager_finalize (GObject *object) +{ + GsdPowerManager *manager; + + manager = GSD_POWER_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + + G_OBJECT_CLASS (gsd_power_manager_parent_class)->finalize (object); +} + +/* returns new level */ +static void +handle_method_call_keyboard (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint step; + gint value = -1; + gboolean ret; + guint percentage; + GError *error = NULL; + + if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("keyboard step up"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MIN (manager->priv->kbd_brightness_now + step, + manager->priv->kbd_brightness_max); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("keyboard step down"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MAX (manager->priv->kbd_brightness_now - step, 0); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "Toggle") == 0) { + ret = upower_kbd_toggle (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (!ret) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + percentage = ABS_TO_PERCENTAGE (0, + manager->priv->kbd_brightness_max, + value); + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + percentage)); + } +} + +static void +handle_method_call_screen (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gboolean ret = FALSE; + gint value = -1; + guint value_tmp; + GError *error = NULL; + + if (g_strcmp0 (method_name, "GetPercentage") == 0) { + g_debug ("screen get percentage"); + value = backlight_get_percentage (manager, &error); + + } else if (g_strcmp0 (method_name, "SetPercentage") == 0) { + g_debug ("screen set percentage"); + g_variant_get (parameters, "(u)", &value_tmp); + ret = backlight_set_percentage (manager, value_tmp, TRUE, &error); + if (ret) + value = value_tmp; + + } else if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("screen step up"); + value = backlight_step_up (manager, &error); + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("screen step down"); + value = backlight_step_down (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (value < 0) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + value)); + } +} + +static GVariant * +device_to_variant_blob (UpDevice *device) +{ + const gchar *object_path; + gchar *device_icon; + gdouble percentage; + GIcon *icon; + guint64 time_empty, time_full; + guint64 time_state = 0; + GVariant *value; + UpDeviceKind kind; + UpDeviceState state; + + icon = gpm_upower_get_device_icon (device, TRUE); + device_icon = g_icon_to_string (icon); + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "state", &state, + "time-to-empty", &time_empty, + "time-to-full", &time_full, + NULL); + + /* only return time for these simple states */ + if (state == UP_DEVICE_STATE_DISCHARGING) + time_state = time_empty; + else if (state == UP_DEVICE_STATE_CHARGING) + time_state = time_full; + + /* get an object path, even for the composite device */ + object_path = up_device_get_object_path (device); + if (object_path == NULL) + object_path = GSD_DBUS_PATH; + + /* format complex object */ + value = g_variant_new ("(susdut)", + object_path, + kind, + device_icon, + percentage, + state, + time_state); + g_free (device_icon); + g_object_unref (icon); + return value; +} + +static void +handle_method_call_main (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GPtrArray *array; + guint i; + GVariantBuilder *builder; + GVariant *tuple = NULL; + GVariant *value = NULL; + UpDevice *device; + + /* return object */ + if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) { + + /* get the virtual device */ + device = engine_get_primary_device (manager); + if (device == NULL) { + g_dbus_method_invocation_return_dbus_error (invocation, + "org.gnome.SettingsDaemon.Power.Failed", + "There is no primary device."); + return; + } + + /* return the value */ + value = device_to_variant_blob (device); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_object_unref (device); + return; + } + + /* return array */ + if (g_strcmp0 (method_name, "GetDevices") == 0) { + + /* create builder */ + builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)")); + + /* add each tuple to the array */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + value = device_to_variant_blob (device); + g_variant_builder_add_value (builder, value); + } + + /* return the value */ + value = g_variant_builder_end (builder); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_variant_builder_unref (builder); + return; + } + + g_assert_not_reached (); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for Power", + interface_name, method_name); + + if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE) == 0) { + handle_method_call_main (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_SCREEN) == 0) { + handle_method_call_screen (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_KEYBOARD) == 0) { + handle_method_call_keyboard (manager, + method_name, + parameters, + invocation); + } else { + g_warning ("not recognised interface: %s", interface_name); + } +} + +static GVariant * +handle_get_property (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + GVariant *retval = NULL; + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return NULL; + } + + if (g_strcmp0 (property_name, "Icon") == 0) { + retval = engine_get_icon_property_variant (manager); + } else if (g_strcmp0 (property_name, "Tooltip") == 0) { + retval = engine_get_tooltip_property_variant (manager); + } + + return retval; +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdPowerManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + guint i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_POWER_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdPowerManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdPowerManager * +gsd_power_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_POWER_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + return GSD_POWER_MANAGER (manager_object); +} diff --git a/.pc/61_unity_use_application_indicator.patch/configure.ac b/.pc/61_unity_use_application_indicator.patch/configure.ac new file mode 100644 index 00000000..7baa25e8 --- /dev/null +++ b/.pc/61_unity_use_application_indicator.patch/configure.ac @@ -0,0 +1,581 @@ +AC_PREREQ([2.60]) + +AC_INIT([gnome-settings-daemon], + [3.6.4], + [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon]) + +AC_CONFIG_SRCDIR([gnome-settings-daemon/gnome-settings-manager.c]) + +AM_INIT_AUTOMAKE([1.9 tar-ustar dist-xz no-dist-gzip check-news]) +AM_MAINTAINER_MODE([enable]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +m4_define([gsd_api_version_major],[3]) +m4_define([gsd_api_version_minor],[0]) +m4_define([gsd_api_version],[gsd_api_version_major.gsd_api_version_minor]) +GSD_API_VERSION="gsd_api_version" +AC_SUBST(GSD_API_VERSION) + +AC_STDC_HEADERS +AC_PROG_CXX +AM_PROG_CC_C_O +AC_PROG_LIBTOOL + +AC_HEADER_STDC + +AC_SUBST(VERSION) + +AC_CONFIG_HEADERS([config.h]) + +IT_PROG_INTLTOOL([0.37.1]) + +GETTEXT_PACKAGE=gnome-settings-daemon +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain]) + +AM_GLIB_GNU_GETTEXT + +GSD_INTLTOOL_PLUGIN_RULE='%.gnome-settings-plugin: %.gnome-settings-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +AC_SUBST([GSD_INTLTOOL_PLUGIN_RULE]) + +dnl --------------------------------------------------------------------------- +dnl - Dependencies +dnl --------------------------------------------------------------------------- + +GLIB_REQUIRED_VERSION=2.31.0 +GTK_REQUIRED_VERSION=3.3.18 +GCONF_REQUIRED_VERSION=2.6.1 +GIO_REQUIRED_VERSION=2.26.0 +GNOME_DESKTOP_REQUIRED_VERSION=3.5.3 +LIBNOTIFY_REQUIRED_VERSION=0.7.3 +UPOWER_GLIB_REQUIRED_VERSION=0.9.1 +PA_REQUIRED_VERSION=0.9.16 +LIBWACOM_REQUIRED_VERSION=0.6 +UPOWER_REQUIRED_VERSION=0.9.11 +IBUS_REQUIRED_VERSION=1.4.99 + +EXTRA_COMPILE_WARNINGS(yes) + +PKG_CHECK_MODULES(SETTINGS_DAEMON, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +) + +PKG_CHECK_MODULES(SETTINGS_PLUGIN, + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +) + +GSD_PLUGIN_LDFLAGS="-export_dynamic -module -avoid-version -no-undefined" +case $host_os in + darwin*) + GSD_PLUGIN_LDFLAGS="${GSD_PLUGIN_LDFLAGS} -Wl,-bundle_loader,\$(top_builddir)/gnome-settings-daemon/gnome-settings-daemon" + ;; +esac +AC_SUBST([GSD_PLUGIN_LDFLAGS]) + +AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + +dnl ================================================================ +dnl GSettings stuff +dnl ================================================================ + +GLIB_GSETTINGS + +dnl --------------------------------------------------------------------------- +dnl - Check for gnome-desktop +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Check for LCMS2 +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2, have_new_lcms=yes, have_new_lcms=no) +if test x$have_new_lcms = xyes; then + AC_DEFINE(HAVE_NEW_LCMS,1,[Got new lcms2]) +else + PKG_CHECK_MODULES(LCMS, lcms2) +fi + +dnl --------------------------------------------------------------------------- +dnl - Check for libnotify +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_libnotify=yes], have_libnotify=no) +if test "x$have_libnotify" = xno ; then + AC_MSG_ERROR([libnotify is required to build gnome-settings-daemon]) +fi +AC_SUBST(LIBNOTIFY_CFLAGS) +AC_SUBST(LIBNOTIFY_LIBS) + +dnl --------------------------------------------------------------------------- +dnl - GUdev integration (default enabled) +dnl --------------------------------------------------------------------------- +GUDEV_PKG="" +AC_ARG_ENABLE(gudev, AS_HELP_STRING([--disable-gudev],[Disable GUdev support (not optional on Linux platforms)]), enable_gudev=$enableval) +if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(GUDEV, gudev-1.0, have_gudev="yes", have_gudev="no") + if test "x$have_gudev" = "xyes"; then + AC_DEFINE(HAVE_GUDEV, 1, [define if GUdev is available]) + GUDEV_PKG="gudev-1.0" + else + if test x$enable_gudev = xyes; then + AC_MSG_ERROR([GUdev enabled but not found]) + fi + fi +else + have_gudev=no +fi +AM_CONDITIONAL(HAVE_GUDEV, test x$have_gudev = xyes) + +dnl --------------------------------------------------------------------------- +dnl - common +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COMMON, x11 kbproto xi) + +dnl --------------------------------------------------------------------------- +dnl - automount +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(AUTOMOUNT, x11 kbproto) + +dnl --------------------------------------------------------------------------- +dnl - background +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(BACKGROUND, x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - mouse +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MOUSE, x11 xi) + +dnl --------------------------------------------------------------------------- +dnl - cursor +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(CURSOR, xfixes) + +dnl --------------------------------------------------------------------------- +dnl - xsettings +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XSETTINGS, fontconfig) + +dnl --------------------------------------------------------------------------- +dnl - Keyboard plugin stuff +dnl --------------------------------------------------------------------------- + +AC_ARG_ENABLE(ibus, + AS_HELP_STRING([--disable-ibus], + [Disable IBus support]), + enable_ibus=$enableval, + enable_ibus=yes) + +if test "x$enable_ibus" = "xyes" ; then + IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" + AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled]) +else + IBUS_MODULE= +fi +AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes") + +PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Housekeeping plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(GIOUNIX, [gio-unix-2.0]) + +dnl --------------------------------------------------------------------------- +dnl - media-keys plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra libnotify]) + +dnl --------------------------------------------------------------------------- +dnl - xrandr plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XRANDR, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION]) + +dnl --------------------------------------------------------------------------- +dnl - orientation plugin stuff +dnl --------------------------------------------------------------------------- + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(ORIENTATION, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0]) +fi + +dnl --------------------------------------------------------------------------- +dnl - sound plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(SOUND, [libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION]) + +# --------------------------------------------------------------------------- +# Power +# --------------------------------------------------------------------------- +PKG_CHECK_MODULES(POWER, upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext) + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(BACKLIGHT_HELPER, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ) +fi + +dnl --------------------------------------------------------------------------- +dnl - color +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COLOR, [colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3]) + +dnl --------------------------------------------------------------------------- +dnl - wacom (disabled for s390/s390x and non Linux platforms) +dnl --------------------------------------------------------------------------- + +case $host_os in + linux*) + if test "$host_cpu" = s390 -o "$host_cpu" = s390x; then + have_wacom=no + else + if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(WACOM, [libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom]) + else + AC_MSG_ERROR([GUdev is necessary to compile Wacom support]) + fi + have_wacom=yes + fi + ;; + *) + have_wacom=no + ;; +esac +AM_CONDITIONAL(HAVE_WACOM, test x$have_wacom = xyes) + +dnl ============================================== +dnl PackageKit section +dnl ============================================== + +have_packagekit=false +AC_ARG_ENABLE(packagekit, + AC_HELP_STRING([--disable-packagekit], + [turn off PackageKit support]), + [case "${enableval}" in + yes) WANT_PACKAGEKIT=yes ;; + no) WANT_PACKAGEKIT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-packagekit) ;; + esac], + [WANT_PACKAGEKIT=yes]) dnl Default value + +if test x$WANT_PACKAGEKIT = xyes ; then + PK_REQUIRED_VERSION=0.7.4 + PKG_CHECK_MODULES(PACKAGEKIT, glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_packagekit=true + AC_DEFINE(HAVE_PACKAGEKIT, 1, [Define if PackageKit should be used])], + [have_packagekit=false]) +fi +AM_CONDITIONAL(HAVE_PACKAGEKIT, test "x$have_packagekit" = "xtrue") + +AC_SUBST(PACKAGEKIT_CFLAGS) +AC_SUBST(PACKAGEKIT_LIBS) + +dnl ============================================== +dnl smartcard section +dnl ============================================== +have_smartcard_support=false +AC_ARG_ENABLE(smartcard-support, + AC_HELP_STRING([--disable-smartcard-support], + [turn off smartcard support]), + [case "${enableval}" in + yes) WANT_SMARTCARD_SUPPORT=yes ;; + no) WANT_SMARTCARD_SUPPORT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-smartcard-support) ;; + esac], + [WANT_SMARTCARD_SUPPORT=yes]) + +if test x$WANT_SMARTCARD_SUPPORT = xyes ; then + NSS_REQUIRED_VERSION=3.11.2 + PKG_CHECK_MODULES(NSS, nss >= $NSS_REQUIRED_VERSION, + [have_smartcard_support=true + AC_DEFINE(SMARTCARD_SUPPORT, 1, [Define if smartcard support should be enabled])], + [have_smartcard_support=false]) +fi +AM_CONDITIONAL(SMARTCARD_SUPPORT, test "x$have_smartcard_support" = "xtrue") + +AC_SUBST(NSS_CFLAGS) +AC_SUBST(NSS_LIBS) + +AC_ARG_WITH(nssdb, + AC_HELP_STRING([--with-nssdb], + [where system NSS database is])) + +NSS_DATABASE="" +if test "x$have_smartcard_support" = "xtrue"; then + if ! test -z "$with_nssdb" ; then + NSS_DATABASE="$with_nssdb" + else + NSS_DATABASE="${sysconfdir}/pki/nssdb" + fi +else + if ! test -z "$with_nssdb" ; then + AC_MSG_WARN([nssdb specified when smartcard support is disabled]) + fi +fi + +AC_SUBST(NSS_DATABASE) + + +dnl ============================================== +dnl systemd check +dnl ============================================== + +AC_ARG_ENABLE([systemd], + AS_HELP_STRING([--enable-systemd], [Use systemd for session tracking]), + [with_systemd=$enableval], + [with_systemd=no]) +if test "$with_systemd" = "yes" ; then + PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login]) + AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking]) + SESSION_TRACKING=systemd +else + SESSION_TRACKING=ConsoleKit +fi + +AC_SUBST(SYSTEMD_CFLAGS) +AC_SUBST(SYSTEMD_LIBS) + +AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = "yes"], [Using systemd]) + +# --------------------------------------------------------------------------- +# CUPS +# --------------------------------------------------------------------------- + +AC_ARG_ENABLE(cups, + AS_HELP_STRING([--disable-cups], [disable CUPS support (default: enabled)]),, + enable_cups=yes) + +if test x"$enable_cups" != x"no" ; then + AC_PROG_SED + + AC_PATH_PROG(CUPS_CONFIG, cups-config) + + if test x$CUPS_CONFIG = x; then + AC_MSG_ERROR([cups-config not found but CUPS support requested]) + fi + + CUPS_API_VERSION=`$CUPS_CONFIG --api-version` + CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 1` + CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 2` + + AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h],, + AC_MSG_ERROR([CUPS headers not found but CUPS support requested])) + + if ! test $CUPS_API_MAJOR -gt 1 -o \ + $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4 ; then + AC_MSG_ERROR([CUPS 1.4 or newer not found, but CUPS support requested]) + fi + + CUPS_CFLAGS=`$CUPS_CONFIG --cflags | $SED -e 's/-O\w*//g' -e 's/-m\w*//g'` + CUPS_LIBS=`$CUPS_CONFIG --libs` + AC_SUBST(CUPS_CFLAGS) + AC_SUBST(CUPS_LIBS) +fi + +AM_CONDITIONAL(BUILD_PRINT_NOTIFICATIONS, [test x"$enable_cups" = x"yes"]) + +# --------------------------------------------------------------------------- +# Enable Profiling +# --------------------------------------------------------------------------- +AC_ARG_ENABLE(profiling, + [AC_HELP_STRING([--enable-profiling], + [turn on profiling])], + , enable_profiling=no) +if test "x$enable_profiling" = "xyes"; then + AC_DEFINE(ENABLE_PROFILING,1,[enable profiling]) +fi + + +# --------------------------------------------------------------------------- +# Plugins +# --------------------------------------------------------------------------- + +plugindir='$(libdir)/gnome-settings-daemon-gsd_api_version' +AC_SUBST([plugindir]) + +PLUGIN_CFLAGS="-DG_LOG_DOMAIN=\"\\\"\$(plugin_name)-plugin\\\"\" -DPLUGIN_NAME=\"\\\"\$(plugin_name)\\\"\" " +AC_SUBST(PLUGIN_CFLAGS) + +AC_ARG_ENABLE(man, + [AS_HELP_STRING([--enable-man], + [generate man pages [default=yes]])],, + enable_man=yes) +if test "$enable_man" != no; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test -z "$XSLTPROC"; then + AC_MSG_ERROR([xsltproc is required for --enable-man]) + fi +fi +AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) + +dnl --------------------------------------------------------------------------- +dnl - Finish +dnl --------------------------------------------------------------------------- + + +# Turn on the additional warnings last, so warnings don't affect other tests. + +AC_ARG_ENABLE(more-warnings, + [AC_HELP_STRING([--enable-more-warnings], + [Maximum compiler warnings])], + set_more_warnings="$enableval",[ + if test -d $srcdir/.git; then + set_more_warnings=yes + else + set_more_warnings=no + fi + ]) +AC_MSG_CHECKING(for more warnings) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + CFLAGS="\ + -Wall \ + -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ + -Wnested-externs -Wpointer-arith \ + -Wcast-align -Wsign-compare \ + $CFLAGS" + + for option in -Wno-strict-aliasing -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + AC_MSG_RESULT($has_option) + unset has_option + unset SAVE_CFLAGS + done + unset option +else + AC_MSG_RESULT(no) +fi + +# +# Enable Debug +# +AC_ARG_ENABLE(debug, + [AC_HELP_STRING([--enable-debug], + [turn on debugging])], + , enable_debug=yes) +if test "$enable_debug" = "yes"; then + DEBUG_CFLAGS="-DG_ENABLE_DEBUG" +else + if test "x$enable_debug" = "xno"; then + DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" + else + DEBUG_CFLAGS="" + fi +fi +AC_SUBST(DEBUG_CFLAGS) + +AC_OUTPUT([ +Makefile +gnome-settings-daemon/Makefile +plugins/Makefile +plugins/a11y-keyboard/Makefile +plugins/a11y-settings/Makefile +plugins/automount/Makefile +plugins/background/Makefile +plugins/clipboard/Makefile +plugins/color/Makefile +plugins/common/Makefile +plugins/cursor/Makefile +plugins/dummy/Makefile +plugins/power/Makefile +plugins/housekeeping/Makefile +plugins/keyboard/Makefile +plugins/media-keys/Makefile +plugins/media-keys/cut-n-paste/Makefile +plugins/mouse/Makefile +plugins/orientation/Makefile +plugins/print-notifications/Makefile +plugins/screensaver-proxy/Makefile +plugins/smartcard/Makefile +plugins/sound/Makefile +plugins/updates/Makefile +plugins/wacom/Makefile +plugins/xrandr/Makefile +plugins/xsettings/Makefile +data/Makefile +data/gnome-settings-daemon.pc +data/gnome-settings-daemon-uninstalled.pc +data/org.gnome.settings-daemon.plugins.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in +data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in +data/org.gnome.settings-daemon.plugins.power.gschema.xml.in +data/org.gnome.settings-daemon.plugins.color.gschema.xml.in +data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.gschema.xml.in +data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in +data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in +data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in +data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in +po/Makefile.in +man/Makefile +]) + +dnl --------------------------------------------------------------------------- +dnl - Show summary +dnl --------------------------------------------------------------------------- + +echo " + gnome-settings-daemon $VERSION + ============================= + + prefix: ${prefix} + exec_prefix: ${exec_prefix} + libdir: ${libdir} + bindir: ${bindir} + sbindir: ${sbindir} + sysconfdir: ${sysconfdir} + sysconfsubdir: ${sysconfsubdir} + localstatedir: ${localstatedir} + plugindir: ${plugindir} + datadir: ${datadir} + source code location: ${srcdir} + compiler: ${CC} + cflags: ${CFLAGS} + Maintainer mode: ${USE_MAINTAINER_MODE} + + Session tracking: ${SESSION_TRACKING} + LCMS DICT support: ${have_new_lcms} + IBus support: ${enable_ibus} + Libnotify support: ${have_libnotify} + PackageKit support: ${have_packagekit} + Smartcard support: ${have_smartcard_support} + Cups support: ${enable_cups} + Wacom support: ${have_wacom} +${NSS_DATABASE:+\ + System nssdb: ${NSS_DATABASE} +}\ + Profiling support: ${enable_profiling} +" diff --git a/.pc/61_unity_use_application_indicator.patch/plugins/a11y-keyboard/Makefile.am b/.pc/61_unity_use_application_indicator.patch/plugins/a11y-keyboard/Makefile.am new file mode 100644 index 00000000..912800a5 --- /dev/null +++ b/.pc/61_unity_use_application_indicator.patch/plugins/a11y-keyboard/Makefile.am @@ -0,0 +1,113 @@ +NULL = + +plugin_name = a11y-keyboard + +gtkbuilderdir = $(pkgdatadir) +gtkbuilder_DATA = \ + gsd-a11y-preferences-dialog.ui \ + $(NULL) + +noinst_PROGRAMS = test-a11y-preferences-dialog + +libexec_PROGRAMS = gsd-test-a11y-keyboard + +gsd_test_a11y_keyboard_SOURCES = \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-keyboard.c + +gsd_test_a11y_keyboard_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + $(PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_a11y_keyboard_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(LIBNOTIFY_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +test_a11y_preferences_dialog_SOURCES = \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-preferences-dialog.c \ + $(NULL) + +test_a11y_preferences_dialog_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_a11y_preferences_dialog_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_a11y_preferences_dialog_LDADD = \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + liba11y-keyboard.la \ + $(NULL) + +liba11y_keyboard_la_SOURCES = \ + gsd-a11y-keyboard-plugin.h \ + gsd-a11y-keyboard-plugin.c \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.h \ + gsd-a11y-preferences-dialog.c \ + $(NULL) + +liba11y_keyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(gtkbuilderdir)"\" \ + $(AM_CPPFLAGS) + +liba11y_keyboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_keyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +liba11y_keyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(LIBNOTIFY_LIBS) \ + $(NULL) + +plugin_in_files = \ + a11y-keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(gtkbuilder_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/.pc/61_unity_use_application_indicator.patch/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/.pc/61_unity_use_application_indicator.patch/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c new file mode 100644 index 00000000..a227dd4d --- /dev/null +++ b/.pc/61_unity_use_application_indicator.patch/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c @@ -0,0 +1,1158 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-a11y-keyboard-manager.h" +#include "gsd-a11y-preferences-dialog.h" + +#define KEYBOARD_A11Y_SCHEMA "org.gnome.desktop.a11y.keyboard" +#define NOTIFICATION_TIMEOUT 30 + +#define GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerPrivate)) + +struct GsdA11yKeyboardManagerPrivate +{ + guint start_idle_id; + int xkbEventBase; + GdkDeviceManager *device_manager; + guint device_added_id; + gboolean stickykeys_shortcut_val; + gboolean slowkeys_shortcut_val; + GtkWidget *stickykeys_alert; + GtkWidget *slowkeys_alert; + GtkWidget *preferences_dialog; + GtkStatusIcon *status_icon; + + GSettings *settings; + + NotifyNotification *notification; +}; + +static void gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass); +static void gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *a11y_keyboard_manager); +static void gsd_a11y_keyboard_manager_finalize (GObject *object); +static void gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager); +static void set_server_from_gsettings (GsdA11yKeyboardManager *manager); + +G_DEFINE_TYPE (GsdA11yKeyboardManager, gsd_a11y_keyboard_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdA11yKeyboardManager *manager) +{ + if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) + set_server_from_gsettings (manager); +} + +static void +set_devicepresence_handler (GsdA11yKeyboardManager *manager) +{ + GdkDeviceManager *device_manager; + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + if (device_manager == NULL) + return; + + manager->priv->device_manager = device_manager; + manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (device_added_cb), manager); +} + +static gboolean +xkb_enabled (GsdA11yKeyboardManager *manager) +{ + int opcode, errorBase, major, minor; + + if (!XkbQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + &opcode, + &manager->priv->xkbEventBase, + &errorBase, + &major, + &minor)) + return FALSE; + + if (!XkbUseExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor)) + return FALSE; + + return TRUE; +} + +static XkbDescRec * +get_xkb_desc_rec (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + Status status = Success; + + gdk_error_trap_push (); + desc = XkbGetMap (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XkbAllMapComponentsMask, XkbUseCoreKbd); + if (desc != NULL) { + desc->ctrls = NULL; + status = XkbGetControls (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XkbAllControlsMask, desc); + } + gdk_error_trap_pop_ignored (); + + g_return_val_if_fail (desc != NULL, NULL); + g_return_val_if_fail (desc->ctrls != NULL, NULL); + g_return_val_if_fail (status == Success, NULL); + + return desc; +} + +static int +get_int (GSettings *settings, + char const *key) +{ + int res = g_settings_get_int (settings, key); + if (res <= 0) { + res = 1; + } + return res; +} + +static gboolean +set_int (GSettings *settings, + char const *key, + int val) +{ + int prev_val; + + prev_val = g_settings_get_int (settings, key); + g_settings_set_int (settings, key, val); + if (val != prev_val) { + g_debug ("%s changed", key); + } + + return val != prev_val; +} + +static gboolean +set_bool (GSettings *settings, + char const *key, + int val) +{ + gboolean bval = (val != 0); + gboolean prev_val; + + prev_val = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, bval ? TRUE : FALSE); + if (bval != prev_val) { + g_debug ("%s changed", key); + return TRUE; + } + return (bval != prev_val); +} + +static unsigned long +set_clear (gboolean flag, + unsigned long value, + unsigned long mask) +{ + if (flag) { + return value | mask; + } + return value & ~mask; +} + +static gboolean +set_ctrl_from_gsettings (XkbDescRec *desc, + GSettings *settings, + char const *key, + unsigned long mask) +{ + gboolean result = g_settings_get_boolean (settings, key); + desc->ctrls->enabled_ctrls = set_clear (result, desc->ctrls->enabled_ctrls, mask); + return result; +} + +static void +set_server_from_gsettings (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + gboolean enable_accessX; + GSettings *settings; + + gnome_settings_profile_start (NULL); + + desc = get_xkb_desc_rec (manager); + if (!desc) { + return; + } + + settings = manager->priv->settings; + + /* general */ + enable_accessX = g_settings_get_boolean (settings, "enable"); + + desc->ctrls->enabled_ctrls = set_clear (enable_accessX, + desc->ctrls->enabled_ctrls, + XkbAccessXKeysMask); + + if (set_ctrl_from_gsettings (desc, settings, "timeout-enable", + XkbAccessXTimeoutMask)) { + desc->ctrls->ax_timeout = get_int (settings, "disable-timeout"); + /* disable only the master flag via the server we will disable + * the rest on the rebound without affecting GSettings state + * don't change the option flags at all. + */ + desc->ctrls->axt_ctrls_mask = XkbAccessXKeysMask | XkbAccessXFeedbackMask; + desc->ctrls->axt_ctrls_values = 0; + desc->ctrls->axt_opts_mask = 0; + } + + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "feature-state-change-beep"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask); + + /* bounce keys */ + if (set_ctrl_from_gsettings (desc, settings, "bouncekeys-enable", XkbBounceKeysMask)) { + desc->ctrls->debounce_delay = get_int (settings, "bouncekeys-delay"); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "bouncekeys-beep-reject"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_BKRejectFBMask); + } + + /* mouse keys */ + if (set_ctrl_from_gsettings (desc, settings, "mousekeys-enable", XkbMouseKeysMask | XkbMouseKeysAccelMask)) { + desc->ctrls->mk_interval = 100; /* msec between mousekey events */ + desc->ctrls->mk_curve = 50; + + /* We store pixels / sec, XKB wants pixels / event */ + desc->ctrls->mk_max_speed = get_int (settings, "mousekeys-max-speed") / (1000 / desc->ctrls->mk_interval); + if (desc->ctrls->mk_max_speed <= 0) + desc->ctrls->mk_max_speed = 1; + + desc->ctrls->mk_time_to_max = get_int (settings, /* events before max */ + "mousekeys-accel-time") / desc->ctrls->mk_interval; + if (desc->ctrls->mk_time_to_max <= 0) + desc->ctrls->mk_time_to_max = 1; + + desc->ctrls->mk_delay = get_int (settings, /* ms before 1st event */ + "mousekeys-init-delay"); + } + + /* slow keys */ + if (set_ctrl_from_gsettings (desc, settings, "slowkeys-enable", XkbSlowKeysMask)) { + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-press"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKPressFBMask); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-accept"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKAcceptFBMask); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-reject"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKRejectFBMask); + desc->ctrls->slow_keys_delay = get_int (settings, "slowkeys-delay"); + /* anything larger than 500 seems to loose all keyboard input */ + if (desc->ctrls->slow_keys_delay > 500) + desc->ctrls->slow_keys_delay = 500; + } + + /* sticky keys */ + if (set_ctrl_from_gsettings (desc, settings, "stickykeys-enable", XkbStickyKeysMask)) { + desc->ctrls->ax_options |= XkbAX_LatchToLockMask; + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "stickykeys-two-key-off"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_TwoKeysMask); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "stickykeys-modifier-beep"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_StickyKeysFBMask); + } + + /* toggle keys */ + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "togglekeys-enable"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask); + + /* + g_debug ("CHANGE to : 0x%x", desc->ctrls->enabled_ctrls); + g_debug ("CHANGE to : 0x%x (2)", desc->ctrls->ax_options); + */ + + gdk_error_trap_push (); + XkbSetControls (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XkbSlowKeysMask | + XkbBounceKeysMask | + XkbStickyKeysMask | + XkbMouseKeysMask | + XkbMouseKeysAccelMask | + XkbAccessXKeysMask | + XkbAccessXTimeoutMask | + XkbAccessXFeedbackMask | + XkbControlsEnabledMask, + desc); + + XkbFreeKeyboard (desc, XkbAllComponentsMask, True); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + gdk_error_trap_pop_ignored (); + + gnome_settings_profile_end (NULL); +} + +static gboolean +ax_response_callback (GsdA11yKeyboardManager *manager, + GtkWindow *parent, + gint response_id, + guint revert_controls_mask, + gboolean enabled) +{ + GSettings *settings; + GdkScreen *screen; + GError *err; + + settings = manager->priv->settings; + + switch (response_id) { + case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_REJECT: + case GTK_RESPONSE_CANCEL: + + /* we're reverting, so we invert sense of 'enabled' flag */ + g_debug ("cancelling AccessX request"); + if (revert_controls_mask == XkbStickyKeysMask) { + g_settings_set_boolean (settings, + "stickykeys-enable", + !enabled); + } else if (revert_controls_mask == XkbSlowKeysMask) { + g_settings_set_boolean (settings, + "slowkeys-enable", + !enabled); + } + + set_server_from_gsettings (manager); + break; + + case GTK_RESPONSE_HELP: + if (!parent) + screen = gdk_screen_get_default (); + else + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); + + err = NULL; + if (!gtk_show_uri (screen, + "help:gnome-help/a11y", + gtk_get_current_event_time(), + &err)) { + GtkWidget *error_dialog = gtk_message_dialog_new (parent, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("There was an error displaying help: %s"), + err->message); + g_signal_connect (error_dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE); + gtk_widget_show (error_dialog); + g_error_free (err); + } + return FALSE; + default: + break; + } + return TRUE; +} + +static void +ax_stickykeys_response (GtkDialog *dialog, + gint response_id, + GsdA11yKeyboardManager *manager) +{ + if (ax_response_callback (manager, GTK_WINDOW (dialog), + response_id, XkbStickyKeysMask, + manager->priv->stickykeys_shortcut_val)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + } +} + +static void +ax_slowkeys_response (GtkDialog *dialog, + gint response_id, + GsdA11yKeyboardManager *manager) +{ + if (ax_response_callback (manager, GTK_WINDOW (dialog), + response_id, XkbSlowKeysMask, + manager->priv->slowkeys_shortcut_val)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + } +} + +static void +maybe_show_status_icon (GsdA11yKeyboardManager *manager) +{ + gboolean show; + + /* for now, show if accessx is enabled */ + show = g_settings_get_boolean (manager->priv->settings, "enable"); + + if (!show && manager->priv->status_icon == NULL) + return; + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, show); +} + +static void +on_notification_closed (NotifyNotification *notification, + GsdA11yKeyboardManager *manager) +{ + g_object_unref (manager->priv->notification); + manager->priv->notification = NULL; +} + +static void +on_slow_keys_action (NotifyNotification *notification, + const char *action, + GsdA11yKeyboardManager *manager) +{ + gboolean res; + int response_id; + + g_assert (action != NULL); + + if (strcmp (action, "accept") == 0) { + response_id = GTK_RESPONSE_ACCEPT; + } else if (strcmp (action, "reject") == 0) { + response_id = GTK_RESPONSE_REJECT; + } else { + return; + } + + res = ax_response_callback (manager, NULL, + response_id, XkbSlowKeysMask, + manager->priv->slowkeys_shortcut_val); + if (res) { + notify_notification_close (manager->priv->notification, NULL); + } +} + +static void +on_sticky_keys_action (NotifyNotification *notification, + const char *action, + GsdA11yKeyboardManager *manager) +{ + gboolean res; + int response_id; + + g_assert (action != NULL); + + if (strcmp (action, "accept") == 0) { + response_id = GTK_RESPONSE_ACCEPT; + } else if (strcmp (action, "reject") == 0) { + response_id = GTK_RESPONSE_REJECT; + } else { + return; + } + + res = ax_response_callback (manager, NULL, + response_id, XkbStickyKeysMask, + manager->priv->stickykeys_shortcut_val); + if (res) { + notify_notification_close (manager->priv->notification, NULL); + } +} + +static gboolean +ax_slowkeys_warning_post_bubble (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + gboolean res; + const char *title; + const char *message; + GError *error; + + title = enabled ? + _("Slow Keys Turned On") : + _("Slow Keys Turned Off"); + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); + } + + if (manager->priv->notification != NULL) { + notify_notification_close (manager->priv->notification, NULL); + } + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + manager->priv->notification = notify_notification_new (title, + message, + "preferences-desktop-accessibility-symbolic"); + notify_notification_set_app_name (manager->priv->notification, _("Universal Access")); + notify_notification_set_timeout (manager->priv->notification, NOTIFICATION_TIMEOUT * 1000); + notify_notification_set_hint (manager->priv->notification, "transient", g_variant_new_boolean (TRUE)); + + notify_notification_add_action (manager->priv->notification, + "reject", + enabled ? _("Turn Off") : _("Turn On"), + (NotifyActionCallback) on_slow_keys_action, + manager, + NULL); + notify_notification_add_action (manager->priv->notification, + "accept", + enabled ? _("Leave On") : _("Leave Off"), + (NotifyActionCallback) on_slow_keys_action, + manager, + NULL); + + g_signal_connect (manager->priv->notification, + "closed", + G_CALLBACK (on_notification_closed), + manager); + + error = NULL; + res = notify_notification_show (manager->priv->notification, &error); + if (! res) { + g_warning ("GsdA11yKeyboardManager: unable to show notification: %s", error->message); + g_error_free (error); + notify_notification_close (manager->priv->notification, NULL); + } + + return res; +} + + +static void +ax_slowkeys_warning_post_dialog (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + const char *title; + const char *message; + + title = enabled ? + _("Slow Keys Turned On") : + _("Slow Keys Turned Off"); + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_show (manager->priv->slowkeys_alert); + return; + } + + manager->priv->slowkeys_alert = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + "%s", title); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->slowkeys_alert), + "%s", message); + + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + enabled ? _("_Turn Off") : _("_Turn On"), + GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + enabled ? _("_Leave On") : _("_Leave Off"), + GTK_RESPONSE_ACCEPT); + + gtk_window_set_title (GTK_WINDOW (manager->priv->slowkeys_alert), ""); + gtk_window_set_icon_name (GTK_WINDOW (manager->priv->slowkeys_alert), + "preferences-desktop-accessibility"); + gtk_dialog_set_default_response (GTK_DIALOG (manager->priv->slowkeys_alert), + GTK_RESPONSE_ACCEPT); + + g_signal_connect (manager->priv->slowkeys_alert, + "response", + G_CALLBACK (ax_slowkeys_response), + manager); + gtk_widget_show (manager->priv->slowkeys_alert); + + g_object_add_weak_pointer (G_OBJECT (manager->priv->slowkeys_alert), + (gpointer*) &manager->priv->slowkeys_alert); +} + +static void +ax_slowkeys_warning_post (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + + manager->priv->slowkeys_shortcut_val = enabled; + + /* alway try to show something */ + if (! ax_slowkeys_warning_post_bubble (manager, enabled)) { + ax_slowkeys_warning_post_dialog (manager, enabled); + } +} + +static gboolean +ax_stickykeys_warning_post_bubble (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ +#if 1 + gboolean res; + const char *title; + const char *message; + GError *error; + + title = enabled ? + _("Sticky Keys Turned On") : + _("Sticky Keys Turned Off"); + message = enabled ? + _("You just pressed the Shift key 5 times in a row. This is the shortcut " + "for the Sticky Keys feature, which affects the way your keyboard works.") : + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); + } + + if (manager->priv->notification != NULL) { + notify_notification_close (manager->priv->notification, NULL); + } + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + manager->priv->notification = notify_notification_new (title, + message, + "preferences-desktop-accessibility-symbolic"); + notify_notification_set_app_name (manager->priv->notification, _("Universal Access")); + notify_notification_set_timeout (manager->priv->notification, NOTIFICATION_TIMEOUT * 1000); + notify_notification_set_hint (manager->priv->notification, "transient", g_variant_new_boolean (TRUE)); + + notify_notification_add_action (manager->priv->notification, + "reject", + enabled ? _("Turn Off") : _("Turn On"), + (NotifyActionCallback) on_sticky_keys_action, + manager, + NULL); + notify_notification_add_action (manager->priv->notification, + "accept", + enabled ? _("Leave On") : _("Leave Off"), + (NotifyActionCallback) on_sticky_keys_action, + manager, + NULL); + + g_signal_connect (manager->priv->notification, + "closed", + G_CALLBACK (on_notification_closed), + manager); + + error = NULL; + res = notify_notification_show (manager->priv->notification, &error); + if (! res) { + g_warning ("GsdA11yKeyboardManager: unable to show notification: %s", error->message); + g_error_free (error); + notify_notification_close (manager->priv->notification, NULL); + } + + return res; +#endif /* 1 */ +} + +static void +ax_stickykeys_warning_post_dialog (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + const char *title; + const char *message; + + title = enabled ? + _("Sticky Keys Turned On") : + _("Sticky Keys Turned Off"); + message = enabled ? + _("You just pressed the Shift key 5 times in a row. This is the shortcut " + "for the Sticky Keys feature, which affects the way your keyboard works.") : + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + + if (manager->priv->stickykeys_alert != NULL) { + gtk_widget_show (manager->priv->stickykeys_alert); + return; + } + + manager->priv->stickykeys_alert = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + "%s", title); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert), + "%s", message); + + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + enabled ? _("_Turn Off") : _("_Turn On"), + GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + enabled ? _("_Leave On") : _("_Leave Off"), + GTK_RESPONSE_ACCEPT); + + gtk_window_set_title (GTK_WINDOW (manager->priv->stickykeys_alert), ""); + gtk_window_set_icon_name (GTK_WINDOW (manager->priv->stickykeys_alert), + "preferences-desktop-accessibility"); + gtk_dialog_set_default_response (GTK_DIALOG (manager->priv->stickykeys_alert), + GTK_RESPONSE_ACCEPT); + + g_signal_connect (manager->priv->stickykeys_alert, + "response", + G_CALLBACK (ax_stickykeys_response), + manager); + gtk_widget_show (manager->priv->stickykeys_alert); + + g_object_add_weak_pointer (G_OBJECT (manager->priv->stickykeys_alert), + (gpointer*) &manager->priv->stickykeys_alert); +} + +static void +ax_stickykeys_warning_post (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + + manager->priv->stickykeys_shortcut_val = enabled; + + /* alway try to show something */ + if (! ax_stickykeys_warning_post_bubble (manager, enabled)) { + ax_stickykeys_warning_post_dialog (manager, enabled); + } +} + +static void +set_gsettings_from_server (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + gboolean changed = FALSE; + gboolean slowkeys_changed; + gboolean stickykeys_changed; + GSettings *settings; + + desc = get_xkb_desc_rec (manager); + if (! desc) { + return; + } + + /* Create a new one, so that only those settings + * are delayed */ + settings = g_settings_new (KEYBOARD_A11Y_SCHEMA); + g_settings_delay (settings); + + /* + fprintf (stderr, "changed to : 0x%x\n", desc->ctrls->enabled_ctrls); + fprintf (stderr, "changed to : 0x%x (2)\n", desc->ctrls->ax_options); + */ + + changed |= set_bool (settings, + "enable", + desc->ctrls->enabled_ctrls & XkbAccessXKeysMask); + + changed |= set_bool (settings, + "feature-state-change-beep", + desc->ctrls->ax_options & (XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask)); + changed |= set_bool (settings, + "timeout-enable", + desc->ctrls->enabled_ctrls & XkbAccessXTimeoutMask); + changed |= set_int (settings, + "disable-timeout", + desc->ctrls->ax_timeout); + + changed |= set_bool (settings, + "bouncekeys-enable", + desc->ctrls->enabled_ctrls & XkbBounceKeysMask); + changed |= set_int (settings, + "bouncekeys-delay", + desc->ctrls->debounce_delay); + changed |= set_bool (settings, + "bouncekeys-beep-reject", + desc->ctrls->ax_options & XkbAX_BKRejectFBMask); + + changed |= set_bool (settings, + "mousekeys-enable", + desc->ctrls->enabled_ctrls & XkbMouseKeysMask); + changed |= set_int (settings, + "mousekeys-max-speed", + desc->ctrls->mk_max_speed * (1000 / desc->ctrls->mk_interval)); + /* NOTE : mk_time_to_max is measured in events not time */ + changed |= set_int (settings, + "mousekeys-accel-time", + desc->ctrls->mk_time_to_max * desc->ctrls->mk_interval); + changed |= set_int (settings, + "mousekeys-init-delay", + desc->ctrls->mk_delay); + + slowkeys_changed = set_bool (settings, + "slowkeys-enable", + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + changed |= set_bool (settings, + "slowkeys-beep-press", + desc->ctrls->ax_options & XkbAX_SKPressFBMask); + changed |= set_bool (settings, + "slowkeys-beep-accept", + desc->ctrls->ax_options & XkbAX_SKAcceptFBMask); + changed |= set_bool (settings, + "slowkeys-beep-reject", + desc->ctrls->ax_options & XkbAX_SKRejectFBMask); + changed |= set_int (settings, + "slowkeys-delay", + desc->ctrls->slow_keys_delay); + + stickykeys_changed = set_bool (settings, + "stickykeys-enable", + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + changed |= set_bool (settings, + "stickykeys-two-key-off", + desc->ctrls->ax_options & XkbAX_TwoKeysMask); + changed |= set_bool (settings, + "stickykeys-modifier-beep", + desc->ctrls->ax_options & XkbAX_StickyKeysFBMask); + + changed |= set_bool (settings, + "togglekeys-enable", + desc->ctrls->ax_options & XkbAX_IndicatorFBMask); + + if (!changed && stickykeys_changed ^ slowkeys_changed) { + /* + * sticky or slowkeys has changed, singly, without our intervention. + * 99% chance this is due to a keyboard shortcut being used. + * we need to detect via this hack until we get + * XkbAXN_AXKWarning notifications working (probable XKB bug), + * at which time we can directly intercept such shortcuts instead. + * See cb_xkb_event_filter () below. + */ + + /* sanity check: are keyboard shortcuts available? */ + if (desc->ctrls->enabled_ctrls & XkbAccessXKeysMask) { + if (slowkeys_changed) { + ax_slowkeys_warning_post (manager, + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + } else { + ax_stickykeys_warning_post (manager, + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + } + } + } + + XkbFreeKeyboard (desc, XkbAllComponentsMask, True); + + g_settings_apply (settings); + g_object_unref (settings); +} + +static GdkFilterReturn +cb_xkb_event_filter (GdkXEvent *xevent, + GdkEvent *ignored1, + GsdA11yKeyboardManager *manager) +{ + XEvent *xev = (XEvent *) xevent; + XkbEvent *xkbEv = (XkbEvent *) xevent; + + /* 'event_type' is set to zero on notifying us of updates in + * response to client requests (including our own) and non-zero + * to notify us of key/mouse events causing changes (like + * pressing shift 5 times to enable sticky keys). + * + * We only want to update GSettings when it's in response to an + * explicit user input event, so require a non-zero event_type. + */ + if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) && + xkbEv->any.xkb_type == XkbControlsNotify && + xkbEv->ctrls.event_type != 0) { + g_debug ("XKB state changed"); + set_gsettings_from_server (manager); + } else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) && + xkbEv->any.xkb_type == XkbAccessXNotify) { + if (xkbEv->accessx.detail == XkbAXN_AXKWarning) { + g_debug ("About to turn on an AccessX feature from the keyboard!"); + /* + * TODO: when XkbAXN_AXKWarnings start working, we need to + * invoke ax_keys_warning_dialog_run here instead of in + * set_gsettings_from_server(). + */ + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +keyboard_callback (GSettings *settings, + const char *key, + GsdA11yKeyboardManager *manager) +{ + set_server_from_gsettings (manager); + maybe_show_status_icon (manager); +} + +static gboolean +start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager) +{ + guint event_mask; + + g_debug ("Starting a11y_keyboard manager"); + gnome_settings_profile_start (NULL); + + if (!xkb_enabled (manager)) + goto out; + + manager->priv->settings = g_settings_new (KEYBOARD_A11Y_SCHEMA); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (keyboard_callback), manager); + + set_devicepresence_handler (manager); + + event_mask = XkbControlsNotifyMask; + event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */ + + /* be sure to init before starting to monitor the server */ + set_server_from_gsettings (manager); + + XkbSelectEvents (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XkbUseCoreKbd, + event_mask, + event_mask); + + gdk_window_add_filter (NULL, + (GdkFilterFunc) cb_xkb_event_filter, + manager); + + maybe_show_status_icon (manager); + + out: + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_a11y_keyboard_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager) +{ + GsdA11yKeyboardManagerPrivate *p = manager->priv; + + g_debug ("Stopping a11y_keyboard manager"); + + if (p->start_idle_id != 0) { + g_source_remove (p->start_idle_id); + p->start_idle_id = 0; + } + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); + p->device_manager = NULL; + } + + if (p->status_icon) { + gtk_status_icon_set_visible (p->status_icon, FALSE); + p->status_icon = NULL; + } + + if (p->settings != NULL) { + g_signal_handlers_disconnect_by_func (p->settings, keyboard_callback, manager); + g_object_unref (p->settings); + p->settings = NULL; + } + + gdk_window_remove_filter (NULL, + (GdkFilterFunc) cb_xkb_event_filter, + manager); + + if (p->slowkeys_alert != NULL) { + gtk_widget_destroy (p->slowkeys_alert); + p->slowkeys_alert = NULL; + } + + if (p->stickykeys_alert != NULL) { + gtk_widget_destroy (p->stickykeys_alert); + p->stickykeys_alert = NULL; + } + + p->slowkeys_shortcut_val = FALSE; + p->stickykeys_shortcut_val = FALSE; +} + +static GObject * +gsd_a11y_keyboard_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (a11y_keyboard_manager); +} + +static void +gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_a11y_keyboard_manager_constructor; + object_class->finalize = gsd_a11y_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdA11yKeyboardManagerPrivate)); +} + +static void +on_preferences_dialog_response (GtkDialog *dialog, + int response, + GsdA11yKeyboardManager *manager) +{ + g_signal_handlers_disconnect_by_func (dialog, + on_preferences_dialog_response, + manager); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + manager->priv->preferences_dialog = NULL; +} + +static void +on_status_icon_activate (GtkStatusIcon *status_icon, + GsdA11yKeyboardManager *manager) +{ + if (manager->priv->preferences_dialog == NULL) { + manager->priv->preferences_dialog = gsd_a11y_preferences_dialog_new (); + g_signal_connect (manager->priv->preferences_dialog, + "response", + G_CALLBACK (on_preferences_dialog_response), + manager); + + gtk_window_present (GTK_WINDOW (manager->priv->preferences_dialog)); + } else { + g_signal_handlers_disconnect_by_func (manager->priv->preferences_dialog, + on_preferences_dialog_response, + manager); + gtk_widget_destroy (GTK_WIDGET (manager->priv->preferences_dialog)); + manager->priv->preferences_dialog = NULL; + } +} + +static void +on_status_icon_popup_menu (GtkStatusIcon *status_icon, + guint button, + guint activate_time, + GsdA11yKeyboardManager *manager) +{ + on_status_icon_activate (status_icon, manager); +} + +static void +gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager) +{ + gnome_settings_profile_start (NULL); + + if (!manager->priv->status_icon) { + + manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility"); + gtk_status_icon_set_name (manager->priv->status_icon, "a11y-keyboard"); + g_signal_connect (manager->priv->status_icon, + "activate", + G_CALLBACK (on_status_icon_activate), + manager); + g_signal_connect (manager->priv->status_icon, + "popup-menu", + G_CALLBACK (on_status_icon_popup_menu), + manager); + } + + gnome_settings_profile_end (NULL); +} + +static void +gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *manager) +{ + manager->priv = GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_a11y_keyboard_manager_finalize (GObject *object) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_KEYBOARD_MANAGER (object)); + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (object); + + g_return_if_fail (a11y_keyboard_manager->priv != NULL); + + if (a11y_keyboard_manager->priv->start_idle_id != 0) + g_source_remove (a11y_keyboard_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->finalize (object); +} + +GsdA11yKeyboardManager * +gsd_a11y_keyboard_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_A11Y_KEYBOARD_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_A11Y_KEYBOARD_MANAGER (manager_object); +} diff --git a/.pc/62_unity_disable_gsd_printer.patch/plugins/print-notifications/gsd-print-notifications-plugin.c b/.pc/62_unity_disable_gsd_printer.patch/plugins/print-notifications/gsd-print-notifications-plugin.c new file mode 100644 index 00000000..0a788061 --- /dev/null +++ b/.pc/62_unity_disable_gsd_printer.patch/plugins/print-notifications/gsd-print-notifications-plugin.c @@ -0,0 +1,102 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Red Hat, Inc. + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-print-notifications-plugin.h" +#include "gsd-print-notifications-manager.h" + +struct GsdPrintNotificationsPluginPrivate { + GsdPrintNotificationsManager *manager; +}; + +#define GSD_PRINT_NOTIFICATIONS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN, GsdPrintNotificationsPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdPrintNotificationsPlugin, gsd_print_notifications_plugin) + +static void +gsd_print_notifications_plugin_init (GsdPrintNotificationsPlugin *plugin) +{ + plugin->priv = GSD_PRINT_NOTIFICATIONS_PLUGIN_GET_PRIVATE (plugin); + + plugin->priv->manager = gsd_print_notifications_manager_new (); +} + +static void +gsd_print_notifications_plugin_finalize (GObject *object) +{ + GsdPrintNotificationsPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_PRINT_NOTIFICATIONS_PLUGIN (object)); + + g_debug ("GsdPrintNotificationsPlugin finalizing"); + + plugin = GSD_PRINT_NOTIFICATIONS_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_print_notifications_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating print-notifications plugin"); + + error = NULL; + res = gsd_print_notifications_manager_start (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start print-notifications manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating print_notifications plugin"); + gsd_print_notifications_manager_stop (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_print_notifications_plugin_class_init (GsdPrintNotificationsPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_print_notifications_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdPrintNotificationsPluginPrivate)); +} diff --git a/.pc/63_unity_start_mounter.patch/plugins/automount/gnome-fallback-mount-helper.desktop.in.in b/.pc/63_unity_start_mounter.patch/plugins/automount/gnome-fallback-mount-helper.desktop.in.in new file mode 100644 index 00000000..f3de2cd0 --- /dev/null +++ b/.pc/63_unity_start_mounter.patch/plugins/automount/gnome-fallback-mount-helper.desktop.in.in @@ -0,0 +1,12 @@ +[Desktop Entry] +_Name=Mount Helper +_Comment=Automount and autorun plugged devices +Exec=@LIBEXECDIR@/gnome-fallback-mount-helper +Icon=drive-optical +Terminal=false +Type=Application +Categories= +NoDisplay=true +OnlyShowIn=GNOME;Unity; +X-GNOME-Autostart-Notify=true +AutostartCondition=GNOME3 if-session gnome-fallback diff --git a/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in b/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in new file mode 100644 index 00000000..b56b5d1e --- /dev/null +++ b/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in @@ -0,0 +1,207 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + [] + <_summary>Custom keybindings + <_description>List of custom keybindings + + + 'XF86Calculator' + <_summary>Launch calculator + <_description>Binding to launch the calculator. + + + 'XF86Mail' + <_summary>Launch email client + <_description>Binding to launch the email client. + + + 'XF86Eject' + <_summary>Eject + <_description>Binding to eject an optical disc. + + + '' + <_summary>Launch help browser + <_description>Binding to launch the help browser. + + + 'XF86Explorer' + <_summary>Home folder + <_description>Binding to open the Home folder. + + + 'XF86AudioMedia' + <_summary>Launch media player + <_description>Binding to launch the media player. + + + 'XF86AudioNext' + <_summary>Next track + <_description>Binding to skip to next track. + + + 'XF86AudioPause' + <_summary>Pause playback + <_description>Binding to pause playback. + + + 'XF86AudioPlay' + <_summary>Play (or play/pause) + <_description>Binding to start playback (or toggle play/pause). + + + '<Control><Alt>Delete' + <_summary>Log out + <_description>Binding to log out. + + + 'XF86AudioPrev' + <_summary>Previous track + <_description>Binding to skip to previous track. + + + 98 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + '<Control><Alt>l' + <_summary>Lock screen + <_description>Binding to lock the screen. + + + 'XF86Search' + <_summary>Search + <_description>Binding to launch the search tool. + + + 'XF86AudioStop' + <_summary>Stop playback + <_description>Binding to stop playback. + + + 'XF86AudioLowerVolume' + <_summary>Volume down + <_description>Binding to lower the system volume. + + + 'XF86AudioMute' + <_summary>Volume mute + <_description>Binding to mute the system volume. + + + 'XF86AudioRaiseVolume' + <_summary>Volume up + <_description>Binding to raise the system volume. + + + 'Print' + <_summary>Take a screenshot + <_description>Binding to take a screenshot. + + + '<Alt>Print' + <_summary>Take a screenshot of a window + <_description>Binding to take a screenshot of a window. + + + '<Shift>Print' + <_summary>Take a screenshot of an area + <_description>Binding to take a screenshot of an area. + + + '<Ctrl>Print' + <_summary>Copy a screenshot to clipboard + <_description>Binding to copy a screenshot to clipboard. + + + '<Ctrl><Alt>Print' + <_summary>Copy a screenshot of a window to clipboard + <_description>Binding to copy a screenshot of a window to clipboard. + + + '<Ctrl><Shift>Print' + <_summary>Copy a screenshot of an area to clipboard + <_description>Binding to copy a screenshot of an area to clipboard. + + + 'XF86WWW' + <_summary>Launch web browser + <_description>Binding to launch the web browser. + + + '<Alt><Super>8' + <_summary>Toggle magnifier + <_description>Binding to show the screen magnifier + + + '' + <_summary>Toggle screen reader + <_description>Binding to start the screen reader + + + '' + <_summary>Toggle on-screen keyboard + <_description>Binding to show the on-screen keyboard + + + '' + <_summary>Increase text size + <_description>Binding to increase the text size + + + '' + <_summary>Decrease text size + <_description>Binding to decrease the text size + + + '' + <_summary>Toggle contrast + <_description>Binding to toggle the interface contrast + + + '<Alt><Super>equal' + <_summary>Magnifier zoom in + <_description>Binding for the magnifier to zoom in + + + '<Alt><Super>minus' + <_summary>Magnifier zoom out + <_description>Binding for the magnifier to zoom out + + + '' + <_summary>Switch input source + <_description>Binding to select the next input source + + + '' + <_summary>Switch input source backward + <_description>Binding to select the previous input source + + + + + + '' + <_summary>Name + <_description>Name of the custom binding + + + '' + <_summary>Binding + <_description>Binding for the custom binding + + + '' + <_summary>Command + <_description>Command to run when the binding is invoked + + + diff --git a/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/plugins/media-keys/gsd-media-keys-manager.c b/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/plugins/media-keys/gsd-media-keys-manager.c new file mode 100644 index 00000000..e99bf1df --- /dev/null +++ b/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/plugins/media-keys/gsd-media-keys-manager.c @@ -0,0 +1,2770 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GUDEV +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-marshal.h" +#include "gsd-media-keys-manager.h" + +#include "shortcuts-list.h" +#include "gsd-osd-window.h" +#include "gsd-input-helper.h" +#include "gsd-power-helper.h" +#include "gsd-enums.h" + +#include +#include +#include "gvc-mixer-control.h" + +#include + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" +#define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +#define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +#define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring" +#define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon" +#define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon" + +#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +#define SETTINGS_INTERFACE_DIR "org.gnome.desktop.interface" +#define SETTINGS_POWER_DIR "org.gnome.settings-daemon.plugins.power" +#define SETTINGS_XSETTINGS_DIR "org.gnome.settings-daemon.plugins.xsettings" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" +#define TOUCHPAD_ENABLED_KEY "touchpad-enabled" +#define HIGH_CONTRAST "HighContrast" + +#define VOLUME_STEP 6 /* percents for one volume button press */ +#define MAX_VOLUME 65536.0 + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" + +#define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + +typedef struct { + char *application; + char *name; + guint32 time; + guint watch_id; +} MediaPlayer; + +typedef struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; + char *custom_path; + char *custom_command; + Key *key; +} MediaKey; + +struct GsdMediaKeysManagerPrivate +{ + /* Volume bits */ + GvcMixerControl *volume; + GvcMixerStream *stream; + ca_context *ca; + GtkSettings *gtksettings; +#ifdef HAVE_GUDEV + GHashTable *streams; /* key = X device ID, value = stream id */ + GUdevClient *udev_client; +#endif /* HAVE_GUDEV */ + + GtkWidget *dialog; + GSettings *settings; + GHashTable *custom_settings; + + GPtrArray *keys; + + /* HighContrast theme settings */ + GSettings *interface_settings; + char *icon_theme; + char *gtk_theme; + + /* Power stuff */ + GSettings *power_settings; + GDBusProxy *upower_proxy; + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; + int opcode; + + GList *media_players; + + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + guint start_idle_id; + + /* Ubuntu notifications */ + NotifyNotification *volume_notification; + NotifyNotification *brightness_notification; + NotifyNotification *kb_backlight_notification; +}; + +static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +static void gsd_media_keys_manager_init (GsdMediaKeysManager *media_keys_manager); +static void gsd_media_keys_manager_finalize (GObject *object); +static void register_manager (GsdMediaKeysManager *manager); +static void custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager); +G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous" +#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only" +#define NOTIFY_HINT_TRUE "true" + +typedef struct { + GsdMediaKeysManager *manager; + MediaKeyType type; + guint old_percentage; + +} GsdBrightnessActionData; + +static const char *volume_icons[] = { + "notification-audio-volume-muted", + "notification-audio-volume-low", + "notification-audio-volume-medium", + "notification-audio-volume-high", + NULL +}; + +static const char *brightness_icons[] = { + "notification-display-brightness-off", + "notification-display-brightness-low", + "notification-display-brightness-medium", + "notification-display-brightness-high", + "notification-display-brightness-full", + NULL +}; + +static const char *kb_backlight_icons[] = { + "notification-keyboard-brightness-off", + "notification-keyboard-brightness-low", + "notification-keyboard-brightness-medium", + "notification-keyboard-brightness-high", + "notification-keyboard-brightness-full", + NULL +}; + +static const char * +calculate_icon_name (gint value, const char **icon_names) +{ + value = CLAMP (value, 0, 100); + gint length = g_strv_length (icon_names); + gint s = (length - 1) * value / 100 + 1; + s = CLAMP (s, 1, length - 1); + + return icon_names[s]; +} + +static gboolean +ubuntu_osd_notification_is_supported (void) +{ + GList *caps; + gboolean has_cap; + + caps = notify_get_server_caps (); + has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL); + g_list_foreach (caps, (GFunc) g_free, NULL); + g_list_free (caps); + + return has_cap; +} + +static gboolean +ubuntu_osd_notification_show_icon (const char *icon, + const char *hint) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + NotifyNotification *notification = notify_notification_new (" ", "", icon); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE); + + gboolean res = notify_notification_show (notification, NULL); + g_object_unref (notification); + + return res; +} + +static gboolean +ubuntu_osd_do_notification (NotifyNotification **notification, + const char *hint, + gint value, + gboolean muted, + const char **icon_names) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + if (!*notification) { + *notification = notify_notification_new (" ", "", NULL); + notify_notification_set_hint_string (*notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + } + + value = CLAMP (value, -1, 101); + const char *icon = muted ? icon_names[0] : calculate_icon_name (value, icon_names); + notify_notification_set_hint_int32 (*notification, "value", value); + notify_notification_update (*notification, " ", "", icon); + + return notify_notification_show (*notification, NULL); +} + +static gboolean +ubuntu_osd_notification_show_volume (GsdMediaKeysManager *manager, + gint value, + gboolean muted) +{ + return ubuntu_osd_do_notification (&manager->priv->volume_notification, + "volume", value, muted, volume_icons); +} + +static gboolean +ubuntu_osd_notification_show_brightness (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->brightness_notification, + "brightness", value, value <= 0, brightness_icons); +} + +static gboolean +ubuntu_osd_notification_show_kb_backlight (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->kb_backlight_notification, + "keyboard", value, value <= 0, kb_backlight_icons); +} + +static void +init_screens (GsdMediaKeysManager *manager) +{ + GdkDisplay *display; + int i; + + display = gdk_display_get_default (); + for (i = 0; i < gdk_display_get_n_screens (display); i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + if (screen == NULL) { + continue; + } + manager->priv->screens = g_slist_append (manager->priv->screens, screen); + } + + manager->priv->current_screen = manager->priv->screens->data; +} + +static void +media_key_free (MediaKey *key) +{ + if (key == NULL) + return; + g_free (key->custom_path); + g_free (key->custom_command); + free_key (key->key); + g_free (key); +} + +static char * +get_term_command (GsdMediaKeysManager *manager) +{ + char *cmd_term, *cmd_args;; + char *cmd = NULL; + GSettings *settings; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + cmd_term = g_settings_get_string (settings, "exec"); + if (cmd_term[0] == '\0') + cmd_term = g_strdup ("gnome-terminal"); + + cmd_args = g_settings_get_string (settings, "exec-arg"); + if (strcmp (cmd_term, "") != 0) { + cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args); + } else { + cmd = g_strdup_printf ("%s -e", cmd_term); + } + + g_free (cmd_args); + g_free (cmd_term); + g_object_unref (settings); + + return cmd; +} + +static char ** +get_keyring_env (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant, *item; + GVariantIter *iter; + char **envp; + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_KEYRING_DBUS_NAME, + GNOME_KEYRING_DBUS_PATH, + GNOME_KEYRING_DBUS_INTERFACE, + "GetEnvironment", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call GetEnvironment on keyring daemon: %s", error->message); + g_error_free (error); + return NULL; + } + + envp = g_get_environ (); + + g_variant_get (variant, "(a{ss})", &iter); + + while ((item = g_variant_iter_next_value (iter))) { + char *key; + char *value; + + g_variant_get (item, + "{ss}", + &key, + &value); + + envp = g_environ_setenv (envp, key, value, TRUE); + + g_variant_unref (item); + g_free (key); + g_free (value); + } + + g_variant_iter_free (iter); + g_variant_unref (variant); + + return envp; +} + +static void +execute (GsdMediaKeysManager *manager, + char *cmd, + gboolean need_term) +{ + gboolean retval; + char **argv; + int argc; + char *exec; + char *term = NULL; + GError *error = NULL; + + retval = FALSE; + + if (need_term) + term = get_term_command (manager); + + if (term) { + exec = g_strdup_printf ("%s %s", term, cmd); + g_free (term); + } else { + exec = g_strdup (cmd); + } + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + char **envp; + + envp = get_keyring_env (manager); + + retval = g_spawn_async (g_get_home_dir (), + argv, + envp, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + &error); + + g_strfreev (argv); + g_strfreev (envp); + } + + if (retval == FALSE) { + g_warning ("Couldn't execute command: %s: %s", exec, error->message); + g_error_free (error); + } + g_free (exec); +} + +static void +dialog_init (GsdMediaKeysManager *manager) +{ + if (manager->priv->dialog != NULL + && !gsd_osd_window_is_valid (GSD_OSD_WINDOW (manager->priv->dialog))) { + gtk_widget_destroy (manager->priv->dialog); + manager->priv->dialog = NULL; + } + + if (manager->priv->dialog == NULL) { + manager->priv->dialog = gsd_osd_window_new (); + } +} + +static void +print_key_parse_error (MediaKey *key, + const char *str) +{ + if (str == NULL || *str == '\0') + return; + if (key->settings_key != NULL) + g_debug ("Unable to parse key '%s' for GSettings entry '%s'", str, key->settings_key); + else + g_debug ("Unable to parse hard-coded key '%s'", key->hard_coded); +} + +static char * +get_key_string (GsdMediaKeysManager *manager, + MediaKey *key) +{ + if (key->settings_key != NULL) + return g_settings_get_string (manager->priv->settings, key->settings_key); + else if (key->hard_coded != NULL) + return g_strdup (key->hard_coded); + else if (key->custom_path != NULL) { + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->custom_settings, + key->custom_path); + return g_settings_get_string (settings, "binding"); + } else + g_assert_not_reached (); +} + +static gboolean +grab_media_key (MediaKey *key, + GsdMediaKeysManager *manager) +{ + char *tmp; + gboolean need_flush; + + need_flush = FALSE; + + if (key->key != NULL) { + need_flush = TRUE; + ungrab_key_unsafe (key->key, manager->priv->screens); + } + + free_key (key->key); + key->key = NULL; + + tmp = get_key_string (manager, key); + + key->key = parse_key (tmp); + if (key->key == NULL) { + print_key_parse_error (key, tmp); + g_free (tmp); + return need_flush; + } + + grab_key_unsafe (key->key, GSD_KEYGRAB_NORMAL, manager->priv->screens); + + g_free (tmp); + + return TRUE; +} + +static void +gsettings_changed_cb (GSettings *settings, + const gchar *settings_key, + GsdMediaKeysManager *manager) +{ + int i; + gboolean need_flush = TRUE; + + /* handled in gsettings_custom_changed_cb() */ + if (g_str_equal (settings_key, "custom-keybindings")) + return; + + gdk_error_trap_push (); + + /* Find the key that was modified */ + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + /* Skip over hard-coded and GConf keys */ + if (key->settings_key == NULL) + continue; + if (strcmp (settings_key, key->settings_key) == 0) { + if (grab_media_key (key, manager)) + need_flush = TRUE; + break; + } + } + + if (need_flush) + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); +} + +static MediaKey * +media_key_new_for_path (GsdMediaKeysManager *manager, + char *path) +{ + GSettings *settings; + char *command, *binding; + MediaKey *key; + + g_debug ("media_key_new_for_path: %s", path); + + settings = g_hash_table_lookup (manager->priv->custom_settings, path); + if (settings == NULL) { + settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path); + + g_signal_connect (settings, "changed", + G_CALLBACK (custom_binding_changed), manager); + g_hash_table_insert (manager->priv->custom_settings, + g_strdup (path), settings); + } + + command = g_settings_get_string (settings, "command"); + binding = g_settings_get_string (settings, "binding"); + + if (*command == '\0' && *binding == '\0') { + g_debug ("Key binding (%s) is incomplete", path); + g_free (command); + g_free (binding); + return NULL; + } + g_free (binding); + + key = g_new0 (MediaKey, 1); + key->key_type = CUSTOM_KEY; + key->custom_path = g_strdup (path); + key->custom_command = command; + + return key; +} + +static void +update_custom_binding (GsdMediaKeysManager *manager, + char *path) +{ + MediaKey *key; + int i; + + /* Remove the existing key */ + for (i = 0; i < manager->priv->keys->len; i++) { + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->custom_path == NULL) + continue; + if (strcmp (key->custom_path, path) == 0) { + g_debug ("Removing custom key binding %s", path); + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", path); + } + g_ptr_array_remove_index_fast (manager->priv->keys, i); + break; + } + } + + /* And create a new one! */ + key = media_key_new_for_path (manager, path); + if (key) { + g_debug ("Adding new custom key binding %s", path); + g_ptr_array_add (manager->priv->keys, key); + + gdk_error_trap_push (); + + grab_media_key (key, manager); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for custom key '%s'", + key->custom_path); + } +} + +static void +custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char *path; + + if (strcmp (settings_key, "name") == 0) + return; /* we don't care */ + + g_object_get (settings, "path", &path, NULL); + update_custom_binding (manager, path); + g_free (path); +} + +static void +gsettings_custom_changed_cb (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char **bindings; + int i, j, n_bindings; + + bindings = g_settings_get_strv (settings, settings_key); + n_bindings = g_strv_length (bindings); + + /* Handle additions */ + for (i = 0; i < n_bindings; i++) { + if (g_hash_table_lookup (manager->priv->custom_settings, + bindings[i])) + continue; + update_custom_binding (manager, bindings[i]); + } + + /* Handle removals */ + for (i = 0; i < manager->priv->keys->len; i++) { + gboolean found = FALSE; + MediaKey *key = g_ptr_array_index (manager->priv->keys, i); + if (key->key_type != CUSTOM_KEY) + continue; + + for (j = 0; j < n_bindings && !found; j++) + found = strcmp (bindings[j], key->custom_path) == 0; + + if (found) + continue; + + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", key->custom_path); + } + g_hash_table_remove (manager->priv->custom_settings, + key->custom_path); + g_ptr_array_remove_index_fast (manager->priv->keys, i); + --i; /* make up for the removed key */ + } + g_strfreev (bindings); +} + +static void +add_key (GsdMediaKeysManager *manager, guint i) +{ + MediaKey *key; + + key = g_new0 (MediaKey, 1); + key->key_type = media_keys[i].key_type; + key->settings_key = media_keys[i].settings_key; + key->hard_coded = media_keys[i].hard_coded; + + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); +} + +static void +init_kbd (GsdMediaKeysManager *manager) +{ + char **custom_paths; + int i; + + gnome_settings_profile_start (NULL); + + gdk_error_trap_push (); + + manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free); + + /* Media keys + * Add hard-coded shortcuts first so that they can't be preempted */ + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded) + add_key (manager, i); + } + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded == NULL) + add_key (manager, i); + } + + /* Custom shortcuts */ + custom_paths = g_settings_get_strv (manager->priv->settings, + "custom-keybindings"); + + for (i = 0; i < g_strv_length (custom_paths); i++) { + MediaKey *key; + + g_debug ("Setting up custom keybinding %s", custom_paths[i]); + + key = media_key_new_for_path (manager, custom_paths[i]); + if (!key) { + continue; + } + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); + } + g_strfreev (custom_paths); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); + + gnome_settings_profile_end (NULL); +} + +static void +dialog_show (GsdMediaKeysManager *manager) +{ + int orig_w; + int orig_h; + int screen_w; + int screen_h; + int x; + int y; + GdkRectangle geometry; + int monitor; + + gtk_window_set_screen (GTK_WINDOW (manager->priv->dialog), + manager->priv->current_screen); + + /* + * get the window size + * if the window hasn't been mapped, it doesn't necessarily + * know its true size, yet, so we need to jump through hoops + */ + gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h); + + monitor = gdk_screen_get_primary_monitor (manager->priv->current_screen); + + gdk_screen_get_monitor_geometry (manager->priv->current_screen, + monitor, + &geometry); + + screen_w = geometry.width; + screen_h = geometry.height; + + x = ((screen_w - orig_w) / 2) + geometry.x; + y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; + + gtk_window_move (GTK_WINDOW (manager->priv->dialog), x, y); + + gtk_widget_show (manager->priv->dialog); + + gdk_display_sync (gdk_screen_get_display (manager->priv->current_screen)); +} + +static void +launch_app (GAppInfo *app_info, + gint64 timestamp) +{ + GError *error = NULL; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + if (!g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) { + g_warning ("Could not launch '%s': %s", + g_app_info_get_commandline (app_info), + error->message); + g_error_free (error); + } + g_object_unref (launch_context); +} + +static void +do_url_action (GsdMediaKeysManager *manager, + const char *scheme, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_uri_scheme (scheme); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' scheme", scheme); + } +} + +static void +do_media_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg"); + } +} + +static void +gnome_session_shutdown (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + /* Shouldn't happen, but you never know */ + if (manager->priv->connection == NULL) { + execute (manager, "gnome-session-quit --logout", FALSE); + return; + } + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + "Shutdown", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call Shutdown on session manager: %s", error->message); + g_error_free (error); + return; + } + g_variant_unref (variant); +} + +static void +do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + g_drive_eject_with_operation_finish (drive, res, NULL); +} + +#define NO_SCORE 0 +#define SCORE_CAN_EJECT 50 +#define SCORE_HAS_MEDIA 100 +static void +do_eject_action (GsdMediaKeysManager *manager) +{ + GList *drives, *l; + GDrive *fav_drive; + guint score; + GVolumeMonitor *volume_monitor; + + volume_monitor = g_volume_monitor_get (); + + + /* Find the best drive to eject */ + fav_drive = NULL; + score = NO_SCORE; + drives = g_volume_monitor_get_connected_drives (volume_monitor); + for (l = drives; l != NULL; l = l->next) { + GDrive *drive = l->data; + + if (g_drive_can_eject (drive) == FALSE) + continue; + if (g_drive_is_media_removable (drive) == FALSE) + continue; + if (score < SCORE_CAN_EJECT) { + fav_drive = drive; + score = SCORE_CAN_EJECT; + } + if (g_drive_has_media (drive) == FALSE) + continue; + if (score < SCORE_HAS_MEDIA) { + fav_drive = drive; + score = SCORE_HAS_MEDIA; + break; + } + } + + /* Show the dialogue */ + if (!ubuntu_osd_notification_show_icon ("notification-device-eject", "Eject")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "media-eject-symbolic", + FALSE); + dialog_show (manager); + } + + /* Clean up the drive selection and exit if no suitable + * drives are found */ + if (fav_drive != NULL) + fav_drive = g_object_ref (fav_drive); + + g_list_foreach (drives, (GFunc) g_object_unref, NULL); + if (fav_drive == NULL) + return; + + /* Eject! */ + g_drive_eject_with_operation (fav_drive, G_MOUNT_UNMOUNT_FORCE, + NULL, NULL, + (GAsyncReadyCallback) do_eject_action_cb, + manager); + g_object_unref (fav_drive); + g_object_unref (volume_monitor); +} + +static void +do_home_key_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GFile *file; + GError *error = NULL; + char *uri; + + file = g_file_new_for_path (g_get_home_dir ()); + uri = g_file_get_uri (file); + g_object_unref (file); + + if (gtk_show_uri (NULL, uri, timestamp, &error) == FALSE) { + g_warning ("Failed to launch '%s': %s", uri, error->message); + g_error_free (error); + } + g_free (uri); +} + +static void +do_execute_desktop (GsdMediaKeysManager *manager, + const char *desktop, + gint64 timestamp) +{ + GDesktopAppInfo *app_info; + + app_info = g_desktop_app_info_new (desktop); + if (app_info != NULL) { + launch_app (G_APP_INFO (app_info), timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find application '%s'", desktop); + } +} + +static void +do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) +{ + if (!ubuntu_osd_notification_show_icon ((!state) ? "touchpad-disabled-symbolic" : "input-touchpad-symbolic", "Touchpad")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", + FALSE); + dialog_show (manager); + } +} + +static void +do_touchpad_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + gboolean state; + + if (touchpad_is_present () == FALSE) { + do_touchpad_osd_action (manager, FALSE); + return; + } + + settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY); + + do_touchpad_osd_action (manager, !state); + + g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state); + g_object_unref (settings); +} + +static void +update_dialog (GsdMediaKeysManager *manager, + GvcMixerStream *stream, + guint vol, + gboolean muted, + gboolean sound_changed, + gboolean quiet) +{ + if (ubuntu_osd_notification_show_volume (manager, vol, muted)) + goto done; + + vol = CLAMP (vol, 0, 100); + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), + muted); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), vol); + gsd_osd_window_set_action (GSD_OSD_WINDOW (manager->priv->dialog), + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + +done: + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); + ca_context_play (manager->priv->ca, 1, + CA_PROP_EVENT_ID, "audio-volume-change", + CA_PROP_EVENT_DESCRIPTION, "volume changed through key press", + CA_PROP_CANBERRA_CACHE_CONTROL, "permanent", + NULL); + } +} + +#ifdef HAVE_GUDEV +/* PulseAudio gives us /devices/... paths, when udev + * expects /sys/devices/... paths. */ +static GUdevDevice * +get_udev_device_for_sysfs_path (GsdMediaKeysManager *manager, + const char *sysfs_path) +{ + char *path; + GUdevDevice *dev; + + path = g_strdup_printf ("/sys%s", sysfs_path); + dev = g_udev_client_query_by_sysfs_path (manager->priv->udev_client, path); + g_free (path); + + return dev; +} + +static GvcMixerStream * +get_stream_for_device_id (GsdMediaKeysManager *manager, + guint deviceid) +{ + char *devnode; + gpointer id_ptr; + GvcMixerStream *res; + GUdevDevice *dev, *parent; + GSList *sinks, *l; + + id_ptr = g_hash_table_lookup (manager->priv->streams, GUINT_TO_POINTER (deviceid)); + if (id_ptr != NULL) { + if (GPOINTER_TO_UINT (id_ptr) == (guint) -1) + return NULL; + else + return gvc_mixer_control_lookup_stream_id (manager->priv->volume, GPOINTER_TO_UINT (id_ptr)); + } + + devnode = xdevice_get_device_node (deviceid); + if (devnode == NULL) { + g_debug ("Could not find device node for XInput device %d", deviceid); + return NULL; + } + + dev = g_udev_client_query_by_device_file (manager->priv->udev_client, devnode); + if (dev == NULL) { + g_debug ("Could not find udev device for device path '%s'", devnode); + g_free (devnode); + return NULL; + } + g_free (devnode); + + if (g_strcmp0 (g_udev_device_get_property (dev, "ID_BUS"), "usb") != 0) { + g_debug ("Not handling XInput device %d, not USB", deviceid); + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + g_object_unref (dev); + return NULL; + } + + parent = g_udev_device_get_parent_with_subsystem (dev, "usb", "usb_device"); + if (parent == NULL) { + g_warning ("No USB device parent for XInput device %d even though it's USB", deviceid); + g_object_unref (dev); + return NULL; + } + + res = NULL; + sinks = gvc_mixer_control_get_sinks (manager->priv->volume); + for (l = sinks; l; l = l->next) { + GvcMixerStream *stream = l->data; + const char *sysfs_path; + GUdevDevice *sink_dev, *sink_parent; + + sysfs_path = gvc_mixer_stream_get_sysfs_path (stream); + sink_dev = get_udev_device_for_sysfs_path (manager, sysfs_path); + if (sink_dev == NULL) + continue; + sink_parent = g_udev_device_get_parent_with_subsystem (sink_dev, "usb", "usb_device"); + g_object_unref (sink_dev); + if (sink_parent == NULL) + continue; + + if (g_strcmp0 (g_udev_device_get_sysfs_path (sink_parent), + g_udev_device_get_sysfs_path (parent)) == 0) { + res = stream; + } + g_object_unref (sink_parent); + if (res != NULL) + break; + } + + if (res) + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER (gvc_mixer_stream_get_id (res))); + else + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + + return res; +} +#endif /* HAVE_GUDEV */ + +static void +do_sound_action (GsdMediaKeysManager *manager, + guint deviceid, + int type, + gboolean quiet) +{ + GvcMixerStream *stream; + gboolean old_muted, new_muted; + guint old_vol, new_vol, norm_vol_step, osd_vol; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +#ifdef HAVE_GUDEV + stream = get_stream_for_device_id (manager, deviceid); + if (stream == NULL) +#endif /* HAVE_GUDEV */ + stream = manager->priv->stream; + if (stream == NULL) + return; + + norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100; + + /* FIXME: this is racy */ + new_vol = old_vol = gvc_mixer_stream_get_volume (stream); + new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream); + sound_changed = FALSE; + + switch (type) { + case MUTE_KEY: + new_muted = !old_muted; + break; + case VOLUME_DOWN_KEY: + if (old_vol <= norm_vol_step) { + new_vol = 0; + new_muted = TRUE; + } else { + new_vol = old_vol - norm_vol_step; + } + break; + case VOLUME_UP_KEY: + new_muted = FALSE; + /* When coming out of mute only increase the volume if it was 0 */ + if (!old_muted || old_vol == 0) + new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME); + break; + } + + if (old_muted != new_muted) { + gvc_mixer_stream_change_is_muted (stream, new_muted); + sound_changed = TRUE; + } + + if (old_vol != new_vol) { + if (gvc_mixer_stream_set_volume (stream, new_vol) != FALSE) { + gvc_mixer_stream_push_volume (stream); + sound_changed = TRUE; + } + } + + if (type == VOLUME_DOWN_KEY && old_vol == 0 && old_muted) + osd_vol = -1; + else if (type == VOLUME_UP_KEY && old_vol == PA_VOLUME_NORM && !old_muted) + osd_vol = 101; + else if (!new_muted) + osd_vol = (int) (100 * (double) new_vol / PA_VOLUME_NORM); + else + osd_vol = 0; + + update_dialog (manager, stream, osd_vol, new_muted, sound_changed, quiet); +} + +static void +sound_theme_changed (GtkSettings *settings, + GParamSpec *pspec, + GsdMediaKeysManager *manager) +{ + char *theme_name; + + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); +} + +static void +update_default_sink (GsdMediaKeysManager *manager) +{ + GvcMixerStream *stream; + + stream = gvc_mixer_control_get_default_sink (manager->priv->volume); + if (stream == manager->priv->stream) + return; + + if (manager->priv->stream != NULL) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + + if (stream != NULL) { + manager->priv->stream = g_object_ref (stream); + } else { + g_warning ("Unable to get default sink"); + } +} + +static void +on_control_state_changed (GvcMixerControl *control, + GvcMixerControlState new_state, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +static void +on_control_default_sink_changed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +#ifdef HAVE_GUDEV +static gboolean +remove_stream (gpointer key, + gpointer value, + gpointer id) +{ + if (GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (id)) + return TRUE; + return FALSE; +} +#endif /* HAVE_GUDEV */ + +static void +on_control_stream_removed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + if (manager->priv->stream != NULL) { + if (gvc_mixer_stream_get_id (manager->priv->stream) == id) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + } + +#ifdef HAVE_GUDEV + g_hash_table_foreach_remove (manager->priv->streams, (GHRFunc) remove_stream, GUINT_TO_POINTER (id)); +#endif +} + +static void +free_media_player (MediaPlayer *player) +{ + if (player->watch_id > 0) { + g_bus_unwatch_name (player->watch_id); + player->watch_id = 0; + } + g_free (player->application); + g_free (player->name); + g_free (player); +} + +static gint +find_by_application (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->application, b); +} + +static gint +find_by_name (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->name, b); +} + +static gint +find_by_time (gconstpointer a, + gconstpointer b) +{ + return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time; +} + +static void +name_vanished_handler (GDBusConnection *connection, + const gchar *name, + GsdMediaKeysManager *manager) +{ + GList *iter; + + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering vanished %s (name: %s)", player->application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +/* + * Register a new media player. Most applications will want to call + * this with time = GDK_CURRENT_TIME. This way, the last registered + * player will receive media events. In some cases, applications + * may want to register with a lower priority (usually 1), to grab + * events only nobody is interested. + */ +static void +gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name, + guint32 time) +{ + GList *iter; + MediaPlayer *media_player; + guint watch_id; + + if (time == GDK_CURRENT_TIME) { + GTimeVal tv; + + g_get_current_time (&tv); + time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + } + + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + + if (iter != NULL) { + if (((MediaPlayer *)iter->data)->time < time) { + MediaPlayer *player = iter->data; + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } else { + return; + } + } + + watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_handler, + manager, + NULL); + + g_debug ("Registering %s at %u", application, time); + media_player = g_new0 (MediaPlayer, 1); + media_player->application = g_strdup (application); + media_player->name = g_strdup (name); + media_player->time = time; + media_player->watch_id = watch_id; + + manager->priv->media_players = g_list_insert_sorted (manager->priv->media_players, + media_player, + find_by_time); +} + +static void +gsd_media_keys_manager_release_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name) +{ + GList *iter = NULL; + + g_return_if_fail (application != NULL || name != NULL); + + if (application != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + } + + if (iter == NULL && name != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + } + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering %s (name: %s)", application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +static gboolean +gsd_media_player_key_pressed (GsdMediaKeysManager *manager, + const char *key) +{ + const char *application; + gboolean have_listeners; + GError *error = NULL; + MediaPlayer *player; + + g_return_val_if_fail (key != NULL, FALSE); + + g_debug ("Media key '%s' pressed", key); + + have_listeners = (manager->priv->media_players != NULL); + + if (!have_listeners) { + /* Popup a dialog with an (/) icon */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "action-unavailable-symbolic", + FALSE); + dialog_show (manager); + return TRUE; + } + + player = manager->priv->media_players->data; + application = player->application; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + player->name, + GSD_MEDIA_KEYS_DBUS_PATH, + GSD_MEDIA_KEYS_DBUS_NAME, + "MediaPlayerKeyPressed", + g_variant_new ("(ss)", application ? application : "", key), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + + return !have_listeners; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdMediaKeysManager *manager = (GsdMediaKeysManager *) user_data; + + g_debug ("Calling method '%s' for media-keys", method_name); + + if (g_strcmp0 (method_name, "ReleaseMediaPlayerKeys") == 0) { + const char *app_name; + + g_variant_get (parameters, "(&s)", &app_name); + gsd_media_keys_manager_release_media_player_keys (manager, app_name, sender); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "GrabMediaPlayerKeys") == 0) { + const char *app_name; + guint32 time; + + g_variant_get (parameters, "(&su)", &app_name, &time); + gsd_media_keys_manager_grab_media_player_keys (manager, app_name, sender, time); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static gboolean +do_multimedia_player_action (GsdMediaKeysManager *manager, + const char *icon, + const char *key) +{ + if (icon != NULL) + ubuntu_osd_notification_show_icon (icon, key); + return gsd_media_player_key_pressed (manager, key); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + char *action; + + action = g_object_get_data (G_OBJECT (source_object), + "gsd-media-keys-manager-xrandr-action"); + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call '%s': %s", action, error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } + + g_free (action); +} + +static void +do_xrandr_action (GsdMediaKeysManager *manager, + const char *action, + gint64 timestamp) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + priv->cancellable = g_cancellable_new (); + + g_object_set_data (G_OBJECT (priv->xrandr_proxy), + "gsd-media-keys-manager-xrandr-action", + g_strdup (action)); + + g_dbus_proxy_call (priv->xrandr_proxy, + action, + g_variant_new ("(x)", timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static gboolean +do_video_out_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "VideoModeSwitch", timestamp); + return FALSE; +} + +static gboolean +do_video_rotate_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "Rotate", timestamp); + return FALSE; +} + +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + +static void +do_text_size_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + gdouble factor, best, distance; + guint i; + + /* Same values used in the Seeing tab of the Universal Access panel */ + static gdouble factors[] = { + 0.75, + 1.0, + 1.25, + 1.5 + }; + + /* Figure out the current DPI scaling factor */ + factor = g_settings_get_double (manager->priv->interface_settings, "text-scaling-factor"); + factor += (type == INCREASE_TEXT_KEY ? 0.25 : -0.25); + + /* Try to find a matching value */ + distance = 1e6; + best = 1.0; + for (i = 0; i < G_N_ELEMENTS(factors); i++) { + gdouble d; + d = fabs (factor - factors[i]); + if (d < distance) { + best = factors[i]; + distance = d; + } + } + + if (best == 1.0) + g_settings_reset (manager->priv->interface_settings, "text-scaling-factor"); + else + g_settings_set_double (manager->priv->interface_settings, "text-scaling-factor", best); +} + +static void +do_magnifier_zoom_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + gdouble offset, value; + + if (type == MAGNIFIER_ZOOM_IN_KEY) + offset = 1.0; + else + offset = -1.0; + + settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + value = g_settings_get_double (settings, "mag-factor"); + value += offset; + value = roundl (value); + g_settings_set_double (settings, "mag-factor", value); + g_object_unref (settings); +} + +static void +do_toggle_contrast_action (GsdMediaKeysManager *manager) +{ + gboolean high_contrast; + char *theme; + + /* Are we using HighContrast now? */ + theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + high_contrast = g_str_equal (theme, HIGH_CONTRAST); + g_free (theme); + + if (high_contrast != FALSE) { + if (manager->priv->gtk_theme == NULL) + g_settings_reset (manager->priv->interface_settings, "gtk-theme"); + else + g_settings_set (manager->priv->interface_settings, "gtk-theme", manager->priv->gtk_theme); + g_settings_set (manager->priv->interface_settings, "icon-theme", manager->priv->icon_theme); + } else { + g_settings_set (manager->priv->interface_settings, "gtk-theme", HIGH_CONTRAST); + g_settings_set (manager->priv->interface_settings, "icon-theme", HIGH_CONTRAST); + } +} + +static void +do_config_power_action (GsdMediaKeysManager *manager, + const gchar *config_key) +{ + GsdPowerActionType action_type; + + action_type = g_settings_get_enum (manager->priv->power_settings, + config_key); + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + case GSD_POWER_ACTION_SHUTDOWN: + gnome_session_shutdown (manager); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_BLANK: + case GSD_POWER_ACTION_NOTHING: + /* these actions cannot be handled by media-keys and + * are not used in this context */ + break; + } +} + +static void +update_screen_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); + g_free (data); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + guint osd_percentage; + + if (data->old_percentage == 100 && data->type == SCREEN_BRIGHTNESS_UP_KEY) + osd_percentage = 101; + else if (data->old_percentage == 0 && data->type == SCREEN_BRIGHTNESS_DOWN_KEY) + osd_percentage = -1; + else + osd_percentage = CLAMP (percentage, 0, 100); + + if (!ubuntu_osd_notification_show_brightness (manager, osd_percentage)) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "display-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_free (data); + g_variant_unref (new_percentage); +} + +static void +do_screen_brightness_action_real (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + GError *error = NULL; + + GVariant *old_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (old_percentage == NULL) { + g_warning ("Failed to get old screen percentage: %s", error->message); + g_error_free (error); + g_free (data); + return; + } + + g_variant_get (old_percentage, "(u)", &data->old_percentage); + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_screen_proxy, + data->type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_screen_cb, + data); + + g_variant_unref (old_percentage); +} + +static void +do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + if (manager->priv->connection == NULL || + manager->priv->power_screen_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + GsdBrightnessActionData *data = g_new0 (GsdBrightnessActionData, 1); + data->manager = manager; + data->type = type; + + g_dbus_proxy_call (manager->priv->power_screen_proxy, + "GetPercentage", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + do_screen_brightness_action_real, + data); +} + +static void +update_keyboard_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new keyboard percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + + /* FIXME: No overshoot effect for keyboard, as the power plugin has no interface + * to get the old brightness */ + if (!ubuntu_osd_notification_show_kb_backlight (manager, CLAMP (percentage, 0, 100))) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "keyboard-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_variant_unref (new_percentage); +} + +static void +do_keyboard_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + const char *cmd; + + if (manager->priv->connection == NULL || + manager->priv->power_keyboard_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + switch (type) { + case KEYBOARD_BRIGHTNESS_UP_KEY: + cmd = "StepUp"; + break; + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + cmd = "StepDown"; + break; + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + cmd = "Toggle"; + break; + default: + g_assert_not_reached (); + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_keyboard_proxy, + cmd, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_keyboard_cb, + manager); +} + +static void +do_switch_input_source_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + GVariant *sources; + gint i, n; + + settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + + n = g_variant_n_children (sources); + if (n < 2) + goto out; + + i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); + + if (type == SWITCH_INPUT_SOURCE_KEY) + i += 1; + else + i -= 1; + + if (i < 0) + i = n - 1; + else if (i >= n) + i = 0; + + g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); + + out: + g_variant_unref (sources); + g_object_unref (settings); +} + +static void +do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +{ + execute (manager, key->custom_command, FALSE); +} + +static gboolean +do_action (GsdMediaKeysManager *manager, + guint deviceid, + MediaKeyType type, + gint64 timestamp) +{ + char *cmd; + + g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid); + + switch (type) { + case TOUCHPAD_KEY: + do_touchpad_action (manager); + break; + case TOUCHPAD_ON_KEY: + do_touchpad_osd_action (manager, TRUE); + break; + case TOUCHPAD_OFF_KEY: + do_touchpad_osd_action (manager, FALSE); + break; + case MUTE_KEY: + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + do_sound_action (manager, deviceid, type, FALSE); + break; + case MUTE_QUIET_KEY: + do_sound_action (manager, deviceid, MUTE_KEY, TRUE); + break; + case VOLUME_DOWN_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_DOWN_KEY, TRUE); + break; + case VOLUME_UP_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: + gnome_session_shutdown (manager); + break; + case EJECT_KEY: + do_eject_action (manager); + break; + case HOME_KEY: + do_home_key_action (manager, timestamp); + break; + case SEARCH_KEY: + cmd = NULL; + if ((cmd = g_find_program_in_path ("tracker-search-tool"))) + do_execute_desktop (manager, "tracker-needle.desktop", timestamp); + else + do_execute_desktop (manager, "gnome-search-tool.desktop", timestamp); + g_free (cmd); + break; + case EMAIL_KEY: + do_url_action (manager, "mailto", timestamp); + break; + case SCREENSAVER_KEY: + execute (manager, "gnome-screensaver-command --lock", FALSE); + break; + case HELP_KEY: + do_url_action (manager, "ghelp", timestamp); + break; + case SCREENSHOT_KEY: + execute (manager, "gnome-screenshot", FALSE); + break; + case WINDOW_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --window", FALSE); + break; + case AREA_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --area", FALSE); + break; + case SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --clipboard", FALSE); + break; + case WINDOW_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --window --clipboard", FALSE); + break; + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; + case MEDIA_KEY: + do_media_action (manager, timestamp); + break; + case CALCULATOR_KEY: + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: + return do_multimedia_player_action (manager, NULL, "Play"); + case PAUSE_KEY: + return do_multimedia_player_action (manager, NULL, "Pause"); + case STOP_KEY: + return do_multimedia_player_action (manager, NULL, "Stop"); + case PREVIOUS_KEY: + return do_multimedia_player_action (manager, NULL, "Previous"); + case NEXT_KEY: + return do_multimedia_player_action (manager, NULL, "Next"); + case REWIND_KEY: + return do_multimedia_player_action (manager, NULL, "Rewind"); + case FORWARD_KEY: + return do_multimedia_player_action (manager, NULL, "FastForward"); + case REPEAT_KEY: + return do_multimedia_player_action (manager, NULL, "Repeat"); + case RANDOM_KEY: + return do_multimedia_player_action (manager, NULL, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; + case ROTATE_VIDEO_KEY: + do_video_rotate_action (manager, timestamp); + break; + case MAGNIFIER_KEY: + do_magnifier_action (manager); + break; + case SCREENREADER_KEY: + do_screenreader_action (manager); + break; + case ON_SCREEN_KEYBOARD_KEY: + do_on_screen_keyboard_action (manager); + break; + case INCREASE_TEXT_KEY: + case DECREASE_TEXT_KEY: + do_text_size_action (manager, type); + break; + case MAGNIFIER_ZOOM_IN_KEY: + case MAGNIFIER_ZOOM_OUT_KEY: + do_magnifier_zoom_action (manager, type); + break; + case TOGGLE_CONTRAST_KEY: + do_toggle_contrast_action (manager); + break; + case POWER_KEY: + do_config_power_action (manager, "button-power"); + break; + case SLEEP_KEY: + do_config_power_action (manager, "button-sleep"); + break; + case SUSPEND_KEY: + do_config_power_action (manager, "button-suspend"); + break; + case HIBERNATE_KEY: + do_config_power_action (manager, "button-hibernate"); + break; + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + do_screen_brightness_action (manager, type); + break; + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + do_keyboard_brightness_action (manager, type); + break; + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; + case SWITCH_INPUT_SOURCE_KEY: + case SWITCH_INPUT_SOURCE_BACKWARD_KEY: + do_switch_input_source_action (manager, type); + break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); + } + + return FALSE; +} + +static GdkScreen * +get_screen_from_root (GsdMediaKeysManager *manager, + Window root) +{ + GSList *l; + + /* Look for which screen we're receiving events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + GdkScreen *screen = (GdkScreen *) l->data; + GdkWindow *window = gdk_screen_get_root_window (screen); + + if (GDK_WINDOW_XID (window) == root) + return screen; + } + + return NULL; +} + +static GdkFilterReturn +filter_key_events (XEvent *xevent, + GdkEvent *event, + GsdMediaKeysManager *manager) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XGenericEventCookie *cookie; + guint i; + guint deviceid; + + /* verify we have a key event */ + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + cookie = &xevent->xcookie; + if (cookie->extension != manager->priv->opcode) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + deviceid = xev->sourceid; + + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (match_xi2_key (key->key, xev)) { + switch (key->key_type) { + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + /* auto-repeatable keys */ + if (xiev->evtype != XI_KeyPress) + return GDK_FILTER_CONTINUE; + break; + default: + if (xiev->evtype != XI_KeyRelease) { + return GDK_FILTER_CONTINUE; + } + } + + manager->priv->current_screen = get_screen_from_root (manager, xev->root); + + if (key->key_type == CUSTOM_KEY) { + do_custom_action (manager, key, xev->time); + return GDK_FILTER_REMOVE; + } + + if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +update_theme_settings (GSettings *settings, + const char *key, + GsdMediaKeysManager *manager) +{ + char *theme; + + theme = g_settings_get_string (manager->priv->interface_settings, key); + if (g_str_equal (theme, HIGH_CONTRAST)) { + g_free (theme); + } else { + if (g_str_equal (key, "gtk-theme")) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = theme; + } else { + g_free (manager->priv->icon_theme); + manager->priv->icon_theme = theme; + } + } +} + +static gboolean +start_media_keys_idle_cb (GsdMediaKeysManager *manager) +{ + GSList *l; + char *theme_name; + + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + + + gvc_mixer_control_open (manager->priv->volume); + + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::custom-keybindings", + G_CALLBACK (gsettings_custom_changed_cb), manager); + + manager->priv->custom_settings = + g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + /* Sound events */ + ca_context_create (&manager->priv->ca); + ca_context_set_driver (manager->priv->ca, "pulse"); + ca_context_change_props (manager->priv->ca, 0, + CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", + NULL); + manager->priv->gtksettings = gtk_settings_get_for_screen (gdk_screen_get_default ()); + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); + g_signal_connect (manager->priv->gtksettings, "notify::gtk-sound-theme-name", + G_CALLBACK (sound_theme_changed), manager); + + /* for the power plugin interface code */ + manager->priv->power_settings = g_settings_new (SETTINGS_POWER_DIR); + + /* Logic from http://git.gnome.org/browse/gnome-shell/tree/js/ui/status/accessibility.js#n163 */ + manager->priv->interface_settings = g_settings_new (SETTINGS_INTERFACE_DIR); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::gtk-theme", + G_CALLBACK (update_theme_settings), manager); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::icon-theme", + G_CALLBACK (update_theme_settings), manager); + manager->priv->gtk_theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + if (g_str_equal (manager->priv->gtk_theme, HIGH_CONTRAST)) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = NULL; + } + manager->priv->icon_theme = g_settings_get_string (manager->priv->interface_settings, "icon-theme"); + + init_screens (manager); + init_kbd (manager); + + /* Start filtering the events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + gnome_settings_profile_start ("gdk_window_add_filter"); + + g_debug ("adding key filter for screen: %d", + gdk_screen_get_number (l->data)); + + gdk_window_add_filter (gdk_screen_get_root_window (l->data), + (GdkFilterFunc) filter_key_events, + manager); + gnome_settings_profile_end ("gdk_window_add_filter"); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error) +{ + const char * const subsystems[] = { "input", "usb", "sound", NULL }; + + gnome_settings_profile_start (NULL); + + if (supports_xinput2_devices (&manager->priv->opcode) == FALSE) { + g_debug ("No Xinput2 support, disabling plugin"); + return TRUE; + } + +#ifdef HAVE_GUDEV + manager->priv->streams = g_hash_table_new (g_direct_hash, g_direct_equal); + manager->priv->udev_client = g_udev_client_new (subsystems); +#endif + + /* initialise Volume handler + * + * We do this one here to force checking gstreamer cache, etc. + * The rest (grabbing and setting the keys) can happen in an + * idle. + */ + gnome_settings_profile_start ("gvc_mixer_control_new"); + + manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys"); + + g_signal_connect (manager->priv->volume, + "state-changed", + G_CALLBACK (on_control_state_changed), + manager); + g_signal_connect (manager->priv->volume, + "default-sink-changed", + G_CALLBACK (on_control_default_sink_changed), + manager); + g_signal_connect (manager->priv->volume, + "stream-removed", + G_CALLBACK (on_control_stream_removed), + manager); + + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); + + register_manager (manager_object); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_media_keys_manager_stop (GsdMediaKeysManager *manager) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + GSList *ls; + GList *l; + int i; + + g_debug ("Stopping media_keys manager"); + + if (priv->bus_cancellable != NULL) { + g_cancellable_cancel (priv->bus_cancellable); + g_object_unref (priv->bus_cancellable); + priv->bus_cancellable = NULL; + } + + for (ls = priv->screens; ls != NULL; ls = ls->next) { + gdk_window_remove_filter (gdk_screen_get_root_window (ls->data), + (GdkFilterFunc) filter_key_events, + manager); + } + + if (manager->priv->gtksettings != NULL) { + g_signal_handlers_disconnect_by_func (manager->priv->gtksettings, sound_theme_changed, manager); + manager->priv->gtksettings = NULL; + } + + if (manager->priv->ca) { + ca_context_destroy (manager->priv->ca); + manager->priv->ca = NULL; + } + +#ifdef HAVE_GUDEV + if (priv->streams) { + g_hash_table_destroy (priv->streams); + priv->streams = NULL; + } + if (priv->udev_client) { + g_object_unref (priv->udev_client); + priv->udev_client = NULL; + } +#endif /* HAVE_GUDEV */ + + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; + } + + if (priv->power_settings) { + g_object_unref (priv->power_settings); + priv->power_settings = NULL; + } + + if (priv->power_screen_proxy) { + g_object_unref (priv->power_screen_proxy); + priv->power_screen_proxy = NULL; + } + + if (priv->power_keyboard_proxy) { + g_object_unref (priv->power_keyboard_proxy); + priv->power_keyboard_proxy = NULL; + } + + if (priv->upower_proxy) { + g_object_unref (priv->upower_proxy); + priv->upower_proxy = NULL; + } + + if (priv->cancellable != NULL) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + + if (priv->introspection_data) { + g_dbus_node_info_unref (priv->introspection_data); + priv->introspection_data = NULL; + } + + if (priv->connection != NULL) { + g_object_unref (priv->connection); + priv->connection = NULL; + } + + if (priv->volume_notification != NULL) { + notify_notification_close (priv->volume_notification, NULL); + g_object_unref (priv->volume_notification); + priv->volume_notification = NULL; + } + + if (priv->brightness_notification != NULL) { + notify_notification_close (priv->brightness_notification, NULL); + g_object_unref (priv->brightness_notification); + priv->brightness_notification = NULL; + } + + if (priv->kb_backlight_notification != NULL) { + notify_notification_close (priv->kb_backlight_notification, NULL); + g_object_unref (priv->kb_backlight_notification); + priv->kb_backlight_notification = NULL; + } + + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->key) + ungrab_key_unsafe (key->key, priv->screens); + } + g_ptr_array_free (priv->keys, TRUE); + priv->keys = NULL; + + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (priv->screens != NULL) { + g_slist_free (priv->screens); + priv->screens = NULL; + } + + if (priv->stream) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + if (priv->volume) { + g_object_unref (priv->volume); + priv->volume = NULL; + } + + if (priv->dialog != NULL) { + gtk_widget_destroy (priv->dialog); + priv->dialog = NULL; + } + + if (priv->media_players != NULL) { + for (l = priv->media_players; l; l = l->next) { + MediaPlayer *mp = l->data; + g_free (mp->application); + g_free (mp); + } + g_list_free (priv->media_players); + priv->media_players = NULL; + } +} + +static GObject * +gsd_media_keys_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMediaKeysManager *media_keys_manager; + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (media_keys_manager); +} + +static void +gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_media_keys_manager_constructor; + object_class->finalize = gsd_media_keys_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysManagerPrivate)); +} + +static void +gsd_media_keys_manager_init (GsdMediaKeysManager *manager) +{ + manager->priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_media_keys_manager_finalize (GObject *object) +{ + GsdMediaKeysManager *media_keys_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_MANAGER (object)); + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (object); + + g_return_if_fail (media_keys_manager->priv != NULL); + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object); +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +upower_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->upower_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Failed to get proxy for upower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_screen_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_screen_proxy == NULL) { + g_warning ("Failed to get proxy for power (screen): %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_keyboard_proxy == NULL) { + g_warning ("Failed to get proxy for power (keyboard): %s", + error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MEDIA_KEYS_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Screen", + NULL, + (GAsyncReadyCallback) power_screen_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Keyboard", + NULL, + (GAsyncReadyCallback) power_keyboard_ready_cb, + manager); +} + +static void +register_manager (GsdMediaKeysManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + NULL, + (GAsyncReadyCallback) upower_ready_cb, + manager); +} + +GsdMediaKeysManager * +gsd_media_keys_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MEDIA_KEYS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MEDIA_KEYS_MANAGER (manager_object); +} diff --git a/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/plugins/media-keys/shortcuts-list.h b/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/plugins/media-keys/shortcuts-list.h new file mode 100644 index 00000000..a16d0e77 --- /dev/null +++ b/.pc/64_restore_terminal_keyboard_shortcut_schema.patch/plugins/media-keys/shortcuts-list.h @@ -0,0 +1,156 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001 Bastien Nocera + * + * 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 __ACME_H__ +#define __ACME_H__ + +#include "gsd-keygrab.h" + +#define SETTINGS_BINDING_DIR "org.gnome.settings-daemon.plugins.media-keys" + +typedef enum { + TOUCHPAD_KEY, + TOUCHPAD_ON_KEY, + TOUCHPAD_OFF_KEY, + MUTE_KEY, + VOLUME_DOWN_KEY, + VOLUME_UP_KEY, + MUTE_QUIET_KEY, + VOLUME_DOWN_QUIET_KEY, + VOLUME_UP_QUIET_KEY, + LOGOUT_KEY, + EJECT_KEY, + HOME_KEY, + MEDIA_KEY, + CALCULATOR_KEY, + SEARCH_KEY, + EMAIL_KEY, + SCREENSAVER_KEY, + HELP_KEY, + SCREENSHOT_KEY, + WINDOW_SCREENSHOT_KEY, + AREA_SCREENSHOT_KEY, + SCREENSHOT_CLIP_KEY, + WINDOW_SCREENSHOT_CLIP_KEY, + AREA_SCREENSHOT_CLIP_KEY, + WWW_KEY, + PLAY_KEY, + PAUSE_KEY, + STOP_KEY, + PREVIOUS_KEY, + NEXT_KEY, + REWIND_KEY, + FORWARD_KEY, + REPEAT_KEY, + RANDOM_KEY, + VIDEO_OUT_KEY, + ROTATE_VIDEO_KEY, + MAGNIFIER_KEY, + SCREENREADER_KEY, + ON_SCREEN_KEYBOARD_KEY, + INCREASE_TEXT_KEY, + DECREASE_TEXT_KEY, + TOGGLE_CONTRAST_KEY, + MAGNIFIER_ZOOM_IN_KEY, + MAGNIFIER_ZOOM_OUT_KEY, + POWER_KEY, + SLEEP_KEY, + SUSPEND_KEY, + HIBERNATE_KEY, + SCREEN_BRIGHTNESS_UP_KEY, + SCREEN_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_UP_KEY, + KEYBOARD_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_TOGGLE_KEY, + BATTERY_KEY, + SWITCH_INPUT_SOURCE_KEY, + SWITCH_INPUT_SOURCE_BACKWARD_KEY, + CUSTOM_KEY +} MediaKeyType; + +static struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; +} media_keys[] = { + { TOUCHPAD_KEY, NULL, "XF86TouchpadToggle" }, + { TOUCHPAD_ON_KEY, NULL, "XF86TouchpadOn" }, + { TOUCHPAD_OFF_KEY, NULL, "XF86TouchpadOff" }, + { MUTE_KEY, "volume-mute", NULL }, + { VOLUME_DOWN_KEY, "volume-down", NULL }, + { VOLUME_UP_KEY, "volume-up", NULL }, + { MUTE_QUIET_KEY, NULL, "XF86AudioMute" }, + { VOLUME_DOWN_QUIET_KEY, NULL, "XF86AudioLowerVolume" }, + { VOLUME_UP_QUIET_KEY, NULL, "XF86AudioRaiseVolume" }, + { LOGOUT_KEY, "logout", NULL }, + { EJECT_KEY, "eject", NULL }, + { HOME_KEY, "home", NULL }, + { MEDIA_KEY, "media", NULL }, + { CALCULATOR_KEY, "calculator", NULL }, + { SEARCH_KEY, "search", NULL }, + { EMAIL_KEY, "email", NULL }, + { SCREENSAVER_KEY, "screensaver", NULL }, + { SCREENSAVER_KEY, NULL, "XF86ScreenSaver" }, + { HELP_KEY, "help", NULL }, + { SCREENSHOT_KEY, "screenshot", NULL }, + { WINDOW_SCREENSHOT_KEY, "window-screenshot", NULL }, + { AREA_SCREENSHOT_KEY, "area-screenshot", NULL }, + { SCREENSHOT_CLIP_KEY, "screenshot-clip", NULL }, + { WINDOW_SCREENSHOT_CLIP_KEY, "window-screenshot-clip", NULL }, + { AREA_SCREENSHOT_CLIP_KEY, "area-screenshot-clip", NULL }, + { WWW_KEY, "www", NULL }, + { PLAY_KEY, "play", NULL }, + { PAUSE_KEY, "pause", NULL }, + { STOP_KEY, "stop", NULL }, + { PREVIOUS_KEY, "previous", NULL }, + { NEXT_KEY, "next", NULL }, + { REWIND_KEY, NULL, "XF86AudioRewind" }, + { FORWARD_KEY, NULL, "XF86AudioForward" }, + { REPEAT_KEY, NULL, "XF86AudioRepeat" }, + { RANDOM_KEY, NULL, "XF86AudioRandomPlay"}, + { VIDEO_OUT_KEY, NULL, "p" }, + /* Key code of the XF86Display key (Fn-F7 on Thinkpads, Fn-F4 on HP machines, etc.) */ + { VIDEO_OUT_KEY, NULL, "XF86Display" }, + /* Key code of the XF86RotateWindows key (present on some tablets) */ + { ROTATE_VIDEO_KEY, NULL, "XF86RotateWindows" }, + { MAGNIFIER_KEY, "magnifier", NULL }, + { SCREENREADER_KEY, "screenreader", NULL }, + { ON_SCREEN_KEYBOARD_KEY, "on-screen-keyboard", NULL }, + { INCREASE_TEXT_KEY, "increase-text-size", NULL }, + { DECREASE_TEXT_KEY, "decrease-text-size", NULL }, + { TOGGLE_CONTRAST_KEY, "toggle-contrast", NULL }, + { MAGNIFIER_ZOOM_IN_KEY, "magnifier-zoom-in", NULL }, + { MAGNIFIER_ZOOM_OUT_KEY, "magnifier-zoom-out", NULL }, + { POWER_KEY, NULL, "XF86PowerOff" }, + /* the kernel / Xorg names really are like this... */ + { SLEEP_KEY, NULL, "XF86Suspend" }, + { SUSPEND_KEY, NULL, "XF86Sleep" }, + { HIBERNATE_KEY, NULL, "XF86Hibernate" }, + { SCREEN_BRIGHTNESS_UP_KEY, NULL, "XF86MonBrightnessUp" }, + { SCREEN_BRIGHTNESS_DOWN_KEY, NULL, "XF86MonBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_UP_KEY, NULL, "XF86KbdBrightnessUp" }, + { KEYBOARD_BRIGHTNESS_DOWN_KEY, NULL, "XF86KbdBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_TOGGLE_KEY, NULL, "XF86KbdLightOnOff" }, + { SWITCH_INPUT_SOURCE_KEY, "switch-input-source", NULL }, + { SWITCH_INPUT_SOURCE_BACKWARD_KEY, "switch-input-source-backward", NULL }, + { BATTERY_KEY, NULL, "XF86Battery" }, +}; + +#endif /* __ACME_H__ */ diff --git a/.pc/90_set_gmenus_xsettings.patch/plugins/xsettings/gsd-xsettings-manager.c b/.pc/90_set_gmenus_xsettings.patch/plugins/xsettings/gsd-xsettings-manager.c new file mode 100644 index 00000000..1bb76e32 --- /dev/null +++ b/.pc/90_set_gmenus_xsettings.patch/plugins/xsettings/gsd-xsettings-manager.c @@ -0,0 +1,1053 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 Rodrigo Moya + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-enums.h" +#include "gsd-xsettings-manager.h" +#include "gsd-xsettings-gtk.h" +#include "xsettings-manager.h" +#include "fontconfig-monitor.h" + +#define GNOME_XSETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_XSETTINGS_MANAGER, GnomeXSettingsManagerPrivate)) + +#define MOUSE_SETTINGS_SCHEMA "org.gnome.settings-daemon.peripherals.mouse" +#define INTERFACE_SETTINGS_SCHEMA "org.gnome.desktop.interface" +#define SOUND_SETTINGS_SCHEMA "org.gnome.desktop.sound" + +#define XSETTINGS_PLUGIN_SCHEMA "org.gnome.settings-daemon.plugins.xsettings" +#define XSETTINGS_OVERRIDE_KEY "overrides" + +#define GTK_MODULES_DISABLED_KEY "disabled-gtk-modules" +#define GTK_MODULES_ENABLED_KEY "enabled-gtk-modules" + +#define TEXT_SCALING_FACTOR_KEY "text-scaling-factor" + +#define FONT_ANTIALIASING_KEY "antialiasing" +#define FONT_HINTING_KEY "hinting" +#define FONT_RGBA_ORDER_KEY "rgba-order" + +/* As we cannot rely on the X server giving us good DPI information, and + * that we don't want multi-monitor screens to have different DPIs (thus + * different text sizes), we'll hard-code the value of the DPI + * + * See also: + * https://bugzilla.novell.com/show_bug.cgi?id=217790• + * https://bugzilla.gnome.org/show_bug.cgi?id=643704 + * + * http://lists.fedoraproject.org/pipermail/devel/2011-October/157671.html + * Why EDID is not trustworthy for DPI + * Adam Jackson ajax at redhat.com + * Tue Oct 4 17:54:57 UTC 2011 + * + * Previous message: GNOME 3 - font point sizes now scaled? + * Next message: Why EDID is not trustworthy for DPI + * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] + * + * On Tue, 2011-10-04 at 11:46 -0400, Kaleb S. KEITHLEY wrote: + * + * > Grovelling around in the F15 xorg-server sources and reviewing the Xorg + * > log file on my F15 box, I see, with _modern hardware_ at least, that we + * > do have the monitor geometry available from DDC or EDIC, and obviously + * > it is trivial to compute the actual, correct DPI for each screen. + * + * I am clearly going to have to explain this one more time, forever. + * Let's see if I can't write it authoritatively once and simply answer + * with a URL from here out. (As always, use of the second person "you" + * herein is plural, not singular.) + * + * EDID does not reliably give you the size of the display. + * + * Base EDID has at least two different places where you can give a + * physical size (before considering extensions that aren't widely deployed + * so whatever). The first is a global property, measured in centimeters, + * of the physical size of the glass. The second is attached to your (zero + * or more) detailed timing specifications, and reflects the size of the + * mode, in millimeters. + * + * So, how does this screw you? + * + * a) Glass size is too coarse. On a large display that cm roundoff isn't + * a big deal, but on subnotebooks it's a different game. The 11" MBA is + * 25.68x14.44 cm, so that gives you a range of 52.54-54.64 dpcm horizontal + * and 51.20-54.86 dpcm vertical (133.4-138.8 dpi h and 130.0-139.3 dpi v). + * Which is optimistic, because that's doing the math forward from knowing + * the actual size, and you as the EDID parser can't know which way the + * manufacturer rounded. + * + * b) Glass size need not be non-zero. This is in fact the usual case for + * projectors, which don't have a fixed display size since it's a function + * of how far away the wall is from the lens. + * + * c) Glass size could be partially non-zero. Yes, really. EDID 1.4 + * defines a method of using these two bytes to encode aspect ratio, where + * if vertical size is 0 then the aspect ratio is computed as (horizontal + * value + 99) / 100 in portrait mode (and the obvious reverse thing if + * horizontal is zero). Admittedly, unlike every other item in this list, + * I've never seen this in the wild. But it's legal. + * + * d) Glass size could be a direct encoding of the aspect ratio. Base EDID + * doesn't condone this behaviour, but the CEA spec (to which all HDMI + * monitors must conform) does allow-but-not-require it, which means your + * 1920x1080 TV could claim to be 16 "cm" by 9 "cm". So of course that's + * what TV manufacturers do because that way they don't have to modify the + * EDID info when physical construction changes, and that's cheaper. + * + * e) You could use mode size to get size in millimeters, but you might not + * have any detailed timings. + * + * f) You could use mode size, but mode size is explicitly _not_ glass + * size. It's the size that the display chooses to present that mode. + * Sometimes those are the same, and sometimes they're not. You could be + * scaled or {letter,pillar}boxed, and that's not necessarily something you + * can control from the host side. + * + * g) You could use mode size, but it could be an encoded aspect ratio, as + * in case d above, because CEA says that's okay. + * + * h) You could use mode size, but it could be the aspect ratio from case d + * multiplied by 10 in each direction (because, of course, you gave size in + * centimeters and so your authoring tool just multiplied it up). + * + * i) Any or all of the above could be complete and utter garbage, because + * - and I really, really need you to understand this - there is no + * requirements program for any commercial OS or industry standard that + * requires honesty here, as far as I'm aware. There is every incentive + * for there to _never_ be one, because it would make the manufacturing + * process more expensive. + * + * So from this point the suggestion is usually "well come up with some + * heuristic to make a good guess assuming there's some correlation between + * the various numbers you're given". I have in fact written heuristics + * for this, and they're in your kernel and your X server, and they still + * encounter a huge number of cases where we simply _cannot_ know from EDID + * anything like a physical size, because - to pick only one example - the + * consumer electronics industry are cheap bastards, because you the + * consumer demanded that they be cheap. + * + * And then your only recourse is to an external database, and now you're + * up the creek again because the identifying information here is a + * vendor/model/serial tuple, and the vendor can and does change physical + * construction without changing model number. Now you get to play the + * guessing game of how big the serial number range is for each subvariant, + * assuming they bothered to encode a serial number - and they didn't. Or, + * if they bothered to encode week/year of manufacturer correctly - and + * they didn't - which weeks meant which models. And then you still have + * to go out and buy one of every TV at Fry's, and that covers you for one + * market, for three months. + * + * If someone wants to write something better, please, by all means. If + * it's kernel code, send it to dri-devel at lists.freedesktop.org and cc me + * and I will happily review it. Likewise xorg-devel@ for X server + * changes. + * + * I gently suggest that doing so is a waste of time. + * + * But if there's one thing free software has taught me, it's that you can + * not tell people something is a bad idea and have any expectation they + * will believe you. + * + * > Obviously in a multi-screen set-up using Xinerama this has the potential + * > to be a Hard Problem if the monitors differ greatly in their DPI. + * > + * > If the major resistance is over what to do with older hardware that + * > doesn't have this data available, then yes, punt; use a hard-coded + * > default. Likewise, if the two monitors really differ greatly, then punt. + * + * I'm going to limit myself to observing that "greatly" is a matter of + * opinion, and that in order to be really useful you'd need some way of + * communicating "I punted" to the desktop. + * + * Beyond that, sure, pick a heuristic, accept that it's going to be + * insufficient for someone, and then sit back and wait to get + * second-guessed on it over and over. + * + * > And it wouldn't be so hard to to add something like -dpi:0, -dpi:1, + * > -dpi:2 command line options to specify per-screen dpi. I kinda thought I + * > did that a long, long time ago, but maybe I only thought about doing it + * > and never actually got around to it. + * + * The RANDR extension as of version 1.2 does allow you to override + * physical size on a per-output basis at runtime. We even try pretty hard + * to set them as honestly as we can up front. The 96dpi thing people + * complain about is from the per-screen info, which is simply a default + * because of all the tl;dr above; because you have N outputs per screen + * which means a single number is in general useless; and because there is + * no way to refresh the per-screen info at runtime, as it's only ever sent + * in the initial connection handshake. + * + * - ajax + * + */ +#define DPI_FALLBACK 96 + +typedef struct _TranslationEntry TranslationEntry; +typedef void (* TranslationFunc) (GnomeXSettingsManager *manager, + TranslationEntry *trans, + GVariant *value); + +struct _TranslationEntry { + const char *gsettings_schema; + const char *gsettings_key; + const char *xsetting_name; + + TranslationFunc translate; +}; + +struct GnomeXSettingsManagerPrivate +{ + guint start_idle_id; + XSettingsManager **managers; + GHashTable *settings; + + GSettings *plugin_settings; + fontconfig_monitor_handle_t *fontconfig_handle; + + GsdXSettingsGtk *gtk; + + guint shell_name_watch_id; + gboolean have_shell; + + guint notify_idle_id; +}; + +#define GSD_XSETTINGS_ERROR gsd_xsettings_error_quark () + +enum { + GSD_XSETTINGS_ERROR_INIT +}; + +static void gnome_xsettings_manager_class_init (GnomeXSettingsManagerClass *klass); +static void gnome_xsettings_manager_init (GnomeXSettingsManager *xsettings_manager); +static void gnome_xsettings_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GnomeXSettingsManager, gnome_xsettings_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static GQuark +gsd_xsettings_error_quark (void) +{ + return g_quark_from_static_string ("gsd-xsettings-error-quark"); +} + +static void +translate_bool_int (GnomeXSettingsManager *manager, + TranslationEntry *trans, + GVariant *value) +{ + int i; + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_int (manager->priv->managers [i], trans->xsetting_name, + g_variant_get_boolean (value)); + } +} + +static void +translate_int_int (GnomeXSettingsManager *manager, + TranslationEntry *trans, + GVariant *value) +{ + int i; + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_int (manager->priv->managers [i], trans->xsetting_name, + g_variant_get_int32 (value)); + } +} + +static void +translate_string_string (GnomeXSettingsManager *manager, + TranslationEntry *trans, + GVariant *value) +{ + int i; + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_string (manager->priv->managers [i], + trans->xsetting_name, + g_variant_get_string (value, NULL)); + } +} + +static void +translate_string_string_toolbar (GnomeXSettingsManager *manager, + TranslationEntry *trans, + GVariant *value) +{ + int i; + const char *tmp; + + /* This is kind of a workaround since GNOME expects the key value to be + * "both_horiz" and gtk+ wants the XSetting to be "both-horiz". + */ + tmp = g_variant_get_string (value, NULL); + if (tmp && strcmp (tmp, "both_horiz") == 0) { + tmp = "both-horiz"; + } + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_string (manager->priv->managers [i], + trans->xsetting_name, + tmp); + } +} + +static TranslationEntry translations [] = { + { "org.gnome.settings-daemon.peripherals.mouse", "double-click", "Net/DoubleClickTime", translate_int_int }, + { "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "Net/DndDragThreshold", translate_int_int }, + + { "org.gnome.desktop.interface", "gtk-color-palette", "Gtk/ColorPalette", translate_string_string }, + { "org.gnome.desktop.interface", "font-name", "Gtk/FontName", translate_string_string }, + { "org.gnome.desktop.interface", "gtk-key-theme", "Gtk/KeyThemeName", translate_string_string }, + { "org.gnome.desktop.interface", "toolbar-style", "Gtk/ToolbarStyle", translate_string_string_toolbar }, + { "org.gnome.desktop.interface", "toolbar-icons-size", "Gtk/ToolbarIconSize", translate_string_string }, + { "org.gnome.desktop.interface", "can-change-accels", "Gtk/CanChangeAccels", translate_bool_int }, + { "org.gnome.desktop.interface", "cursor-blink", "Net/CursorBlink", translate_bool_int }, + { "org.gnome.desktop.interface", "cursor-blink-time", "Net/CursorBlinkTime", translate_int_int }, + { "org.gnome.desktop.interface", "cursor-blink-timeout", "Gtk/CursorBlinkTimeout", translate_int_int }, + { "org.gnome.desktop.interface", "gtk-theme", "Net/ThemeName", translate_string_string }, + { "org.gnome.desktop.interface", "gtk-timeout-initial", "Gtk/TimeoutInitial", translate_int_int }, + { "org.gnome.desktop.interface", "gtk-timeout-repeat", "Gtk/TimeoutRepeat", translate_int_int }, + { "org.gnome.desktop.interface", "gtk-color-scheme", "Gtk/ColorScheme", translate_string_string }, + { "org.gnome.desktop.interface", "gtk-im-preedit-style", "Gtk/IMPreeditStyle", translate_string_string }, + { "org.gnome.desktop.interface", "gtk-im-status-style", "Gtk/IMStatusStyle", translate_string_string }, + { "org.gnome.desktop.interface", "gtk-im-module", "Gtk/IMModule", translate_string_string }, + { "org.gnome.desktop.interface", "icon-theme", "Net/IconThemeName", translate_string_string }, + { "org.gnome.desktop.interface", "menus-have-icons", "Gtk/MenuImages", translate_bool_int }, + { "org.gnome.desktop.interface", "buttons-have-icons", "Gtk/ButtonImages", translate_bool_int }, + { "org.gnome.desktop.interface", "menubar-accel", "Gtk/MenuBarAccel", translate_string_string }, + { "org.gnome.desktop.interface", "enable-animations", "Gtk/EnableAnimations", translate_bool_int }, + { "org.gnome.desktop.interface", "cursor-theme", "Gtk/CursorThemeName", translate_string_string }, + { "org.gnome.desktop.interface", "cursor-size", "Gtk/CursorThemeSize", translate_int_int }, + { "org.gnome.desktop.interface", "show-input-method-menu", "Gtk/ShowInputMethodMenu", translate_bool_int }, + { "org.gnome.desktop.interface", "show-unicode-menu", "Gtk/ShowUnicodeMenu", translate_bool_int }, + { "org.gnome.desktop.interface", "automatic-mnemonics", "Gtk/AutoMnemonics", translate_bool_int }, + + { "org.gnome.desktop.sound", "theme-name", "Net/SoundThemeName", translate_string_string }, + { "org.gnome.desktop.sound", "event-sounds", "Net/EnableEventSounds" , translate_bool_int }, + { "org.gnome.desktop.sound", "input-feedback-sounds", "Net/EnableInputFeedbackSounds", translate_bool_int } +}; + +static gboolean +notify_idle (gpointer data) +{ + GnomeXSettingsManager *manager = data; + gint i; + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_notify (manager->priv->managers[i]); + } + manager->priv->notify_idle_id = 0; + return G_SOURCE_REMOVE; +} + +static void +queue_notify (GnomeXSettingsManager *manager) +{ + if (manager->priv->notify_idle_id != 0) + return; + + manager->priv->notify_idle_id = g_idle_add (notify_idle, manager); +} + +static double +get_dpi_from_gsettings (GnomeXSettingsManager *manager) +{ + GSettings *interface_settings; + double dpi; + double factor; + + interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA); + factor = g_settings_get_double (interface_settings, TEXT_SCALING_FACTOR_KEY); + + dpi = DPI_FALLBACK; + + return dpi * factor; +} + +typedef struct { + gboolean antialias; + gboolean hinting; + int dpi; + const char *rgba; + const char *hintstyle; +} GnomeXftSettings; + +/* Read GSettings and determine the appropriate Xft settings based on them. */ +static void +xft_settings_get (GnomeXSettingsManager *manager, + GnomeXftSettings *settings) +{ + GsdFontAntialiasingMode antialiasing; + GsdFontHinting hinting; + GsdFontRgbaOrder order; + gboolean use_rgba = FALSE; + + antialiasing = g_settings_get_enum (manager->priv->plugin_settings, FONT_ANTIALIASING_KEY); + hinting = g_settings_get_enum (manager->priv->plugin_settings, FONT_HINTING_KEY); + order = g_settings_get_enum (manager->priv->plugin_settings, FONT_RGBA_ORDER_KEY); + + settings->antialias = (antialiasing != GSD_FONT_ANTIALIASING_MODE_NONE); + settings->hinting = (hinting != GSD_FONT_HINTING_NONE); + settings->dpi = get_dpi_from_gsettings (manager) * 1024; /* Xft wants 1/1024ths of an inch */ + settings->rgba = "rgb"; + settings->hintstyle = "hintfull"; + + switch (hinting) { + case GSD_FONT_HINTING_NONE: + settings->hintstyle = "hintnone"; + break; + case GSD_FONT_HINTING_SLIGHT: + settings->hintstyle = "hintslight"; + break; + case GSD_FONT_HINTING_MEDIUM: + settings->hintstyle = "hintmedium"; + break; + case GSD_FONT_HINTING_FULL: + settings->hintstyle = "hintfull"; + break; + } + + switch (order) { + case GSD_FONT_RGBA_ORDER_RGBA: + settings->rgba = "rgba"; + break; + case GSD_FONT_RGBA_ORDER_RGB: + settings->rgba = "rgb"; + break; + case GSD_FONT_RGBA_ORDER_BGR: + settings->rgba = "bgr"; + break; + case GSD_FONT_RGBA_ORDER_VRGB: + settings->rgba = "vrgb"; + break; + case GSD_FONT_RGBA_ORDER_VBGR: + settings->rgba = "vbgr"; + break; + } + + switch (antialiasing) { + case GSD_FONT_ANTIALIASING_MODE_NONE: + settings->antialias = 0; + break; + case GSD_FONT_ANTIALIASING_MODE_GRAYSCALE: + settings->antialias = 1; + break; + case GSD_FONT_ANTIALIASING_MODE_RGBA: + settings->antialias = 1; + use_rgba = TRUE; + } + + if (!use_rgba) { + settings->rgba = "none"; + } +} + +static void +xft_settings_set_xsettings (GnomeXSettingsManager *manager, + GnomeXftSettings *settings) +{ + int i; + + gnome_settings_profile_start (NULL); + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_int (manager->priv->managers [i], "Xft/Antialias", settings->antialias); + xsettings_manager_set_int (manager->priv->managers [i], "Xft/Hinting", settings->hinting); + xsettings_manager_set_string (manager->priv->managers [i], "Xft/HintStyle", settings->hintstyle); + xsettings_manager_set_int (manager->priv->managers [i], "Xft/DPI", settings->dpi); + xsettings_manager_set_string (manager->priv->managers [i], "Xft/RGBA", settings->rgba); + } + gnome_settings_profile_end (NULL); +} + +static void +update_property (GString *props, const gchar* key, const gchar* value) +{ + gchar* needle; + size_t needle_len; + gchar* found = NULL; + + /* update an existing property */ + needle = g_strconcat (key, ":", NULL); + needle_len = strlen (needle); + if (g_str_has_prefix (props->str, needle)) + found = props->str; + else + found = strstr (props->str, needle); + + if (found) { + size_t value_index; + gchar* end; + + end = strchr (found, '\n'); + value_index = (found - props->str) + needle_len + 1; + g_string_erase (props, value_index, end ? (end - found - needle_len) : -1); + g_string_insert (props, value_index, "\n"); + g_string_insert (props, value_index, value); + } else { + g_string_append_printf (props, "%s:\t%s\n", key, value); + } + + g_free (needle); +} + +static void +xft_settings_set_xresources (GnomeXftSettings *settings) +{ + GString *add_string; + char dpibuf[G_ASCII_DTOSTR_BUF_SIZE]; + Display *dpy; + + gnome_settings_profile_start (NULL); + + /* get existing properties */ + dpy = XOpenDisplay (NULL); + g_return_if_fail (dpy != NULL); + add_string = g_string_new (XResourceManagerString (dpy)); + + g_debug("xft_settings_set_xresources: orig res '%s'", add_string->str); + + update_property (add_string, "Xft.dpi", + g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->dpi / 1024.0)); + update_property (add_string, "Xft.antialias", + settings->antialias ? "1" : "0"); + update_property (add_string, "Xft.hinting", + settings->hinting ? "1" : "0"); + update_property (add_string, "Xft.hintstyle", + settings->hintstyle); + update_property (add_string, "Xft.rgba", + settings->rgba); + + g_debug("xft_settings_set_xresources: new res '%s'", add_string->str); + + /* Set the new X property */ + XChangeProperty(dpy, RootWindow (dpy, 0), + XA_RESOURCE_MANAGER, XA_STRING, 8, PropModeReplace, (const unsigned char *) add_string->str, add_string->len); + XCloseDisplay (dpy); + + g_string_free (add_string, TRUE); + + gnome_settings_profile_end (NULL); +} + +/* We mirror the Xft properties both through XSETTINGS and through + * X resources + */ +static void +update_xft_settings (GnomeXSettingsManager *manager) +{ + GnomeXftSettings settings; + + gnome_settings_profile_start (NULL); + + xft_settings_get (manager, &settings); + xft_settings_set_xsettings (manager, &settings); + xft_settings_set_xresources (&settings); + + gnome_settings_profile_end (NULL); +} + +static void +xft_callback (GSettings *settings, + const gchar *key, + GnomeXSettingsManager *manager) +{ + update_xft_settings (manager); + queue_notify (manager); +} + +static void +override_callback (GSettings *settings, + const gchar *key, + GnomeXSettingsManager *manager) +{ + GVariant *value; + int i; + + value = g_settings_get_value (settings, XSETTINGS_OVERRIDE_KEY); + + for (i = 0; manager->priv->managers[i]; i++) { + xsettings_manager_set_overrides (manager->priv->managers[i], value); + } + queue_notify (manager); + + g_variant_unref (value); +} + +static void +plugin_callback (GSettings *settings, + const char *key, + GnomeXSettingsManager *manager) +{ + if (g_str_equal (key, GTK_MODULES_DISABLED_KEY) || + g_str_equal (key, GTK_MODULES_ENABLED_KEY)) { + /* Do nothing, as GsdXsettingsGtk will handle it */ + } else if (g_str_equal (key, XSETTINGS_OVERRIDE_KEY)) { + override_callback (settings, key, manager); + } else { + xft_callback (settings, key, manager); + } +} + +static void +gtk_modules_callback (GsdXSettingsGtk *gtk, + GParamSpec *spec, + GnomeXSettingsManager *manager) +{ + const char *modules = gsd_xsettings_gtk_get_modules (manager->priv->gtk); + int i; + + if (modules == NULL) { + for (i = 0; manager->priv->managers [i]; ++i) { + xsettings_manager_delete_setting (manager->priv->managers [i], "Gtk/Modules"); + } + } else { + g_debug ("Setting GTK modules '%s'", modules); + for (i = 0; manager->priv->managers [i]; ++i) { + xsettings_manager_set_string (manager->priv->managers [i], + "Gtk/Modules", + modules); + } + } + + queue_notify (manager); +} + +static void +fontconfig_callback (fontconfig_monitor_handle_t *handle, + GnomeXSettingsManager *manager) +{ + int i; + int timestamp = time (NULL); + + gnome_settings_profile_start (NULL); + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_int (manager->priv->managers [i], "Fontconfig/Timestamp", timestamp); + } + queue_notify (manager); + gnome_settings_profile_end (NULL); +} + +static gboolean +start_fontconfig_monitor_idle_cb (GnomeXSettingsManager *manager) +{ + gnome_settings_profile_start (NULL); + + manager->priv->fontconfig_handle = fontconfig_monitor_start ((GFunc) fontconfig_callback, manager); + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +static void +start_fontconfig_monitor (GnomeXSettingsManager *manager) +{ + gnome_settings_profile_start (NULL); + + fontconfig_cache_init (); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_fontconfig_monitor_idle_cb, manager); + + gnome_settings_profile_end (NULL); +} + +static void +stop_fontconfig_monitor (GnomeXSettingsManager *manager) +{ + if (manager->priv->fontconfig_handle) { + fontconfig_monitor_stop (manager->priv->fontconfig_handle); + manager->priv->fontconfig_handle = NULL; + } +} + +static void +notify_have_shell (GnomeXSettingsManager *manager, + gboolean have_shell) +{ + int i; + + gnome_settings_profile_start (NULL); + if (manager->priv->have_shell == have_shell) + return; + manager->priv->have_shell = have_shell; + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_int (manager->priv->managers [i], "Gtk/ShellShowsAppMenu", have_shell); + } + queue_notify (manager); + gnome_settings_profile_end (NULL); +} + +static void +on_shell_appeared (GDBusConnection *connection, + const gchar *name, + const gchar *name_owner, + gpointer user_data) +{ + notify_have_shell (user_data, TRUE); +} + +static void +on_shell_disappeared (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + notify_have_shell (user_data, FALSE); +} + +static void +process_value (GnomeXSettingsManager *manager, + TranslationEntry *trans, + GVariant *value) +{ + (* trans->translate) (manager, trans, value); +} + +static TranslationEntry * +find_translation_entry (GSettings *settings, const char *key) +{ + guint i; + char *schema; + + g_object_get (settings, "schema", &schema, NULL); + + for (i = 0; i < G_N_ELEMENTS (translations); i++) { + if (g_str_equal (schema, translations[i].gsettings_schema) && + g_str_equal (key, translations[i].gsettings_key)) { + g_free (schema); + return &translations[i]; + } + } + + g_free (schema); + + return NULL; +} + +static void +xsettings_callback (GSettings *settings, + const char *key, + GnomeXSettingsManager *manager) +{ + TranslationEntry *trans; + guint i; + GVariant *value; + + if (g_str_equal (key, TEXT_SCALING_FACTOR_KEY)) { + xft_callback (NULL, key, manager); + return; + } + + trans = find_translation_entry (settings, key); + if (trans == NULL) { + return; + } + + value = g_settings_get_value (settings, key); + + process_value (manager, trans, value); + + g_variant_unref (value); + + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_string (manager->priv->managers [i], + "Net/FallbackIconTheme", + "gnome"); + } + queue_notify (manager); +} + +static void +terminate_cb (void *data) +{ + gboolean *terminated = data; + + if (*terminated) { + return; + } + + *terminated = TRUE; + g_warning ("X Settings Manager is terminating"); + gtk_main_quit (); +} + +static gboolean +setup_xsettings_managers (GnomeXSettingsManager *manager) +{ + GdkDisplay *display; + int i; + int n_screens; + gboolean res; + gboolean terminated; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + res = xsettings_manager_check_running (gdk_x11_display_get_xdisplay (display), + gdk_screen_get_number (gdk_screen_get_default ())); + + if (res) { + g_warning ("You can only run one xsettings manager at a time; exiting"); + return FALSE; + } + + manager->priv->managers = g_new0 (XSettingsManager *, n_screens + 1); + + terminated = FALSE; + for (i = 0; i < n_screens; i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + + manager->priv->managers [i] = xsettings_manager_new (gdk_x11_display_get_xdisplay (display), + gdk_screen_get_number (screen), + terminate_cb, + &terminated); + if (! manager->priv->managers [i]) { + g_warning ("Could not create xsettings manager for screen %d!", i); + return FALSE; + } + } + + return TRUE; +} + +static void +start_shell_monitor (GnomeXSettingsManager *manager) +{ + notify_have_shell (manager, TRUE); + manager->priv->have_shell = TRUE; + manager->priv->shell_name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + "org.gnome.Shell", + 0, + on_shell_appeared, + on_shell_disappeared, + manager, + NULL); +} + +gboolean +gnome_xsettings_manager_start (GnomeXSettingsManager *manager, + GError **error) +{ + GVariant *overrides; + guint i; + GList *list, *l; + + g_debug ("Starting xsettings manager"); + gnome_settings_profile_start (NULL); + + if (!setup_xsettings_managers (manager)) { + g_set_error (error, GSD_XSETTINGS_ERROR, + GSD_XSETTINGS_ERROR_INIT, + "Could not initialize xsettings manager."); + return FALSE; + } + + manager->priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, + NULL, (GDestroyNotify) g_object_unref); + + g_hash_table_insert (manager->priv->settings, + MOUSE_SETTINGS_SCHEMA, g_settings_new (MOUSE_SETTINGS_SCHEMA)); + g_hash_table_insert (manager->priv->settings, + INTERFACE_SETTINGS_SCHEMA, g_settings_new (INTERFACE_SETTINGS_SCHEMA)); + g_hash_table_insert (manager->priv->settings, + SOUND_SETTINGS_SCHEMA, g_settings_new (SOUND_SETTINGS_SCHEMA)); + + for (i = 0; i < G_N_ELEMENTS (translations); i++) { + GVariant *val; + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->settings, + translations[i].gsettings_schema); + if (settings == NULL) { + g_warning ("Schemas '%s' has not been setup", translations[i].gsettings_schema); + continue; + } + + val = g_settings_get_value (settings, translations[i].gsettings_key); + + process_value (manager, &translations[i], val); + g_variant_unref (val); + } + + list = g_hash_table_get_values (manager->priv->settings); + for (l = list; l != NULL; l = l->next) { + g_signal_connect_object (G_OBJECT (l->data), "changed", G_CALLBACK (xsettings_callback), manager, 0); + } + g_list_free (list); + + /* Plugin settings (GTK modules and Xft) */ + manager->priv->plugin_settings = g_settings_new (XSETTINGS_PLUGIN_SCHEMA); + g_signal_connect_object (manager->priv->plugin_settings, "changed", G_CALLBACK (plugin_callback), manager, 0); + + manager->priv->gtk = gsd_xsettings_gtk_new (); + g_signal_connect (G_OBJECT (manager->priv->gtk), "notify::gtk-modules", + G_CALLBACK (gtk_modules_callback), manager); + gtk_modules_callback (manager->priv->gtk, NULL, manager); + + /* Xft settings */ + update_xft_settings (manager); + + start_fontconfig_monitor (manager); + + start_shell_monitor (manager); + + for (i = 0; manager->priv->managers [i]; i++) + xsettings_manager_set_string (manager->priv->managers [i], + "Net/FallbackIconTheme", + "gnome"); + + overrides = g_settings_get_value (manager->priv->plugin_settings, XSETTINGS_OVERRIDE_KEY); + for (i = 0; manager->priv->managers [i]; i++) { + xsettings_manager_set_overrides (manager->priv->managers [i], overrides); + } + queue_notify (manager); + g_variant_unref (overrides); + + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gnome_xsettings_manager_stop (GnomeXSettingsManager *manager) +{ + GnomeXSettingsManagerPrivate *p = manager->priv; + int i; + + g_debug ("Stopping xsettings manager"); + + if (p->managers != NULL) { + for (i = 0; p->managers [i]; ++i) + xsettings_manager_destroy (p->managers [i]); + + g_free (p->managers); + p->managers = NULL; + } + + if (p->plugin_settings != NULL) { + g_object_unref (p->plugin_settings); + p->plugin_settings = NULL; + } + + stop_fontconfig_monitor (manager); + + if (manager->priv->shell_name_watch_id > 0) + g_bus_unwatch_name (manager->priv->shell_name_watch_id); + + if (p->settings != NULL) { + g_hash_table_destroy (p->settings); + p->settings = NULL; + } + + if (p->gtk != NULL) { + g_object_unref (p->gtk); + p->gtk = NULL; + } +} + +static GObject * +gnome_xsettings_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GnomeXSettingsManager *xsettings_manager; + + xsettings_manager = GNOME_XSETTINGS_MANAGER (G_OBJECT_CLASS (gnome_xsettings_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (xsettings_manager); +} + +static void +gnome_xsettings_manager_class_init (GnomeXSettingsManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gnome_xsettings_manager_constructor; + object_class->finalize = gnome_xsettings_manager_finalize; + + g_type_class_add_private (klass, sizeof (GnomeXSettingsManagerPrivate)); +} + +static void +gnome_xsettings_manager_init (GnomeXSettingsManager *manager) +{ + manager->priv = GNOME_XSETTINGS_MANAGER_GET_PRIVATE (manager); +} + +static void +gnome_xsettings_manager_finalize (GObject *object) +{ + GnomeXSettingsManager *xsettings_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GNOME_IS_XSETTINGS_MANAGER (object)); + + xsettings_manager = GNOME_XSETTINGS_MANAGER (object); + + g_return_if_fail (xsettings_manager->priv != NULL); + + if (xsettings_manager->priv->start_idle_id != 0) + g_source_remove (xsettings_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gnome_xsettings_manager_parent_class)->finalize (object); +} + +GnomeXSettingsManager * +gnome_xsettings_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GNOME_TYPE_XSETTINGS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GNOME_XSETTINGS_MANAGER (manager_object); +} diff --git a/.pc/applied-patches b/.pc/applied-patches new file mode 100644 index 00000000..be332f18 --- /dev/null +++ b/.pc/applied-patches @@ -0,0 +1,23 @@ +05_disable_corner_tapping.patch +16_use_synchronous_notifications.patch +43_disable_locale_settings.patch +45_suppress-printer-may-not-be-connected-notification.patch +47_delay_pa_connect_to_idle.patch +48_register_client_before_idle_callbacks.patch +51_lock_screen_on_suspend.patch +52_sync_background_to_accountsservice.patch +60_unity_hide_status_icon.patch +61_unity_use_application_indicator.patch +62_unity_disable_gsd_printer.patch +63_unity_start_mounter.patch +64_restore_terminal_keyboard_shortcut_schema.patch +90_set_gmenus_xsettings.patch +disable_three_touch_tap.patch +bugzilla_segfault_dpms.patch +correct_logout_action.patch +power-no-fallback-notifications.patch +power-check-null-devices.patch +revert_new_ibus_use.patch +migrate_metacity_keys.patch +touchscreen_rotation.patch +nexus-orientation.patch diff --git a/.pc/bugzilla_segfault_dpms.patch/plugins/power/gsd-power-manager.c b/.pc/bugzilla_segfault_dpms.patch/plugins/power/gsd-power-manager.c new file mode 100644 index 00000000..021c0cde --- /dev/null +++ b/.pc/bugzilla_segfault_dpms.patch/plugins/power/gsd-power-manager.c @@ -0,0 +1,4391 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * Copyright (C) 2011 Ritesh Khadgaray + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gpm-common.h" +#include "gpm-phone.h" +#include "gpm-idletime.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-enums.h" +#include "gsd-power-manager.h" +#include "gsd-power-helper.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_PATH_PRESENCE "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE_PRESENCE "org.gnome.SessionManager.Presence" + +#define UPOWER_DBUS_NAME "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_PATH_KBDBACKLIGHT "/org/freedesktop/UPower/KbdBacklight" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DBUS_INTERFACE_KBDBACKLIGHT "org.freedesktop.UPower.KbdBacklight" + +#define GSD_POWER_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power" + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_POWER_DBUS_PATH GSD_DBUS_PATH "/Power" +#define GSD_POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#define GSD_POWER_DBUS_INTERFACE_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_POWER_DBUS_INTERFACE_KEYBOARD "org.gnome.SettingsDaemon.Power.Keyboard" + +#define GS_DBUS_NAME "org.gnome.ScreenSaver" +#define GS_DBUS_PATH "/org/gnome/ScreenSaver" +#define GS_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER 0 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */ + +#define GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ +#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */ +#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + +/* Keep this in sync with gnome-shell */ +#define SCREENSAVER_FADE_TIME 10 /* seconds */ + +#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */ + +enum { + GSD_POWER_IDLETIME_NULL_ID, + GSD_POWER_IDLETIME_DIM_ID, + GSD_POWER_IDLETIME_BLANK_ID, + GSD_POWER_IDLETIME_SLEEP_ID +}; + +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +/* on ACPI machines we have 4-16 levels, on others it's ~150 */ +#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) + +/* take a discrete value with offset and convert to percentage */ +static int +abs_to_percentage (int min, int max, int value) +{ + g_return_val_if_fail (max > min, -1); + g_return_val_if_fail (value >= min, -1); + g_return_val_if_fail (value <= max, -1); + return (((value - min) * 100) / (max - min)); +} +#define ABS_TO_PERCENTAGE(min, max, value) abs_to_percentage(min, max, value) +#define PERCENTAGE_TO_ABS(min, max, value) (min + (((max - min) * value) / 100)) + +#define GSD_POWER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerPrivate)) + +typedef enum { + GSD_POWER_IDLE_MODE_NORMAL, + GSD_POWER_IDLE_MODE_DIM, + GSD_POWER_IDLE_MODE_BLANK, + GSD_POWER_IDLE_MODE_SLEEP +} GsdPowerIdleMode; + +struct GsdPowerManagerPrivate +{ + GnomeSettingsSession *session; + gboolean lid_is_closed; + GSettings *settings; + GSettings *settings_screensaver; + UpClient *up_client; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *upower_proxy; + GDBusProxy *upower_kdb_proxy; + gint kbd_brightness_now; + gint kbd_brightness_max; + gint kbd_brightness_old; + gint kbd_brightness_pre_dim; + GnomeRRScreen *x11_screen; + gboolean use_time_primary; + gchar *previous_summary; + GIcon *previous_icon; + GpmPhone *phone; + GPtrArray *devices_array; + guint action_percentage; + guint action_time; + guint critical_percentage; + guint critical_time; + guint low_percentage; + guint low_time; + gint pre_dim_brightness; /* level, not percentage */ + UpDevice *device_composite; + NotifyNotification *notification_discharging; + NotifyNotification *notification_low; + ca_context *canberra_context; + ca_proplist *critical_alert_loop_props; + guint32 critical_alert_timeout_id; + GDBusProxy *screensaver_proxy; + GDBusProxy *session_proxy; + GDBusProxy *session_presence_proxy; + GpmIdletime *idletime; + GsdPowerIdleMode current_idle_mode; + guint lid_close_safety_timer_id; + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; +}; + +enum { + PROP_0, +}; + +static void gsd_power_manager_class_init (GsdPowerManagerClass *klass); +static void gsd_power_manager_init (GsdPowerManager *power_manager); +static void gsd_power_manager_finalize (GObject *object); + +static UpDevice *engine_get_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static UpDevice *engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static GIcon *engine_get_icon (GsdPowerManager *manager); +static gchar *engine_get_summary (GsdPowerManager *manager); +static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type); +static void do_lid_closed_action (GsdPowerManager *manager); +static void lock_screensaver (GsdPowerManager *manager); +static void kill_lid_close_safety_timer (GsdPowerManager *manager); + +G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gsd_power_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_power_manager_error"); + return quark; +} + +static gboolean +play_loop_timeout_cb (GsdPowerManager *manager) +{ + ca_context *context; + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play_full (context, 0, + manager->priv->critical_alert_loop_props, + NULL, + NULL); + return TRUE; +} + +static gboolean +play_loop_stop (GsdPowerManager *manager) +{ + if (manager->priv->critical_alert_timeout_id == 0) { + g_warning ("no sound loop present to stop"); + return FALSE; + } + + g_source_remove (manager->priv->critical_alert_timeout_id); + ca_proplist_destroy (manager->priv->critical_alert_loop_props); + + manager->priv->critical_alert_loop_props = NULL; + manager->priv->critical_alert_timeout_id = 0; + + return TRUE; +} + +static gboolean +play_loop_start (GsdPowerManager *manager, + const gchar *id, + const gchar *desc, + gboolean force, + guint timeout) +{ + ca_context *context; + + if (timeout == 0) { + g_warning ("received invalid timeout"); + return FALSE; + } + + /* if a sound loop is already running, stop the existing loop */ + if (manager->priv->critical_alert_timeout_id != 0) { + g_warning ("was instructed to play a sound loop with one already playing"); + play_loop_stop (manager); + } + + ca_proplist_create (&(manager->priv->critical_alert_loop_props)); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_ID, id); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_DESCRIPTION, desc); + + manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout, + (GSourceFunc) play_loop_timeout_cb, + manager); + g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, + "[GsdPowerManager] play-loop"); + + /* play the sound, using sounds from the naming spec */ + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play (context, 0, + CA_PROP_EVENT_ID, id, + CA_PROP_EVENT_DESCRIPTION, desc, NULL); + return TRUE; +} + +static void +notify_close_if_showing (NotifyNotification *notification) +{ + gboolean ret; + GError *error = NULL; + + if (notification == NULL) + return; + ret = notify_notification_close (notification, &error); + if (!ret) { + g_warning ("failed to close notification: %s", + error->message); + g_error_free (error); + } +} + +static const gchar * +get_first_themed_icon_name (GIcon *icon) +{ + const gchar* const *icon_names; + const gchar *icon_name = NULL; + + /* no icon */ + if (icon == NULL) + goto out; + + /* just use the first icon */ + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + if (icon_names != NULL) + icon_name = icon_names[0]; +out: + return icon_name; +} + +typedef enum { + WARNING_NONE = 0, + WARNING_DISCHARGING = 1, + WARNING_LOW = 2, + WARNING_CRITICAL = 3, + WARNING_ACTION = 4 +} GsdPowerManagerWarning; + +static GVariant * +engine_get_icon_property_variant (GsdPowerManager *manager) +{ + GIcon *icon; + GVariant *retval; + + icon = engine_get_icon (manager); + if (icon != NULL) { + char *str; + str = g_icon_to_string (icon); + g_object_unref (icon); + retval = g_variant_new_string (str); + g_free (str); + } else { + retval = g_variant_new_string (""); + } + return retval; +} + +static GVariant * +engine_get_tooltip_property_variant (GsdPowerManager *manager) +{ + char *tooltip; + GVariant *retval; + + tooltip = engine_get_summary (manager); + retval = g_variant_new_string (tooltip != NULL ? tooltip : ""); + g_free (tooltip); + + return retval; +} + +static void +engine_emit_changed (GsdPowerManager *manager, + gboolean icon_changed, + gboolean state_changed) +{ + GVariantBuilder props_builder; + GVariant *props_changed = NULL; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + + g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}")); + + if (icon_changed) + g_variant_builder_add (&props_builder, "{sv}", "Icon", + engine_get_icon_property_variant (manager)); + if (state_changed) + g_variant_builder_add (&props_builder, "{sv}", "Tooltip", + engine_get_tooltip_property_variant (manager)); + + props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE, + g_variant_builder_end (&props_builder), + g_variant_new_strv (NULL, 0)); + g_variant_ref_sink (props_changed); + + if (!g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_POWER_DBUS_PATH, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + props_changed, + &error)) + goto out; + + out: + if (error) { + g_warning ("%s", error->message); + g_clear_error (&error); + } + if (props_changed) + g_variant_unref (props_changed); +} + +static GsdPowerManagerWarning +engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage < 26.0f) + return WARNING_LOW; + else if (percentage < 13.0f) + return WARNING_CRITICAL; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage <= manager->priv->action_percentage) + return WARNING_ACTION; + if (percentage <= manager->priv->critical_percentage) + return WARNING_CRITICAL; + if (percentage <= manager->priv->low_percentage) + return WARNING_LOW; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_time (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "time-to-empty", &time_to_empty, + NULL); + + /* this is probably an error condition */ + if (time_to_empty == 0) { + g_debug ("time zero, falling back to percentage for %s", + up_device_kind_to_string (kind)); + return engine_get_warning_percentage (manager, device); + } + + if (time_to_empty <= manager->priv->action_time) + return WARNING_ACTION; + if (time_to_empty <= manager->priv->critical_time) + return WARNING_CRITICAL; + if (time_to_empty <= manager->priv->low_time) + return WARNING_LOW; + return WARNING_NONE; +} + +/** + * This gets the possible engine state for the device according to the + * policy, which could be per-percent, or per-time. + **/ +static GsdPowerManagerWarning +engine_get_warning (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + UpDeviceState state; + GsdPowerManagerWarning warning_type; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + NULL); + + /* default to no engine */ + warning_type = WARNING_NONE; + + /* if the device in question is on ac, don't give a warning */ + if (state == UP_DEVICE_STATE_CHARGING) + goto out; + + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + + warning_type = engine_get_warning_csr (manager, device); + + } else if (kind == UP_DEVICE_KIND_UPS || +#if UP_CHECK_VERSION(0,9,5) + kind == UP_DEVICE_KIND_MEDIA_PLAYER || + kind == UP_DEVICE_KIND_TABLET || + kind == UP_DEVICE_KIND_COMPUTER || +#endif + kind == UP_DEVICE_KIND_PDA) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_BATTERY) { + /* only use the time when it is accurate, and settings is not disabled */ + if (manager->priv->use_time_primary) + warning_type = engine_get_warning_time (manager, device); + else + warning_type = engine_get_warning_percentage (manager, device); + } + + /* If we have no important engines, we should test for discharging */ + if (warning_type == WARNING_NONE) { + if (state == UP_DEVICE_STATE_DISCHARGING) + warning_type = WARNING_DISCHARGING; + } + + out: + return warning_type; +} + +static gchar * +engine_get_summary (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + GString *tooltip = NULL; + gchar *part; + gboolean is_present; + + + /* need to get AC state */ + tooltip = g_string_new (""); + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "is-present", &is_present, + "state", &state, + NULL); + if (!is_present) + continue; + if (state == UP_DEVICE_STATE_EMPTY) + continue; + part = gpm_upower_get_device_summary (device); + if (part != NULL) + g_string_append_printf (tooltip, "%s\n", part); + g_free (part); + } + + /* remove the last \n */ + g_string_truncate (tooltip, tooltip->len-1); + + g_debug ("tooltip: %s", tooltip->str); + + return g_string_free (tooltip, FALSE); +} + +static GIcon * +engine_get_icon_priv (GsdPowerManager *manager, + UpDeviceKind device_kind, + GsdPowerManagerWarning warning, + gboolean use_state) +{ + guint i; + GPtrArray *array; + UpDevice *device; + GsdPowerManagerWarning warning_temp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) + device = engine_get_composite_device (manager, device); + + warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), + "engine-warning-old")); + if (kind == device_kind && is_present) { + if (warning != WARNING_NONE) { + if (warning_temp == warning) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + if (use_state) { + if (state == UP_DEVICE_STATE_CHARGING || + state == UP_DEVICE_STATE_DISCHARGING) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + return gpm_upower_get_device_icon (device, TRUE); + } + } + return NULL; +} + +static GIcon * +engine_get_icon (GsdPowerManager *manager) +{ + GIcon *icon = NULL; + + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + + /* we try (DIS)CHARGING: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + + /* we try PRESENT: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + + /* do not show an icon */ + return NULL; +} + +static gboolean +engine_recalculate_state_icon (GsdPowerManager *manager) +{ + GIcon *icon; + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + if (icon == NULL) { + /* none before, now none */ + if (manager->priv->previous_icon == NULL) + return FALSE; + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = NULL; + return TRUE; + } + + /* no icon before, now icon */ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + /* icon before, now different */ + if (!g_icon_equal (manager->priv->previous_icon, icon)) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + g_debug ("no change"); + /* nothing to do */ + g_object_unref (icon); + return FALSE; +} + +static gboolean +engine_recalculate_state_summary (GsdPowerManager *manager) +{ + gchar *summary; + + summary = engine_get_summary (manager); + if (manager->priv->previous_summary == NULL) { + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + + if (strcmp (manager->priv->previous_summary, summary) != 0) { + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + g_debug ("no change"); + /* nothing to do */ + g_free (summary); + return FALSE; +} + +static void +engine_recalculate_state (GsdPowerManager *manager) +{ + gboolean icon_changed = FALSE; + gboolean state_changed = FALSE; + + icon_changed = engine_recalculate_state_icon (manager); + state_changed = engine_recalculate_state_summary (manager); + + /* only emit if the icon or summary has changed */ + if (icon_changed || state_changed) + engine_emit_changed (manager, icon_changed, state_changed); +} + +static UpDevice * +engine_get_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint battery_devices = 0; + GPtrArray *array; + UpDevice *device; + UpDeviceKind kind; + UpDeviceKind original_kind; + guint i; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* find out how many batteries in the system */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + NULL); + if (kind == original_kind) + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices <= 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use the composite device */ + device = manager->priv->device_composite; +out: + /* return composite device or original device */ + return device; +} + +static UpDevice * +engine_update_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint i; + gdouble percentage = 0.0; + gdouble energy = 0.0; + gdouble energy_full = 0.0; + gdouble energy_rate = 0.0; + gdouble energy_total = 0.0; + gdouble energy_full_total = 0.0; + gdouble energy_rate_total = 0.0; + gint64 time_to_empty = 0; + gint64 time_to_full = 0; + guint battery_devices = 0; + gboolean is_charging = FALSE; + gboolean is_discharging = FALSE; + gboolean is_fully_charged = TRUE; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + UpDeviceKind kind; + UpDeviceKind original_kind; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* update the composite device */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + "state", &state, + "energy", &energy, + "energy-full", &energy_full, + "energy-rate", &energy_rate, + NULL); + if (kind != original_kind) + continue; + + /* one of these will be charging or discharging */ + if (state == UP_DEVICE_STATE_CHARGING) + is_charging = TRUE; + if (state == UP_DEVICE_STATE_DISCHARGING) + is_discharging = TRUE; + if (state != UP_DEVICE_STATE_FULLY_CHARGED) + is_fully_charged = FALSE; + + /* sum up composite */ + energy_total += energy; + energy_full_total += energy_full; + energy_rate_total += energy_rate; + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices == 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use percentage weighted for each battery capacity */ + if (energy_full_total > 0.0) + percentage = 100.0 * energy_total / energy_full_total; + + /* set composite state */ + if (is_charging) + state = UP_DEVICE_STATE_CHARGING; + else if (is_discharging) + state = UP_DEVICE_STATE_DISCHARGING; + else if (is_fully_charged) + state = UP_DEVICE_STATE_FULLY_CHARGED; + else + state = UP_DEVICE_STATE_UNKNOWN; + + /* calculate a quick and dirty time remaining value */ + if (energy_rate_total > 0) { + if (state == UP_DEVICE_STATE_DISCHARGING) + time_to_empty = 3600 * (energy_total / energy_rate_total); + else if (state == UP_DEVICE_STATE_CHARGING) + time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total); + } + + /* okay, we can use the composite device */ + device = manager->priv->device_composite; + + g_debug ("printing composite device"); + g_object_set (device, + "energy", energy, + "energy-full", energy_full, + "energy-rate", energy_rate, + "time-to-empty", time_to_empty, + "time-to-full", time_to_full, + "percentage", percentage, + "state", state, + NULL); + + /* force update of icon */ + if (engine_recalculate_state_icon (manager)) + engine_emit_changed (manager, TRUE, FALSE); +out: + /* return composite device or original device */ + return device; +} + +typedef struct { + GsdPowerManager *manager; + UpDevice *device; +} GsdPowerManagerRecallData; + +static void +device_perhaps_recall_response_cb (GtkDialog *dialog, + gint response_id, + GsdPowerManagerRecallData *recall_data) +{ + GdkScreen *screen; + GtkWidget *dialog_error; + GError *error = NULL; + gboolean ret; + gchar *website = NULL; + + /* don't show this again */ + if (response_id == GTK_RESPONSE_CANCEL) { + g_settings_set_boolean (recall_data->manager->priv->settings, + "notify-perhaps-recall", + FALSE); + goto out; + } + + /* visit recall website */ + if (response_id == GTK_RESPONSE_OK) { + + g_object_get (recall_data->device, + "recall-url", &website, + NULL); + + screen = gdk_screen_get_default(); + ret = gtk_show_uri (screen, + website, + gtk_get_current_event_time (), + &error); + if (!ret) { + dialog_error = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Failed to show url %s", + error->message); + gtk_dialog_run (GTK_DIALOG (dialog_error)); + g_error_free (error); + } + } +out: + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (recall_data->device); + g_object_unref (recall_data->manager); + g_free (recall_data); + g_free (website); + return; +} + +static gboolean +device_perhaps_recall_delay_cb (gpointer user_data) +{ + gchar *vendor; + const gchar *title = NULL; + GString *message = NULL; + GtkWidget *dialog; + GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data; + + g_object_get (recall_data->device, + "recall-vendor", &vendor, + NULL); + + /* TRANSLATORS: the battery may be recalled by its vendor */ + title = _("Battery may be recalled"); + message = g_string_new (""); + g_string_append_printf (message, + _("A battery in your computer may have been " + "recalled by %s and you may be at risk."), vendor); + g_string_append (message, "\n\n"); + g_string_append (message, _("For more information visit the battery recall website.")); + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + title); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", message->str); + + /* TRANSLATORS: button text, visit the manufacturers recall website */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), + GTK_RESPONSE_OK); + + /* TRANSLATORS: button text, do not show this bubble again */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), + GTK_RESPONSE_CANCEL); + + gtk_widget_show (dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (device_perhaps_recall_response_cb), + recall_data); + + g_string_free (message, TRUE); + g_free (vendor); + return FALSE; +} + +static void +device_perhaps_recall (GsdPowerManager *manager, UpDevice *device) +{ + gboolean ret; + guint timer_id; + GsdPowerManagerRecallData *recall_data; + + /* don't show when running under GDM */ + if (g_getenv ("RUNNING_UNDER_GDM") != NULL) { + g_debug ("running under gdm, so no notification"); + return; + } + + /* already shown, and dismissed */ + ret = g_settings_get_boolean (manager->priv->settings, + "notify-perhaps-recall"); + if (!ret) { + g_debug ("settings prevents recall notification"); + return; + } + + recall_data = g_new0 (GsdPowerManagerRecallData, 1); + recall_data->manager = g_object_ref (manager); + recall_data->device = g_object_ref (device); + + /* delay by a few seconds so the session can load */ + timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY, + device_perhaps_recall_delay_cb, + recall_data); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall"); +} + +static void +engine_device_add (GsdPowerManager *manager, UpDevice *device) +{ + gboolean recall_notice; + GsdPowerManagerWarning warning; + UpDeviceState state; + UpDeviceKind kind; + UpDevice *composite; + + /* assign warning */ + warning = engine_get_warning (manager, device); + g_object_set_data (G_OBJECT(device), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "recall-notice", &recall_notice, + NULL); + + /* add old state for transitions */ + g_debug ("adding %s with state %s", + up_device_get_object_path (device), up_device_state_to_string (state)); + g_object_set_data (G_OBJECT(device), + "engine-state-old", + GUINT_TO_POINTER(state)); + + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because we added a device"); + composite = engine_update_composite_device (manager, device); + + /* get the same values for the composite device */ + warning = engine_get_warning (manager, composite); + g_object_set_data (G_OBJECT(composite), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + g_object_get (composite, "state", &state, NULL); + g_object_set_data (G_OBJECT(composite), + "engine-state-old", + GUINT_TO_POINTER(state)); + } + + /* the device is recalled */ + if (recall_notice) + device_perhaps_recall (manager, device); +} + +static gboolean +engine_check_recall (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gboolean recall_notice = FALSE; + gchar *recall_vendor = NULL; + gchar *recall_url = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "recall-notice", &recall_notice, + "recall-vendor", &recall_vendor, + "recall-url", &recall_url, + NULL); + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + goto out; + + /* no recall data */ + if (!recall_notice) + goto out; + + /* emit signal for manager */ + g_debug ("** EMIT: perhaps-recall"); + g_debug ("%s-%s", recall_vendor, recall_url); +out: + g_free (recall_vendor); + g_free (recall_url); + return recall_notice; +} + +static gboolean +engine_coldplug (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array = NULL; + UpDevice *device; + gboolean ret; + GError *error = NULL; + + /* get devices from UPower */ + ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error); + if (!ret) { + g_warning ("failed to get device list: %s", error->message); + g_error_free (error); + goto out; + } + + /* connected mobile phones */ + gpm_phone_coldplug (manager->priv->phone); + + engine_recalculate_state (manager); + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); + /* never repeat */ + return FALSE; +} + +static void +engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + /* add to list */ + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_check_recall (manager, device); + + engine_recalculate_state (manager); +} + +static void +engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + gboolean ret; + ret = g_ptr_array_remove (manager->priv->devices_array, device); + if (!ret) + return; + engine_recalculate_state (manager); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +create_notification (const char *summary, + const char *body, + const char *icon, + NotifyNotification **weak_pointer_location) +{ + NotifyNotification *notification; + + notification = notify_notification_new (summary, body, icon); + *weak_pointer_location = notification; + g_object_add_weak_pointer (G_OBJECT (notification), + (gpointer *) weak_pointer_location); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); +} + +static void +engine_ups_discharging (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title; + gboolean ret; + gchar *remaining_text = NULL; + gdouble percentage; + GError *error = NULL; + GIcon *icon = NULL; + gint64 time_to_empty; + GString *message; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + if (kind != UP_DEVICE_KIND_UPS) + return; + + /* only show text if there is a valid time */ + if (time_to_empty > 0) + remaining_text = gpm_get_timestring (time_to_empty); + + /* TRANSLATORS: UPS is now discharging */ + title = _("UPS Discharging"); + + message = g_string_new (""); + if (remaining_text != NULL) { + /* TRANSLATORS: tell the user how much time they have got */ + g_string_append_printf (message, _("%s of UPS backup power remaining"), + remaining_text); + } else { + g_string_append (message, gpm_device_to_localised_string (device)); + } + g_string_append_printf (message, " (%.0f%%)", percentage); + + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_discharging); + + /* create a new notification */ + create_notification (title, message->str, + get_first_themed_icon_name (icon), + &manager->priv->notification_discharging); + notify_notification_set_timeout (manager->priv->notification_discharging, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_discharging, + NOTIFY_URGENCY_NORMAL); + /* TRANSLATORS: this is the notification application name */ + notify_notification_set_app_name (manager->priv->notification_discharging, _("Power")); + notify_notification_set_hint (manager->priv->notification_discharging, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_discharging, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_discharging); + } + g_string_free (message, TRUE); + if (icon != NULL) + g_object_unref (icon); + g_free (remaining_text); +} + +static GsdPowerActionType +manager_critical_action_get (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType policy; + + policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action"); + if (policy == GSD_POWER_ACTION_SUSPEND) { + if (is_ups == FALSE && + up_client_get_can_suspend (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_can_hibernate (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } + + return policy; +} + +static gboolean +manager_critical_action_do (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType action_type; + + /* stop playing the alert as it's too late to do anything now */ + if (manager->priv->critical_alert_timeout_id > 0) + play_loop_stop (manager); + + action_type = manager_critical_action_get (manager, is_ups); + do_power_action_type (manager, action_type); + + return FALSE; +} + +static gboolean +manager_critical_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, FALSE); + return FALSE; +} + +static gboolean +manager_critical_ups_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, TRUE); + return FALSE; +} + +static gboolean +engine_just_laptop_battery (GsdPowerManager *manager) +{ + UpDevice *device; + UpDeviceKind kind; + GPtrArray *array; + gboolean ret = TRUE; + guint i; + + /* find if there are any other device types that mean we have to + * be more specific in our wording */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, "kind", &kind, NULL); + if (kind != UP_DEVICE_KIND_BATTERY) { + ret = FALSE; + break; + } + } + return ret; +} + +static void +engine_charge_low (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gchar *tmp; + gchar *remaining_text; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery low, and we only have one battery */ + title = _("Battery low"); + } else { + /* TRANSLATORS: laptop battery low, and we have more than one kind of battery */ + title = _("Laptop battery low"); + } + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage); + g_free (remaining_text); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is starting to get a little low */ + title = _("UPS low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s of remaining UPS backup power (%.0f%%)"), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: mouse is getting a little low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless mouse is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: keyboard is getting a little low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless keyboard is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PDA) { + /* TRANSLATORS: PDA is getting a little low */ + title = _("PDA battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("PDA is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + /* TRANSLATORS: cell phone (mobile) is getting a little low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + /* TRANSLATORS: media player, e.g. mp3 is getting a little low */ + title = _("Media player battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_TABLET) { + /* TRANSLATORS: graphics tablet, e.g. wacom is getting a little low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + /* TRANSLATORS: computer, e.g. ipad is getting a little low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_NORMAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + notify_notification_set_hint (manager->priv->notification_low, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-low", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL); + +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_critical (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + GsdPowerActionType policy; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */ + title = _("Battery critically low"); + } else { + /* TRANSLATORS: laptop battery critically low, and we have more than one type of battery */ + title = _("Laptop battery critically low"); + } + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */ + message = g_strdup (_("Plug in your AC adapter to avoid losing data.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in.")); + } + + } else if (kind == UP_DEVICE_KIND_UPS) { + gchar *remaining_text; + gchar *tmp; + + /* TRANSLATORS: the UPS is very low */ + title = _("UPS critically low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Approximately %s of remaining UPS power (%.0f%%). " + "Restore AC power to your computer to avoid losing data."), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: the mouse battery is very low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless mouse is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: the keyboard battery is very low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless keyboard is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_PDA) { + + /* TRANSLATORS: the PDA battery is very low */ + title = _("PDA battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("PDA is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Media player is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_TABLET) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Attached computer is very low in power (%.0f%%). " + "The device will soon shutdown if not charged."), + percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + switch (kind) { + + case UP_DEVICE_KIND_BATTERY: + case UP_DEVICE_KIND_UPS: + g_debug ("critical charge level reached, starting sound loop"); + play_loop_start (manager, + "battery-caution", + _("Battery is critically low"), + TRUE, + GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT); + break; + + default: + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); + break; + } +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_action (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + GError *error = NULL; + GIcon *icon = NULL; + GsdPowerActionType policy; + guint timer_id; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* TRANSLATORS: laptop battery is really, really, low */ + title = _("Laptop battery critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("The battery is below the critical level and " + "this computer will power-off when the " + "battery becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: computer will suspend */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to suspend.\n" + "NOTE: A small amount of power is required " + "to keep your computer in a suspended state.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action"); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is really, really, low */ + title = _("UPS critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, TRUE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("UPS is below the critical level and " + "this computer will power-off when the " + "UPS becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_ups_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action"); + } + + /* not all types have actions */ + if (title == NULL) + return; + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + UpDeviceKind kind; + UpDeviceState state; + UpDeviceState state_old; + GsdPowerManagerWarning warning_old; + GsdPowerManagerWarning warning; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because %s changed", up_device_get_object_path (device)); + device = engine_update_composite_device (manager, device); + } + + /* get device properties (may be composite) */ + g_object_get (device, + "state", &state, + NULL); + + g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state)); + + /* see if any interesting state changes have happened */ + state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old")); + if (state_old != state) { + if (state == UP_DEVICE_STATE_DISCHARGING) { + g_debug ("discharging"); + engine_ups_discharging (manager, device); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED || + state == UP_DEVICE_STATE_CHARGING) { + g_debug ("fully charged or charging, hiding notifications if any"); + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + } + + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state)); + } + + /* check the warning state has not changed */ + warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old")); + warning = engine_get_warning (manager, device); + if (warning != warning_old) { + if (warning == WARNING_LOW) { + g_debug ("** EMIT: charge-low"); + engine_charge_low (manager, device); + } else if (warning == WARNING_CRITICAL) { + g_debug ("** EMIT: charge-critical"); + engine_charge_critical (manager, device); + } else if (warning == WARNING_ACTION) { + g_debug ("charge-action"); + engine_charge_action (manager, device); + } + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning)); + } + + engine_recalculate_state (manager); +} + +static UpDevice * +engine_get_primary_device (GsdPowerManager *manager) +{ + guint i; + UpDevice *device = NULL; + UpDevice *device_tmp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + for (i=0; ipriv->devices_array->len; i++) { + device_tmp = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device_tmp, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* not present */ + if (!is_present) + continue; + + /* not discharging */ + if (state != UP_DEVICE_STATE_DISCHARGING) + continue; + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + + /* use composite device to cope with multiple batteries */ + device = g_object_ref (engine_get_composite_device (manager, device_tmp)); + break; + } + return device; +} + +static void +phone_device_added_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + UpDevice *device; + device = up_device_new (); + + g_debug ("phone added %i", idx); + + /* get device properties */ + g_object_set (device, + "kind", UP_DEVICE_KIND_PHONE, + "is-rechargeable", TRUE, + "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "is-present", TRUE, + NULL); + + /* state changed */ + engine_device_add (manager, device); + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_recalculate_state (manager); +} + +static void +phone_device_removed_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + + g_debug ("phone removed %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + g_ptr_array_remove_index (manager->priv->devices_array, i); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +phone_device_refresh_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + + g_debug ("phone refresh %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + is_present = gpm_phone_get_present (phone, idx); + state = gpm_phone_get_on_ac (phone, idx) ? UP_DEVICE_STATE_CHARGING : UP_DEVICE_STATE_DISCHARGING; + percentage = gpm_phone_get_percentage (phone, idx); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +gnome_session_shutdown_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't shutdown using gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +gnome_session_shutdown (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* ask gnome-session to show the shutdown dialog with a timeout */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to gnome-session: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Shutdown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gnome_session_shutdown_cb, NULL); + g_object_unref (proxy); +} + +static void +do_power_action_type (GsdPowerManager *manager, + GsdPowerActionType action_type) +{ + gboolean ret; + GError *error = NULL; + + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + gnome_session_shutdown (); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_SHUTDOWN: + /* this is only used on critically low battery where + * hibernate is not available and is marginally better + * than just powering down the computer mid-write */ + gsd_power_poweroff (); + break; + case GSD_POWER_ACTION_BLANK: + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off for policy action: %s", + error->message); + g_error_free (error); + } + break; + case GSD_POWER_ACTION_NOTHING: + break; + } +} + +static gboolean +upower_kbd_set_brightness (GsdPowerManager *manager, guint value, GError **error) +{ + GVariant *retval; + + /* same as before */ + if (manager->priv->kbd_brightness_now == value) + return TRUE; + + /* update h/w value */ + retval = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "SetBrightness", + g_variant_new ("(i)", (gint) value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + error); + if (retval == NULL) + return FALSE; + + /* save new value */ + manager->priv->kbd_brightness_now = value; + g_variant_unref (retval); + return TRUE; +} + +static gboolean +upower_kbd_toggle (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + if (manager->priv->kbd_brightness_old >= 0) { + g_debug ("keyboard toggle off"); + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_old, + error); + if (ret) { + /* succeeded, set to -1 since now no old value */ + manager->priv->kbd_brightness_old = -1; + } + } else { + g_debug ("keyboard toggle on"); + /* save the current value to restore later when untoggling */ + manager->priv->kbd_brightness_old = manager->priv->kbd_brightness_now; + ret = upower_kbd_set_brightness (manager, 0, error); + if (!ret) { + /* failed, reset back to -1 */ + manager->priv->kbd_brightness_old = -1; + } + } + + return ret; +} + +static void +do_lid_open_action (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-open", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been opened"), + NULL); + + /* ensure we turn the panel back on after lid open */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after lid open: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy != NULL && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_error_free (error); + } + } + + kill_lid_close_safety_timer (manager); +} + +static gboolean +is_on (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + + crtc = gnome_rr_output_get_crtc (output); + if (!crtc) + return FALSE; + return gnome_rr_crtc_get_current_mode (crtc) != NULL; +} + +static gboolean +non_laptop_outputs_are_all_off (GnomeRRScreen *screen) +{ + GnomeRROutput **outputs; + int i; + + outputs = gnome_rr_screen_list_outputs (screen); + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_laptop (outputs[i])) + continue; + + if (is_on (outputs[i])) + return FALSE; + } + + return TRUE; +} + +/* Timeout callback used to check conditions when the laptop's lid is closed but + * the machine is not suspended yet. We try to suspend again, so that the laptop + * won't overheat if placed in a backpack. + */ +static gboolean +lid_close_safety_timer_cb (GsdPowerManager *manager) +{ + manager->priv->lid_close_safety_timer_id = 0; + + g_debug ("lid has been closed for a while; trying to suspend again"); + do_lid_closed_action (manager); + + return FALSE; +} + +/* Sets up a timer to be triggered some seconds after closing the laptop lid + * when the laptop is *not* suspended for some reason. We'll check conditions + * again in the timeout handler to see if we can suspend then. + */ +static void +setup_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) + return; + + manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT, + (GSourceFunc) lid_close_safety_timer_cb, + manager); + g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer"); +} + +static void +kill_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) { + g_source_remove (manager->priv->lid_close_safety_timer_id); + manager->priv->lid_close_safety_timer_id = 0; + } +} + +static void +suspend_with_lid_closed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + GsdPowerActionType action_type; + + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-battery-action"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-ac-action"); + } + + /* check we won't melt when the lid is closed */ + if (action_type != GSD_POWER_ACTION_SUSPEND && + action_type != GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_lid_force_sleep (manager->priv->up_client)) { + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; + } else { + /* maybe lock the screen if the lid is closed */ + lock_screensaver (manager); + } + } + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off after lid close: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + do_power_action_type (manager, action_type); +} + +static void +do_lid_closed_action (GsdPowerManager *manager) +{ + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-close", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been closed"), + NULL); + + /* refresh RANDR so we get an accurate view of what monitors are plugged in when the lid is closed */ + gnome_rr_screen_refresh (manager->priv->x11_screen, NULL); /* NULL-GError */ + + /* perform policy action */ + if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor") + || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) { + g_debug ("lid is closed; suspending or hibernating"); + suspend_with_lid_closed (manager); + } else { + g_debug ("lid is closed; not suspending nor hibernating since some external monitor outputs are still active"); + setup_lid_close_safety_timer (manager); + } +} + + +static void +up_client_changed_cb (UpClient *client, GsdPowerManager *manager) +{ + gboolean tmp; + + if (!up_client_get_on_battery (client)) { + /* if we are playing a critical charge sound loop on AC, stop it */ + if (manager->priv->critical_alert_timeout_id > 0) { + g_debug ("stopping alert loop due to ac being present"); + play_loop_stop (manager); + } + notify_close_if_showing (manager->priv->notification_low); + } + + /* same state */ + tmp = up_client_get_lid_is_closed (manager->priv->up_client); + if (manager->priv->lid_is_closed == tmp) + return; + manager->priv->lid_is_closed = tmp; + + /* fake a keypress */ + if (tmp) + do_lid_closed_action (manager); + else + do_lid_open_action (manager); +} + +typedef enum { + SESSION_STATUS_CODE_AVAILABLE = 0, + SESSION_STATUS_CODE_INVISIBLE, + SESSION_STATUS_CODE_BUSY, + SESSION_STATUS_CODE_IDLE, + SESSION_STATUS_CODE_UNKNOWN +} SessionStatusCode; + +typedef enum { + SESSION_INHIBIT_MASK_LOGOUT = 1, + SESSION_INHIBIT_MASK_SWITCH = 2, + SESSION_INHIBIT_MASK_SUSPEND = 4, + SESSION_INHIBIT_MASK_IDLE = 8 +} SessionInhibitMask; + +static const gchar * +idle_mode_to_string (GsdPowerIdleMode mode) +{ + if (mode == GSD_POWER_IDLE_MODE_NORMAL) + return "normal"; + if (mode == GSD_POWER_IDLE_MODE_DIM) + return "dim"; + if (mode == GSD_POWER_IDLE_MODE_BLANK) + return "blank"; + if (mode == GSD_POWER_IDLE_MODE_SLEEP) + return "sleep"; + return "unknown"; +} + +static GnomeRROutput * +get_primary_output (GsdPowerManager *manager) +{ + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + guint i; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL) + goto out; + + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i]) && + gnome_rr_output_is_laptop (outputs[i]) && + gnome_rr_output_get_backlight_min (outputs[i]) >= 0 && + gnome_rr_output_get_backlight_max (outputs[i]) > 0) { + output = outputs[i]; + break; + } + } +out: + return output; +} + +/** + * backlight_helper_get_value: + * + * Gets a brightness value from the PolicyKit helper. + * + * Return value: the signed integer value from the helper, or -1 + * for failure. If -1 then @error is set. + **/ +static gint64 +backlight_helper_get_value (const gchar *argument, GError **error) +{ + gboolean ret; + gchar *stdout_data = NULL; + gint exit_status = 0; + gint64 value = -1; + gchar *command = NULL; + gchar *endptr = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf (LIBEXECDIR "/gsd-backlight-helper --%s", + argument); + ret = g_spawn_command_line_sync (command, + &stdout_data, + NULL, + &exit_status, + error); + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret) + goto out; + + if (WEXITSTATUS (exit_status) != 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "gsd-backlight-helper failed: %s", + stdout_data ? stdout_data : "No reason"); + goto out; + } + + /* parse */ + value = g_ascii_strtoll (stdout_data, &endptr, 10); + + /* parsing error */ + if (endptr == stdout_data) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to parse value: %s", + stdout_data); + goto out; + } + + /* out of range */ + if (value > G_MAXINT) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value out of range: %s", + stdout_data); + goto out; + } + + /* Fetching the value failed, for some other reason */ + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value negative, but helper did not fail: %s", + stdout_data); + goto out; + } + +out: + g_free (command); + g_free (stdout_data); + return value; +} + +/** + * backlight_helper_set_value: + * + * Sets a brightness value using the PolicyKit helper. + * + * Return value: Success. If FALSE then @error is set. + **/ +static gboolean +backlight_helper_set_value (const gchar *argument, + gint value, + GError **error) +{ + gboolean ret; + gint exit_status = 0; + gchar *command = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-backlight-helper --%s %i", + argument, value); + ret = g_spawn_command_line_sync (command, + NULL, + NULL, + &exit_status, + error); + + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret || WEXITSTATUS (exit_status) != 0) + goto out; + +out: + g_free (command); + return ret; +} + +static gint +backlight_get_abs (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + return gnome_rr_output_get_backlight (output, + error); + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-brightness", error); +} + +static gint +backlight_get_percentage (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gint now; + gint value = -1; + gint min = 0; + gint max; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); +out: + return value; +} + +static gint +backlight_get_min (GsdPowerManager *manager) +{ + GnomeRROutput *output; + + /* if we have no xbacklight device, then hardcode zero as sysfs + * offsets everything to 0 as min */ + output = get_primary_output (manager); + if (output == NULL) + return 0; + + /* get xbacklight value, which maybe non-zero */ + return gnome_rr_output_get_backlight_min (output); +} + +static gint +backlight_get_max (GsdPowerManager *manager, GError **error) +{ + gint value; + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + value = gnome_rr_output_get_backlight_max (output); + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to get backlight max"); + } + return value; + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-max-brightness", error); +} + +static void +backlight_emit_changed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + ret = g_dbus_connection_emit_signal (manager->priv->connection, + GSD_DBUS_SERVICE, + GSD_POWER_DBUS_PATH, + GSD_POWER_DBUS_INTERFACE_SCREEN, + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit Changed: %s", error->message); + g_error_free (error); + } +} + +static gboolean +backlight_set_percentage (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint min = 0; + gint max; + guint discrete; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + if (min < 0 || max < 0) { + g_warning ("no xrandr backlight capability"); + goto out; + } + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gint +backlight_step_up (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_step_down (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_set_abs (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + ret = gnome_rr_output_set_backlight (output, + value, + error); + goto out; + } + + /* fall back to the polkit helper */ + ret = backlight_helper_set_value ("set-brightness", + value, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gboolean +display_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gint min; + gint max; + gint now; + gint idle; + gboolean ret = FALSE; + + now = backlight_get_abs (manager, error); + if (now < 0) { + goto out; + } + + /* is the dim brightness actually *dimmer* than the + * brightness we have now? */ + min = backlight_get_min (manager); + max = backlight_get_max (manager, error); + if (max < 0) { + goto out; + } + idle = PERCENTAGE_TO_ABS (min, max, idle_percentage); + if (idle > now) { + g_debug ("brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + ret = TRUE; + goto out; + } + ret = backlight_set_abs (manager, + idle, + FALSE, + error); + if (!ret) { + goto out; + } + + /* save for undim */ + manager->priv->pre_dim_brightness = now; + +out: + return ret; +} + +static gboolean +kbd_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gboolean ret; + gint idle; + gint max; + gint now; + + if (manager->priv->upower_kdb_proxy == NULL) + return TRUE; + + now = manager->priv->kbd_brightness_now; + max = manager->priv->kbd_brightness_max; + idle = PERCENTAGE_TO_ABS (0, max, idle_percentage); + if (idle > now) { + g_debug ("kbd brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + return TRUE; + } + ret = upower_kbd_set_brightness (manager, idle, error); + if (!ret) + return FALSE; + + /* save for undim */ + manager->priv->kbd_brightness_pre_dim = now; + return TRUE; +} + +static void +idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode) +{ + gboolean ret = FALSE; + GError *error = NULL; + gint idle_percentage; + GsdPowerActionType action_type; + GnomeSettingsSessionState state; + + if (mode == manager->priv->current_idle_mode) + return; + + /* Ignore attempts to set "less idle" modes */ + if (mode < manager->priv->current_idle_mode && + mode != GSD_POWER_IDLE_MODE_NORMAL) + return; + + /* ensure we're still on an active console */ + state = gnome_settings_session_get_state (manager->priv->session); + if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) { + g_debug ("ignoring state transition to %s as inactive", + idle_mode_to_string (mode)); + return; + } + + manager->priv->current_idle_mode = mode; + g_debug ("Doing a state transition: %s", idle_mode_to_string (mode)); + + /* don't do any power saving if we're a VM */ + if (manager->priv->is_virtual_machine) { + g_debug ("ignoring state transition to %s as virtual machine", + idle_mode_to_string (mode)); + return; + } + + /* save current brightness, and set dim level */ + if (mode == GSD_POWER_IDLE_MODE_DIM) { + + /* have we disabled the action */ + if (up_client_get_on_battery (manager->priv->up_client)) { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-battery"); + } else { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-ac"); + } + if (!ret) { + g_debug ("not dimming due to policy"); + return; + } + + /* display backlight */ + idle_percentage = g_settings_get_int (manager->priv->settings, + "idle-brightness"); + ret = display_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* keyboard backlight */ + ret = kbd_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim kbd backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* turn off screen and kbd */ + } else if (mode == GSD_POWER_IDLE_MODE_BLANK) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + /* sleep */ + } else if (mode == GSD_POWER_IDLE_MODE_SLEEP) { + + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-battery-type"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-ac-type"); + } + do_power_action_type (manager, action_type); + + /* turn on screen and restore user-selected brightness level */ + } else if (mode == GSD_POWER_IDLE_MODE_NORMAL) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on: %s", + error->message); + g_clear_error (&error); + } + + /* reset brightness if we dimmed */ + if (manager->priv->pre_dim_brightness >= 0) { + ret = backlight_set_abs (manager, + manager->priv->pre_dim_brightness, + FALSE, + &error); + if (!ret) { + g_warning ("failed to restore backlight to %i: %s", + manager->priv->pre_dim_brightness, + error->message); + g_clear_error (&error); + } else { + manager->priv->pre_dim_brightness = -1; + } + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_clear_error (&error); + } + } + + /* reset kbd brightness if we dimmed */ + if (manager->priv->kbd_brightness_pre_dim >= 0) { + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_pre_dim, + &error); + if (!ret) { + g_warning ("failed to restore kbd backlight to %i: %s", + manager->priv->kbd_brightness_pre_dim, + error->message); + g_error_free (error); + } + manager->priv->kbd_brightness_pre_dim = -1; + } + + } +} + +static gboolean +idle_is_session_idle (GsdPowerManager *manager) +{ + gboolean ret; + GVariant *result; + guint status; + + /* not yet connected to gnome-session */ + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("session idleness not available, gnome-session is not available"); + return FALSE; + } + + /* get the session status */ + result = g_dbus_proxy_get_cached_property (manager->priv->session_presence_proxy, + "status"); + if (result == NULL) { + g_warning ("no readable status property on %s", + g_dbus_proxy_get_interface_name (manager->priv->session_presence_proxy)); + return FALSE; + } + + g_variant_get (result, "u", &status); + ret = (status == SESSION_STATUS_CODE_IDLE); + g_variant_unref (result); + + return ret; +} + +static gboolean +idle_is_session_inhibited (GsdPowerManager *manager, guint mask) +{ + gboolean ret; + GVariant *retval = NULL; + GError *error = NULL; + + /* not yet connected to gnome-session */ + if (manager->priv->session_proxy == NULL) { + g_warning ("session inhibition not available, gnome-session is not available"); + return FALSE; + } + + retval = g_dbus_proxy_call_sync (manager->priv->session_proxy, + "IsInhibited", + g_variant_new ("(u)", + mask), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + &error); + if (retval == NULL) { + /* abort as the DBUS method failed */ + g_warning ("IsInhibited failed: %s", error->message); + g_error_free (error); + return FALSE; + } + + g_variant_get (retval, "(b)", &ret); + g_variant_unref (retval); + + return ret; +} + +/** + * idle_adjust_timeout: + * @idle_time: Current idle time, in seconds. + * @timeout: The new timeout we want to set, in seconds. + * + * On slow machines, or machines that have lots to load duing login, + * the current idle time could be bigger than the requested timeout. + * In this case the scheduled idle timeout will never fire, unless + * some user activity (keyboard, mouse) resets the current idle time. + * Instead of relying on user activity to correct this issue, we need + * to adjust timeout, as related to current idle time, so the idle + * timeout will fire as designed. + * + * Return value: timeout to set, adjusted acccording to current idle time. + **/ +static guint +idle_adjust_timeout (guint idle_time, guint timeout) +{ + /* allow 2 sec margin for messaging delay. */ + idle_time += 2; + + /* Double timeout until it's larger than current idle time. + * Give up for ultra slow machines. (86400 sec = 24 hours) */ + while (timeout < idle_time && + timeout < 86400 && + timeout > 0) { + timeout *= 2; + } + return timeout; +} + +/** + * idle_adjust_timeout_blank: + * @idle_time: current idle time, in seconds. + * @timeout: the new timeout we want to set, in seconds. + * + * Same as idle_adjust_timeout(), but also accounts for the duration + * of the fading animation in the screensaver (so that blanking happens + * exactly at the end of it, if configured with the same timeouts) + */ +static guint +idle_adjust_timeout_blank (guint idle_time, guint timeout) +{ + return idle_adjust_timeout (idle_time, + timeout + SCREENSAVER_FADE_TIME); +} + +static void +idle_configure (GsdPowerManager *manager) +{ + gboolean is_idle_inhibited; + guint current_idle_time; + guint timeout_blank; + guint timeout_sleep; + gboolean on_battery; + + /* are we inhibited from going idle */ + is_idle_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_IDLE); + if (is_idle_inhibited) { + g_debug ("inhibited, so using normal state"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); + + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + return; + } + + current_idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + + /* set up blank callback even when session is not idle, + * but only if we actually want to blank. */ + on_battery = up_client_get_on_battery (manager->priv->up_client); + if (on_battery) { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-battery"); + } else { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-ac"); + } + if (timeout_blank != 0) { + g_debug ("setting up blank callback for %is", timeout_blank); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID, + idle_adjust_timeout_blank (current_idle_time, timeout_blank) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + } + + /* only do the sleep timeout when the session is idle + * and we aren't inhibited from sleeping */ + if (on_battery) { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-battery-timeout"); + } else { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-ac-timeout"); + } + if (timeout_sleep != 0) { + g_debug ("setting up sleep callback %is", timeout_sleep); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID, + idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + } +} + +/** + * @timeout: The new timeout we want to set, in seconds + **/ +static gboolean +idle_set_timeout_dim (GsdPowerManager *manager, guint timeout) +{ + guint idle_time; + + idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + if (idle_time == 0) + return FALSE; + + g_debug ("Setting dim idle timeout: %ds", timeout); + if (timeout > 0) { + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID, + idle_adjust_timeout (idle_time, timeout) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID); + } + return TRUE; +} + +static void +refresh_idle_dim_settings (GsdPowerManager *manager) +{ + gint timeout_dim; + timeout_dim = g_settings_get_int (manager->priv->settings, + "idle-dim-time"); + g_debug ("idle dim set with timeout %i", timeout_dim); + idle_set_timeout_dim (manager, timeout_dim); +} + +static void +gsd_power_manager_class_init (GsdPowerManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_power_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPowerManagerPrivate)); +} + +static void +sleep_cb_screensaver_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->screensaver_proxy == NULL) { + g_warning ("Could not connect to gnome-screensaver: %s", + error->message); + g_error_free (error); + return; + } + + /* Finish the upower_notify_sleep_cb() call by locking the screen */ + g_debug ("gnome-screensaver activated, doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); +} + +static void +idle_dbus_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 || + g_strcmp0 (signal_name, "InhibitorRemoved") == 0) { + g_debug ("Received gnome session inhibitor change"); + idle_configure (manager); + } + if (g_strcmp0 (signal_name, "StatusChanged") == 0) { + guint status; + + g_variant_get (parameters, "(u)", &status); + g_dbus_proxy_set_cached_property (proxy, "status", + g_variant_new ("u", status)); + g_debug ("Received gnome session status change"); + idle_configure (manager); + } +} + +static void +session_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_proxy == NULL) { + g_warning ("Could not connect to gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (manager->priv->session_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); + } + + idle_configure (manager); +} + +static void +session_presence_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_presence_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("Could not connect to gnome-sesson: %s", + error->message); + g_error_free (error); + return; + } + g_signal_connect (manager->priv->session_presence_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); +} + +static void +power_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *k_now = NULL; + GVariant *k_max = NULL; + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_kdb_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_kdb_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + goto out; + } + + k_now = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_now == NULL) { + if (error->domain != G_DBUS_ERROR || + error->code != G_DBUS_ERROR_UNKNOWN_METHOD) { + g_warning ("Failed to get brightness: %s", + error->message); + } + g_error_free (error); + goto out; + } + + k_max = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetMaxBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_max == NULL) { + g_warning ("Failed to get max brightness: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (k_now, "(i)", &manager->priv->kbd_brightness_now); + g_variant_get (k_max, "(i)", &manager->priv->kbd_brightness_max); + + /* set brightness to max if not currently set so is something + * sensible */ + if (manager->priv->kbd_brightness_now <= 0) { + gboolean ret; + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_max, + &error); + if (!ret) { + g_warning ("failed to initialize kbd backlight to %i: %s", + manager->priv->kbd_brightness_max, + error->message); + g_error_free (error); + } + } +out: + if (k_now != NULL) + g_variant_unref (k_now); + if (k_max != NULL) + g_variant_unref (k_max); +} + +static void +lock_screensaver (GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "lock-enabled"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_sleep_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "ubuntu-lock-on-suspend"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_resume_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* this displays the unlock dialogue so the user doesn't have + * to move the mouse or press any key before the window comes up */ + if (manager->priv->screensaver_proxy != NULL) { + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "SimulateUserActivity", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + } + + /* close existing notifications on resume, the system power + * state is probably different now */ + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after resume: %s", + error->message); + g_error_free (error); + } +} + +static void +idle_send_to_sleep (GsdPowerManager *manager) +{ + gboolean is_inhibited; + gboolean is_idle; + + /* check the session is not now inhibited */ + is_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_SUSPEND); + if (is_inhibited) { + g_debug ("suspend inhibited"); + return; + } + + /* check the session is really idle*/ + is_idle = idle_is_session_idle (manager); + if (!is_idle) { + g_debug ("session is not idle, cannot SLEEP"); + return; + } + + /* send to sleep, and cancel timeout */ + g_debug ("sending to SLEEP"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP); +} + +static void +idle_idletime_alarm_expired_cb (GpmIdletime *idletime, + guint alarm_id, + GsdPowerManager *manager) +{ + g_debug ("idletime alarm: %i", alarm_id); + + switch (alarm_id) { + case GSD_POWER_IDLETIME_DIM_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM); + break; + case GSD_POWER_IDLETIME_BLANK_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK); + break; + case GSD_POWER_IDLETIME_SLEEP_ID: + idle_send_to_sleep (manager); + break; + } +} + +static void +idle_idletime_reset_cb (GpmIdletime *idletime, + GsdPowerManager *manager) +{ + g_debug ("idletime reset"); + + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +static void +engine_settings_key_changed_cb (GSettings *settings, + const gchar *key, + GsdPowerManager *manager) +{ + if (g_strcmp0 (key, "use-time-for-policy") == 0) { + manager->priv->use_time_primary = g_settings_get_boolean (settings, key); + return; + } + if (g_strcmp0 (key, "idle-dim-time") == 0) { + refresh_idle_dim_settings (manager); + return; + } + if (g_str_has_prefix (key, "sleep-inactive") || + g_str_has_prefix (key, "sleep-display")) { + idle_configure (manager); + return; + } +} + +static void +engine_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdPowerManager *manager) +{ + /* when doing the fast-user-switch into a new account, + * ensure the new account is undimmed and with the backlight on */ + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +/* This timer goes off every few minutes, whether the user is idle or not, + to try and clean up anything that has gone wrong. + + It calls disable_builtin_screensaver() so that if xset has been used, + or some other program (like xlock) has messed with the XSetScreenSaver() + settings, they will be set back to sensible values (if a server extension + is in use, messing with xlock can cause the screensaver to never get a wakeup + event, and could cause monitor power-saving to occur, and all manner of + heinousness.) + + This code was originally part of gnome-screensaver, see + http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530 + */ +static gboolean +disable_builtin_screensaver (gpointer unused) +{ + int current_server_timeout, current_server_interval; + int current_prefer_blank, current_allow_exp; + int desired_server_timeout, desired_server_interval; + int desired_prefer_blank, desired_allow_exp; + + XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + ¤t_server_timeout, + ¤t_server_interval, + ¤t_prefer_blank, + ¤t_allow_exp); + + desired_server_timeout = current_server_timeout; + desired_server_interval = current_server_interval; + desired_prefer_blank = current_prefer_blank; + desired_allow_exp = current_allow_exp; + + desired_server_interval = 0; + + /* I suspect (but am not sure) that DontAllowExposures might have + something to do with powering off the monitor as well, at least + on some systems that don't support XDPMS? Who know... */ + desired_allow_exp = AllowExposures; + + /* When we're not using an extension, set the server-side timeout to 0, + so that the server never gets involved with screen blanking, and we + do it all ourselves. (However, when we *are* using an extension, + we tell the server when to notify us, and rather than blanking the + screen, the server will send us an X event telling us to blank.) + */ + desired_server_timeout = 0; + + if (desired_server_timeout != current_server_timeout + || desired_server_interval != current_server_interval + || desired_prefer_blank != current_prefer_blank + || desired_allow_exp != current_allow_exp) { + + g_debug ("disabling server builtin screensaver:" + " (xset s %d %d; xset s %s; xset s %s)", + desired_server_timeout, + desired_server_interval, + (desired_prefer_blank ? "blank" : "noblank"), + (desired_allow_exp ? "expose" : "noexpose")); + + XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + desired_server_timeout, + desired_server_interval, + desired_prefer_blank, + desired_allow_exp); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + } + + return TRUE; +} + +static gboolean +is_hardware_a_virtual_machine (void) +{ + const gchar *str; + gboolean ret = FALSE; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.systemd1.Manager", + "Virtualization"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Virtualization", error->message); + g_error_free (error); + goto out; + } + + /* on bare-metal hardware this is the empty string, + * otherwise an identifier such as "kvm", "vmware", etc. */ + g_variant_get (variant, "(v)", &inner); + str = g_variant_get_string (inner, NULL); + if (str != NULL && str[0] != '\0') + ret = TRUE; +out: + if (connection != NULL) + g_object_unref (connection); + if (variant != NULL) + g_variant_unref (variant); + return ret; +} + +gboolean +gsd_power_manager_start (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting power manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (manager->priv->x11_screen == NULL) + return FALSE; + + /* track the active session */ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (engine_session_active_changed_cb), + manager); + + manager->priv->kbd_brightness_old = -1; + manager->priv->kbd_brightness_pre_dim = -1; + manager->priv->pre_dim_brightness = -1; + manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA); + g_signal_connect (manager->priv->settings, "changed", + G_CALLBACK (engine_settings_key_changed_cb), manager); + manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver"); + manager->priv->up_client = up_client_new (); + g_signal_connect (manager->priv->up_client, "notify-sleep", + G_CALLBACK (upower_notify_sleep_cb), manager); + g_signal_connect (manager->priv->up_client, "notify-resume", + G_CALLBACK (upower_notify_resume_cb), manager); + manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client); + g_signal_connect (manager->priv->up_client, "device-added", + G_CALLBACK (engine_device_added_cb), manager); + g_signal_connect (manager->priv->up_client, "device-removed", + G_CALLBACK (engine_device_removed_cb), manager); + g_signal_connect (manager->priv->up_client, "device-changed", + G_CALLBACK (engine_device_changed_cb), manager); + g_signal_connect_after (manager->priv->up_client, "changed", + G_CALLBACK (up_client_changed_cb), manager); + + /* use the fallback name from gnome-power-manager so the shell + * blocks this, and uses the power extension instead */ + manager->priv->status_icon = gtk_status_icon_new (); + gtk_status_icon_set_name (manager->priv->status_icon, + "gnome-power-manager"); + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH, + UPOWER_DBUS_INTERFACE, + NULL, + power_proxy_ready_cb, + manager); + + /* connect to UPower for keyboard backlight control */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH_KBDBACKLIGHT, + UPOWER_DBUS_INTERFACE_KBDBACKLIGHT, + NULL, + power_keyboard_proxy_ready_cb, + manager); + + /* connect to the session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + session_proxy_ready_cb, + manager); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + 0, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH_PRESENCE, + GNOME_SESSION_DBUS_INTERFACE_PRESENCE, + NULL, + session_presence_proxy_ready_cb, + manager); + + manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref); + manager->priv->canberra_context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + + manager->priv->phone = gpm_phone_new (); + g_signal_connect (manager->priv->phone, "device-added", + G_CALLBACK (phone_device_added_cb), manager); + g_signal_connect (manager->priv->phone, "device-removed", + G_CALLBACK (phone_device_removed_cb), manager); + g_signal_connect (manager->priv->phone, "device-refresh", + G_CALLBACK (phone_device_refresh_cb), manager); + + /* create a fake virtual composite battery */ + manager->priv->device_composite = up_device_new (); + g_object_set (manager->priv->device_composite, + "kind", UP_DEVICE_KIND_BATTERY, + "is-rechargeable", TRUE, + "native-path", "dummy:composite_battery", + "power-supply", TRUE, + "is-present", TRUE, + NULL); + + /* get percentage policy */ + manager->priv->low_percentage = g_settings_get_int (manager->priv->settings, + "percentage-low"); + manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings, + "percentage-critical"); + manager->priv->action_percentage = g_settings_get_int (manager->priv->settings, + "percentage-action"); + + /* get time policy */ + manager->priv->low_time = g_settings_get_int (manager->priv->settings, + "time-low"); + manager->priv->critical_time = g_settings_get_int (manager->priv->settings, + "time-critical"); + manager->priv->action_time = g_settings_get_int (manager->priv->settings, + "time-action"); + + /* we can disable this if the time remaining is inaccurate or just plain wrong */ + manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings, + "use-time-for-policy"); + + /* create IDLETIME watcher */ + manager->priv->idletime = gpm_idletime_new (); + g_signal_connect (manager->priv->idletime, "reset", + G_CALLBACK (idle_idletime_reset_cb), manager); + g_signal_connect (manager->priv->idletime, "alarm-expired", + G_CALLBACK (idle_idletime_alarm_expired_cb), manager); + + /* ensure the default dpms timeouts are cleared */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + error); + if (!ret) { + g_warning ("Failed set DPMS mode: %s", (*error)->message); + g_clear_error (error); + } + + /* coldplug the engine */ + engine_coldplug (manager); + + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); + /* don't blank inside a VM */ + manager->priv->is_virtual_machine = is_hardware_a_virtual_machine (); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_power_manager_stop (GsdPowerManager *manager) +{ + g_debug ("Stopping power manager"); + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + kill_lid_close_safety_timer (manager); + + g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager); + + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->session); + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->settings_screensaver); + g_clear_object (&manager->priv->up_client); + g_clear_object (&manager->priv->x11_screen); + + g_ptr_array_unref (manager->priv->devices_array); + manager->priv->devices_array = NULL; + g_clear_object (&manager->priv->phone); + g_clear_object (&manager->priv->device_composite); + g_clear_object (&manager->priv->previous_icon); + + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = NULL; + + g_clear_object (&manager->priv->upower_proxy); + g_clear_object (&manager->priv->session_proxy); + g_clear_object (&manager->priv->session_presence_proxy); + + if (manager->priv->critical_alert_timeout_id > 0) { + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); + + if (manager->priv->xscreensaver_watchdog_timer_id > 0) { + g_source_remove (manager->priv->xscreensaver_watchdog_timer_id); + manager->priv->xscreensaver_watchdog_timer_id = 0; + } +} + +static void +gsd_power_manager_init (GsdPowerManager *manager) +{ + manager->priv = GSD_POWER_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_power_manager_finalize (GObject *object) +{ + GsdPowerManager *manager; + + manager = GSD_POWER_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + + G_OBJECT_CLASS (gsd_power_manager_parent_class)->finalize (object); +} + +/* returns new level */ +static void +handle_method_call_keyboard (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint step; + gint value = -1; + gboolean ret; + guint percentage; + GError *error = NULL; + + if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("keyboard step up"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MIN (manager->priv->kbd_brightness_now + step, + manager->priv->kbd_brightness_max); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("keyboard step down"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MAX (manager->priv->kbd_brightness_now - step, 0); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "Toggle") == 0) { + ret = upower_kbd_toggle (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (!ret) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + percentage = ABS_TO_PERCENTAGE (0, + manager->priv->kbd_brightness_max, + value); + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + percentage)); + } +} + +static void +handle_method_call_screen (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gboolean ret = FALSE; + gint value = -1; + guint value_tmp; + GError *error = NULL; + + if (g_strcmp0 (method_name, "GetPercentage") == 0) { + g_debug ("screen get percentage"); + value = backlight_get_percentage (manager, &error); + + } else if (g_strcmp0 (method_name, "SetPercentage") == 0) { + g_debug ("screen set percentage"); + g_variant_get (parameters, "(u)", &value_tmp); + ret = backlight_set_percentage (manager, value_tmp, TRUE, &error); + if (ret) + value = value_tmp; + + } else if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("screen step up"); + value = backlight_step_up (manager, &error); + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("screen step down"); + value = backlight_step_down (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (value < 0) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + value)); + } +} + +static GVariant * +device_to_variant_blob (UpDevice *device) +{ + const gchar *object_path; + gchar *device_icon; + gdouble percentage; + GIcon *icon; + guint64 time_empty, time_full; + guint64 time_state = 0; + GVariant *value; + UpDeviceKind kind; + UpDeviceState state; + + icon = gpm_upower_get_device_icon (device, TRUE); + device_icon = g_icon_to_string (icon); + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "state", &state, + "time-to-empty", &time_empty, + "time-to-full", &time_full, + NULL); + + /* only return time for these simple states */ + if (state == UP_DEVICE_STATE_DISCHARGING) + time_state = time_empty; + else if (state == UP_DEVICE_STATE_CHARGING) + time_state = time_full; + + /* get an object path, even for the composite device */ + object_path = up_device_get_object_path (device); + if (object_path == NULL) + object_path = GSD_DBUS_PATH; + + /* format complex object */ + value = g_variant_new ("(susdut)", + object_path, + kind, + device_icon, + percentage, + state, + time_state); + g_free (device_icon); + g_object_unref (icon); + return value; +} + +static void +handle_method_call_main (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GPtrArray *array; + guint i; + GVariantBuilder *builder; + GVariant *tuple = NULL; + GVariant *value = NULL; + UpDevice *device; + + /* return object */ + if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) { + + /* get the virtual device */ + device = engine_get_primary_device (manager); + if (device == NULL) { + g_dbus_method_invocation_return_dbus_error (invocation, + "org.gnome.SettingsDaemon.Power.Failed", + "There is no primary device."); + return; + } + + /* return the value */ + value = device_to_variant_blob (device); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_object_unref (device); + return; + } + + /* return array */ + if (g_strcmp0 (method_name, "GetDevices") == 0) { + + /* create builder */ + builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)")); + + /* add each tuple to the array */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + value = device_to_variant_blob (device); + g_variant_builder_add_value (builder, value); + } + + /* return the value */ + value = g_variant_builder_end (builder); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_variant_builder_unref (builder); + return; + } + + g_assert_not_reached (); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for Power", + interface_name, method_name); + + if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE) == 0) { + handle_method_call_main (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_SCREEN) == 0) { + handle_method_call_screen (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_KEYBOARD) == 0) { + handle_method_call_keyboard (manager, + method_name, + parameters, + invocation); + } else { + g_warning ("not recognised interface: %s", interface_name); + } +} + +static GVariant * +handle_get_property (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + GVariant *retval = NULL; + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return NULL; + } + + if (g_strcmp0 (property_name, "Icon") == 0) { + retval = engine_get_icon_property_variant (manager); + } else if (g_strcmp0 (property_name, "Tooltip") == 0) { + retval = engine_get_tooltip_property_variant (manager); + } + + return retval; +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdPowerManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + guint i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_POWER_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdPowerManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdPowerManager * +gsd_power_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_POWER_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + return GSD_POWER_MANAGER (manager_object); +} diff --git a/.pc/correct_logout_action.patch/plugins/media-keys/gsd-media-keys-manager.c b/.pc/correct_logout_action.patch/plugins/media-keys/gsd-media-keys-manager.c new file mode 100644 index 00000000..eb59d056 --- /dev/null +++ b/.pc/correct_logout_action.patch/plugins/media-keys/gsd-media-keys-manager.c @@ -0,0 +1,2789 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GUDEV +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-marshal.h" +#include "gsd-media-keys-manager.h" + +#include "shortcuts-list.h" +#include "gsd-osd-window.h" +#include "gsd-input-helper.h" +#include "gsd-power-helper.h" +#include "gsd-enums.h" + +#include +#include +#include "gvc-mixer-control.h" + +#include + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" +#define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +#define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +#define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring" +#define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon" +#define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon" + +#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +#define SETTINGS_INTERFACE_DIR "org.gnome.desktop.interface" +#define SETTINGS_POWER_DIR "org.gnome.settings-daemon.plugins.power" +#define SETTINGS_XSETTINGS_DIR "org.gnome.settings-daemon.plugins.xsettings" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" +#define TOUCHPAD_ENABLED_KEY "touchpad-enabled" +#define HIGH_CONTRAST "HighContrast" + +#define VOLUME_STEP 6 /* percents for one volume button press */ +#define MAX_VOLUME 65536.0 + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" + +#define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + +typedef struct { + char *application; + char *name; + guint32 time; + guint watch_id; +} MediaPlayer; + +typedef struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; + char *custom_path; + char *custom_command; + Key *key; +} MediaKey; + +struct GsdMediaKeysManagerPrivate +{ + /* Volume bits */ + GvcMixerControl *volume; + GvcMixerStream *stream; + ca_context *ca; + GtkSettings *gtksettings; +#ifdef HAVE_GUDEV + GHashTable *streams; /* key = X device ID, value = stream id */ + GUdevClient *udev_client; +#endif /* HAVE_GUDEV */ + + GtkWidget *dialog; + GSettings *settings; + GHashTable *custom_settings; + + GPtrArray *keys; + + /* HighContrast theme settings */ + GSettings *interface_settings; + char *icon_theme; + char *gtk_theme; + + /* Power stuff */ + GSettings *power_settings; + GDBusProxy *upower_proxy; + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; + int opcode; + + GList *media_players; + + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + guint start_idle_id; + + /* Ubuntu notifications */ + NotifyNotification *volume_notification; + NotifyNotification *brightness_notification; + NotifyNotification *kb_backlight_notification; +}; + +static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +static void gsd_media_keys_manager_init (GsdMediaKeysManager *media_keys_manager); +static void gsd_media_keys_manager_finalize (GObject *object); +static void register_manager (GsdMediaKeysManager *manager); +static void custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager); +G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous" +#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only" +#define NOTIFY_HINT_TRUE "true" + +typedef struct { + GsdMediaKeysManager *manager; + MediaKeyType type; + guint old_percentage; + +} GsdBrightnessActionData; + +static const char *volume_icons[] = { + "notification-audio-volume-muted", + "notification-audio-volume-low", + "notification-audio-volume-medium", + "notification-audio-volume-high", + NULL +}; + +static const char *brightness_icons[] = { + "notification-display-brightness-off", + "notification-display-brightness-low", + "notification-display-brightness-medium", + "notification-display-brightness-high", + "notification-display-brightness-full", + NULL +}; + +static const char *kb_backlight_icons[] = { + "notification-keyboard-brightness-off", + "notification-keyboard-brightness-low", + "notification-keyboard-brightness-medium", + "notification-keyboard-brightness-high", + "notification-keyboard-brightness-full", + NULL +}; + +static const char * +calculate_icon_name (gint value, const char **icon_names) +{ + value = CLAMP (value, 0, 100); + gint length = g_strv_length (icon_names); + gint s = (length - 1) * value / 100 + 1; + s = CLAMP (s, 1, length - 1); + + return icon_names[s]; +} + +static gboolean +ubuntu_osd_notification_is_supported (void) +{ + GList *caps; + gboolean has_cap; + + caps = notify_get_server_caps (); + has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL); + g_list_foreach (caps, (GFunc) g_free, NULL); + g_list_free (caps); + + return has_cap; +} + +static gboolean +ubuntu_osd_notification_show_icon (const char *icon, + const char *hint) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + NotifyNotification *notification = notify_notification_new (" ", "", icon); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE); + + gboolean res = notify_notification_show (notification, NULL); + g_object_unref (notification); + + return res; +} + +static gboolean +ubuntu_osd_do_notification (NotifyNotification **notification, + const char *hint, + gint value, + gboolean muted, + const char **icon_names) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + if (!*notification) { + *notification = notify_notification_new (" ", "", NULL); + notify_notification_set_hint_string (*notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + } + + value = CLAMP (value, -1, 101); + const char *icon = muted ? icon_names[0] : calculate_icon_name (value, icon_names); + notify_notification_set_hint_int32 (*notification, "value", value); + notify_notification_update (*notification, " ", "", icon); + + return notify_notification_show (*notification, NULL); +} + +static gboolean +ubuntu_osd_notification_show_volume (GsdMediaKeysManager *manager, + gint value, + gboolean muted) +{ + return ubuntu_osd_do_notification (&manager->priv->volume_notification, + "volume", value, muted, volume_icons); +} + +static gboolean +ubuntu_osd_notification_show_brightness (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->brightness_notification, + "brightness", value, value <= 0, brightness_icons); +} + +static gboolean +ubuntu_osd_notification_show_kb_backlight (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->kb_backlight_notification, + "keyboard", value, value <= 0, kb_backlight_icons); +} + +static void +init_screens (GsdMediaKeysManager *manager) +{ + GdkDisplay *display; + int i; + + display = gdk_display_get_default (); + for (i = 0; i < gdk_display_get_n_screens (display); i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + if (screen == NULL) { + continue; + } + manager->priv->screens = g_slist_append (manager->priv->screens, screen); + } + + manager->priv->current_screen = manager->priv->screens->data; +} + +static void +media_key_free (MediaKey *key) +{ + if (key == NULL) + return; + g_free (key->custom_path); + g_free (key->custom_command); + free_key (key->key); + g_free (key); +} + +static char * +get_term_command (GsdMediaKeysManager *manager) +{ + char *cmd_term, *cmd_args;; + char *cmd = NULL; + GSettings *settings; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + cmd_term = g_settings_get_string (settings, "exec"); + if (cmd_term[0] == '\0') + cmd_term = g_strdup ("gnome-terminal"); + + cmd_args = g_settings_get_string (settings, "exec-arg"); + if (strcmp (cmd_term, "") != 0) { + cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args); + } else { + cmd = g_strdup_printf ("%s -e", cmd_term); + } + + g_free (cmd_args); + g_free (cmd_term); + g_object_unref (settings); + + return cmd; +} + +static char ** +get_keyring_env (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant, *item; + GVariantIter *iter; + char **envp; + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_KEYRING_DBUS_NAME, + GNOME_KEYRING_DBUS_PATH, + GNOME_KEYRING_DBUS_INTERFACE, + "GetEnvironment", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call GetEnvironment on keyring daemon: %s", error->message); + g_error_free (error); + return NULL; + } + + envp = g_get_environ (); + + g_variant_get (variant, "(a{ss})", &iter); + + while ((item = g_variant_iter_next_value (iter))) { + char *key; + char *value; + + g_variant_get (item, + "{ss}", + &key, + &value); + + envp = g_environ_setenv (envp, key, value, TRUE); + + g_variant_unref (item); + g_free (key); + g_free (value); + } + + g_variant_iter_free (iter); + g_variant_unref (variant); + + return envp; +} + +static void +execute (GsdMediaKeysManager *manager, + char *cmd, + gboolean need_term) +{ + gboolean retval; + char **argv; + int argc; + char *exec; + char *term = NULL; + GError *error = NULL; + + retval = FALSE; + + if (need_term) + term = get_term_command (manager); + + if (term) { + exec = g_strdup_printf ("%s %s", term, cmd); + g_free (term); + } else { + exec = g_strdup (cmd); + } + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + char **envp; + + envp = get_keyring_env (manager); + + retval = g_spawn_async (g_get_home_dir (), + argv, + envp, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + &error); + + g_strfreev (argv); + g_strfreev (envp); + } + + if (retval == FALSE) { + g_warning ("Couldn't execute command: %s: %s", exec, error->message); + g_error_free (error); + } + g_free (exec); +} + +static void +dialog_init (GsdMediaKeysManager *manager) +{ + if (manager->priv->dialog != NULL + && !gsd_osd_window_is_valid (GSD_OSD_WINDOW (manager->priv->dialog))) { + gtk_widget_destroy (manager->priv->dialog); + manager->priv->dialog = NULL; + } + + if (manager->priv->dialog == NULL) { + manager->priv->dialog = gsd_osd_window_new (); + } +} + +static void +print_key_parse_error (MediaKey *key, + const char *str) +{ + if (str == NULL || *str == '\0') + return; + if (key->settings_key != NULL) + g_debug ("Unable to parse key '%s' for GSettings entry '%s'", str, key->settings_key); + else + g_debug ("Unable to parse hard-coded key '%s'", key->hard_coded); +} + +static char * +get_key_string (GsdMediaKeysManager *manager, + MediaKey *key) +{ + if (key->settings_key != NULL) + return g_settings_get_string (manager->priv->settings, key->settings_key); + else if (key->hard_coded != NULL) + return g_strdup (key->hard_coded); + else if (key->custom_path != NULL) { + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->custom_settings, + key->custom_path); + return g_settings_get_string (settings, "binding"); + } else + g_assert_not_reached (); +} + +static gboolean +grab_media_key (MediaKey *key, + GsdMediaKeysManager *manager) +{ + char *tmp; + gboolean need_flush; + + need_flush = FALSE; + + if (key->key != NULL) { + need_flush = TRUE; + ungrab_key_unsafe (key->key, manager->priv->screens); + } + + free_key (key->key); + key->key = NULL; + + tmp = get_key_string (manager, key); + + key->key = parse_key (tmp); + if (key->key == NULL) { + print_key_parse_error (key, tmp); + g_free (tmp); + return need_flush; + } + + grab_key_unsafe (key->key, GSD_KEYGRAB_NORMAL, manager->priv->screens); + + g_free (tmp); + + return TRUE; +} + +static void +gsettings_changed_cb (GSettings *settings, + const gchar *settings_key, + GsdMediaKeysManager *manager) +{ + int i; + gboolean need_flush = TRUE; + + /* handled in gsettings_custom_changed_cb() */ + if (g_str_equal (settings_key, "custom-keybindings")) + return; + + gdk_error_trap_push (); + + /* Find the key that was modified */ + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + /* Skip over hard-coded and GConf keys */ + if (key->settings_key == NULL) + continue; + if (strcmp (settings_key, key->settings_key) == 0) { + if (grab_media_key (key, manager)) + need_flush = TRUE; + break; + } + } + + if (need_flush) + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); +} + +static MediaKey * +media_key_new_for_path (GsdMediaKeysManager *manager, + char *path) +{ + GSettings *settings; + char *command, *binding; + MediaKey *key; + + g_debug ("media_key_new_for_path: %s", path); + + settings = g_hash_table_lookup (manager->priv->custom_settings, path); + if (settings == NULL) { + settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path); + + g_signal_connect (settings, "changed", + G_CALLBACK (custom_binding_changed), manager); + g_hash_table_insert (manager->priv->custom_settings, + g_strdup (path), settings); + } + + command = g_settings_get_string (settings, "command"); + binding = g_settings_get_string (settings, "binding"); + + if (*command == '\0' && *binding == '\0') { + g_debug ("Key binding (%s) is incomplete", path); + g_free (command); + g_free (binding); + return NULL; + } + g_free (binding); + + key = g_new0 (MediaKey, 1); + key->key_type = CUSTOM_KEY; + key->custom_path = g_strdup (path); + key->custom_command = command; + + return key; +} + +static void +update_custom_binding (GsdMediaKeysManager *manager, + char *path) +{ + MediaKey *key; + int i; + + /* Remove the existing key */ + for (i = 0; i < manager->priv->keys->len; i++) { + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->custom_path == NULL) + continue; + if (strcmp (key->custom_path, path) == 0) { + g_debug ("Removing custom key binding %s", path); + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", path); + } + g_ptr_array_remove_index_fast (manager->priv->keys, i); + break; + } + } + + /* And create a new one! */ + key = media_key_new_for_path (manager, path); + if (key) { + g_debug ("Adding new custom key binding %s", path); + g_ptr_array_add (manager->priv->keys, key); + + gdk_error_trap_push (); + + grab_media_key (key, manager); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for custom key '%s'", + key->custom_path); + } +} + +static void +custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char *path; + + if (strcmp (settings_key, "name") == 0) + return; /* we don't care */ + + g_object_get (settings, "path", &path, NULL); + update_custom_binding (manager, path); + g_free (path); +} + +static void +gsettings_custom_changed_cb (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char **bindings; + int i, j, n_bindings; + + bindings = g_settings_get_strv (settings, settings_key); + n_bindings = g_strv_length (bindings); + + /* Handle additions */ + for (i = 0; i < n_bindings; i++) { + if (g_hash_table_lookup (manager->priv->custom_settings, + bindings[i])) + continue; + update_custom_binding (manager, bindings[i]); + } + + /* Handle removals */ + for (i = 0; i < manager->priv->keys->len; i++) { + gboolean found = FALSE; + MediaKey *key = g_ptr_array_index (manager->priv->keys, i); + if (key->key_type != CUSTOM_KEY) + continue; + + for (j = 0; j < n_bindings && !found; j++) + found = strcmp (bindings[j], key->custom_path) == 0; + + if (found) + continue; + + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", key->custom_path); + } + g_hash_table_remove (manager->priv->custom_settings, + key->custom_path); + g_ptr_array_remove_index_fast (manager->priv->keys, i); + --i; /* make up for the removed key */ + } + g_strfreev (bindings); +} + +static void +add_key (GsdMediaKeysManager *manager, guint i) +{ + MediaKey *key; + + key = g_new0 (MediaKey, 1); + key->key_type = media_keys[i].key_type; + key->settings_key = media_keys[i].settings_key; + key->hard_coded = media_keys[i].hard_coded; + + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); +} + +static void +init_kbd (GsdMediaKeysManager *manager) +{ + char **custom_paths; + int i; + + gnome_settings_profile_start (NULL); + + gdk_error_trap_push (); + + manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free); + + /* Media keys + * Add hard-coded shortcuts first so that they can't be preempted */ + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded) + add_key (manager, i); + } + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded == NULL) + add_key (manager, i); + } + + /* Custom shortcuts */ + custom_paths = g_settings_get_strv (manager->priv->settings, + "custom-keybindings"); + + for (i = 0; i < g_strv_length (custom_paths); i++) { + MediaKey *key; + + g_debug ("Setting up custom keybinding %s", custom_paths[i]); + + key = media_key_new_for_path (manager, custom_paths[i]); + if (!key) { + continue; + } + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); + } + g_strfreev (custom_paths); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); + + gnome_settings_profile_end (NULL); +} + +static void +dialog_show (GsdMediaKeysManager *manager) +{ + int orig_w; + int orig_h; + int screen_w; + int screen_h; + int x; + int y; + GdkRectangle geometry; + int monitor; + + gtk_window_set_screen (GTK_WINDOW (manager->priv->dialog), + manager->priv->current_screen); + + /* + * get the window size + * if the window hasn't been mapped, it doesn't necessarily + * know its true size, yet, so we need to jump through hoops + */ + gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h); + + monitor = gdk_screen_get_primary_monitor (manager->priv->current_screen); + + gdk_screen_get_monitor_geometry (manager->priv->current_screen, + monitor, + &geometry); + + screen_w = geometry.width; + screen_h = geometry.height; + + x = ((screen_w - orig_w) / 2) + geometry.x; + y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; + + gtk_window_move (GTK_WINDOW (manager->priv->dialog), x, y); + + gtk_widget_show (manager->priv->dialog); + + gdk_display_sync (gdk_screen_get_display (manager->priv->current_screen)); +} + +static void +launch_app (GAppInfo *app_info, + gint64 timestamp) +{ + GError *error = NULL; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + if (!g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) { + g_warning ("Could not launch '%s': %s", + g_app_info_get_commandline (app_info), + error->message); + g_error_free (error); + } + g_object_unref (launch_context); +} + +static void +do_url_action (GsdMediaKeysManager *manager, + const char *scheme, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_uri_scheme (scheme); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' scheme", scheme); + } +} + +static void +do_media_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg"); + } +} + +static void +do_terminal_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + char *term; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + term = g_settings_get_string (settings, "exec"); + + if (term) + execute (manager, term, FALSE); + + g_free (term); + g_object_unref (settings); +} + +static void +gnome_session_shutdown (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + /* Shouldn't happen, but you never know */ + if (manager->priv->connection == NULL) { + execute (manager, "gnome-session-quit --logout", FALSE); + return; + } + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + "Shutdown", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call Shutdown on session manager: %s", error->message); + g_error_free (error); + return; + } + g_variant_unref (variant); +} + +static void +do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + g_drive_eject_with_operation_finish (drive, res, NULL); +} + +#define NO_SCORE 0 +#define SCORE_CAN_EJECT 50 +#define SCORE_HAS_MEDIA 100 +static void +do_eject_action (GsdMediaKeysManager *manager) +{ + GList *drives, *l; + GDrive *fav_drive; + guint score; + GVolumeMonitor *volume_monitor; + + volume_monitor = g_volume_monitor_get (); + + + /* Find the best drive to eject */ + fav_drive = NULL; + score = NO_SCORE; + drives = g_volume_monitor_get_connected_drives (volume_monitor); + for (l = drives; l != NULL; l = l->next) { + GDrive *drive = l->data; + + if (g_drive_can_eject (drive) == FALSE) + continue; + if (g_drive_is_media_removable (drive) == FALSE) + continue; + if (score < SCORE_CAN_EJECT) { + fav_drive = drive; + score = SCORE_CAN_EJECT; + } + if (g_drive_has_media (drive) == FALSE) + continue; + if (score < SCORE_HAS_MEDIA) { + fav_drive = drive; + score = SCORE_HAS_MEDIA; + break; + } + } + + /* Show the dialogue */ + if (!ubuntu_osd_notification_show_icon ("notification-device-eject", "Eject")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "media-eject-symbolic", + FALSE); + dialog_show (manager); + } + + /* Clean up the drive selection and exit if no suitable + * drives are found */ + if (fav_drive != NULL) + fav_drive = g_object_ref (fav_drive); + + g_list_foreach (drives, (GFunc) g_object_unref, NULL); + if (fav_drive == NULL) + return; + + /* Eject! */ + g_drive_eject_with_operation (fav_drive, G_MOUNT_UNMOUNT_FORCE, + NULL, NULL, + (GAsyncReadyCallback) do_eject_action_cb, + manager); + g_object_unref (fav_drive); + g_object_unref (volume_monitor); +} + +static void +do_home_key_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GFile *file; + GError *error = NULL; + char *uri; + + file = g_file_new_for_path (g_get_home_dir ()); + uri = g_file_get_uri (file); + g_object_unref (file); + + if (gtk_show_uri (NULL, uri, timestamp, &error) == FALSE) { + g_warning ("Failed to launch '%s': %s", uri, error->message); + g_error_free (error); + } + g_free (uri); +} + +static void +do_execute_desktop (GsdMediaKeysManager *manager, + const char *desktop, + gint64 timestamp) +{ + GDesktopAppInfo *app_info; + + app_info = g_desktop_app_info_new (desktop); + if (app_info != NULL) { + launch_app (G_APP_INFO (app_info), timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find application '%s'", desktop); + } +} + +static void +do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) +{ + if (!ubuntu_osd_notification_show_icon ((!state) ? "touchpad-disabled-symbolic" : "input-touchpad-symbolic", "Touchpad")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", + FALSE); + dialog_show (manager); + } +} + +static void +do_touchpad_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + gboolean state; + + if (touchpad_is_present () == FALSE) { + do_touchpad_osd_action (manager, FALSE); + return; + } + + settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY); + + do_touchpad_osd_action (manager, !state); + + g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state); + g_object_unref (settings); +} + +static void +update_dialog (GsdMediaKeysManager *manager, + GvcMixerStream *stream, + guint vol, + gboolean muted, + gboolean sound_changed, + gboolean quiet) +{ + if (ubuntu_osd_notification_show_volume (manager, vol, muted)) + goto done; + + vol = CLAMP (vol, 0, 100); + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), + muted); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), vol); + gsd_osd_window_set_action (GSD_OSD_WINDOW (manager->priv->dialog), + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + +done: + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); + ca_context_play (manager->priv->ca, 1, + CA_PROP_EVENT_ID, "audio-volume-change", + CA_PROP_EVENT_DESCRIPTION, "volume changed through key press", + CA_PROP_CANBERRA_CACHE_CONTROL, "permanent", + NULL); + } +} + +#ifdef HAVE_GUDEV +/* PulseAudio gives us /devices/... paths, when udev + * expects /sys/devices/... paths. */ +static GUdevDevice * +get_udev_device_for_sysfs_path (GsdMediaKeysManager *manager, + const char *sysfs_path) +{ + char *path; + GUdevDevice *dev; + + path = g_strdup_printf ("/sys%s", sysfs_path); + dev = g_udev_client_query_by_sysfs_path (manager->priv->udev_client, path); + g_free (path); + + return dev; +} + +static GvcMixerStream * +get_stream_for_device_id (GsdMediaKeysManager *manager, + guint deviceid) +{ + char *devnode; + gpointer id_ptr; + GvcMixerStream *res; + GUdevDevice *dev, *parent; + GSList *sinks, *l; + + id_ptr = g_hash_table_lookup (manager->priv->streams, GUINT_TO_POINTER (deviceid)); + if (id_ptr != NULL) { + if (GPOINTER_TO_UINT (id_ptr) == (guint) -1) + return NULL; + else + return gvc_mixer_control_lookup_stream_id (manager->priv->volume, GPOINTER_TO_UINT (id_ptr)); + } + + devnode = xdevice_get_device_node (deviceid); + if (devnode == NULL) { + g_debug ("Could not find device node for XInput device %d", deviceid); + return NULL; + } + + dev = g_udev_client_query_by_device_file (manager->priv->udev_client, devnode); + if (dev == NULL) { + g_debug ("Could not find udev device for device path '%s'", devnode); + g_free (devnode); + return NULL; + } + g_free (devnode); + + if (g_strcmp0 (g_udev_device_get_property (dev, "ID_BUS"), "usb") != 0) { + g_debug ("Not handling XInput device %d, not USB", deviceid); + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + g_object_unref (dev); + return NULL; + } + + parent = g_udev_device_get_parent_with_subsystem (dev, "usb", "usb_device"); + if (parent == NULL) { + g_warning ("No USB device parent for XInput device %d even though it's USB", deviceid); + g_object_unref (dev); + return NULL; + } + + res = NULL; + sinks = gvc_mixer_control_get_sinks (manager->priv->volume); + for (l = sinks; l; l = l->next) { + GvcMixerStream *stream = l->data; + const char *sysfs_path; + GUdevDevice *sink_dev, *sink_parent; + + sysfs_path = gvc_mixer_stream_get_sysfs_path (stream); + sink_dev = get_udev_device_for_sysfs_path (manager, sysfs_path); + if (sink_dev == NULL) + continue; + sink_parent = g_udev_device_get_parent_with_subsystem (sink_dev, "usb", "usb_device"); + g_object_unref (sink_dev); + if (sink_parent == NULL) + continue; + + if (g_strcmp0 (g_udev_device_get_sysfs_path (sink_parent), + g_udev_device_get_sysfs_path (parent)) == 0) { + res = stream; + } + g_object_unref (sink_parent); + if (res != NULL) + break; + } + + if (res) + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER (gvc_mixer_stream_get_id (res))); + else + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + + return res; +} +#endif /* HAVE_GUDEV */ + +static void +do_sound_action (GsdMediaKeysManager *manager, + guint deviceid, + int type, + gboolean quiet) +{ + GvcMixerStream *stream; + gboolean old_muted, new_muted; + guint old_vol, new_vol, norm_vol_step, osd_vol; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +#ifdef HAVE_GUDEV + stream = get_stream_for_device_id (manager, deviceid); + if (stream == NULL) +#endif /* HAVE_GUDEV */ + stream = manager->priv->stream; + if (stream == NULL) + return; + + norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100; + + /* FIXME: this is racy */ + new_vol = old_vol = gvc_mixer_stream_get_volume (stream); + new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream); + sound_changed = FALSE; + + switch (type) { + case MUTE_KEY: + new_muted = !old_muted; + break; + case VOLUME_DOWN_KEY: + if (old_vol <= norm_vol_step) { + new_vol = 0; + new_muted = TRUE; + } else { + new_vol = old_vol - norm_vol_step; + } + break; + case VOLUME_UP_KEY: + new_muted = FALSE; + /* When coming out of mute only increase the volume if it was 0 */ + if (!old_muted || old_vol == 0) + new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME); + break; + } + + if (old_muted != new_muted) { + gvc_mixer_stream_change_is_muted (stream, new_muted); + sound_changed = TRUE; + } + + if (old_vol != new_vol) { + if (gvc_mixer_stream_set_volume (stream, new_vol) != FALSE) { + gvc_mixer_stream_push_volume (stream); + sound_changed = TRUE; + } + } + + if (type == VOLUME_DOWN_KEY && old_vol == 0 && old_muted) + osd_vol = -1; + else if (type == VOLUME_UP_KEY && old_vol == PA_VOLUME_NORM && !old_muted) + osd_vol = 101; + else if (!new_muted) + osd_vol = (int) (100 * (double) new_vol / PA_VOLUME_NORM); + else + osd_vol = 0; + + update_dialog (manager, stream, osd_vol, new_muted, sound_changed, quiet); +} + +static void +sound_theme_changed (GtkSettings *settings, + GParamSpec *pspec, + GsdMediaKeysManager *manager) +{ + char *theme_name; + + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); +} + +static void +update_default_sink (GsdMediaKeysManager *manager) +{ + GvcMixerStream *stream; + + stream = gvc_mixer_control_get_default_sink (manager->priv->volume); + if (stream == manager->priv->stream) + return; + + if (manager->priv->stream != NULL) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + + if (stream != NULL) { + manager->priv->stream = g_object_ref (stream); + } else { + g_warning ("Unable to get default sink"); + } +} + +static void +on_control_state_changed (GvcMixerControl *control, + GvcMixerControlState new_state, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +static void +on_control_default_sink_changed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +#ifdef HAVE_GUDEV +static gboolean +remove_stream (gpointer key, + gpointer value, + gpointer id) +{ + if (GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (id)) + return TRUE; + return FALSE; +} +#endif /* HAVE_GUDEV */ + +static void +on_control_stream_removed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + if (manager->priv->stream != NULL) { + if (gvc_mixer_stream_get_id (manager->priv->stream) == id) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + } + +#ifdef HAVE_GUDEV + g_hash_table_foreach_remove (manager->priv->streams, (GHRFunc) remove_stream, GUINT_TO_POINTER (id)); +#endif +} + +static void +free_media_player (MediaPlayer *player) +{ + if (player->watch_id > 0) { + g_bus_unwatch_name (player->watch_id); + player->watch_id = 0; + } + g_free (player->application); + g_free (player->name); + g_free (player); +} + +static gint +find_by_application (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->application, b); +} + +static gint +find_by_name (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->name, b); +} + +static gint +find_by_time (gconstpointer a, + gconstpointer b) +{ + return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time; +} + +static void +name_vanished_handler (GDBusConnection *connection, + const gchar *name, + GsdMediaKeysManager *manager) +{ + GList *iter; + + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering vanished %s (name: %s)", player->application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +/* + * Register a new media player. Most applications will want to call + * this with time = GDK_CURRENT_TIME. This way, the last registered + * player will receive media events. In some cases, applications + * may want to register with a lower priority (usually 1), to grab + * events only nobody is interested. + */ +static void +gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name, + guint32 time) +{ + GList *iter; + MediaPlayer *media_player; + guint watch_id; + + if (time == GDK_CURRENT_TIME) { + GTimeVal tv; + + g_get_current_time (&tv); + time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + } + + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + + if (iter != NULL) { + if (((MediaPlayer *)iter->data)->time < time) { + MediaPlayer *player = iter->data; + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } else { + return; + } + } + + watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_handler, + manager, + NULL); + + g_debug ("Registering %s at %u", application, time); + media_player = g_new0 (MediaPlayer, 1); + media_player->application = g_strdup (application); + media_player->name = g_strdup (name); + media_player->time = time; + media_player->watch_id = watch_id; + + manager->priv->media_players = g_list_insert_sorted (manager->priv->media_players, + media_player, + find_by_time); +} + +static void +gsd_media_keys_manager_release_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name) +{ + GList *iter = NULL; + + g_return_if_fail (application != NULL || name != NULL); + + if (application != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + } + + if (iter == NULL && name != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + } + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering %s (name: %s)", application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +static gboolean +gsd_media_player_key_pressed (GsdMediaKeysManager *manager, + const char *key) +{ + const char *application; + gboolean have_listeners; + GError *error = NULL; + MediaPlayer *player; + + g_return_val_if_fail (key != NULL, FALSE); + + g_debug ("Media key '%s' pressed", key); + + have_listeners = (manager->priv->media_players != NULL); + + if (!have_listeners) { + /* Popup a dialog with an (/) icon */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "action-unavailable-symbolic", + FALSE); + dialog_show (manager); + return TRUE; + } + + player = manager->priv->media_players->data; + application = player->application; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + player->name, + GSD_MEDIA_KEYS_DBUS_PATH, + GSD_MEDIA_KEYS_DBUS_NAME, + "MediaPlayerKeyPressed", + g_variant_new ("(ss)", application ? application : "", key), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + + return !have_listeners; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdMediaKeysManager *manager = (GsdMediaKeysManager *) user_data; + + g_debug ("Calling method '%s' for media-keys", method_name); + + if (g_strcmp0 (method_name, "ReleaseMediaPlayerKeys") == 0) { + const char *app_name; + + g_variant_get (parameters, "(&s)", &app_name); + gsd_media_keys_manager_release_media_player_keys (manager, app_name, sender); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "GrabMediaPlayerKeys") == 0) { + const char *app_name; + guint32 time; + + g_variant_get (parameters, "(&su)", &app_name, &time); + gsd_media_keys_manager_grab_media_player_keys (manager, app_name, sender, time); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static gboolean +do_multimedia_player_action (GsdMediaKeysManager *manager, + const char *icon, + const char *key) +{ + if (icon != NULL) + ubuntu_osd_notification_show_icon (icon, key); + return gsd_media_player_key_pressed (manager, key); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + char *action; + + action = g_object_get_data (G_OBJECT (source_object), + "gsd-media-keys-manager-xrandr-action"); + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call '%s': %s", action, error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } + + g_free (action); +} + +static void +do_xrandr_action (GsdMediaKeysManager *manager, + const char *action, + gint64 timestamp) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + priv->cancellable = g_cancellable_new (); + + g_object_set_data (G_OBJECT (priv->xrandr_proxy), + "gsd-media-keys-manager-xrandr-action", + g_strdup (action)); + + g_dbus_proxy_call (priv->xrandr_proxy, + action, + g_variant_new ("(x)", timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static gboolean +do_video_out_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "VideoModeSwitch", timestamp); + return FALSE; +} + +static gboolean +do_video_rotate_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "Rotate", timestamp); + return FALSE; +} + +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + +static void +do_text_size_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + gdouble factor, best, distance; + guint i; + + /* Same values used in the Seeing tab of the Universal Access panel */ + static gdouble factors[] = { + 0.75, + 1.0, + 1.25, + 1.5 + }; + + /* Figure out the current DPI scaling factor */ + factor = g_settings_get_double (manager->priv->interface_settings, "text-scaling-factor"); + factor += (type == INCREASE_TEXT_KEY ? 0.25 : -0.25); + + /* Try to find a matching value */ + distance = 1e6; + best = 1.0; + for (i = 0; i < G_N_ELEMENTS(factors); i++) { + gdouble d; + d = fabs (factor - factors[i]); + if (d < distance) { + best = factors[i]; + distance = d; + } + } + + if (best == 1.0) + g_settings_reset (manager->priv->interface_settings, "text-scaling-factor"); + else + g_settings_set_double (manager->priv->interface_settings, "text-scaling-factor", best); +} + +static void +do_magnifier_zoom_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + gdouble offset, value; + + if (type == MAGNIFIER_ZOOM_IN_KEY) + offset = 1.0; + else + offset = -1.0; + + settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + value = g_settings_get_double (settings, "mag-factor"); + value += offset; + value = roundl (value); + g_settings_set_double (settings, "mag-factor", value); + g_object_unref (settings); +} + +static void +do_toggle_contrast_action (GsdMediaKeysManager *manager) +{ + gboolean high_contrast; + char *theme; + + /* Are we using HighContrast now? */ + theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + high_contrast = g_str_equal (theme, HIGH_CONTRAST); + g_free (theme); + + if (high_contrast != FALSE) { + if (manager->priv->gtk_theme == NULL) + g_settings_reset (manager->priv->interface_settings, "gtk-theme"); + else + g_settings_set (manager->priv->interface_settings, "gtk-theme", manager->priv->gtk_theme); + g_settings_set (manager->priv->interface_settings, "icon-theme", manager->priv->icon_theme); + } else { + g_settings_set (manager->priv->interface_settings, "gtk-theme", HIGH_CONTRAST); + g_settings_set (manager->priv->interface_settings, "icon-theme", HIGH_CONTRAST); + } +} + +static void +do_config_power_action (GsdMediaKeysManager *manager, + const gchar *config_key) +{ + GsdPowerActionType action_type; + + action_type = g_settings_get_enum (manager->priv->power_settings, + config_key); + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + case GSD_POWER_ACTION_SHUTDOWN: + gnome_session_shutdown (manager); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_BLANK: + case GSD_POWER_ACTION_NOTHING: + /* these actions cannot be handled by media-keys and + * are not used in this context */ + break; + } +} + +static void +update_screen_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); + g_free (data); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + guint osd_percentage; + + if (data->old_percentage == 100 && data->type == SCREEN_BRIGHTNESS_UP_KEY) + osd_percentage = 101; + else if (data->old_percentage == 0 && data->type == SCREEN_BRIGHTNESS_DOWN_KEY) + osd_percentage = -1; + else + osd_percentage = CLAMP (percentage, 0, 100); + + if (!ubuntu_osd_notification_show_brightness (manager, osd_percentage)) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "display-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_free (data); + g_variant_unref (new_percentage); +} + +static void +do_screen_brightness_action_real (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + GError *error = NULL; + + GVariant *old_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (old_percentage == NULL) { + g_warning ("Failed to get old screen percentage: %s", error->message); + g_error_free (error); + g_free (data); + return; + } + + g_variant_get (old_percentage, "(u)", &data->old_percentage); + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_screen_proxy, + data->type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_screen_cb, + data); + + g_variant_unref (old_percentage); +} + +static void +do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + if (manager->priv->connection == NULL || + manager->priv->power_screen_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + GsdBrightnessActionData *data = g_new0 (GsdBrightnessActionData, 1); + data->manager = manager; + data->type = type; + + g_dbus_proxy_call (manager->priv->power_screen_proxy, + "GetPercentage", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + do_screen_brightness_action_real, + data); +} + +static void +update_keyboard_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new keyboard percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + + /* FIXME: No overshoot effect for keyboard, as the power plugin has no interface + * to get the old brightness */ + if (!ubuntu_osd_notification_show_kb_backlight (manager, CLAMP (percentage, 0, 100))) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "keyboard-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_variant_unref (new_percentage); +} + +static void +do_keyboard_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + const char *cmd; + + if (manager->priv->connection == NULL || + manager->priv->power_keyboard_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + switch (type) { + case KEYBOARD_BRIGHTNESS_UP_KEY: + cmd = "StepUp"; + break; + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + cmd = "StepDown"; + break; + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + cmd = "Toggle"; + break; + default: + g_assert_not_reached (); + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_keyboard_proxy, + cmd, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_keyboard_cb, + manager); +} + +static void +do_switch_input_source_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + GVariant *sources; + gint i, n; + + settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + + n = g_variant_n_children (sources); + if (n < 2) + goto out; + + i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); + + if (type == SWITCH_INPUT_SOURCE_KEY) + i += 1; + else + i -= 1; + + if (i < 0) + i = n - 1; + else if (i >= n) + i = 0; + + g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); + + out: + g_variant_unref (sources); + g_object_unref (settings); +} + +static void +do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +{ + execute (manager, key->custom_command, FALSE); +} + +static gboolean +do_action (GsdMediaKeysManager *manager, + guint deviceid, + MediaKeyType type, + gint64 timestamp) +{ + char *cmd; + + g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid); + + switch (type) { + case TOUCHPAD_KEY: + do_touchpad_action (manager); + break; + case TOUCHPAD_ON_KEY: + do_touchpad_osd_action (manager, TRUE); + break; + case TOUCHPAD_OFF_KEY: + do_touchpad_osd_action (manager, FALSE); + break; + case MUTE_KEY: + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + do_sound_action (manager, deviceid, type, FALSE); + break; + case MUTE_QUIET_KEY: + do_sound_action (manager, deviceid, MUTE_KEY, TRUE); + break; + case VOLUME_DOWN_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_DOWN_KEY, TRUE); + break; + case VOLUME_UP_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: + gnome_session_shutdown (manager); + break; + case EJECT_KEY: + do_eject_action (manager); + break; + case HOME_KEY: + do_home_key_action (manager, timestamp); + break; + case SEARCH_KEY: + cmd = NULL; + if ((cmd = g_find_program_in_path ("tracker-search-tool"))) + do_execute_desktop (manager, "tracker-needle.desktop", timestamp); + else + do_execute_desktop (manager, "gnome-search-tool.desktop", timestamp); + g_free (cmd); + break; + case EMAIL_KEY: + do_url_action (manager, "mailto", timestamp); + break; + case SCREENSAVER_KEY: + execute (manager, "gnome-screensaver-command --lock", FALSE); + break; + case HELP_KEY: + do_url_action (manager, "ghelp", timestamp); + break; + case SCREENSHOT_KEY: + execute (manager, "gnome-screenshot", FALSE); + break; + case WINDOW_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --window", FALSE); + break; + case AREA_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --area", FALSE); + break; + case SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --clipboard", FALSE); + break; + case WINDOW_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --window --clipboard", FALSE); + break; + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; + case TERMINAL_KEY: + do_terminal_action (manager); + break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; + case MEDIA_KEY: + do_media_action (manager, timestamp); + break; + case CALCULATOR_KEY: + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: + return do_multimedia_player_action (manager, NULL, "Play"); + case PAUSE_KEY: + return do_multimedia_player_action (manager, NULL, "Pause"); + case STOP_KEY: + return do_multimedia_player_action (manager, NULL, "Stop"); + case PREVIOUS_KEY: + return do_multimedia_player_action (manager, NULL, "Previous"); + case NEXT_KEY: + return do_multimedia_player_action (manager, NULL, "Next"); + case REWIND_KEY: + return do_multimedia_player_action (manager, NULL, "Rewind"); + case FORWARD_KEY: + return do_multimedia_player_action (manager, NULL, "FastForward"); + case REPEAT_KEY: + return do_multimedia_player_action (manager, NULL, "Repeat"); + case RANDOM_KEY: + return do_multimedia_player_action (manager, NULL, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; + case ROTATE_VIDEO_KEY: + do_video_rotate_action (manager, timestamp); + break; + case MAGNIFIER_KEY: + do_magnifier_action (manager); + break; + case SCREENREADER_KEY: + do_screenreader_action (manager); + break; + case ON_SCREEN_KEYBOARD_KEY: + do_on_screen_keyboard_action (manager); + break; + case INCREASE_TEXT_KEY: + case DECREASE_TEXT_KEY: + do_text_size_action (manager, type); + break; + case MAGNIFIER_ZOOM_IN_KEY: + case MAGNIFIER_ZOOM_OUT_KEY: + do_magnifier_zoom_action (manager, type); + break; + case TOGGLE_CONTRAST_KEY: + do_toggle_contrast_action (manager); + break; + case POWER_KEY: + do_config_power_action (manager, "button-power"); + break; + case SLEEP_KEY: + do_config_power_action (manager, "button-sleep"); + break; + case SUSPEND_KEY: + do_config_power_action (manager, "button-suspend"); + break; + case HIBERNATE_KEY: + do_config_power_action (manager, "button-hibernate"); + break; + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + do_screen_brightness_action (manager, type); + break; + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + do_keyboard_brightness_action (manager, type); + break; + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; + case SWITCH_INPUT_SOURCE_KEY: + case SWITCH_INPUT_SOURCE_BACKWARD_KEY: + do_switch_input_source_action (manager, type); + break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); + } + + return FALSE; +} + +static GdkScreen * +get_screen_from_root (GsdMediaKeysManager *manager, + Window root) +{ + GSList *l; + + /* Look for which screen we're receiving events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + GdkScreen *screen = (GdkScreen *) l->data; + GdkWindow *window = gdk_screen_get_root_window (screen); + + if (GDK_WINDOW_XID (window) == root) + return screen; + } + + return NULL; +} + +static GdkFilterReturn +filter_key_events (XEvent *xevent, + GdkEvent *event, + GsdMediaKeysManager *manager) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XGenericEventCookie *cookie; + guint i; + guint deviceid; + + /* verify we have a key event */ + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + cookie = &xevent->xcookie; + if (cookie->extension != manager->priv->opcode) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + deviceid = xev->sourceid; + + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (match_xi2_key (key->key, xev)) { + switch (key->key_type) { + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + /* auto-repeatable keys */ + if (xiev->evtype != XI_KeyPress) + return GDK_FILTER_CONTINUE; + break; + default: + if (xiev->evtype != XI_KeyRelease) { + return GDK_FILTER_CONTINUE; + } + } + + manager->priv->current_screen = get_screen_from_root (manager, xev->root); + + if (key->key_type == CUSTOM_KEY) { + do_custom_action (manager, key, xev->time); + return GDK_FILTER_REMOVE; + } + + if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +update_theme_settings (GSettings *settings, + const char *key, + GsdMediaKeysManager *manager) +{ + char *theme; + + theme = g_settings_get_string (manager->priv->interface_settings, key); + if (g_str_equal (theme, HIGH_CONTRAST)) { + g_free (theme); + } else { + if (g_str_equal (key, "gtk-theme")) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = theme; + } else { + g_free (manager->priv->icon_theme); + manager->priv->icon_theme = theme; + } + } +} + +static gboolean +start_media_keys_idle_cb (GsdMediaKeysManager *manager) +{ + GSList *l; + char *theme_name; + + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + + + gvc_mixer_control_open (manager->priv->volume); + + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::custom-keybindings", + G_CALLBACK (gsettings_custom_changed_cb), manager); + + manager->priv->custom_settings = + g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + /* Sound events */ + ca_context_create (&manager->priv->ca); + ca_context_set_driver (manager->priv->ca, "pulse"); + ca_context_change_props (manager->priv->ca, 0, + CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", + NULL); + manager->priv->gtksettings = gtk_settings_get_for_screen (gdk_screen_get_default ()); + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); + g_signal_connect (manager->priv->gtksettings, "notify::gtk-sound-theme-name", + G_CALLBACK (sound_theme_changed), manager); + + /* for the power plugin interface code */ + manager->priv->power_settings = g_settings_new (SETTINGS_POWER_DIR); + + /* Logic from http://git.gnome.org/browse/gnome-shell/tree/js/ui/status/accessibility.js#n163 */ + manager->priv->interface_settings = g_settings_new (SETTINGS_INTERFACE_DIR); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::gtk-theme", + G_CALLBACK (update_theme_settings), manager); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::icon-theme", + G_CALLBACK (update_theme_settings), manager); + manager->priv->gtk_theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + if (g_str_equal (manager->priv->gtk_theme, HIGH_CONTRAST)) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = NULL; + } + manager->priv->icon_theme = g_settings_get_string (manager->priv->interface_settings, "icon-theme"); + + init_screens (manager); + init_kbd (manager); + + /* Start filtering the events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + gnome_settings_profile_start ("gdk_window_add_filter"); + + g_debug ("adding key filter for screen: %d", + gdk_screen_get_number (l->data)); + + gdk_window_add_filter (gdk_screen_get_root_window (l->data), + (GdkFilterFunc) filter_key_events, + manager); + gnome_settings_profile_end ("gdk_window_add_filter"); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error) +{ + const char * const subsystems[] = { "input", "usb", "sound", NULL }; + + gnome_settings_profile_start (NULL); + + if (supports_xinput2_devices (&manager->priv->opcode) == FALSE) { + g_debug ("No Xinput2 support, disabling plugin"); + return TRUE; + } + +#ifdef HAVE_GUDEV + manager->priv->streams = g_hash_table_new (g_direct_hash, g_direct_equal); + manager->priv->udev_client = g_udev_client_new (subsystems); +#endif + + /* initialise Volume handler + * + * We do this one here to force checking gstreamer cache, etc. + * The rest (grabbing and setting the keys) can happen in an + * idle. + */ + gnome_settings_profile_start ("gvc_mixer_control_new"); + + manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys"); + + g_signal_connect (manager->priv->volume, + "state-changed", + G_CALLBACK (on_control_state_changed), + manager); + g_signal_connect (manager->priv->volume, + "default-sink-changed", + G_CALLBACK (on_control_default_sink_changed), + manager); + g_signal_connect (manager->priv->volume, + "stream-removed", + G_CALLBACK (on_control_stream_removed), + manager); + + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); + + register_manager (manager_object); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_media_keys_manager_stop (GsdMediaKeysManager *manager) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + GSList *ls; + GList *l; + int i; + + g_debug ("Stopping media_keys manager"); + + if (priv->bus_cancellable != NULL) { + g_cancellable_cancel (priv->bus_cancellable); + g_object_unref (priv->bus_cancellable); + priv->bus_cancellable = NULL; + } + + for (ls = priv->screens; ls != NULL; ls = ls->next) { + gdk_window_remove_filter (gdk_screen_get_root_window (ls->data), + (GdkFilterFunc) filter_key_events, + manager); + } + + if (manager->priv->gtksettings != NULL) { + g_signal_handlers_disconnect_by_func (manager->priv->gtksettings, sound_theme_changed, manager); + manager->priv->gtksettings = NULL; + } + + if (manager->priv->ca) { + ca_context_destroy (manager->priv->ca); + manager->priv->ca = NULL; + } + +#ifdef HAVE_GUDEV + if (priv->streams) { + g_hash_table_destroy (priv->streams); + priv->streams = NULL; + } + if (priv->udev_client) { + g_object_unref (priv->udev_client); + priv->udev_client = NULL; + } +#endif /* HAVE_GUDEV */ + + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; + } + + if (priv->power_settings) { + g_object_unref (priv->power_settings); + priv->power_settings = NULL; + } + + if (priv->power_screen_proxy) { + g_object_unref (priv->power_screen_proxy); + priv->power_screen_proxy = NULL; + } + + if (priv->power_keyboard_proxy) { + g_object_unref (priv->power_keyboard_proxy); + priv->power_keyboard_proxy = NULL; + } + + if (priv->upower_proxy) { + g_object_unref (priv->upower_proxy); + priv->upower_proxy = NULL; + } + + if (priv->cancellable != NULL) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + + if (priv->introspection_data) { + g_dbus_node_info_unref (priv->introspection_data); + priv->introspection_data = NULL; + } + + if (priv->connection != NULL) { + g_object_unref (priv->connection); + priv->connection = NULL; + } + + if (priv->volume_notification != NULL) { + notify_notification_close (priv->volume_notification, NULL); + g_object_unref (priv->volume_notification); + priv->volume_notification = NULL; + } + + if (priv->brightness_notification != NULL) { + notify_notification_close (priv->brightness_notification, NULL); + g_object_unref (priv->brightness_notification); + priv->brightness_notification = NULL; + } + + if (priv->kb_backlight_notification != NULL) { + notify_notification_close (priv->kb_backlight_notification, NULL); + g_object_unref (priv->kb_backlight_notification); + priv->kb_backlight_notification = NULL; + } + + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->key) + ungrab_key_unsafe (key->key, priv->screens); + } + g_ptr_array_free (priv->keys, TRUE); + priv->keys = NULL; + + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (priv->screens != NULL) { + g_slist_free (priv->screens); + priv->screens = NULL; + } + + if (priv->stream) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + if (priv->volume) { + g_object_unref (priv->volume); + priv->volume = NULL; + } + + if (priv->dialog != NULL) { + gtk_widget_destroy (priv->dialog); + priv->dialog = NULL; + } + + if (priv->media_players != NULL) { + for (l = priv->media_players; l; l = l->next) { + MediaPlayer *mp = l->data; + g_free (mp->application); + g_free (mp); + } + g_list_free (priv->media_players); + priv->media_players = NULL; + } +} + +static GObject * +gsd_media_keys_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMediaKeysManager *media_keys_manager; + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (media_keys_manager); +} + +static void +gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_media_keys_manager_constructor; + object_class->finalize = gsd_media_keys_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysManagerPrivate)); +} + +static void +gsd_media_keys_manager_init (GsdMediaKeysManager *manager) +{ + manager->priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_media_keys_manager_finalize (GObject *object) +{ + GsdMediaKeysManager *media_keys_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_MANAGER (object)); + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (object); + + g_return_if_fail (media_keys_manager->priv != NULL); + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object); +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +upower_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->upower_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Failed to get proxy for upower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_screen_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_screen_proxy == NULL) { + g_warning ("Failed to get proxy for power (screen): %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_keyboard_proxy == NULL) { + g_warning ("Failed to get proxy for power (keyboard): %s", + error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MEDIA_KEYS_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Screen", + NULL, + (GAsyncReadyCallback) power_screen_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Keyboard", + NULL, + (GAsyncReadyCallback) power_keyboard_ready_cb, + manager); +} + +static void +register_manager (GsdMediaKeysManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + NULL, + (GAsyncReadyCallback) upower_ready_cb, + manager); +} + +GsdMediaKeysManager * +gsd_media_keys_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MEDIA_KEYS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MEDIA_KEYS_MANAGER (manager_object); +} diff --git a/.pc/disable_three_touch_tap.patch/plugins/mouse/gsd-mouse-manager.c b/.pc/disable_three_touch_tap.patch/plugins/mouse/gsd-mouse-manager.c new file mode 100644 index 00000000..581392af --- /dev/null +++ b/.pc/disable_three_touch_tap.patch/plugins/mouse/gsd-mouse-manager.c @@ -0,0 +1,1354 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#ifdef __linux +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-mouse-manager.h" +#include "gsd-input-helper.h" +#include "gsd-enums.h" + +#define GSD_MOUSE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerPrivate)) + +#define SETTINGS_MOUSE_DIR "org.gnome.settings-daemon.peripherals.mouse" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" + +/* Keys for both touchpad and mouse */ +#define KEY_LEFT_HANDED "left-handed" /* a boolean for mouse, an enum for touchpad */ +#define KEY_MOTION_ACCELERATION "motion-acceleration" +#define KEY_MOTION_THRESHOLD "motion-threshold" + +/* Touchpad settings */ +#define KEY_TOUCHPAD_DISABLE_W_TYPING "disable-while-typing" +#define KEY_PAD_HORIZ_SCROLL "horiz-scroll-enabled" +#define KEY_SCROLL_METHOD "scroll-method" +#define KEY_TAP_TO_CLICK "tap-to-click" +#define KEY_TOUCHPAD_ENABLED "touchpad-enabled" +#define KEY_NATURAL_SCROLL_ENABLED "natural-scroll" + +/* Mouse settings */ +#define KEY_LOCATE_POINTER "locate-pointer" +#define KEY_DWELL_CLICK_ENABLED "dwell-click-enabled" +#define KEY_SECONDARY_CLICK_ENABLED "secondary-click-enabled" +#define KEY_MIDDLE_BUTTON_EMULATION "middle-button-enabled" + +struct GsdMouseManagerPrivate +{ + guint start_idle_id; + GSettings *touchpad_settings; + GSettings *mouse_settings; + GSettings *mouse_a11y_settings; + GdkDeviceManager *device_manager; + guint device_added_id; + guint device_removed_id; + GHashTable *blacklist; + + gboolean mousetweaks_daemon_running; + gboolean syndaemon_spawned; + GPid syndaemon_pid; + gboolean locate_pointer_spawned; + GPid locate_pointer_pid; +}; + +static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass); +static void gsd_mouse_manager_init (GsdMouseManager *mouse_manager); +static void gsd_mouse_manager_finalize (GObject *object); +static void set_tap_to_click (GdkDevice *device, + gboolean state, + gboolean left_handed); +static void set_natural_scroll (GsdMouseManager *manager, + GdkDevice *device, + gboolean natural_scroll); + +G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + + +static GObject * +gsd_mouse_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMouseManager *mouse_manager; + + mouse_manager = GSD_MOUSE_MANAGER (G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (mouse_manager); +} + +static void +gsd_mouse_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->dispose (object); +} + +static void +gsd_mouse_manager_class_init (GsdMouseManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_mouse_manager_constructor; + object_class->dispose = gsd_mouse_manager_dispose; + object_class->finalize = gsd_mouse_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMouseManagerPrivate)); +} + +static XDevice * +open_gdk_device (GdkDevice *device) +{ + XDevice *xdevice; + int id; + + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + gdk_error_trap_push (); + + xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id); + + if (gdk_error_trap_pop () != 0) + return NULL; + + return xdevice; +} + +static gboolean +device_is_blacklisted (GsdMouseManager *manager, + GdkDevice *device) +{ + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + if (g_hash_table_lookup (manager->priv->blacklist, GINT_TO_POINTER (id)) != NULL) { + g_debug ("device %s (%d) is blacklisted", gdk_device_get_name (device), id); + return TRUE; + } + return FALSE; +} + +static gboolean +device_is_ignored (GsdMouseManager *manager, + GdkDevice *device) +{ + GdkInputSource source; + const char *name; + + if (device_is_blacklisted (manager, device)) + return TRUE; + + source = gdk_device_get_source (device); + if (source != GDK_SOURCE_MOUSE && + source != GDK_SOURCE_TOUCHPAD && + source != GDK_SOURCE_CURSOR) + return TRUE; + + name = gdk_device_get_name (device); + if (name != NULL && g_str_equal ("Virtual core XTEST pointer", name)) + return TRUE; + + return FALSE; +} + +static void +configure_button_layout (guchar *buttons, + gint n_buttons, + gboolean left_handed) +{ + const gint left_button = 1; + gint right_button; + gint i; + + /* if the button is higher than 2 (3rd button) then it's + * probably one direction of a scroll wheel or something else + * uninteresting + */ + right_button = MIN (n_buttons, 3); + + /* If we change things we need to make sure we only swap buttons. + * If we end up with multiple physical buttons assigned to the same + * logical button the server will complain. This code assumes physical + * button 0 is the physical left mouse button, and that the physical + * button other than 0 currently assigned left_button or right_button + * is the physical right mouse button. + */ + + /* check if the current mapping satisfies the above assumptions */ + if (buttons[left_button - 1] != left_button && + buttons[left_button - 1] != right_button) + /* The current mapping is weird. Swapping buttons is probably not a + * good idea. + */ + return; + + /* check if we are left_handed and currently not swapped */ + if (left_handed && buttons[left_button - 1] == left_button) { + /* find the right button */ + for (i = 0; i < n_buttons; i++) { + if (buttons[i] == right_button) { + buttons[i] = left_button; + break; + } + } + /* swap the buttons */ + buttons[left_button - 1] = right_button; + } + /* check if we are not left_handed but are swapped */ + else if (!left_handed && buttons[left_button - 1] == right_button) { + /* find the right button */ + for (i = 0; i < n_buttons; i++) { + if (buttons[i] == left_button) { + buttons[i] = right_button; + break; + } + } + /* swap the buttons */ + buttons[left_button - 1] = left_button; + } +} + +static gboolean +xinput_device_has_buttons (GdkDevice *device) +{ + int i; + XAnyClassInfo *class_info; + + /* FIXME can we use the XDevice's classes here instead? */ + XDeviceInfo *device_info, *info; + gint n_devices; + int id; + + /* Find the XDeviceInfo for the GdkDevice */ + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return FALSE; + + info = NULL; + for (i = 0; i < n_devices; i++) { + if (device_info[i].id == id) { + info = &device_info[i]; + break; + } + } + if (info == NULL) + goto bail; + + class_info = info->inputclassinfo; + for (i = 0; i < info->num_classes; i++) { + if (class_info->class == ButtonClass) { + XButtonInfo *button_info; + + button_info = (XButtonInfo *) class_info; + if (button_info->num_buttons > 0) { + XFreeDeviceList (device_info); + return TRUE; + } + } + + class_info = (XAnyClassInfo *) (((guchar *) class_info) + + class_info->length); + } + +bail: + XFreeDeviceList (device_info); + + return FALSE; +} + +static gboolean +touchpad_has_single_button (XDevice *device) +{ + Atom type, prop; + int format; + unsigned long nitems, bytes_after; + unsigned char *data; + gboolean is_single_button = FALSE; + int rc; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Capabilities", False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 1, False, + XA_INTEGER, &type, &format, &nitems, + &bytes_after, &data); + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 3) + is_single_button = (data[0] == 1 && data[1] == 0 && data[2] == 0); + + if (rc == Success) + XFree (data); + + gdk_error_trap_pop_ignored (); + + return is_single_button; +} + +static void +set_left_handed (GsdMouseManager *manager, + GdkDevice *device, + gboolean mouse_left_handed, + gboolean touchpad_left_handed) +{ + XDevice *xdevice; + guchar *buttons; + gsize buttons_capacity = 16; + gboolean left_handed; + gint n_buttons; + + if (!xinput_device_has_buttons (device)) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting handedness on %s", gdk_device_get_name (device)); + + buttons = g_new (guchar, buttons_capacity); + + /* If the device is a touchpad, swap tap buttons + * around too, otherwise a tap would be a right-click */ + if (device_is_touchpad (xdevice)) { + gboolean tap = g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TAP_TO_CLICK); + gboolean single_button = touchpad_has_single_button (xdevice); + + left_handed = touchpad_left_handed; + + if (tap && !single_button) + set_tap_to_click (device, tap, left_handed); + + if (single_button) + goto out; + } else { + left_handed = mouse_left_handed; + } + + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + buttons, + buttons_capacity); + + while (n_buttons > buttons_capacity) { + buttons_capacity = n_buttons; + buttons = (guchar *) g_realloc (buttons, + buttons_capacity * sizeof (guchar)); + + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + buttons, + buttons_capacity); + } + + configure_button_layout (buttons, n_buttons, left_handed); + + gdk_error_trap_push (); + XSetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, buttons, n_buttons); + gdk_error_trap_pop_ignored (); + +out: + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + g_free (buttons); +} + +static void +set_motion (GsdMouseManager *manager, + GdkDevice *device) +{ + XDevice *xdevice; + XPtrFeedbackControl feedback; + XFeedbackState *states, *state; + int num_feedbacks; + int numerator, denominator; + gfloat motion_acceleration; + int motion_threshold; + GSettings *settings; + guint i; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting motion on %s", gdk_device_get_name (device)); + + if (device_is_touchpad (xdevice)) + settings = manager->priv->touchpad_settings; + else + settings = manager->priv->mouse_settings; + + /* Calculate acceleration */ + motion_acceleration = g_settings_get_double (settings, KEY_MOTION_ACCELERATION); + + if (motion_acceleration >= 1.0) { + /* we want to get the acceleration, with a resolution of 0.5 + */ + if ((motion_acceleration - floor (motion_acceleration)) < 0.25) { + numerator = floor (motion_acceleration); + denominator = 1; + } else if ((motion_acceleration - floor (motion_acceleration)) < 0.5) { + numerator = ceil (2.0 * motion_acceleration); + denominator = 2; + } else if ((motion_acceleration - floor (motion_acceleration)) < 0.75) { + numerator = floor (2.0 *motion_acceleration); + denominator = 2; + } else { + numerator = ceil (motion_acceleration); + denominator = 1; + } + } else if (motion_acceleration < 1.0 && motion_acceleration > 0) { + /* This we do to 1/10ths */ + numerator = floor (motion_acceleration * 10) + 1; + denominator= 10; + } else { + numerator = -1; + denominator = -1; + } + + /* And threshold */ + motion_threshold = g_settings_get_int (settings, KEY_MOTION_THRESHOLD); + + /* Get the list of feedbacks for the device */ + states = XGetFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, &num_feedbacks); + if (states == NULL) + goto out; + state = (XFeedbackState *) states; + for (i = 0; i < num_feedbacks; i++) { + if (state->class == PtrFeedbackClass) { + /* And tell the device */ + feedback.class = PtrFeedbackClass; + feedback.length = sizeof (XPtrFeedbackControl); + feedback.id = state->id; + feedback.threshold = motion_threshold; + feedback.accelNum = numerator; + feedback.accelDenom = denominator; + + g_debug ("Setting accel %d/%d, threshold %d for device '%s'", + numerator, denominator, motion_threshold, gdk_device_get_name (device)); + + XChangeFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, + DvAccelNum | DvAccelDenom | DvThreshold, + (XFeedbackControl *) &feedback); + + break; + } + state = (XFeedbackState *) ((char *) state + state->length); + } + + XFreeFeedbackList (states); + + out: + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_middle_button (GsdMouseManager *manager, + GdkDevice *device, + gboolean middle_button) +{ + Atom prop; + XDevice *xdevice; + Atom type; + int format; + unsigned long nitems, bytes_after; + unsigned char *data; + int rc; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "Evdev Middle Button Emulation", True); + + if (!prop) /* no evdev devices */ + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting middle button on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, 0, 1, False, XA_INTEGER, &type, &format, + &nitems, &bytes_after, &data); + + if (rc == Success && format == 8 && type == XA_INTEGER && nitems == 1) { + data[0] = middle_button ? 1 : 0; + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, type, format, PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting middle button emulation on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +/* Ensure that syndaemon dies together with us, to avoid running several of + * them */ +static void +setup_syndaemon (gpointer user_data) +{ +#ifdef __linux + prctl (PR_SET_PDEATHSIG, SIGHUP); +#endif +} + +static gboolean +have_program_in_path (const char *name) +{ + gchar *path; + gboolean result; + + path = g_find_program_in_path (name); + result = (path != NULL); + g_free (path); + return result; +} + +static void +syndaemon_died (GPid pid, gint status, gpointer user_data) +{ + GsdMouseManager *manager = GSD_MOUSE_MANAGER (user_data); + + g_debug ("syndaemon stopped with status %i", status); + g_spawn_close_pid (pid); + manager->priv->syndaemon_spawned = FALSE; +} + +static int +set_disable_w_typing (GsdMouseManager *manager, gboolean state) +{ + if (state && touchpad_is_present ()) { + GError *error = NULL; + GPtrArray *args; + + if (manager->priv->syndaemon_spawned) + return 0; + + if (!have_program_in_path ("syndaemon")) + return 0; + + args = g_ptr_array_new (); + + g_ptr_array_add (args, "syndaemon"); + g_ptr_array_add (args, "-i"); + g_ptr_array_add (args, "1.0"); + g_ptr_array_add (args, "-t"); + g_ptr_array_add (args, "-K"); + g_ptr_array_add (args, "-R"); + g_ptr_array_add (args, NULL); + + /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid + * double-forking, otherwise syndaemon will immediately get + * killed again through (PR_SET_PDEATHSIG when the intermediate + * process dies */ + g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL, + G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL, + &manager->priv->syndaemon_pid, &error); + + manager->priv->syndaemon_spawned = (error == NULL); + g_ptr_array_free (args, FALSE); + + if (error) { + g_warning ("Failed to launch syndaemon: %s", error->message); + g_settings_set_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE); + g_error_free (error); + } else { + g_child_watch_add (manager->priv->syndaemon_pid, syndaemon_died, manager); + g_debug ("Launched syndaemon"); + } + } else if (manager->priv->syndaemon_spawned) { + kill (manager->priv->syndaemon_pid, SIGHUP); + g_spawn_close_pid (manager->priv->syndaemon_pid); + manager->priv->syndaemon_spawned = FALSE; + g_debug ("Killed syndaemon"); + } + + return 0; +} + +static void +set_tap_to_click (GdkDevice *device, + gboolean state, + gboolean left_handed) +{ + int format, rc; + unsigned long nitems, bytes_after; + XDevice *xdevice; + unsigned char* data; + Atom prop, type; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Tap Action", False); + if (!prop) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting tap to click on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, 0, 2, + False, XA_INTEGER, &type, &format, &nitems, + &bytes_after, &data); + + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7) { + /* Set MR mapping for corner tapping on the right side*/ + data[0] = (state) ? 2 : 0; + data[1] = (state) ? 3 : 0; + + /* Set RLM mapping for 1/2/3 fingers*/ + data[4] = (state) ? ((left_handed) ? 3 : 1) : 0; + data[5] = (state) ? ((left_handed) ? 1 : 3) : 0; + data[6] = (state) ? 2 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (rc == Success) + XFree (data); + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting tap to click on \"%s\"", gdk_device_get_name (device)); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_horiz_scroll (GdkDevice *device, + gboolean state) +{ + int rc; + XDevice *xdevice; + Atom act_type, prop_edge, prop_twofinger; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False); + + if (!prop_edge || !prop_twofinger) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting horiz scroll on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[1] = (state && data[0]); + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + XFree (data); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[1] = (state && data[0]); + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting horiz scroll on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + +} + +static void +set_edge_scroll (GdkDevice *device, + GsdTouchpadScrollMethod method) +{ + int rc; + XDevice *xdevice; + Atom act_type, prop_edge, prop_twofinger; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False); + + if (!prop_edge || !prop_twofinger) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting edge scroll on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[0] = (method == GSD_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING) ? 1 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + XFree (data); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[0] = (method == GSD_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING) ? 1 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting edge scroll on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_touchpad_disabled (GdkDevice *device) +{ + int id; + XDevice *xdevice; + + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + g_debug ("Trying to set device disabled for \"%s\" (%d)", gdk_device_get_name (device), id); + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + if (set_device_enabled (id, FALSE) == FALSE) + g_warning ("Error disabling device \"%s\" (%d)", gdk_device_get_name (device), id); + else + g_debug ("Disabled device \"%s\" (%d)", gdk_device_get_name (device), id); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_touchpad_enabled (int id) +{ + XDevice *xdevice; + + g_debug ("Trying to set device enabled for %d", id); + + gdk_error_trap_push (); + xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id); + if (gdk_error_trap_pop () != 0) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + if (set_device_enabled (id, TRUE) == FALSE) + g_warning ("Error enabling device \"%d\"", id); + else + g_debug ("Enabled device %d", id); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_locate_pointer (GsdMouseManager *manager, + gboolean state) +{ + if (state) { + GError *error = NULL; + char *args[2]; + + if (manager->priv->locate_pointer_spawned) + return; + + args[0] = LIBEXECDIR "/gsd-locate-pointer"; + args[1] = NULL; + + g_spawn_async (NULL, args, NULL, + 0, NULL, NULL, + &manager->priv->locate_pointer_pid, &error); + + manager->priv->locate_pointer_spawned = (error == NULL); + + if (error) { + g_settings_set_boolean (manager->priv->mouse_settings, KEY_LOCATE_POINTER, FALSE); + g_error_free (error); + } + + } else if (manager->priv->locate_pointer_spawned) { + kill (manager->priv->locate_pointer_pid, SIGHUP); + g_spawn_close_pid (manager->priv->locate_pointer_pid); + manager->priv->locate_pointer_spawned = FALSE; + } +} + +static void +set_mousetweaks_daemon (GsdMouseManager *manager, + gboolean dwell_click_enabled, + gboolean secondary_click_enabled) +{ + GError *error = NULL; + gchar *comm; + gboolean run_daemon = dwell_click_enabled || secondary_click_enabled; + + if (run_daemon || manager->priv->mousetweaks_daemon_running) + comm = g_strdup_printf ("mousetweaks %s", + run_daemon ? "" : "-s"); + else + return; + + if (run_daemon) + manager->priv->mousetweaks_daemon_running = TRUE; + + if (! g_spawn_command_line_async (comm, &error)) { + if (error->code == G_SPAWN_ERROR_NOENT && run_daemon) { + GtkWidget *dialog; + + if (dwell_click_enabled) { + g_settings_set_boolean (manager->priv->mouse_a11y_settings, + KEY_DWELL_CLICK_ENABLED, FALSE); + } else if (secondary_click_enabled) { + g_settings_set_boolean (manager->priv->mouse_a11y_settings, + KEY_SECONDARY_CLICK_ENABLED, FALSE); + } + + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + _("Could not enable mouse accessibility features")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + _("Mouse accessibility requires Mousetweaks " + "to be installed on your system.")); + gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), + "preferences-desktop-accessibility"); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + g_error_free (error); + } + g_free (comm); +} + +static gboolean +get_touchpad_handedness (GsdMouseManager *manager, gboolean mouse_left_handed) +{ + switch (g_settings_get_enum (manager->priv->touchpad_settings, KEY_LEFT_HANDED)) { + case GSD_TOUCHPAD_HANDEDNESS_RIGHT: + return FALSE; + case GSD_TOUCHPAD_HANDEDNESS_LEFT: + return TRUE; + case GSD_TOUCHPAD_HANDEDNESS_MOUSE: + return mouse_left_handed; + default: + g_assert_not_reached (); + } +} + +static void +set_mouse_settings (GsdMouseManager *manager, + GdkDevice *device) +{ + gboolean mouse_left_handed, touchpad_left_handed; + + mouse_left_handed = g_settings_get_boolean (manager->priv->mouse_settings, KEY_LEFT_HANDED); + touchpad_left_handed = get_touchpad_handedness (manager, mouse_left_handed); + set_left_handed (manager, device, mouse_left_handed, touchpad_left_handed); + + set_motion (manager, device); + set_middle_button (manager, device, g_settings_get_boolean (manager->priv->mouse_settings, KEY_MIDDLE_BUTTON_EMULATION)); + + set_tap_to_click (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TAP_TO_CLICK), touchpad_left_handed); + set_edge_scroll (device, g_settings_get_enum (manager->priv->touchpad_settings, KEY_SCROLL_METHOD)); + set_horiz_scroll (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_PAD_HORIZ_SCROLL)); + set_natural_scroll (manager, device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_NATURAL_SCROLL_ENABLED)); + if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED) == FALSE) + set_touchpad_disabled (device); +} + +static void +set_natural_scroll (GsdMouseManager *manager, + GdkDevice *device, + gboolean natural_scroll) +{ + XDevice *xdevice; + Atom scrolling_distance, act_type; + int rc, act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + glong *ptr; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("Trying to set %s for \"%s\"", + natural_scroll ? "natural (reverse) scroll" : "normal scroll", + gdk_device_get_name (device)); + + scrolling_distance = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "Synaptics Scrolling Distance", False); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + scrolling_distance, 0, 2, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + + if (rc == Success && act_type == XA_INTEGER && act_format == 32 && nitems >= 2) { + ptr = (glong *) data; + + if (natural_scroll) { + ptr[0] = -abs(ptr[0]); + ptr[1] = -abs(ptr[1]); + } else { + ptr[0] = abs(ptr[0]); + ptr[1] = abs(ptr[1]); + } + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + scrolling_distance, XA_INTEGER, act_format, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error setting %s for \"%s\"", + natural_scroll ? "natural (reverse) scroll" : "normal scroll", + gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +mouse_callback (GSettings *settings, + const gchar *key, + GsdMouseManager *manager) +{ + GList *devices, *l; + + if (g_str_equal (key, KEY_DWELL_CLICK_ENABLED) || + g_str_equal (key, KEY_SECONDARY_CLICK_ENABLED)) { + set_mousetweaks_daemon (manager, + g_settings_get_boolean (settings, KEY_DWELL_CLICK_ENABLED), + g_settings_get_boolean (settings, KEY_SECONDARY_CLICK_ENABLED)); + return; + } else if (g_str_equal (key, KEY_LOCATE_POINTER)) { + set_locate_pointer (manager, g_settings_get_boolean (settings, KEY_LOCATE_POINTER)); + return; + } + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (g_str_equal (key, KEY_LEFT_HANDED)) { + gboolean mouse_left_handed; + mouse_left_handed = g_settings_get_boolean (settings, KEY_LEFT_HANDED); + set_left_handed (manager, device, mouse_left_handed, get_touchpad_handedness (manager, mouse_left_handed)); + } else if (g_str_equal (key, KEY_MOTION_ACCELERATION) || + g_str_equal (key, KEY_MOTION_THRESHOLD)) { + set_motion (manager, device); + } else if (g_str_equal (key, KEY_MIDDLE_BUTTON_EMULATION)) { + set_middle_button (manager, device, g_settings_get_boolean (settings, KEY_MIDDLE_BUTTON_EMULATION)); + } + } + g_list_free (devices); +} + +static void +touchpad_callback (GSettings *settings, + const gchar *key, + GsdMouseManager *manager) +{ + GList *devices, *l; + + if (g_str_equal (key, KEY_TOUCHPAD_DISABLE_W_TYPING)) { + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, key)); + return; + } + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (g_str_equal (key, KEY_TAP_TO_CLICK)) { + set_tap_to_click (device, g_settings_get_boolean (settings, key), + g_settings_get_boolean (manager->priv->touchpad_settings, KEY_LEFT_HANDED)); + } else if (g_str_equal (key, KEY_SCROLL_METHOD)) { + set_edge_scroll (device, g_settings_get_enum (settings, key)); + set_horiz_scroll (device, g_settings_get_boolean (settings, KEY_PAD_HORIZ_SCROLL)); + } else if (g_str_equal (key, KEY_PAD_HORIZ_SCROLL)) { + set_horiz_scroll (device, g_settings_get_boolean (settings, key)); + } else if (g_str_equal (key, KEY_TOUCHPAD_ENABLED)) { + if (g_settings_get_boolean (settings, key) == FALSE) + set_touchpad_disabled (device); + else + set_touchpad_enabled (gdk_x11_device_get_id (device)); + } else if (g_str_equal (key, KEY_MOTION_ACCELERATION) || + g_str_equal (key, KEY_MOTION_THRESHOLD)) { + set_motion (manager, device); + } else if (g_str_equal (key, KEY_LEFT_HANDED)) { + gboolean mouse_left_handed; + mouse_left_handed = g_settings_get_boolean (manager->priv->mouse_settings, KEY_LEFT_HANDED); + set_left_handed (manager, device, mouse_left_handed, get_touchpad_handedness (manager, mouse_left_handed)); + } else if (g_str_equal (key, KEY_NATURAL_SCROLL_ENABLED)) { + set_natural_scroll (manager, device, g_settings_get_boolean (settings, key)); + } + } + g_list_free (devices); + + if (g_str_equal (key, KEY_TOUCHPAD_ENABLED) && + g_settings_get_boolean (settings, key)) { + devices = get_disabled_devices (manager->priv->device_manager); + for (l = devices; l != NULL; l = l->next) { + int device_id; + + device_id = GPOINTER_TO_INT (l->data); + set_touchpad_enabled (device_id); + } + g_list_free (devices); + } +} + +static void +device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdMouseManager *manager) +{ + if (device_is_ignored (manager, device) == FALSE) { + if (run_custom_command (device, COMMAND_DEVICE_ADDED) == FALSE) { + set_mouse_settings (manager, device); + } else { + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_insert (manager->priv->blacklist, + GINT_TO_POINTER (id), GINT_TO_POINTER (1)); + } + + /* If a touchpad was to appear... */ + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + } +} + +static void +device_removed_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdMouseManager *manager) +{ + int id; + + /* Remove the device from the hash table so that + * device_is_ignored () doesn't check for blacklisted devices */ + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_remove (manager->priv->blacklist, + GINT_TO_POINTER (id)); + + if (device_is_ignored (manager, device) == FALSE) { + run_custom_command (device, COMMAND_DEVICE_REMOVED); + + /* If a touchpad was to disappear... */ + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + } +} + +static void +set_devicepresence_handler (GsdMouseManager *manager) +{ + GdkDeviceManager *device_manager; + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + + manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (device_added_cb), manager); + manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", + G_CALLBACK (device_removed_cb), manager); + manager->priv->device_manager = device_manager; +} + +static void +gsd_mouse_manager_init (GsdMouseManager *manager) +{ + manager->priv = GSD_MOUSE_MANAGER_GET_PRIVATE (manager); + manager->priv->blacklist = g_hash_table_new (g_direct_hash, g_direct_equal); +} + +static gboolean +gsd_mouse_manager_idle_cb (GsdMouseManager *manager) +{ + GList *devices, *l; + + gnome_settings_profile_start (NULL); + + set_devicepresence_handler (manager); + + manager->priv->mouse_settings = g_settings_new (SETTINGS_MOUSE_DIR); + g_signal_connect (manager->priv->mouse_settings, "changed", + G_CALLBACK (mouse_callback), manager); + + manager->priv->mouse_a11y_settings = g_settings_new ("org.gnome.desktop.a11y.mouse"); + g_signal_connect (manager->priv->mouse_a11y_settings, "changed", + G_CALLBACK (mouse_callback), manager); + + manager->priv->touchpad_settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + g_signal_connect (manager->priv->touchpad_settings, "changed", + G_CALLBACK (touchpad_callback), manager); + + manager->priv->syndaemon_spawned = FALSE; + + set_locate_pointer (manager, g_settings_get_boolean (manager->priv->mouse_settings, KEY_LOCATE_POINTER)); + set_mousetweaks_daemon (manager, + g_settings_get_boolean (manager->priv->mouse_a11y_settings, KEY_DWELL_CLICK_ENABLED), + g_settings_get_boolean (manager->priv->mouse_a11y_settings, KEY_SECONDARY_CLICK_ENABLED)); + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (run_custom_command (device, COMMAND_DEVICE_PRESENT) == FALSE) { + set_mouse_settings (manager, device); + } else { + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_insert (manager->priv->blacklist, + GINT_TO_POINTER (id), GINT_TO_POINTER (1)); + } + } + g_list_free (devices); + + if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED)) { + devices = get_disabled_devices (manager->priv->device_manager); + for (l = devices; l != NULL; l = l->next) { + int device_id; + + device_id = GPOINTER_TO_INT (l->data); + set_touchpad_enabled (device_id); + } + g_list_free (devices); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_mouse_manager_start (GsdMouseManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + if (!supports_xinput_devices ()) { + g_debug ("XInput is not supported, not applying any settings"); + return TRUE; + } + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_mouse_manager_stop (GsdMouseManager *manager) +{ + GsdMouseManagerPrivate *p = manager->priv; + + g_debug ("Stopping mouse manager"); + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); + g_signal_handler_disconnect (p->device_manager, p->device_removed_id); + p->device_manager = NULL; + } + + if (p->mouse_a11y_settings != NULL) { + g_object_unref (p->mouse_a11y_settings); + p->mouse_a11y_settings = NULL; + } + + if (p->mouse_settings != NULL) { + g_object_unref (p->mouse_settings); + p->mouse_settings = NULL; + } + + if (p->touchpad_settings != NULL) { + g_object_unref (p->touchpad_settings); + p->touchpad_settings = NULL; + } + + set_locate_pointer (manager, FALSE); +} + +static void +gsd_mouse_manager_finalize (GObject *object) +{ + GsdMouseManager *mouse_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MOUSE_MANAGER (object)); + + mouse_manager = GSD_MOUSE_MANAGER (object); + + g_return_if_fail (mouse_manager->priv != NULL); + + if (mouse_manager->priv->blacklist != NULL) + g_hash_table_destroy (mouse_manager->priv->blacklist); + + if (mouse_manager->priv->start_idle_id != 0) + g_source_remove (mouse_manager->priv->start_idle_id); + + if (mouse_manager->priv->device_manager != NULL) { + g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_added_id); + g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_removed_id); + } + + if (mouse_manager->priv->mouse_settings != NULL) + g_object_unref (mouse_manager->priv->mouse_settings); + + if (mouse_manager->priv->mouse_a11y_settings != NULL) + g_object_unref (mouse_manager->priv->mouse_a11y_settings); + + if (mouse_manager->priv->touchpad_settings != NULL) + g_object_unref (mouse_manager->priv->touchpad_settings); + + G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->finalize (object); +} + +GsdMouseManager * +gsd_mouse_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MOUSE_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MOUSE_MANAGER (manager_object); +} diff --git a/.pc/migrate_metacity_keys.patch/data/gnome-settings-daemon.convert b/.pc/migrate_metacity_keys.patch/data/gnome-settings-daemon.convert new file mode 100644 index 00000000..d4f01367 --- /dev/null +++ b/.pc/migrate_metacity_keys.patch/data/gnome-settings-daemon.convert @@ -0,0 +1,95 @@ +[org.gnome.settings-daemon.peripherals.smartcard] +removal-action = /desktop/gnome/peripherals/smartcard/removal_action + +[org.gnome.settings-daemon.peripherals.touchpad] +disable-while-typing = /desktop/gnome/peripherals/touchpad/disable_while_typing +horiz-scroll-enabled = /desktop/gnome/peripherals/touchpad/horiz_scroll_enabled +scroll-method = /desktop/gnome/peripherals/touchpad/scroll_method +tap-to-click = /desktop/gnome/peripherals/touchpad/tap_to_click +touchpad-enabled = /desktop/gnome/peripherals/touchpad/touchpad_enabled +motion-acceleration = /desktop/gnome/peripherals/mouse/motion_acceleration +motion-threshold = /desktop/gnome/peripherals/mouse/motion_threshold + +[org.gnome.settings-daemon.plugins.a11y-keyboard] +active = /apps/gnome_settings_daemon/plugins/a11y-keyboard/active +priority = /apps/gnome_settings_daemon/plugins/a11y-keyboard/priority + +[org.gnome.settings-daemon.plugins.background] +active = /apps/gnome_settings_daemon/plugins/background/active +priority = /apps/gnome_settings_daemon/plugins/background/priority + +[org.gnome.settings-daemon.plugins.clipboard] +active = /apps/gnome_settings_daemon/plugins/clipboard/active +priority = /apps/gnome_settings_daemon/plugins/clipboard/priority + +[org.gnome.settings-daemon.plugins.font] +active = /apps/gnome_settings_daemon/plugins/font/active +priority = /apps/gnome_settings_daemon/plugins/font/priority + +[org.gnome.settings-daemon.plugins.housekeeping] +active = /apps/gnome_settings_daemon/plugins/housekeeping/active +free-percent-notify = /apps/gnome_settings_daemon/plugins/housekeeping/free_percent_notify +free-percent-notify-again = /apps/gnome_settings_daemon/plugins/housekeeping/free_percent_notify_again +free-size-gb-no-notify = /apps/gnome_settings_daemon/plugins/housekeeping/free_size_gb_no_notify +ignore-paths = /apps/gnome_settings_daemon/plugins/housekeeping/ignore_paths +min-notify-period = /apps/gnome_settings_daemon/plugins/housekeeping/min_notify_period +priority = /apps/gnome_settings_daemon/plugins/housekeeping/priority + +[org.gnome.settings-daemon.plugins.keyboard] +active = /apps/gnome_settings_daemon/plugins/keyboard/active +priority = /apps/gnome_settings_daemon/plugins/keyboard/priority + +[org.gnome.settings-daemon.plugins.media-keys] +active = /apps/gnome_settings_daemon/plugins/keybindings/active +calculator = /apps/gnome_settings_daemon/keybindings/calculator +email = /apps/gnome_settings_daemon/keybindings/email +eject = /apps/gnome_settings_daemon/keybindings/eject +help = /apps/gnome_settings_daemon/keybindings/help +home = /apps/gnome_settings_daemon/keybindings/home +logout = /apps/gnome_settings_daemon/keybindings/power +media = /apps/gnome_settings_daemon/keybindings/media +next = /apps/gnome_settings_daemon/keybindings/next +pause = /apps/gnome_settings_daemon/keybindings/pause +play = /apps/gnome_settings_daemon/keybindings/play +previous = /apps/gnome_settings_daemon/keybindings/previous +priority = /apps/gnome_settings_daemon/plugins/keybindings/priority +screensaver = /apps/gnome_settings_daemon/keybindings/screensaver +search = /apps/gnome_settings_daemon/keybindings/search +stop = /apps/gnome_settings_daemon/keybindings/stop +touchpad = /apps/gnome_settings_daemon/keybindings/touchpad +volume-down = /apps/gnome_settings_daemon/keybindings/volume_down +volume-mute = /apps/gnome_settings_daemon/keybindings/volume_mute +volume-up = /apps/gnome_settings_daemon/keybindings/volume_up +www = /apps/gnome_settings_daemon/keybindings/www + +[org.gnome.settings-daemon.plugins.mouse] +active = /apps/gnome_settings_daemon/plugins/mouse/active +priority = /apps/gnome_settings_daemon/plugins/mouse/priority + +[org.gnome.settings-daemon.peripherals.mouse] +locate-pointer = /desktop/gnome/peripherals/mouse/locate_pointer +double-click = /desktop/gnome/peripherals/mouse/double_click +drag-threshold = /desktop/gnome/peripherals/mouse/drag_threshold +left-handed = /desktop/gnome/peripherals/mouse/left_handed +motion-acceleration = /desktop/gnome/peripherals/mouse/motion_acceleration +motion-threshold = /desktop/gnome/peripherals/mouse/motion_threshold + +[org.gnome.settings-daemon.plugins.smartcard] +active = /apps/gnome_settings_daemon/plugins/smartcard/active +priority = /apps/gnome_settings_daemon/plugins/smartcard/priority + +[org.gnome.settings-daemon.plugins.sound] +active = /apps/gnome_settings_daemon/plugins/sound/active +priority = /apps/gnome_settings_daemon/plugins/sound/priority + +[org.gnome.settings-daemon.plugins.xrandr] +active = /apps/gnome_settings_daemon/plugins/xrandr/active +default-configuration-file = /apps/gnome_settings_daemon/xrandr/default_configuration_file +priority = /apps/gnome_settings_daemon/plugins/xrandr/priority + +[org.gnome.settings-daemon.plugins.xsettings] +active = /apps/gnome_settings_daemon/plugins/xsettings/active +antialiasing = /desktop/gnome/font_rendering/antialiasing +hinting = /desktop/gnome/font_rendering/hinting +priority = /apps/gnome_settings_daemon/plugins/xsettings/priority +rgba-order = /desktop/gnome/font_rendering/rgba_order diff --git a/.pc/nexus-orientation.patch/plugins/orientation/gsd-orientation-manager.c b/.pc/nexus-orientation.patch/plugins/orientation/gsd-orientation-manager.c new file mode 100644 index 00000000..93f22149 --- /dev/null +++ b/.pc/nexus-orientation.patch/plugins/orientation/gsd-orientation-manager.c @@ -0,0 +1,525 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2010,2011 Red Hat, Inc. + * + * Author: Bastien Nocera + * + * 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 +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gsd-input-helper.h" +#include "gnome-settings-profile.h" +#include "gsd-orientation-manager.h" + +typedef enum { + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP +} OrientationUp; + +#define GSD_ORIENTATION_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_ORIENTATION_MANAGER, GsdOrientationManagerPrivate)) + +struct GsdOrientationManagerPrivate +{ + guint start_idle_id; + + /* Accelerometer */ + char *sysfs_path; + OrientationUp prev_orientation; + + /* DBus */ + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + /* Notifications */ + GUdevClient *client; + GSettings *settings; + gboolean orientation_lock; +}; + +#define CONF_SCHEMA "org.gnome.settings-daemon.peripherals.touchscreen" +#define ORIENTATION_LOCK_KEY "orientation-lock" + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_ORIENTATION_DBUS_PATH GSD_DBUS_PATH "/Orientation" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +""; + +static void gsd_orientation_manager_class_init (GsdOrientationManagerClass *klass); +static void gsd_orientation_manager_init (GsdOrientationManager *orientation_manager); +static void gsd_orientation_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdOrientationManager, gsd_orientation_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static GObject * +gsd_orientation_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdOrientationManager *orientation_manager; + + orientation_manager = GSD_ORIENTATION_MANAGER (G_OBJECT_CLASS (gsd_orientation_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (orientation_manager); +} + +static void +gsd_orientation_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_orientation_manager_parent_class)->dispose (object); +} + +static void +gsd_orientation_manager_class_init (GsdOrientationManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_orientation_manager_constructor; + object_class->dispose = gsd_orientation_manager_dispose; + object_class->finalize = gsd_orientation_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdOrientationManagerPrivate)); +} + +static void +gsd_orientation_manager_init (GsdOrientationManager *manager) +{ + manager->priv = GSD_ORIENTATION_MANAGER_GET_PRIVATE (manager); + manager->priv->prev_orientation = ORIENTATION_UNDEFINED; +} + +static GnomeRRRotation +orientation_to_rotation (OrientationUp orientation) +{ + switch (orientation) { + case ORIENTATION_NORMAL: + return GNOME_RR_ROTATION_0; + case ORIENTATION_BOTTOM_UP: + return GNOME_RR_ROTATION_180; + case ORIENTATION_LEFT_UP: + return GNOME_RR_ROTATION_90; + case ORIENTATION_RIGHT_UP: + return GNOME_RR_ROTATION_270; + default: + g_assert_not_reached (); + } +} + +static OrientationUp +orientation_from_string (const char *orientation) +{ + if (g_strcmp0 (orientation, "normal") == 0) + return ORIENTATION_NORMAL; + if (g_strcmp0 (orientation, "bottom-up") == 0) + return ORIENTATION_BOTTOM_UP; + if (g_strcmp0 (orientation, "left-up") == 0) + return ORIENTATION_LEFT_UP; + if (g_strcmp0 (orientation, "right-up") == 0) + return ORIENTATION_RIGHT_UP; + + return ORIENTATION_UNDEFINED; +} + +static const char * +orientation_to_string (OrientationUp o) +{ + switch (o) { + case ORIENTATION_UNDEFINED: + return "undefined"; + case ORIENTATION_NORMAL: + return "normal"; + case ORIENTATION_BOTTOM_UP: + return "bottom-up"; + case ORIENTATION_LEFT_UP: + return "left-up"; + case ORIENTATION_RIGHT_UP: + return "right-up"; + default: + g_assert_not_reached (); + } +} + +static OrientationUp +get_orientation_from_device (GUdevDevice *dev) +{ + const char *value; + + value = g_udev_device_get_property (dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) { + g_debug ("Couldn't find orientation for accelerometer %s", + g_udev_device_get_sysfs_path (dev)); + return ORIENTATION_UNDEFINED; + } + g_debug ("Found orientation '%s' for accelerometer %s", + value, g_udev_device_get_sysfs_path (dev)); + + return orientation_from_string (value); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdOrientationManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call 'RotateTo': %s", error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } +} + +static void +do_xrandr_action (GsdOrientationManager *manager, + GnomeRRRotation rotation) +{ + GsdOrientationManagerPrivate *priv = manager->priv; + GTimeVal tv; + gint64 timestamp; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + g_get_current_time (&tv); + timestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000; + + priv->cancellable = g_cancellable_new (); + + g_dbus_proxy_call (priv->xrandr_proxy, + "RotateTo", + g_variant_new ("(ix)", rotation, timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static void +do_rotation (GsdOrientationManager *manager) +{ + GnomeRRRotation rotation; + + if (manager->priv->orientation_lock) { + g_debug ("Orientation changed, but we are locked"); + return; + } + if (manager->priv->prev_orientation == ORIENTATION_UNDEFINED) { + g_debug ("Not trying to rotate, orientation is undefined"); + return; + } + + rotation = orientation_to_rotation (manager->priv->prev_orientation); + + do_xrandr_action (manager, rotation); +} + +static void +client_uevent_cb (GUdevClient *client, + gchar *action, + GUdevDevice *device, + GsdOrientationManager *manager) +{ + const char *sysfs_path; + OrientationUp orientation; + + sysfs_path = g_udev_device_get_sysfs_path (device); + g_debug ("Received uevent '%s' from '%s'", action, sysfs_path); + + if (manager->priv->orientation_lock) + return; + + if (g_str_equal (action, "change") == FALSE) + return; + + if (g_strcmp0 (manager->priv->sysfs_path, sysfs_path) != 0) + return; + + g_debug ("Received an event from the accelerometer"); + + orientation = get_orientation_from_device (device); + if (orientation != manager->priv->prev_orientation) { + manager->priv->prev_orientation = orientation; + g_debug ("Orientation changed to '%s', switching screen rotation", + orientation_to_string (manager->priv->prev_orientation)); + + do_rotation (manager); + } +} + +static void +orientation_lock_changed_cb (GSettings *settings, + gchar *key, + GsdOrientationManager *manager) +{ + gboolean new; + + new = g_settings_get_boolean (settings, key); + if (new == manager->priv->orientation_lock) + return; + + manager->priv->orientation_lock = new; + + if (new == FALSE) { + /* Handle the rotations that could have occurred while + * we were locked */ + do_rotation (manager); + } +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdOrientationManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdOrientationManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_ORIENTATION_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + NULL, + NULL, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); +} + +static GUdevDevice * +get_accelerometer (GUdevClient *client) +{ + GList *list, *l; + GUdevDevice *ret, *parent; + + /* Look for a device with the ID_INPUT_ACCELEROMETER=1 property */ + ret = NULL; + list = g_udev_client_query_by_subsystem (client, "input"); + for (l = list; l != NULL; l = l->next) { + GUdevDevice *dev; + + dev = l->data; + if (g_udev_device_get_property_as_boolean (dev, "ID_INPUT_ACCELEROMETER")) { + ret = dev; + continue; + } + g_object_unref (dev); + } + g_list_free (list); + + if (ret == NULL) + return NULL; + + /* Now walk up to the parent */ + parent = g_udev_device_get_parent (ret); + if (parent == NULL) + return ret; + + if (g_udev_device_get_property_as_boolean (parent, "ID_INPUT_ACCELEROMETER")) { + g_object_unref (ret); + ret = parent; + } else { + g_object_unref (parent); + } + + return ret; +} + +static gboolean +gsd_orientation_manager_idle_cb (GsdOrientationManager *manager) +{ + const char * const subsystems[] = { "input", NULL }; + GUdevDevice *dev; + + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new (CONF_SCHEMA); + manager->priv->orientation_lock = g_settings_get_boolean (manager->priv->settings, ORIENTATION_LOCK_KEY); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::orientation-lock", + G_CALLBACK (orientation_lock_changed_cb), manager); + + manager->priv->client = g_udev_client_new (subsystems); + dev = get_accelerometer (manager->priv->client); + if (dev == NULL) { + g_debug ("Did not find an accelerometer"); + gnome_settings_profile_end (NULL); + return FALSE; + } + manager->priv->sysfs_path = g_strdup (g_udev_device_get_sysfs_path (dev)); + g_debug ("Found accelerometer at sysfs path '%s'", manager->priv->sysfs_path); + + manager->priv->prev_orientation = get_orientation_from_device (dev); + g_object_unref (dev); + + /* Start process of owning a D-Bus name */ + g_bus_get (G_BUS_TYPE_SESSION, + NULL, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_signal_connect (G_OBJECT (manager->priv->client), "uevent", + G_CALLBACK (client_uevent_cb), manager); + + gnome_settings_profile_end (NULL); + + return FALSE; +} + +gboolean +gsd_orientation_manager_start (GsdOrientationManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_orientation_manager_idle_cb, manager); + + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + g_assert (manager->priv->introspection_data != NULL); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_orientation_manager_stop (GsdOrientationManager *manager) +{ + GsdOrientationManagerPrivate *p = manager->priv; + + g_debug ("Stopping orientation manager"); + + if (p->settings) { + g_object_unref (p->settings); + p->settings = NULL; + } + + if (p->sysfs_path) { + g_free (p->sysfs_path); + p->sysfs_path = NULL; + } + + if (p->introspection_data) { + g_dbus_node_info_unref (p->introspection_data); + p->introspection_data = NULL; + } + + if (p->client) { + g_object_unref (p->client); + p->client = NULL; + } +} + +static void +gsd_orientation_manager_finalize (GObject *object) +{ + GsdOrientationManager *orientation_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_ORIENTATION_MANAGER (object)); + + orientation_manager = GSD_ORIENTATION_MANAGER (object); + + g_return_if_fail (orientation_manager->priv != NULL); + + if (orientation_manager->priv->start_idle_id != 0) + g_source_remove (orientation_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_orientation_manager_parent_class)->finalize (object); +} + +GsdOrientationManager * +gsd_orientation_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_ORIENTATION_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_ORIENTATION_MANAGER (manager_object); +} diff --git a/.pc/power-check-null-devices.patch/plugins/power/gsd-power-manager.c b/.pc/power-check-null-devices.patch/plugins/power/gsd-power-manager.c new file mode 100644 index 00000000..0bb3cbee --- /dev/null +++ b/.pc/power-check-null-devices.patch/plugins/power/gsd-power-manager.c @@ -0,0 +1,4397 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * Copyright (C) 2011 Ritesh Khadgaray + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gpm-common.h" +#include "gpm-phone.h" +#include "gpm-idletime.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-enums.h" +#include "gsd-power-manager.h" +#include "gsd-power-helper.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_PATH_PRESENCE "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE_PRESENCE "org.gnome.SessionManager.Presence" + +#define UPOWER_DBUS_NAME "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_PATH_KBDBACKLIGHT "/org/freedesktop/UPower/KbdBacklight" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DBUS_INTERFACE_KBDBACKLIGHT "org.freedesktop.UPower.KbdBacklight" + +#define GSD_POWER_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power" + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_POWER_DBUS_PATH GSD_DBUS_PATH "/Power" +#define GSD_POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#define GSD_POWER_DBUS_INTERFACE_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_POWER_DBUS_INTERFACE_KEYBOARD "org.gnome.SettingsDaemon.Power.Keyboard" + +#define GS_DBUS_NAME "org.gnome.ScreenSaver" +#define GS_DBUS_PATH "/org/gnome/ScreenSaver" +#define GS_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER 0 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */ + +#define GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ +#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */ +#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + +/* Keep this in sync with gnome-shell */ +#define SCREENSAVER_FADE_TIME 10 /* seconds */ + +#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */ + +enum { + GSD_POWER_IDLETIME_NULL_ID, + GSD_POWER_IDLETIME_DIM_ID, + GSD_POWER_IDLETIME_BLANK_ID, + GSD_POWER_IDLETIME_SLEEP_ID +}; + +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +/* on ACPI machines we have 4-16 levels, on others it's ~150 */ +#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) + +/* take a discrete value with offset and convert to percentage */ +static int +abs_to_percentage (int min, int max, int value) +{ + g_return_val_if_fail (max > min, -1); + g_return_val_if_fail (value >= min, -1); + g_return_val_if_fail (value <= max, -1); + return (((value - min) * 100) / (max - min)); +} +#define ABS_TO_PERCENTAGE(min, max, value) abs_to_percentage(min, max, value) +#define PERCENTAGE_TO_ABS(min, max, value) (min + (((max - min) * value) / 100)) + +#define GSD_POWER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerPrivate)) + +typedef enum { + GSD_POWER_IDLE_MODE_NORMAL, + GSD_POWER_IDLE_MODE_DIM, + GSD_POWER_IDLE_MODE_BLANK, + GSD_POWER_IDLE_MODE_SLEEP +} GsdPowerIdleMode; + +struct GsdPowerManagerPrivate +{ + GnomeSettingsSession *session; + gboolean lid_is_closed; + GSettings *settings; + GSettings *settings_screensaver; + UpClient *up_client; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *upower_proxy; + GDBusProxy *upower_kdb_proxy; + gint kbd_brightness_now; + gint kbd_brightness_max; + gint kbd_brightness_old; + gint kbd_brightness_pre_dim; + GnomeRRScreen *x11_screen; + gboolean use_time_primary; + gchar *previous_summary; + GIcon *previous_icon; + GpmPhone *phone; + GPtrArray *devices_array; + guint action_percentage; + guint action_time; + guint critical_percentage; + guint critical_time; + guint low_percentage; + guint low_time; + gint pre_dim_brightness; /* level, not percentage */ + UpDevice *device_composite; + NotifyNotification *notification_discharging; + NotifyNotification *notification_low; + ca_context *canberra_context; + ca_proplist *critical_alert_loop_props; + guint32 critical_alert_timeout_id; + GDBusProxy *screensaver_proxy; + GDBusProxy *session_proxy; + GDBusProxy *session_presence_proxy; + GpmIdletime *idletime; + GsdPowerIdleMode current_idle_mode; + guint lid_close_safety_timer_id; + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; +}; + +enum { + PROP_0, +}; + +static void gsd_power_manager_class_init (GsdPowerManagerClass *klass); +static void gsd_power_manager_init (GsdPowerManager *power_manager); +static void gsd_power_manager_finalize (GObject *object); + +static UpDevice *engine_get_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static UpDevice *engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static GIcon *engine_get_icon (GsdPowerManager *manager); +static gchar *engine_get_summary (GsdPowerManager *manager); +static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type); +static void do_lid_closed_action (GsdPowerManager *manager); +static void lock_screensaver (GsdPowerManager *manager); +static void kill_lid_close_safety_timer (GsdPowerManager *manager); + +G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gsd_power_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_power_manager_error"); + return quark; +} + +static gboolean +play_loop_timeout_cb (GsdPowerManager *manager) +{ + ca_context *context; + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play_full (context, 0, + manager->priv->critical_alert_loop_props, + NULL, + NULL); + return TRUE; +} + +static gboolean +play_loop_stop (GsdPowerManager *manager) +{ + if (manager->priv->critical_alert_timeout_id == 0) { + g_warning ("no sound loop present to stop"); + return FALSE; + } + + g_source_remove (manager->priv->critical_alert_timeout_id); + ca_proplist_destroy (manager->priv->critical_alert_loop_props); + + manager->priv->critical_alert_loop_props = NULL; + manager->priv->critical_alert_timeout_id = 0; + + return TRUE; +} + +static gboolean +play_loop_start (GsdPowerManager *manager, + const gchar *id, + const gchar *desc, + gboolean force, + guint timeout) +{ + ca_context *context; + + if (timeout == 0) { + g_warning ("received invalid timeout"); + return FALSE; + } + + /* if a sound loop is already running, stop the existing loop */ + if (manager->priv->critical_alert_timeout_id != 0) { + g_warning ("was instructed to play a sound loop with one already playing"); + play_loop_stop (manager); + } + + ca_proplist_create (&(manager->priv->critical_alert_loop_props)); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_ID, id); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_DESCRIPTION, desc); + + manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout, + (GSourceFunc) play_loop_timeout_cb, + manager); + g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, + "[GsdPowerManager] play-loop"); + + /* play the sound, using sounds from the naming spec */ + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play (context, 0, + CA_PROP_EVENT_ID, id, + CA_PROP_EVENT_DESCRIPTION, desc, NULL); + return TRUE; +} + +static void +notify_close_if_showing (NotifyNotification *notification) +{ + gboolean ret; + GError *error = NULL; + + if (notification == NULL) + return; + ret = notify_notification_close (notification, &error); + if (!ret) { + g_warning ("failed to close notification: %s", + error->message); + g_error_free (error); + } +} + +static const gchar * +get_first_themed_icon_name (GIcon *icon) +{ + const gchar* const *icon_names; + const gchar *icon_name = NULL; + + /* no icon */ + if (icon == NULL) + goto out; + + /* just use the first icon */ + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + if (icon_names != NULL) + icon_name = icon_names[0]; +out: + return icon_name; +} + +typedef enum { + WARNING_NONE = 0, + WARNING_DISCHARGING = 1, + WARNING_LOW = 2, + WARNING_CRITICAL = 3, + WARNING_ACTION = 4 +} GsdPowerManagerWarning; + +static GVariant * +engine_get_icon_property_variant (GsdPowerManager *manager) +{ + GIcon *icon; + GVariant *retval; + + icon = engine_get_icon (manager); + if (icon != NULL) { + char *str; + str = g_icon_to_string (icon); + g_object_unref (icon); + retval = g_variant_new_string (str); + g_free (str); + } else { + retval = g_variant_new_string (""); + } + return retval; +} + +static GVariant * +engine_get_tooltip_property_variant (GsdPowerManager *manager) +{ + char *tooltip; + GVariant *retval; + + tooltip = engine_get_summary (manager); + retval = g_variant_new_string (tooltip != NULL ? tooltip : ""); + g_free (tooltip); + + return retval; +} + +static void +engine_emit_changed (GsdPowerManager *manager, + gboolean icon_changed, + gboolean state_changed) +{ + GVariantBuilder props_builder; + GVariant *props_changed = NULL; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + + g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}")); + + if (icon_changed) + g_variant_builder_add (&props_builder, "{sv}", "Icon", + engine_get_icon_property_variant (manager)); + if (state_changed) + g_variant_builder_add (&props_builder, "{sv}", "Tooltip", + engine_get_tooltip_property_variant (manager)); + + props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE, + g_variant_builder_end (&props_builder), + g_variant_new_strv (NULL, 0)); + g_variant_ref_sink (props_changed); + + if (!g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_POWER_DBUS_PATH, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + props_changed, + &error)) + goto out; + + out: + if (error) { + g_warning ("%s", error->message); + g_clear_error (&error); + } + if (props_changed) + g_variant_unref (props_changed); +} + +static GsdPowerManagerWarning +engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage < 26.0f) + return WARNING_LOW; + else if (percentage < 13.0f) + return WARNING_CRITICAL; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage <= manager->priv->action_percentage) + return WARNING_ACTION; + if (percentage <= manager->priv->critical_percentage) + return WARNING_CRITICAL; + if (percentage <= manager->priv->low_percentage) + return WARNING_LOW; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_time (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "time-to-empty", &time_to_empty, + NULL); + + /* this is probably an error condition */ + if (time_to_empty == 0) { + g_debug ("time zero, falling back to percentage for %s", + up_device_kind_to_string (kind)); + return engine_get_warning_percentage (manager, device); + } + + if (time_to_empty <= manager->priv->action_time) + return WARNING_ACTION; + if (time_to_empty <= manager->priv->critical_time) + return WARNING_CRITICAL; + if (time_to_empty <= manager->priv->low_time) + return WARNING_LOW; + return WARNING_NONE; +} + +/** + * This gets the possible engine state for the device according to the + * policy, which could be per-percent, or per-time. + **/ +static GsdPowerManagerWarning +engine_get_warning (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + UpDeviceState state; + GsdPowerManagerWarning warning_type; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + NULL); + + /* default to no engine */ + warning_type = WARNING_NONE; + + /* if the device in question is on ac, don't give a warning */ + if (state == UP_DEVICE_STATE_CHARGING) + goto out; + + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + + warning_type = engine_get_warning_csr (manager, device); + + } else if (kind == UP_DEVICE_KIND_UPS || +#if UP_CHECK_VERSION(0,9,5) + kind == UP_DEVICE_KIND_MEDIA_PLAYER || + kind == UP_DEVICE_KIND_TABLET || + kind == UP_DEVICE_KIND_COMPUTER || +#endif + kind == UP_DEVICE_KIND_PDA) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_BATTERY) { + /* only use the time when it is accurate, and settings is not disabled */ + if (manager->priv->use_time_primary) + warning_type = engine_get_warning_time (manager, device); + else + warning_type = engine_get_warning_percentage (manager, device); + } + + /* If we have no important engines, we should test for discharging */ + if (warning_type == WARNING_NONE) { + if (state == UP_DEVICE_STATE_DISCHARGING) + warning_type = WARNING_DISCHARGING; + } + + out: + return warning_type; +} + +static gchar * +engine_get_summary (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + GString *tooltip = NULL; + gchar *part; + gboolean is_present; + + + /* need to get AC state */ + tooltip = g_string_new (""); + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "is-present", &is_present, + "state", &state, + NULL); + if (!is_present) + continue; + if (state == UP_DEVICE_STATE_EMPTY) + continue; + part = gpm_upower_get_device_summary (device); + if (part != NULL) + g_string_append_printf (tooltip, "%s\n", part); + g_free (part); + } + + /* remove the last \n */ + g_string_truncate (tooltip, tooltip->len-1); + + g_debug ("tooltip: %s", tooltip->str); + + return g_string_free (tooltip, FALSE); +} + +static GIcon * +engine_get_icon_priv (GsdPowerManager *manager, + UpDeviceKind device_kind, + GsdPowerManagerWarning warning, + gboolean use_state) +{ + guint i; + GPtrArray *array; + UpDevice *device; + GsdPowerManagerWarning warning_temp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) + device = engine_get_composite_device (manager, device); + + warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), + "engine-warning-old")); + if (kind == device_kind && is_present) { + if (warning != WARNING_NONE) { + if (warning_temp == warning) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + if (use_state) { + if (state == UP_DEVICE_STATE_CHARGING || + state == UP_DEVICE_STATE_DISCHARGING) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + return gpm_upower_get_device_icon (device, TRUE); + } + } + return NULL; +} + +static GIcon * +engine_get_icon (GsdPowerManager *manager) +{ + GIcon *icon = NULL; + + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + + /* we try (DIS)CHARGING: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + + /* we try PRESENT: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + + /* do not show an icon */ + return NULL; +} + +static gboolean +engine_recalculate_state_icon (GsdPowerManager *manager) +{ + GIcon *icon; + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + if (icon == NULL) { + /* none before, now none */ + if (manager->priv->previous_icon == NULL) + return FALSE; + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = NULL; + return TRUE; + } + + /* no icon before, now icon */ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + /* icon before, now different */ + if (!g_icon_equal (manager->priv->previous_icon, icon)) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + g_debug ("no change"); + /* nothing to do */ + g_object_unref (icon); + return FALSE; +} + +static gboolean +engine_recalculate_state_summary (GsdPowerManager *manager) +{ + gchar *summary; + + summary = engine_get_summary (manager); + if (manager->priv->previous_summary == NULL) { + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + + if (strcmp (manager->priv->previous_summary, summary) != 0) { + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + g_debug ("no change"); + /* nothing to do */ + g_free (summary); + return FALSE; +} + +static void +engine_recalculate_state (GsdPowerManager *manager) +{ + gboolean icon_changed = FALSE; + gboolean state_changed = FALSE; + + icon_changed = engine_recalculate_state_icon (manager); + state_changed = engine_recalculate_state_summary (manager); + + /* only emit if the icon or summary has changed */ + if (icon_changed || state_changed) + engine_emit_changed (manager, icon_changed, state_changed); +} + +static UpDevice * +engine_get_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint battery_devices = 0; + GPtrArray *array; + UpDevice *device; + UpDeviceKind kind; + UpDeviceKind original_kind; + guint i; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* find out how many batteries in the system */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + NULL); + if (kind == original_kind) + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices <= 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use the composite device */ + device = manager->priv->device_composite; +out: + /* return composite device or original device */ + return device; +} + +static UpDevice * +engine_update_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint i; + gdouble percentage = 0.0; + gdouble energy = 0.0; + gdouble energy_full = 0.0; + gdouble energy_rate = 0.0; + gdouble energy_total = 0.0; + gdouble energy_full_total = 0.0; + gdouble energy_rate_total = 0.0; + gint64 time_to_empty = 0; + gint64 time_to_full = 0; + guint battery_devices = 0; + gboolean is_charging = FALSE; + gboolean is_discharging = FALSE; + gboolean is_fully_charged = TRUE; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + UpDeviceKind kind; + UpDeviceKind original_kind; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* update the composite device */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + "state", &state, + "energy", &energy, + "energy-full", &energy_full, + "energy-rate", &energy_rate, + NULL); + if (kind != original_kind) + continue; + + /* one of these will be charging or discharging */ + if (state == UP_DEVICE_STATE_CHARGING) + is_charging = TRUE; + if (state == UP_DEVICE_STATE_DISCHARGING) + is_discharging = TRUE; + if (state != UP_DEVICE_STATE_FULLY_CHARGED) + is_fully_charged = FALSE; + + /* sum up composite */ + energy_total += energy; + energy_full_total += energy_full; + energy_rate_total += energy_rate; + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices == 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use percentage weighted for each battery capacity */ + if (energy_full_total > 0.0) + percentage = 100.0 * energy_total / energy_full_total; + + /* set composite state */ + if (is_charging) + state = UP_DEVICE_STATE_CHARGING; + else if (is_discharging) + state = UP_DEVICE_STATE_DISCHARGING; + else if (is_fully_charged) + state = UP_DEVICE_STATE_FULLY_CHARGED; + else + state = UP_DEVICE_STATE_UNKNOWN; + + /* calculate a quick and dirty time remaining value */ + if (energy_rate_total > 0) { + if (state == UP_DEVICE_STATE_DISCHARGING) + time_to_empty = 3600 * (energy_total / energy_rate_total); + else if (state == UP_DEVICE_STATE_CHARGING) + time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total); + } + + /* okay, we can use the composite device */ + device = manager->priv->device_composite; + + g_debug ("printing composite device"); + g_object_set (device, + "energy", energy, + "energy-full", energy_full, + "energy-rate", energy_rate, + "time-to-empty", time_to_empty, + "time-to-full", time_to_full, + "percentage", percentage, + "state", state, + NULL); + + /* force update of icon */ + if (engine_recalculate_state_icon (manager)) + engine_emit_changed (manager, TRUE, FALSE); +out: + /* return composite device or original device */ + return device; +} + +typedef struct { + GsdPowerManager *manager; + UpDevice *device; +} GsdPowerManagerRecallData; + +static void +device_perhaps_recall_response_cb (GtkDialog *dialog, + gint response_id, + GsdPowerManagerRecallData *recall_data) +{ + GdkScreen *screen; + GtkWidget *dialog_error; + GError *error = NULL; + gboolean ret; + gchar *website = NULL; + + /* don't show this again */ + if (response_id == GTK_RESPONSE_CANCEL) { + g_settings_set_boolean (recall_data->manager->priv->settings, + "notify-perhaps-recall", + FALSE); + goto out; + } + + /* visit recall website */ + if (response_id == GTK_RESPONSE_OK) { + + g_object_get (recall_data->device, + "recall-url", &website, + NULL); + + screen = gdk_screen_get_default(); + ret = gtk_show_uri (screen, + website, + gtk_get_current_event_time (), + &error); + if (!ret) { + dialog_error = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Failed to show url %s", + error->message); + gtk_dialog_run (GTK_DIALOG (dialog_error)); + g_error_free (error); + } + } +out: + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (recall_data->device); + g_object_unref (recall_data->manager); + g_free (recall_data); + g_free (website); + return; +} + +static gboolean +device_perhaps_recall_delay_cb (gpointer user_data) +{ + gchar *vendor; + const gchar *title = NULL; + GString *message = NULL; + GtkWidget *dialog; + GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data; + + g_object_get (recall_data->device, + "recall-vendor", &vendor, + NULL); + + /* TRANSLATORS: the battery may be recalled by its vendor */ + title = _("Battery may be recalled"); + message = g_string_new (""); + g_string_append_printf (message, + _("A battery in your computer may have been " + "recalled by %s and you may be at risk."), vendor); + g_string_append (message, "\n\n"); + g_string_append (message, _("For more information visit the battery recall website.")); + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + title); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", message->str); + + /* TRANSLATORS: button text, visit the manufacturers recall website */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), + GTK_RESPONSE_OK); + + /* TRANSLATORS: button text, do not show this bubble again */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), + GTK_RESPONSE_CANCEL); + + gtk_widget_show (dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (device_perhaps_recall_response_cb), + recall_data); + + g_string_free (message, TRUE); + g_free (vendor); + return FALSE; +} + +static void +device_perhaps_recall (GsdPowerManager *manager, UpDevice *device) +{ + gboolean ret; + guint timer_id; + GsdPowerManagerRecallData *recall_data; + + /* don't show when running under GDM */ + if (g_getenv ("RUNNING_UNDER_GDM") != NULL) { + g_debug ("running under gdm, so no notification"); + return; + } + + /* already shown, and dismissed */ + ret = g_settings_get_boolean (manager->priv->settings, + "notify-perhaps-recall"); + if (!ret) { + g_debug ("settings prevents recall notification"); + return; + } + + recall_data = g_new0 (GsdPowerManagerRecallData, 1); + recall_data->manager = g_object_ref (manager); + recall_data->device = g_object_ref (device); + + /* delay by a few seconds so the session can load */ + timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY, + device_perhaps_recall_delay_cb, + recall_data); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall"); +} + +static void +engine_device_add (GsdPowerManager *manager, UpDevice *device) +{ + gboolean recall_notice; + GsdPowerManagerWarning warning; + UpDeviceState state; + UpDeviceKind kind; + UpDevice *composite; + + /* assign warning */ + warning = engine_get_warning (manager, device); + g_object_set_data (G_OBJECT(device), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "recall-notice", &recall_notice, + NULL); + + /* add old state for transitions */ + g_debug ("adding %s with state %s", + up_device_get_object_path (device), up_device_state_to_string (state)); + g_object_set_data (G_OBJECT(device), + "engine-state-old", + GUINT_TO_POINTER(state)); + + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because we added a device"); + composite = engine_update_composite_device (manager, device); + + /* get the same values for the composite device */ + warning = engine_get_warning (manager, composite); + g_object_set_data (G_OBJECT(composite), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + g_object_get (composite, "state", &state, NULL); + g_object_set_data (G_OBJECT(composite), + "engine-state-old", + GUINT_TO_POINTER(state)); + } + + /* the device is recalled */ + if (recall_notice) + device_perhaps_recall (manager, device); +} + +static gboolean +engine_check_recall (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gboolean recall_notice = FALSE; + gchar *recall_vendor = NULL; + gchar *recall_url = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "recall-notice", &recall_notice, + "recall-vendor", &recall_vendor, + "recall-url", &recall_url, + NULL); + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + goto out; + + /* no recall data */ + if (!recall_notice) + goto out; + + /* emit signal for manager */ + g_debug ("** EMIT: perhaps-recall"); + g_debug ("%s-%s", recall_vendor, recall_url); +out: + g_free (recall_vendor); + g_free (recall_url); + return recall_notice; +} + +static gboolean +engine_coldplug (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array = NULL; + UpDevice *device; + gboolean ret; + GError *error = NULL; + + /* get devices from UPower */ + ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error); + if (!ret) { + g_warning ("failed to get device list: %s", error->message); + g_error_free (error); + goto out; + } + + /* connected mobile phones */ + gpm_phone_coldplug (manager->priv->phone); + + engine_recalculate_state (manager); + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); + /* never repeat */ + return FALSE; +} + +static void +engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + /* add to list */ + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_check_recall (manager, device); + + engine_recalculate_state (manager); +} + +static void +engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + gboolean ret; + ret = g_ptr_array_remove (manager->priv->devices_array, device); + if (!ret) + return; + engine_recalculate_state (manager); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +create_notification (const char *summary, + const char *body, + const char *icon, + NotifyNotification **weak_pointer_location) +{ + NotifyNotification *notification; + + notification = notify_notification_new (summary, body, icon); + *weak_pointer_location = notification; + g_object_add_weak_pointer (G_OBJECT (notification), + (gpointer *) weak_pointer_location); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); +} + +static void +engine_ups_discharging (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title; + gboolean ret; + gchar *remaining_text = NULL; + gdouble percentage; + GError *error = NULL; + GIcon *icon = NULL; + gint64 time_to_empty; + GString *message; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + if (kind != UP_DEVICE_KIND_UPS) + return; + + /* only show text if there is a valid time */ + if (time_to_empty > 0) + remaining_text = gpm_get_timestring (time_to_empty); + + /* TRANSLATORS: UPS is now discharging */ + title = _("UPS Discharging"); + + message = g_string_new (""); + if (remaining_text != NULL) { + /* TRANSLATORS: tell the user how much time they have got */ + g_string_append_printf (message, _("%s of UPS backup power remaining"), + remaining_text); + } else { + g_string_append (message, gpm_device_to_localised_string (device)); + } + g_string_append_printf (message, " (%.0f%%)", percentage); + + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_discharging); + + /* create a new notification */ + create_notification (title, message->str, + get_first_themed_icon_name (icon), + &manager->priv->notification_discharging); + notify_notification_set_timeout (manager->priv->notification_discharging, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_discharging, + NOTIFY_URGENCY_NORMAL); + /* TRANSLATORS: this is the notification application name */ + notify_notification_set_app_name (manager->priv->notification_discharging, _("Power")); + notify_notification_set_hint (manager->priv->notification_discharging, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_discharging, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_discharging); + } + g_string_free (message, TRUE); + if (icon != NULL) + g_object_unref (icon); + g_free (remaining_text); +} + +static GsdPowerActionType +manager_critical_action_get (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType policy; + + policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action"); + if (policy == GSD_POWER_ACTION_SUSPEND) { + if (is_ups == FALSE && + up_client_get_can_suspend (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_can_hibernate (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } + + return policy; +} + +static gboolean +manager_critical_action_do (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType action_type; + + /* stop playing the alert as it's too late to do anything now */ + if (manager->priv->critical_alert_timeout_id > 0) + play_loop_stop (manager); + + action_type = manager_critical_action_get (manager, is_ups); + do_power_action_type (manager, action_type); + + return FALSE; +} + +static gboolean +manager_critical_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, FALSE); + return FALSE; +} + +static gboolean +manager_critical_ups_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, TRUE); + return FALSE; +} + +static gboolean +engine_just_laptop_battery (GsdPowerManager *manager) +{ + UpDevice *device; + UpDeviceKind kind; + GPtrArray *array; + gboolean ret = TRUE; + guint i; + + /* find if there are any other device types that mean we have to + * be more specific in our wording */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, "kind", &kind, NULL); + if (kind != UP_DEVICE_KIND_BATTERY) { + ret = FALSE; + break; + } + } + return ret; +} + +static void +engine_charge_low (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gchar *tmp; + gchar *remaining_text; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery low, and we only have one battery */ + title = _("Battery low"); + } else { + /* TRANSLATORS: laptop battery low, and we have more than one kind of battery */ + title = _("Laptop battery low"); + } + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage); + g_free (remaining_text); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is starting to get a little low */ + title = _("UPS low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s of remaining UPS backup power (%.0f%%)"), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: mouse is getting a little low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless mouse is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: keyboard is getting a little low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless keyboard is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PDA) { + /* TRANSLATORS: PDA is getting a little low */ + title = _("PDA battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("PDA is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + /* TRANSLATORS: cell phone (mobile) is getting a little low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + /* TRANSLATORS: media player, e.g. mp3 is getting a little low */ + title = _("Media player battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_TABLET) { + /* TRANSLATORS: graphics tablet, e.g. wacom is getting a little low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + /* TRANSLATORS: computer, e.g. ipad is getting a little low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_NORMAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + notify_notification_set_hint (manager->priv->notification_low, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-low", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL); + +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_critical (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + GsdPowerActionType policy; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */ + title = _("Battery critically low"); + } else { + /* TRANSLATORS: laptop battery critically low, and we have more than one type of battery */ + title = _("Laptop battery critically low"); + } + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */ + message = g_strdup (_("Plug in your AC adapter to avoid losing data.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in.")); + } + + } else if (kind == UP_DEVICE_KIND_UPS) { + gchar *remaining_text; + gchar *tmp; + + /* TRANSLATORS: the UPS is very low */ + title = _("UPS critically low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Approximately %s of remaining UPS power (%.0f%%). " + "Restore AC power to your computer to avoid losing data."), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: the mouse battery is very low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless mouse is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: the keyboard battery is very low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless keyboard is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_PDA) { + + /* TRANSLATORS: the PDA battery is very low */ + title = _("PDA battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("PDA is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Media player is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_TABLET) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Attached computer is very low in power (%.0f%%). " + "The device will soon shutdown if not charged."), + percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + switch (kind) { + + case UP_DEVICE_KIND_BATTERY: + case UP_DEVICE_KIND_UPS: + g_debug ("critical charge level reached, starting sound loop"); + play_loop_start (manager, + "battery-caution", + _("Battery is critically low"), + TRUE, + GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT); + break; + + default: + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); + break; + } +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_action (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + GError *error = NULL; + GIcon *icon = NULL; + GsdPowerActionType policy; + guint timer_id; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* TRANSLATORS: laptop battery is really, really, low */ + title = _("Laptop battery critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("The battery is below the critical level and " + "this computer will power-off when the " + "battery becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: computer will suspend */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to suspend.\n" + "NOTE: A small amount of power is required " + "to keep your computer in a suspended state.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action"); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is really, really, low */ + title = _("UPS critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, TRUE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("UPS is below the critical level and " + "this computer will power-off when the " + "UPS becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_ups_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action"); + } + + /* not all types have actions */ + if (title == NULL) + return; + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + UpDeviceKind kind; + UpDeviceState state; + UpDeviceState state_old; + GsdPowerManagerWarning warning_old; + GsdPowerManagerWarning warning; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because %s changed", up_device_get_object_path (device)); + device = engine_update_composite_device (manager, device); + } + + /* get device properties (may be composite) */ + g_object_get (device, + "state", &state, + NULL); + + g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state)); + + /* see if any interesting state changes have happened */ + state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old")); + if (state_old != state) { + if (state == UP_DEVICE_STATE_DISCHARGING) { + g_debug ("discharging"); + engine_ups_discharging (manager, device); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED || + state == UP_DEVICE_STATE_CHARGING) { + g_debug ("fully charged or charging, hiding notifications if any"); + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + } + + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state)); + } + + /* check the warning state has not changed */ + warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old")); + warning = engine_get_warning (manager, device); + if (warning != warning_old) { + if (warning == WARNING_LOW) { + g_debug ("** EMIT: charge-low"); + engine_charge_low (manager, device); + } else if (warning == WARNING_CRITICAL) { + g_debug ("** EMIT: charge-critical"); + engine_charge_critical (manager, device); + } else if (warning == WARNING_ACTION) { + g_debug ("charge-action"); + engine_charge_action (manager, device); + } + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning)); + } + + engine_recalculate_state (manager); +} + +static UpDevice * +engine_get_primary_device (GsdPowerManager *manager) +{ + guint i; + UpDevice *device = NULL; + UpDevice *device_tmp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + for (i=0; ipriv->devices_array->len; i++) { + device_tmp = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device_tmp, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* not present */ + if (!is_present) + continue; + + /* not discharging */ + if (state != UP_DEVICE_STATE_DISCHARGING) + continue; + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + + /* use composite device to cope with multiple batteries */ + device = g_object_ref (engine_get_composite_device (manager, device_tmp)); + break; + } + return device; +} + +static void +phone_device_added_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + UpDevice *device; + device = up_device_new (); + + g_debug ("phone added %i", idx); + + /* get device properties */ + g_object_set (device, + "kind", UP_DEVICE_KIND_PHONE, + "is-rechargeable", TRUE, + "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "is-present", TRUE, + NULL); + + /* state changed */ + engine_device_add (manager, device); + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_recalculate_state (manager); +} + +static void +phone_device_removed_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + + g_debug ("phone removed %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + g_ptr_array_remove_index (manager->priv->devices_array, i); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +phone_device_refresh_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + + g_debug ("phone refresh %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + is_present = gpm_phone_get_present (phone, idx); + state = gpm_phone_get_on_ac (phone, idx) ? UP_DEVICE_STATE_CHARGING : UP_DEVICE_STATE_DISCHARGING; + percentage = gpm_phone_get_percentage (phone, idx); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +gnome_session_shutdown_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't shutdown using gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +gnome_session_shutdown (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* ask gnome-session to show the shutdown dialog with a timeout */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to gnome-session: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Shutdown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gnome_session_shutdown_cb, NULL); + g_object_unref (proxy); +} + +static void +do_power_action_type (GsdPowerManager *manager, + GsdPowerActionType action_type) +{ + gboolean ret; + GError *error = NULL; + + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + gnome_session_shutdown (); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_SHUTDOWN: + /* this is only used on critically low battery where + * hibernate is not available and is marginally better + * than just powering down the computer mid-write */ + gsd_power_poweroff (); + break; + case GSD_POWER_ACTION_BLANK: + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off for policy action: %s", + error->message); + g_error_free (error); + } + break; + case GSD_POWER_ACTION_NOTHING: + break; + } +} + +static gboolean +upower_kbd_set_brightness (GsdPowerManager *manager, guint value, GError **error) +{ + GVariant *retval; + + /* same as before */ + if (manager->priv->kbd_brightness_now == value) + return TRUE; + + /* update h/w value */ + retval = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "SetBrightness", + g_variant_new ("(i)", (gint) value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + error); + if (retval == NULL) + return FALSE; + + /* save new value */ + manager->priv->kbd_brightness_now = value; + g_variant_unref (retval); + return TRUE; +} + +static gboolean +upower_kbd_toggle (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + if (manager->priv->kbd_brightness_old >= 0) { + g_debug ("keyboard toggle off"); + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_old, + error); + if (ret) { + /* succeeded, set to -1 since now no old value */ + manager->priv->kbd_brightness_old = -1; + } + } else { + g_debug ("keyboard toggle on"); + /* save the current value to restore later when untoggling */ + manager->priv->kbd_brightness_old = manager->priv->kbd_brightness_now; + ret = upower_kbd_set_brightness (manager, 0, error); + if (!ret) { + /* failed, reset back to -1 */ + manager->priv->kbd_brightness_old = -1; + } + } + + return ret; +} + +static void +do_lid_open_action (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-open", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been opened"), + NULL); + + /* ensure we turn the panel back on after lid open */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after lid open: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy != NULL && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_error_free (error); + } + } + + kill_lid_close_safety_timer (manager); +} + +static gboolean +is_on (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + + crtc = gnome_rr_output_get_crtc (output); + if (!crtc) + return FALSE; + return gnome_rr_crtc_get_current_mode (crtc) != NULL; +} + +static gboolean +non_laptop_outputs_are_all_off (GnomeRRScreen *screen) +{ + GnomeRROutput **outputs; + int i; + + outputs = gnome_rr_screen_list_outputs (screen); + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_laptop (outputs[i])) + continue; + + if (is_on (outputs[i])) + return FALSE; + } + + return TRUE; +} + +/* Timeout callback used to check conditions when the laptop's lid is closed but + * the machine is not suspended yet. We try to suspend again, so that the laptop + * won't overheat if placed in a backpack. + */ +static gboolean +lid_close_safety_timer_cb (GsdPowerManager *manager) +{ + manager->priv->lid_close_safety_timer_id = 0; + + g_debug ("lid has been closed for a while; trying to suspend again"); + do_lid_closed_action (manager); + + return FALSE; +} + +/* Sets up a timer to be triggered some seconds after closing the laptop lid + * when the laptop is *not* suspended for some reason. We'll check conditions + * again in the timeout handler to see if we can suspend then. + */ +static void +setup_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) + return; + + manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT, + (GSourceFunc) lid_close_safety_timer_cb, + manager); + g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer"); +} + +static void +kill_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) { + g_source_remove (manager->priv->lid_close_safety_timer_id); + manager->priv->lid_close_safety_timer_id = 0; + } +} + +static void +suspend_with_lid_closed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + GsdPowerActionType action_type; + + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-battery-action"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-ac-action"); + } + + /* check we won't melt when the lid is closed */ + if (action_type != GSD_POWER_ACTION_SUSPEND && + action_type != GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_lid_force_sleep (manager->priv->up_client)) { + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; + } else { + /* maybe lock the screen if the lid is closed */ + lock_screensaver (manager); + } + } + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off after lid close: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + do_power_action_type (manager, action_type); +} + +static void +do_lid_closed_action (GsdPowerManager *manager) +{ + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-close", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been closed"), + NULL); + + /* refresh RANDR so we get an accurate view of what monitors are plugged in when the lid is closed */ + gnome_rr_screen_refresh (manager->priv->x11_screen, NULL); /* NULL-GError */ + + /* perform policy action */ + if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor") + || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) { + g_debug ("lid is closed; suspending or hibernating"); + suspend_with_lid_closed (manager); + } else { + g_debug ("lid is closed; not suspending nor hibernating since some external monitor outputs are still active"); + setup_lid_close_safety_timer (manager); + } +} + + +static void +up_client_changed_cb (UpClient *client, GsdPowerManager *manager) +{ + gboolean tmp; + + if (!up_client_get_on_battery (client)) { + /* if we are playing a critical charge sound loop on AC, stop it */ + if (manager->priv->critical_alert_timeout_id > 0) { + g_debug ("stopping alert loop due to ac being present"); + play_loop_stop (manager); + } + notify_close_if_showing (manager->priv->notification_low); + } + + /* same state */ + tmp = up_client_get_lid_is_closed (manager->priv->up_client); + if (manager->priv->lid_is_closed == tmp) + return; + manager->priv->lid_is_closed = tmp; + + /* fake a keypress */ + if (tmp) + do_lid_closed_action (manager); + else + do_lid_open_action (manager); +} + +typedef enum { + SESSION_STATUS_CODE_AVAILABLE = 0, + SESSION_STATUS_CODE_INVISIBLE, + SESSION_STATUS_CODE_BUSY, + SESSION_STATUS_CODE_IDLE, + SESSION_STATUS_CODE_UNKNOWN +} SessionStatusCode; + +typedef enum { + SESSION_INHIBIT_MASK_LOGOUT = 1, + SESSION_INHIBIT_MASK_SWITCH = 2, + SESSION_INHIBIT_MASK_SUSPEND = 4, + SESSION_INHIBIT_MASK_IDLE = 8 +} SessionInhibitMask; + +static const gchar * +idle_mode_to_string (GsdPowerIdleMode mode) +{ + if (mode == GSD_POWER_IDLE_MODE_NORMAL) + return "normal"; + if (mode == GSD_POWER_IDLE_MODE_DIM) + return "dim"; + if (mode == GSD_POWER_IDLE_MODE_BLANK) + return "blank"; + if (mode == GSD_POWER_IDLE_MODE_SLEEP) + return "sleep"; + return "unknown"; +} + +static GnomeRROutput * +get_primary_output (GsdPowerManager *manager) +{ + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + guint i; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL) + goto out; + + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i]) && + gnome_rr_output_is_laptop (outputs[i]) && + gnome_rr_output_get_backlight_min (outputs[i]) >= 0 && + gnome_rr_output_get_backlight_max (outputs[i]) > 0) { + output = outputs[i]; + break; + } + } +out: + return output; +} + +/** + * backlight_helper_get_value: + * + * Gets a brightness value from the PolicyKit helper. + * + * Return value: the signed integer value from the helper, or -1 + * for failure. If -1 then @error is set. + **/ +static gint64 +backlight_helper_get_value (const gchar *argument, GError **error) +{ + gboolean ret; + gchar *stdout_data = NULL; + gint exit_status = 0; + gint64 value = -1; + gchar *command = NULL; + gchar *endptr = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf (LIBEXECDIR "/gsd-backlight-helper --%s", + argument); + ret = g_spawn_command_line_sync (command, + &stdout_data, + NULL, + &exit_status, + error); + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret) + goto out; + + if (WEXITSTATUS (exit_status) != 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "gsd-backlight-helper failed: %s", + stdout_data ? stdout_data : "No reason"); + goto out; + } + + /* parse */ + value = g_ascii_strtoll (stdout_data, &endptr, 10); + + /* parsing error */ + if (endptr == stdout_data) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to parse value: %s", + stdout_data); + goto out; + } + + /* out of range */ + if (value > G_MAXINT) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value out of range: %s", + stdout_data); + goto out; + } + + /* Fetching the value failed, for some other reason */ + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value negative, but helper did not fail: %s", + stdout_data); + goto out; + } + +out: + g_free (command); + g_free (stdout_data); + return value; +} + +/** + * backlight_helper_set_value: + * + * Sets a brightness value using the PolicyKit helper. + * + * Return value: Success. If FALSE then @error is set. + **/ +static gboolean +backlight_helper_set_value (const gchar *argument, + gint value, + GError **error) +{ + gboolean ret; + gint exit_status = 0; + gchar *command = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-backlight-helper --%s %i", + argument, value); + ret = g_spawn_command_line_sync (command, + NULL, + NULL, + &exit_status, + error); + + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret || WEXITSTATUS (exit_status) != 0) + goto out; + +out: + g_free (command); + return ret; +} + +static gint +backlight_get_abs (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + return gnome_rr_output_get_backlight (output, + error); + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-brightness", error); +} + +static gint +backlight_get_percentage (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gint now; + gint value = -1; + gint min = 0; + gint max; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); +out: + return value; +} + +static gint +backlight_get_min (GsdPowerManager *manager) +{ + GnomeRROutput *output; + + /* if we have no xbacklight device, then hardcode zero as sysfs + * offsets everything to 0 as min */ + output = get_primary_output (manager); + if (output == NULL) + return 0; + + /* get xbacklight value, which maybe non-zero */ + return gnome_rr_output_get_backlight_min (output); +} + +static gint +backlight_get_max (GsdPowerManager *manager, GError **error) +{ + gint value; + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + value = gnome_rr_output_get_backlight_max (output); + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to get backlight max"); + } + return value; + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-max-brightness", error); +} + +static void +backlight_emit_changed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + ret = g_dbus_connection_emit_signal (manager->priv->connection, + GSD_DBUS_SERVICE, + GSD_POWER_DBUS_PATH, + GSD_POWER_DBUS_INTERFACE_SCREEN, + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit Changed: %s", error->message); + g_error_free (error); + } +} + +static gboolean +backlight_set_percentage (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint min = 0; + gint max; + guint discrete; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + if (min < 0 || max < 0) { + g_warning ("no xrandr backlight capability"); + goto out; + } + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gint +backlight_step_up (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_step_down (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_set_abs (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + ret = gnome_rr_output_set_backlight (output, + value, + error); + goto out; + } + + /* fall back to the polkit helper */ + ret = backlight_helper_set_value ("set-brightness", + value, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gboolean +display_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gint min; + gint max; + gint now; + gint idle; + gboolean ret = FALSE; + + now = backlight_get_abs (manager, error); + if (now < 0) { + goto out; + } + + /* is the dim brightness actually *dimmer* than the + * brightness we have now? */ + min = backlight_get_min (manager); + max = backlight_get_max (manager, error); + if (max < 0) { + goto out; + } + idle = PERCENTAGE_TO_ABS (min, max, idle_percentage); + if (idle > now) { + g_debug ("brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + ret = TRUE; + goto out; + } + ret = backlight_set_abs (manager, + idle, + FALSE, + error); + if (!ret) { + goto out; + } + + /* save for undim */ + manager->priv->pre_dim_brightness = now; + +out: + return ret; +} + +static gboolean +kbd_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gboolean ret; + gint idle; + gint max; + gint now; + + if (manager->priv->upower_kdb_proxy == NULL) + return TRUE; + + now = manager->priv->kbd_brightness_now; + max = manager->priv->kbd_brightness_max; + idle = PERCENTAGE_TO_ABS (0, max, idle_percentage); + if (idle > now) { + g_debug ("kbd brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + return TRUE; + } + ret = upower_kbd_set_brightness (manager, idle, error); + if (!ret) + return FALSE; + + /* save for undim */ + manager->priv->kbd_brightness_pre_dim = now; + return TRUE; +} + +static void +idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode) +{ + gboolean ret = FALSE; + GError *error = NULL; + gint idle_percentage; + GsdPowerActionType action_type; + GnomeSettingsSessionState state; + + if (mode == manager->priv->current_idle_mode) + return; + + /* Ignore attempts to set "less idle" modes */ + if (mode < manager->priv->current_idle_mode && + mode != GSD_POWER_IDLE_MODE_NORMAL) + return; + + /* ensure we're still on an active console */ + state = gnome_settings_session_get_state (manager->priv->session); + if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) { + g_debug ("ignoring state transition to %s as inactive", + idle_mode_to_string (mode)); + return; + } + + manager->priv->current_idle_mode = mode; + g_debug ("Doing a state transition: %s", idle_mode_to_string (mode)); + + /* don't do any power saving if we're a VM */ + if (manager->priv->is_virtual_machine) { + g_debug ("ignoring state transition to %s as virtual machine", + idle_mode_to_string (mode)); + return; + } + + /* save current brightness, and set dim level */ + if (mode == GSD_POWER_IDLE_MODE_DIM) { + + /* have we disabled the action */ + if (up_client_get_on_battery (manager->priv->up_client)) { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-battery"); + } else { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-ac"); + } + if (!ret) { + g_debug ("not dimming due to policy"); + return; + } + + /* display backlight */ + idle_percentage = g_settings_get_int (manager->priv->settings, + "idle-brightness"); + ret = display_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* keyboard backlight */ + ret = kbd_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim kbd backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* turn off screen and kbd */ + } else if (mode == GSD_POWER_IDLE_MODE_BLANK) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + /* sleep */ + } else if (mode == GSD_POWER_IDLE_MODE_SLEEP) { + + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-battery-type"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-ac-type"); + } + do_power_action_type (manager, action_type); + + /* turn on screen and restore user-selected brightness level */ + } else if (mode == GSD_POWER_IDLE_MODE_NORMAL) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on: %s", + error->message); + g_clear_error (&error); + } + + /* reset brightness if we dimmed */ + if (manager->priv->pre_dim_brightness >= 0) { + ret = backlight_set_abs (manager, + manager->priv->pre_dim_brightness, + FALSE, + &error); + if (!ret) { + g_warning ("failed to restore backlight to %i: %s", + manager->priv->pre_dim_brightness, + error->message); + g_clear_error (&error); + } else { + manager->priv->pre_dim_brightness = -1; + } + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_clear_error (&error); + } + } + + /* reset kbd brightness if we dimmed */ + if (manager->priv->kbd_brightness_pre_dim >= 0) { + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_pre_dim, + &error); + if (!ret) { + g_warning ("failed to restore kbd backlight to %i: %s", + manager->priv->kbd_brightness_pre_dim, + error->message); + g_error_free (error); + } + manager->priv->kbd_brightness_pre_dim = -1; + } + + } +} + +static gboolean +idle_is_session_idle (GsdPowerManager *manager) +{ + gboolean ret; + GVariant *result; + guint status; + + /* not yet connected to gnome-session */ + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("session idleness not available, gnome-session is not available"); + return FALSE; + } + + /* get the session status */ + result = g_dbus_proxy_get_cached_property (manager->priv->session_presence_proxy, + "status"); + if (result == NULL) { + g_warning ("no readable status property on %s", + g_dbus_proxy_get_interface_name (manager->priv->session_presence_proxy)); + return FALSE; + } + + g_variant_get (result, "u", &status); + ret = (status == SESSION_STATUS_CODE_IDLE); + g_variant_unref (result); + + return ret; +} + +static gboolean +idle_is_session_inhibited (GsdPowerManager *manager, guint mask) +{ + gboolean ret; + GVariant *retval = NULL; + GError *error = NULL; + + /* not yet connected to gnome-session */ + if (manager->priv->session_proxy == NULL) { + g_warning ("session inhibition not available, gnome-session is not available"); + return FALSE; + } + + retval = g_dbus_proxy_call_sync (manager->priv->session_proxy, + "IsInhibited", + g_variant_new ("(u)", + mask), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + &error); + if (retval == NULL) { + /* abort as the DBUS method failed */ + g_warning ("IsInhibited failed: %s", error->message); + g_error_free (error); + return FALSE; + } + + g_variant_get (retval, "(b)", &ret); + g_variant_unref (retval); + + return ret; +} + +/** + * idle_adjust_timeout: + * @idle_time: Current idle time, in seconds. + * @timeout: The new timeout we want to set, in seconds. + * + * On slow machines, or machines that have lots to load duing login, + * the current idle time could be bigger than the requested timeout. + * In this case the scheduled idle timeout will never fire, unless + * some user activity (keyboard, mouse) resets the current idle time. + * Instead of relying on user activity to correct this issue, we need + * to adjust timeout, as related to current idle time, so the idle + * timeout will fire as designed. + * + * Return value: timeout to set, adjusted acccording to current idle time. + **/ +static guint +idle_adjust_timeout (guint idle_time, guint timeout) +{ + /* allow 2 sec margin for messaging delay. */ + idle_time += 2; + + /* Double timeout until it's larger than current idle time. + * Give up for ultra slow machines. (86400 sec = 24 hours) */ + while (timeout < idle_time && + timeout < 86400 && + timeout > 0) { + timeout *= 2; + } + return timeout; +} + +/** + * idle_adjust_timeout_blank: + * @idle_time: current idle time, in seconds. + * @timeout: the new timeout we want to set, in seconds. + * + * Same as idle_adjust_timeout(), but also accounts for the duration + * of the fading animation in the screensaver (so that blanking happens + * exactly at the end of it, if configured with the same timeouts) + */ +static guint +idle_adjust_timeout_blank (guint idle_time, guint timeout) +{ + return idle_adjust_timeout (idle_time, + timeout + SCREENSAVER_FADE_TIME); +} + +static void +idle_configure (GsdPowerManager *manager) +{ + gboolean is_idle_inhibited; + guint current_idle_time; + guint timeout_blank; + guint timeout_sleep; + gboolean on_battery; + + /* are we inhibited from going idle */ + is_idle_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_IDLE); + if (is_idle_inhibited) { + g_debug ("inhibited, so using normal state"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); + + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + return; + } + + current_idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + + /* set up blank callback even when session is not idle, + * but only if we actually want to blank. */ + on_battery = up_client_get_on_battery (manager->priv->up_client); + if (on_battery) { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-battery"); + } else { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-ac"); + } + if (timeout_blank != 0) { + g_debug ("setting up blank callback for %is", timeout_blank); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID, + idle_adjust_timeout_blank (current_idle_time, timeout_blank) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + } + + /* only do the sleep timeout when the session is idle + * and we aren't inhibited from sleeping */ + if (on_battery) { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-battery-timeout"); + } else { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-ac-timeout"); + } + if (timeout_sleep != 0) { + g_debug ("setting up sleep callback %is", timeout_sleep); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID, + idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + } +} + +/** + * @timeout: The new timeout we want to set, in seconds + **/ +static gboolean +idle_set_timeout_dim (GsdPowerManager *manager, guint timeout) +{ + guint idle_time; + + idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + if (idle_time == 0) + return FALSE; + + g_debug ("Setting dim idle timeout: %ds", timeout); + if (timeout > 0) { + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID, + idle_adjust_timeout (idle_time, timeout) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID); + } + return TRUE; +} + +static void +refresh_idle_dim_settings (GsdPowerManager *manager) +{ + gint timeout_dim; + timeout_dim = g_settings_get_int (manager->priv->settings, + "idle-dim-time"); + g_debug ("idle dim set with timeout %i", timeout_dim); + idle_set_timeout_dim (manager, timeout_dim); +} + +static void +gsd_power_manager_class_init (GsdPowerManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_power_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPowerManagerPrivate)); +} + +static void +sleep_cb_screensaver_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->screensaver_proxy == NULL) { + g_warning ("Could not connect to gnome-screensaver: %s", + error->message); + g_error_free (error); + return; + } + + /* Finish the upower_notify_sleep_cb() call by locking the screen */ + g_debug ("gnome-screensaver activated, doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); +} + +static void +idle_dbus_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 || + g_strcmp0 (signal_name, "InhibitorRemoved") == 0) { + g_debug ("Received gnome session inhibitor change"); + idle_configure (manager); + } + if (g_strcmp0 (signal_name, "StatusChanged") == 0) { + guint status; + + g_variant_get (parameters, "(u)", &status); + g_dbus_proxy_set_cached_property (proxy, "status", + g_variant_new ("u", status)); + g_debug ("Received gnome session status change"); + idle_configure (manager); + } +} + +static void +session_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_proxy == NULL) { + g_warning ("Could not connect to gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (manager->priv->session_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); + } + + idle_configure (manager); +} + +static void +session_presence_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_presence_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("Could not connect to gnome-sesson: %s", + error->message); + g_error_free (error); + return; + } + g_signal_connect (manager->priv->session_presence_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); +} + +static void +power_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *k_now = NULL; + GVariant *k_max = NULL; + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_kdb_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_kdb_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + goto out; + } + + k_now = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_now == NULL) { + if (error->domain != G_DBUS_ERROR || + error->code != G_DBUS_ERROR_UNKNOWN_METHOD) { + g_warning ("Failed to get brightness: %s", + error->message); + } + g_error_free (error); + goto out; + } + + k_max = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetMaxBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_max == NULL) { + g_warning ("Failed to get max brightness: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (k_now, "(i)", &manager->priv->kbd_brightness_now); + g_variant_get (k_max, "(i)", &manager->priv->kbd_brightness_max); + + /* set brightness to max if not currently set so is something + * sensible */ + if (manager->priv->kbd_brightness_now <= 0) { + gboolean ret; + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_max, + &error); + if (!ret) { + g_warning ("failed to initialize kbd backlight to %i: %s", + manager->priv->kbd_brightness_max, + error->message); + g_error_free (error); + } + } +out: + if (k_now != NULL) + g_variant_unref (k_now); + if (k_max != NULL) + g_variant_unref (k_max); +} + +static void +lock_screensaver (GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "lock-enabled"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_sleep_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "ubuntu-lock-on-suspend"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_resume_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* this displays the unlock dialogue so the user doesn't have + * to move the mouse or press any key before the window comes up */ + if (manager->priv->screensaver_proxy != NULL) { + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "SimulateUserActivity", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + } + + /* close existing notifications on resume, the system power + * state is probably different now */ + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after resume: %s", + error->message); + g_error_free (error); + } +} + +static void +idle_send_to_sleep (GsdPowerManager *manager) +{ + gboolean is_inhibited; + gboolean is_idle; + + /* check the session is not now inhibited */ + is_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_SUSPEND); + if (is_inhibited) { + g_debug ("suspend inhibited"); + return; + } + + /* check the session is really idle*/ + is_idle = idle_is_session_idle (manager); + if (!is_idle) { + g_debug ("session is not idle, cannot SLEEP"); + return; + } + + /* send to sleep, and cancel timeout */ + g_debug ("sending to SLEEP"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP); +} + +static void +idle_idletime_alarm_expired_cb (GpmIdletime *idletime, + guint alarm_id, + GsdPowerManager *manager) +{ + g_debug ("idletime alarm: %i", alarm_id); + + switch (alarm_id) { + case GSD_POWER_IDLETIME_DIM_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM); + break; + case GSD_POWER_IDLETIME_BLANK_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK); + break; + case GSD_POWER_IDLETIME_SLEEP_ID: + idle_send_to_sleep (manager); + break; + } +} + +static void +idle_idletime_reset_cb (GpmIdletime *idletime, + GsdPowerManager *manager) +{ + g_debug ("idletime reset"); + + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +static void +engine_settings_key_changed_cb (GSettings *settings, + const gchar *key, + GsdPowerManager *manager) +{ + if (g_strcmp0 (key, "use-time-for-policy") == 0) { + manager->priv->use_time_primary = g_settings_get_boolean (settings, key); + return; + } + if (g_strcmp0 (key, "idle-dim-time") == 0) { + refresh_idle_dim_settings (manager); + return; + } + if (g_str_has_prefix (key, "sleep-inactive") || + g_str_has_prefix (key, "sleep-display")) { + idle_configure (manager); + return; + } +} + +static void +engine_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdPowerManager *manager) +{ + /* when doing the fast-user-switch into a new account, + * ensure the new account is undimmed and with the backlight on */ + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +/* This timer goes off every few minutes, whether the user is idle or not, + to try and clean up anything that has gone wrong. + + It calls disable_builtin_screensaver() so that if xset has been used, + or some other program (like xlock) has messed with the XSetScreenSaver() + settings, they will be set back to sensible values (if a server extension + is in use, messing with xlock can cause the screensaver to never get a wakeup + event, and could cause monitor power-saving to occur, and all manner of + heinousness.) + + This code was originally part of gnome-screensaver, see + http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530 + */ +static gboolean +disable_builtin_screensaver (gpointer unused) +{ + int current_server_timeout, current_server_interval; + int current_prefer_blank, current_allow_exp; + int desired_server_timeout, desired_server_interval; + int desired_prefer_blank, desired_allow_exp; + + XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + ¤t_server_timeout, + ¤t_server_interval, + ¤t_prefer_blank, + ¤t_allow_exp); + + desired_server_timeout = current_server_timeout; + desired_server_interval = current_server_interval; + desired_prefer_blank = current_prefer_blank; + desired_allow_exp = current_allow_exp; + + desired_server_interval = 0; + + /* I suspect (but am not sure) that DontAllowExposures might have + something to do with powering off the monitor as well, at least + on some systems that don't support XDPMS? Who know... */ + desired_allow_exp = AllowExposures; + + /* When we're not using an extension, set the server-side timeout to 0, + so that the server never gets involved with screen blanking, and we + do it all ourselves. (However, when we *are* using an extension, + we tell the server when to notify us, and rather than blanking the + screen, the server will send us an X event telling us to blank.) + */ + desired_server_timeout = 0; + + if (desired_server_timeout != current_server_timeout + || desired_server_interval != current_server_interval + || desired_prefer_blank != current_prefer_blank + || desired_allow_exp != current_allow_exp) { + + g_debug ("disabling server builtin screensaver:" + " (xset s %d %d; xset s %s; xset s %s)", + desired_server_timeout, + desired_server_interval, + (desired_prefer_blank ? "blank" : "noblank"), + (desired_allow_exp ? "expose" : "noexpose")); + + XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + desired_server_timeout, + desired_server_interval, + desired_prefer_blank, + desired_allow_exp); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + } + + return TRUE; +} + +static gboolean +is_hardware_a_virtual_machine (void) +{ + const gchar *str; + gboolean ret = FALSE; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.systemd1.Manager", + "Virtualization"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Virtualization", error->message); + g_error_free (error); + goto out; + } + + /* on bare-metal hardware this is the empty string, + * otherwise an identifier such as "kvm", "vmware", etc. */ + g_variant_get (variant, "(v)", &inner); + str = g_variant_get_string (inner, NULL); + if (str != NULL && str[0] != '\0') + ret = TRUE; +out: + if (connection != NULL) + g_object_unref (connection); + if (variant != NULL) + g_variant_unref (variant); + return ret; +} + +gboolean +gsd_power_manager_start (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting power manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (manager->priv->x11_screen == NULL) + return FALSE; + + /* track the active session */ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (engine_session_active_changed_cb), + manager); + + manager->priv->kbd_brightness_old = -1; + manager->priv->kbd_brightness_pre_dim = -1; + manager->priv->pre_dim_brightness = -1; + manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA); + g_signal_connect (manager->priv->settings, "changed", + G_CALLBACK (engine_settings_key_changed_cb), manager); + manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver"); + manager->priv->up_client = up_client_new (); + g_signal_connect (manager->priv->up_client, "notify-sleep", + G_CALLBACK (upower_notify_sleep_cb), manager); + g_signal_connect (manager->priv->up_client, "notify-resume", + G_CALLBACK (upower_notify_resume_cb), manager); + manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client); + g_signal_connect (manager->priv->up_client, "device-added", + G_CALLBACK (engine_device_added_cb), manager); + g_signal_connect (manager->priv->up_client, "device-removed", + G_CALLBACK (engine_device_removed_cb), manager); + g_signal_connect (manager->priv->up_client, "device-changed", + G_CALLBACK (engine_device_changed_cb), manager); + g_signal_connect_after (manager->priv->up_client, "changed", + G_CALLBACK (up_client_changed_cb), manager); + + /* use the fallback name from gnome-power-manager so the shell + * blocks this, and uses the power extension instead */ + manager->priv->status_icon = gtk_status_icon_new (); + gtk_status_icon_set_name (manager->priv->status_icon, + "gnome-power-manager"); + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH, + UPOWER_DBUS_INTERFACE, + NULL, + power_proxy_ready_cb, + manager); + + /* connect to UPower for keyboard backlight control */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH_KBDBACKLIGHT, + UPOWER_DBUS_INTERFACE_KBDBACKLIGHT, + NULL, + power_keyboard_proxy_ready_cb, + manager); + + /* connect to the session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + session_proxy_ready_cb, + manager); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + 0, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH_PRESENCE, + GNOME_SESSION_DBUS_INTERFACE_PRESENCE, + NULL, + session_presence_proxy_ready_cb, + manager); + + manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref); + manager->priv->canberra_context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + + manager->priv->phone = gpm_phone_new (); + g_signal_connect (manager->priv->phone, "device-added", + G_CALLBACK (phone_device_added_cb), manager); + g_signal_connect (manager->priv->phone, "device-removed", + G_CALLBACK (phone_device_removed_cb), manager); + g_signal_connect (manager->priv->phone, "device-refresh", + G_CALLBACK (phone_device_refresh_cb), manager); + + /* create a fake virtual composite battery */ + manager->priv->device_composite = up_device_new (); + g_object_set (manager->priv->device_composite, + "kind", UP_DEVICE_KIND_BATTERY, + "is-rechargeable", TRUE, + "native-path", "dummy:composite_battery", + "power-supply", TRUE, + "is-present", TRUE, + NULL); + + /* get percentage policy */ + manager->priv->low_percentage = g_settings_get_int (manager->priv->settings, + "percentage-low"); + manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings, + "percentage-critical"); + manager->priv->action_percentage = g_settings_get_int (manager->priv->settings, + "percentage-action"); + + /* get time policy */ + manager->priv->low_time = g_settings_get_int (manager->priv->settings, + "time-low"); + manager->priv->critical_time = g_settings_get_int (manager->priv->settings, + "time-critical"); + manager->priv->action_time = g_settings_get_int (manager->priv->settings, + "time-action"); + + /* we can disable this if the time remaining is inaccurate or just plain wrong */ + manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings, + "use-time-for-policy"); + + /* create IDLETIME watcher */ + manager->priv->idletime = gpm_idletime_new (); + g_signal_connect (manager->priv->idletime, "reset", + G_CALLBACK (idle_idletime_reset_cb), manager); + g_signal_connect (manager->priv->idletime, "alarm-expired", + G_CALLBACK (idle_idletime_alarm_expired_cb), manager); + + /* ensure the default dpms timeouts are cleared */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + error); + if (!ret) { + g_warning ("Failed set DPMS mode: %s", (*error)->message); + g_clear_error (error); + } + + /* coldplug the engine */ + engine_coldplug (manager); + + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); + /* don't blank inside a VM */ + manager->priv->is_virtual_machine = is_hardware_a_virtual_machine (); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_power_manager_stop (GsdPowerManager *manager) +{ + g_debug ("Stopping power manager"); + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + kill_lid_close_safety_timer (manager); + + g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager); + + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->session); + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->settings_screensaver); + g_clear_object (&manager->priv->up_client); + g_clear_object (&manager->priv->x11_screen); + + g_ptr_array_unref (manager->priv->devices_array); + manager->priv->devices_array = NULL; + g_clear_object (&manager->priv->phone); + g_clear_object (&manager->priv->device_composite); + g_clear_object (&manager->priv->previous_icon); + + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = NULL; + + g_clear_object (&manager->priv->upower_proxy); + g_clear_object (&manager->priv->session_proxy); + g_clear_object (&manager->priv->session_presence_proxy); + + if (manager->priv->critical_alert_timeout_id > 0) { + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } + g_signal_handlers_disconnect_by_func (manager->priv->idletime, + idle_idletime_reset_cb, + manager); + g_signal_handlers_disconnect_by_func (manager->priv->idletime, + idle_idletime_alarm_expired_cb, + manager); + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); + + if (manager->priv->xscreensaver_watchdog_timer_id > 0) { + g_source_remove (manager->priv->xscreensaver_watchdog_timer_id); + manager->priv->xscreensaver_watchdog_timer_id = 0; + } +} + +static void +gsd_power_manager_init (GsdPowerManager *manager) +{ + manager->priv = GSD_POWER_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_power_manager_finalize (GObject *object) +{ + GsdPowerManager *manager; + + manager = GSD_POWER_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + + G_OBJECT_CLASS (gsd_power_manager_parent_class)->finalize (object); +} + +/* returns new level */ +static void +handle_method_call_keyboard (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint step; + gint value = -1; + gboolean ret; + guint percentage; + GError *error = NULL; + + if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("keyboard step up"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MIN (manager->priv->kbd_brightness_now + step, + manager->priv->kbd_brightness_max); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("keyboard step down"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MAX (manager->priv->kbd_brightness_now - step, 0); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "Toggle") == 0) { + ret = upower_kbd_toggle (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (!ret) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + percentage = ABS_TO_PERCENTAGE (0, + manager->priv->kbd_brightness_max, + value); + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + percentage)); + } +} + +static void +handle_method_call_screen (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gboolean ret = FALSE; + gint value = -1; + guint value_tmp; + GError *error = NULL; + + if (g_strcmp0 (method_name, "GetPercentage") == 0) { + g_debug ("screen get percentage"); + value = backlight_get_percentage (manager, &error); + + } else if (g_strcmp0 (method_name, "SetPercentage") == 0) { + g_debug ("screen set percentage"); + g_variant_get (parameters, "(u)", &value_tmp); + ret = backlight_set_percentage (manager, value_tmp, TRUE, &error); + if (ret) + value = value_tmp; + + } else if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("screen step up"); + value = backlight_step_up (manager, &error); + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("screen step down"); + value = backlight_step_down (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (value < 0) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + value)); + } +} + +static GVariant * +device_to_variant_blob (UpDevice *device) +{ + const gchar *object_path; + gchar *device_icon; + gdouble percentage; + GIcon *icon; + guint64 time_empty, time_full; + guint64 time_state = 0; + GVariant *value; + UpDeviceKind kind; + UpDeviceState state; + + icon = gpm_upower_get_device_icon (device, TRUE); + device_icon = g_icon_to_string (icon); + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "state", &state, + "time-to-empty", &time_empty, + "time-to-full", &time_full, + NULL); + + /* only return time for these simple states */ + if (state == UP_DEVICE_STATE_DISCHARGING) + time_state = time_empty; + else if (state == UP_DEVICE_STATE_CHARGING) + time_state = time_full; + + /* get an object path, even for the composite device */ + object_path = up_device_get_object_path (device); + if (object_path == NULL) + object_path = GSD_DBUS_PATH; + + /* format complex object */ + value = g_variant_new ("(susdut)", + object_path, + kind, + device_icon, + percentage, + state, + time_state); + g_free (device_icon); + g_object_unref (icon); + return value; +} + +static void +handle_method_call_main (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GPtrArray *array; + guint i; + GVariantBuilder *builder; + GVariant *tuple = NULL; + GVariant *value = NULL; + UpDevice *device; + + /* return object */ + if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) { + + /* get the virtual device */ + device = engine_get_primary_device (manager); + if (device == NULL) { + g_dbus_method_invocation_return_dbus_error (invocation, + "org.gnome.SettingsDaemon.Power.Failed", + "There is no primary device."); + return; + } + + /* return the value */ + value = device_to_variant_blob (device); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_object_unref (device); + return; + } + + /* return array */ + if (g_strcmp0 (method_name, "GetDevices") == 0) { + + /* create builder */ + builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)")); + + /* add each tuple to the array */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + value = device_to_variant_blob (device); + g_variant_builder_add_value (builder, value); + } + + /* return the value */ + value = g_variant_builder_end (builder); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_variant_builder_unref (builder); + return; + } + + g_assert_not_reached (); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for Power", + interface_name, method_name); + + if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE) == 0) { + handle_method_call_main (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_SCREEN) == 0) { + handle_method_call_screen (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_KEYBOARD) == 0) { + handle_method_call_keyboard (manager, + method_name, + parameters, + invocation); + } else { + g_warning ("not recognised interface: %s", interface_name); + } +} + +static GVariant * +handle_get_property (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + GVariant *retval = NULL; + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return NULL; + } + + if (g_strcmp0 (property_name, "Icon") == 0) { + retval = engine_get_icon_property_variant (manager); + } else if (g_strcmp0 (property_name, "Tooltip") == 0) { + retval = engine_get_tooltip_property_variant (manager); + } + + return retval; +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdPowerManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + guint i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_POWER_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdPowerManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdPowerManager * +gsd_power_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_POWER_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + return GSD_POWER_MANAGER (manager_object); +} diff --git a/.pc/power-no-fallback-notifications.patch/plugins/power/gsd-power-manager.c b/.pc/power-no-fallback-notifications.patch/plugins/power/gsd-power-manager.c new file mode 100644 index 00000000..91a3d445 --- /dev/null +++ b/.pc/power-no-fallback-notifications.patch/plugins/power/gsd-power-manager.c @@ -0,0 +1,4397 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * Copyright (C) 2011 Ritesh Khadgaray + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gpm-common.h" +#include "gpm-phone.h" +#include "gpm-idletime.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-enums.h" +#include "gsd-power-manager.h" +#include "gsd-power-helper.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_PATH_PRESENCE "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE_PRESENCE "org.gnome.SessionManager.Presence" + +#define UPOWER_DBUS_NAME "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_PATH_KBDBACKLIGHT "/org/freedesktop/UPower/KbdBacklight" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DBUS_INTERFACE_KBDBACKLIGHT "org.freedesktop.UPower.KbdBacklight" + +#define GSD_POWER_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power" + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_POWER_DBUS_PATH GSD_DBUS_PATH "/Power" +#define GSD_POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#define GSD_POWER_DBUS_INTERFACE_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_POWER_DBUS_INTERFACE_KEYBOARD "org.gnome.SettingsDaemon.Power.Keyboard" + +#define GS_DBUS_NAME "org.gnome.ScreenSaver" +#define GS_DBUS_PATH "/org/gnome/ScreenSaver" +#define GS_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER 0 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */ + +#define GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ +#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */ +#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + +/* Keep this in sync with gnome-shell */ +#define SCREENSAVER_FADE_TIME 10 /* seconds */ + +#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */ + +enum { + GSD_POWER_IDLETIME_NULL_ID, + GSD_POWER_IDLETIME_DIM_ID, + GSD_POWER_IDLETIME_BLANK_ID, + GSD_POWER_IDLETIME_SLEEP_ID +}; + +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +/* on ACPI machines we have 4-16 levels, on others it's ~150 */ +#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) + +/* take a discrete value with offset and convert to percentage */ +static int +abs_to_percentage (int min, int max, int value) +{ + g_return_val_if_fail (max > min, -1); + g_return_val_if_fail (value >= min, -1); + g_return_val_if_fail (value <= max, -1); + return (((value - min) * 100) / (max - min)); +} +#define ABS_TO_PERCENTAGE(min, max, value) abs_to_percentage(min, max, value) +#define PERCENTAGE_TO_ABS(min, max, value) (min + (((max - min) * value) / 100)) + +#define GSD_POWER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerPrivate)) + +typedef enum { + GSD_POWER_IDLE_MODE_NORMAL, + GSD_POWER_IDLE_MODE_DIM, + GSD_POWER_IDLE_MODE_BLANK, + GSD_POWER_IDLE_MODE_SLEEP +} GsdPowerIdleMode; + +struct GsdPowerManagerPrivate +{ + GnomeSettingsSession *session; + gboolean lid_is_closed; + GSettings *settings; + GSettings *settings_screensaver; + UpClient *up_client; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *upower_proxy; + GDBusProxy *upower_kdb_proxy; + gint kbd_brightness_now; + gint kbd_brightness_max; + gint kbd_brightness_old; + gint kbd_brightness_pre_dim; + GnomeRRScreen *x11_screen; + gboolean use_time_primary; + gchar *previous_summary; + GIcon *previous_icon; + GpmPhone *phone; + GPtrArray *devices_array; + guint action_percentage; + guint action_time; + guint critical_percentage; + guint critical_time; + guint low_percentage; + guint low_time; + gint pre_dim_brightness; /* level, not percentage */ + UpDevice *device_composite; + NotifyNotification *notification_discharging; + NotifyNotification *notification_low; + ca_context *canberra_context; + ca_proplist *critical_alert_loop_props; + guint32 critical_alert_timeout_id; + GDBusProxy *screensaver_proxy; + GDBusProxy *session_proxy; + GDBusProxy *session_presence_proxy; + GpmIdletime *idletime; + GsdPowerIdleMode current_idle_mode; + guint lid_close_safety_timer_id; + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; +}; + +enum { + PROP_0, +}; + +static void gsd_power_manager_class_init (GsdPowerManagerClass *klass); +static void gsd_power_manager_init (GsdPowerManager *power_manager); +static void gsd_power_manager_finalize (GObject *object); + +static UpDevice *engine_get_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static UpDevice *engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static GIcon *engine_get_icon (GsdPowerManager *manager); +static gchar *engine_get_summary (GsdPowerManager *manager); +static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type); +static void do_lid_closed_action (GsdPowerManager *manager); +static void lock_screensaver (GsdPowerManager *manager); +static void kill_lid_close_safety_timer (GsdPowerManager *manager); + +G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gsd_power_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_power_manager_error"); + return quark; +} + +static gboolean +play_loop_timeout_cb (GsdPowerManager *manager) +{ + ca_context *context; + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play_full (context, 0, + manager->priv->critical_alert_loop_props, + NULL, + NULL); + return TRUE; +} + +static gboolean +play_loop_stop (GsdPowerManager *manager) +{ + if (manager->priv->critical_alert_timeout_id == 0) { + g_warning ("no sound loop present to stop"); + return FALSE; + } + + g_source_remove (manager->priv->critical_alert_timeout_id); + ca_proplist_destroy (manager->priv->critical_alert_loop_props); + + manager->priv->critical_alert_loop_props = NULL; + manager->priv->critical_alert_timeout_id = 0; + + return TRUE; +} + +static gboolean +play_loop_start (GsdPowerManager *manager, + const gchar *id, + const gchar *desc, + gboolean force, + guint timeout) +{ + ca_context *context; + + if (timeout == 0) { + g_warning ("received invalid timeout"); + return FALSE; + } + + /* if a sound loop is already running, stop the existing loop */ + if (manager->priv->critical_alert_timeout_id != 0) { + g_warning ("was instructed to play a sound loop with one already playing"); + play_loop_stop (manager); + } + + ca_proplist_create (&(manager->priv->critical_alert_loop_props)); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_ID, id); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_DESCRIPTION, desc); + + manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout, + (GSourceFunc) play_loop_timeout_cb, + manager); + g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, + "[GsdPowerManager] play-loop"); + + /* play the sound, using sounds from the naming spec */ + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play (context, 0, + CA_PROP_EVENT_ID, id, + CA_PROP_EVENT_DESCRIPTION, desc, NULL); + return TRUE; +} + +static void +notify_close_if_showing (NotifyNotification *notification) +{ + gboolean ret; + GError *error = NULL; + + if (notification == NULL) + return; + ret = notify_notification_close (notification, &error); + if (!ret) { + g_warning ("failed to close notification: %s", + error->message); + g_error_free (error); + } +} + +static const gchar * +get_first_themed_icon_name (GIcon *icon) +{ + const gchar* const *icon_names; + const gchar *icon_name = NULL; + + /* no icon */ + if (icon == NULL) + goto out; + + /* just use the first icon */ + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + if (icon_names != NULL) + icon_name = icon_names[0]; +out: + return icon_name; +} + +typedef enum { + WARNING_NONE = 0, + WARNING_DISCHARGING = 1, + WARNING_LOW = 2, + WARNING_CRITICAL = 3, + WARNING_ACTION = 4 +} GsdPowerManagerWarning; + +static GVariant * +engine_get_icon_property_variant (GsdPowerManager *manager) +{ + GIcon *icon; + GVariant *retval; + + icon = engine_get_icon (manager); + if (icon != NULL) { + char *str; + str = g_icon_to_string (icon); + g_object_unref (icon); + retval = g_variant_new_string (str); + g_free (str); + } else { + retval = g_variant_new_string (""); + } + return retval; +} + +static GVariant * +engine_get_tooltip_property_variant (GsdPowerManager *manager) +{ + char *tooltip; + GVariant *retval; + + tooltip = engine_get_summary (manager); + retval = g_variant_new_string (tooltip != NULL ? tooltip : ""); + g_free (tooltip); + + return retval; +} + +static void +engine_emit_changed (GsdPowerManager *manager, + gboolean icon_changed, + gboolean state_changed) +{ + GVariantBuilder props_builder; + GVariant *props_changed = NULL; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + + g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}")); + + if (icon_changed) + g_variant_builder_add (&props_builder, "{sv}", "Icon", + engine_get_icon_property_variant (manager)); + if (state_changed) + g_variant_builder_add (&props_builder, "{sv}", "Tooltip", + engine_get_tooltip_property_variant (manager)); + + props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE, + g_variant_builder_end (&props_builder), + g_variant_new_strv (NULL, 0)); + g_variant_ref_sink (props_changed); + + if (!g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_POWER_DBUS_PATH, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + props_changed, + &error)) + goto out; + + out: + if (error) { + g_warning ("%s", error->message); + g_clear_error (&error); + } + if (props_changed) + g_variant_unref (props_changed); +} + +static GsdPowerManagerWarning +engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage < 26.0f) + return WARNING_LOW; + else if (percentage < 13.0f) + return WARNING_CRITICAL; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage <= manager->priv->action_percentage) + return WARNING_ACTION; + if (percentage <= manager->priv->critical_percentage) + return WARNING_CRITICAL; + if (percentage <= manager->priv->low_percentage) + return WARNING_LOW; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_time (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "time-to-empty", &time_to_empty, + NULL); + + /* this is probably an error condition */ + if (time_to_empty == 0) { + g_debug ("time zero, falling back to percentage for %s", + up_device_kind_to_string (kind)); + return engine_get_warning_percentage (manager, device); + } + + if (time_to_empty <= manager->priv->action_time) + return WARNING_ACTION; + if (time_to_empty <= manager->priv->critical_time) + return WARNING_CRITICAL; + if (time_to_empty <= manager->priv->low_time) + return WARNING_LOW; + return WARNING_NONE; +} + +/** + * This gets the possible engine state for the device according to the + * policy, which could be per-percent, or per-time. + **/ +static GsdPowerManagerWarning +engine_get_warning (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + UpDeviceState state; + GsdPowerManagerWarning warning_type; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + NULL); + + /* default to no engine */ + warning_type = WARNING_NONE; + + /* if the device in question is on ac, don't give a warning */ + if (state == UP_DEVICE_STATE_CHARGING) + goto out; + + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + + warning_type = engine_get_warning_csr (manager, device); + + } else if (kind == UP_DEVICE_KIND_UPS || +#if UP_CHECK_VERSION(0,9,5) + kind == UP_DEVICE_KIND_MEDIA_PLAYER || + kind == UP_DEVICE_KIND_TABLET || + kind == UP_DEVICE_KIND_COMPUTER || +#endif + kind == UP_DEVICE_KIND_PDA) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_BATTERY) { + /* only use the time when it is accurate, and settings is not disabled */ + if (manager->priv->use_time_primary) + warning_type = engine_get_warning_time (manager, device); + else + warning_type = engine_get_warning_percentage (manager, device); + } + + /* If we have no important engines, we should test for discharging */ + if (warning_type == WARNING_NONE) { + if (state == UP_DEVICE_STATE_DISCHARGING) + warning_type = WARNING_DISCHARGING; + } + + out: + return warning_type; +} + +static gchar * +engine_get_summary (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + GString *tooltip = NULL; + gchar *part; + gboolean is_present; + + + /* need to get AC state */ + tooltip = g_string_new (""); + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "is-present", &is_present, + "state", &state, + NULL); + if (!is_present) + continue; + if (state == UP_DEVICE_STATE_EMPTY) + continue; + part = gpm_upower_get_device_summary (device); + if (part != NULL) + g_string_append_printf (tooltip, "%s\n", part); + g_free (part); + } + + /* remove the last \n */ + g_string_truncate (tooltip, tooltip->len-1); + + g_debug ("tooltip: %s", tooltip->str); + + return g_string_free (tooltip, FALSE); +} + +static GIcon * +engine_get_icon_priv (GsdPowerManager *manager, + UpDeviceKind device_kind, + GsdPowerManagerWarning warning, + gboolean use_state) +{ + guint i; + GPtrArray *array; + UpDevice *device; + GsdPowerManagerWarning warning_temp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) + device = engine_get_composite_device (manager, device); + + warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), + "engine-warning-old")); + if (kind == device_kind && is_present) { + if (warning != WARNING_NONE) { + if (warning_temp == warning) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + if (use_state) { + if (state == UP_DEVICE_STATE_CHARGING || + state == UP_DEVICE_STATE_DISCHARGING) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + return gpm_upower_get_device_icon (device, TRUE); + } + } + return NULL; +} + +static GIcon * +engine_get_icon (GsdPowerManager *manager) +{ + GIcon *icon = NULL; + + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + + /* we try (DIS)CHARGING: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + + /* we try PRESENT: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + + /* do not show an icon */ + return NULL; +} + +static gboolean +engine_recalculate_state_icon (GsdPowerManager *manager) +{ + GIcon *icon; + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + if (icon == NULL) { + /* none before, now none */ + if (manager->priv->previous_icon == NULL) + return FALSE; + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = NULL; + return TRUE; + } + + /* no icon before, now icon */ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + /* icon before, now different */ + if (!g_icon_equal (manager->priv->previous_icon, icon)) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + g_debug ("no change"); + /* nothing to do */ + g_object_unref (icon); + return FALSE; +} + +static gboolean +engine_recalculate_state_summary (GsdPowerManager *manager) +{ + gchar *summary; + + summary = engine_get_summary (manager); + if (manager->priv->previous_summary == NULL) { + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + + if (strcmp (manager->priv->previous_summary, summary) != 0) { + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + g_debug ("no change"); + /* nothing to do */ + g_free (summary); + return FALSE; +} + +static void +engine_recalculate_state (GsdPowerManager *manager) +{ + gboolean icon_changed = FALSE; + gboolean state_changed = FALSE; + + icon_changed = engine_recalculate_state_icon (manager); + state_changed = engine_recalculate_state_summary (manager); + + /* only emit if the icon or summary has changed */ + if (icon_changed || state_changed) + engine_emit_changed (manager, icon_changed, state_changed); +} + +static UpDevice * +engine_get_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint battery_devices = 0; + GPtrArray *array; + UpDevice *device; + UpDeviceKind kind; + UpDeviceKind original_kind; + guint i; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* find out how many batteries in the system */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + NULL); + if (kind == original_kind) + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices <= 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use the composite device */ + device = manager->priv->device_composite; +out: + /* return composite device or original device */ + return device; +} + +static UpDevice * +engine_update_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint i; + gdouble percentage = 0.0; + gdouble energy = 0.0; + gdouble energy_full = 0.0; + gdouble energy_rate = 0.0; + gdouble energy_total = 0.0; + gdouble energy_full_total = 0.0; + gdouble energy_rate_total = 0.0; + gint64 time_to_empty = 0; + gint64 time_to_full = 0; + guint battery_devices = 0; + gboolean is_charging = FALSE; + gboolean is_discharging = FALSE; + gboolean is_fully_charged = TRUE; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + UpDeviceKind kind; + UpDeviceKind original_kind; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* update the composite device */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + "state", &state, + "energy", &energy, + "energy-full", &energy_full, + "energy-rate", &energy_rate, + NULL); + if (kind != original_kind) + continue; + + /* one of these will be charging or discharging */ + if (state == UP_DEVICE_STATE_CHARGING) + is_charging = TRUE; + if (state == UP_DEVICE_STATE_DISCHARGING) + is_discharging = TRUE; + if (state != UP_DEVICE_STATE_FULLY_CHARGED) + is_fully_charged = FALSE; + + /* sum up composite */ + energy_total += energy; + energy_full_total += energy_full; + energy_rate_total += energy_rate; + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices == 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use percentage weighted for each battery capacity */ + if (energy_full_total > 0.0) + percentage = 100.0 * energy_total / energy_full_total; + + /* set composite state */ + if (is_charging) + state = UP_DEVICE_STATE_CHARGING; + else if (is_discharging) + state = UP_DEVICE_STATE_DISCHARGING; + else if (is_fully_charged) + state = UP_DEVICE_STATE_FULLY_CHARGED; + else + state = UP_DEVICE_STATE_UNKNOWN; + + /* calculate a quick and dirty time remaining value */ + if (energy_rate_total > 0) { + if (state == UP_DEVICE_STATE_DISCHARGING) + time_to_empty = 3600 * (energy_total / energy_rate_total); + else if (state == UP_DEVICE_STATE_CHARGING) + time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total); + } + + /* okay, we can use the composite device */ + device = manager->priv->device_composite; + + g_debug ("printing composite device"); + g_object_set (device, + "energy", energy, + "energy-full", energy_full, + "energy-rate", energy_rate, + "time-to-empty", time_to_empty, + "time-to-full", time_to_full, + "percentage", percentage, + "state", state, + NULL); + + /* force update of icon */ + if (engine_recalculate_state_icon (manager)) + engine_emit_changed (manager, TRUE, FALSE); +out: + /* return composite device or original device */ + return device; +} + +typedef struct { + GsdPowerManager *manager; + UpDevice *device; +} GsdPowerManagerRecallData; + +static void +device_perhaps_recall_response_cb (GtkDialog *dialog, + gint response_id, + GsdPowerManagerRecallData *recall_data) +{ + GdkScreen *screen; + GtkWidget *dialog_error; + GError *error = NULL; + gboolean ret; + gchar *website = NULL; + + /* don't show this again */ + if (response_id == GTK_RESPONSE_CANCEL) { + g_settings_set_boolean (recall_data->manager->priv->settings, + "notify-perhaps-recall", + FALSE); + goto out; + } + + /* visit recall website */ + if (response_id == GTK_RESPONSE_OK) { + + g_object_get (recall_data->device, + "recall-url", &website, + NULL); + + screen = gdk_screen_get_default(); + ret = gtk_show_uri (screen, + website, + gtk_get_current_event_time (), + &error); + if (!ret) { + dialog_error = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Failed to show url %s", + error->message); + gtk_dialog_run (GTK_DIALOG (dialog_error)); + g_error_free (error); + } + } +out: + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (recall_data->device); + g_object_unref (recall_data->manager); + g_free (recall_data); + g_free (website); + return; +} + +static gboolean +device_perhaps_recall_delay_cb (gpointer user_data) +{ + gchar *vendor; + const gchar *title = NULL; + GString *message = NULL; + GtkWidget *dialog; + GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data; + + g_object_get (recall_data->device, + "recall-vendor", &vendor, + NULL); + + /* TRANSLATORS: the battery may be recalled by its vendor */ + title = _("Battery may be recalled"); + message = g_string_new (""); + g_string_append_printf (message, + _("A battery in your computer may have been " + "recalled by %s and you may be at risk."), vendor); + g_string_append (message, "\n\n"); + g_string_append (message, _("For more information visit the battery recall website.")); + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + title); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", message->str); + + /* TRANSLATORS: button text, visit the manufacturers recall website */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), + GTK_RESPONSE_OK); + + /* TRANSLATORS: button text, do not show this bubble again */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), + GTK_RESPONSE_CANCEL); + + gtk_widget_show (dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (device_perhaps_recall_response_cb), + recall_data); + + g_string_free (message, TRUE); + g_free (vendor); + return FALSE; +} + +static void +device_perhaps_recall (GsdPowerManager *manager, UpDevice *device) +{ + gboolean ret; + guint timer_id; + GsdPowerManagerRecallData *recall_data; + + /* don't show when running under GDM */ + if (g_getenv ("RUNNING_UNDER_GDM") != NULL) { + g_debug ("running under gdm, so no notification"); + return; + } + + /* already shown, and dismissed */ + ret = g_settings_get_boolean (manager->priv->settings, + "notify-perhaps-recall"); + if (!ret) { + g_debug ("settings prevents recall notification"); + return; + } + + recall_data = g_new0 (GsdPowerManagerRecallData, 1); + recall_data->manager = g_object_ref (manager); + recall_data->device = g_object_ref (device); + + /* delay by a few seconds so the session can load */ + timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY, + device_perhaps_recall_delay_cb, + recall_data); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall"); +} + +static void +engine_device_add (GsdPowerManager *manager, UpDevice *device) +{ + gboolean recall_notice; + GsdPowerManagerWarning warning; + UpDeviceState state; + UpDeviceKind kind; + UpDevice *composite; + + /* assign warning */ + warning = engine_get_warning (manager, device); + g_object_set_data (G_OBJECT(device), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "recall-notice", &recall_notice, + NULL); + + /* add old state for transitions */ + g_debug ("adding %s with state %s", + up_device_get_object_path (device), up_device_state_to_string (state)); + g_object_set_data (G_OBJECT(device), + "engine-state-old", + GUINT_TO_POINTER(state)); + + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because we added a device"); + composite = engine_update_composite_device (manager, device); + + /* get the same values for the composite device */ + warning = engine_get_warning (manager, composite); + g_object_set_data (G_OBJECT(composite), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + g_object_get (composite, "state", &state, NULL); + g_object_set_data (G_OBJECT(composite), + "engine-state-old", + GUINT_TO_POINTER(state)); + } + + /* the device is recalled */ + if (recall_notice) + device_perhaps_recall (manager, device); +} + +static gboolean +engine_check_recall (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gboolean recall_notice = FALSE; + gchar *recall_vendor = NULL; + gchar *recall_url = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "recall-notice", &recall_notice, + "recall-vendor", &recall_vendor, + "recall-url", &recall_url, + NULL); + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + goto out; + + /* no recall data */ + if (!recall_notice) + goto out; + + /* emit signal for manager */ + g_debug ("** EMIT: perhaps-recall"); + g_debug ("%s-%s", recall_vendor, recall_url); +out: + g_free (recall_vendor); + g_free (recall_url); + return recall_notice; +} + +static gboolean +engine_coldplug (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array = NULL; + UpDevice *device; + gboolean ret; + GError *error = NULL; + + /* get devices from UPower */ + ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error); + if (!ret) { + g_warning ("failed to get device list: %s", error->message); + g_error_free (error); + goto out; + } + + /* connected mobile phones */ + gpm_phone_coldplug (manager->priv->phone); + + engine_recalculate_state (manager); + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); + /* never repeat */ + return FALSE; +} + +static void +engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + /* add to list */ + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_check_recall (manager, device); + + engine_recalculate_state (manager); +} + +static void +engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + gboolean ret; + ret = g_ptr_array_remove (manager->priv->devices_array, device); + if (!ret) + return; + engine_recalculate_state (manager); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +create_notification (const char *summary, + const char *body, + const char *icon, + NotifyNotification **weak_pointer_location) +{ + NotifyNotification *notification; + + notification = notify_notification_new (summary, body, icon); + *weak_pointer_location = notification; + g_object_add_weak_pointer (G_OBJECT (notification), + (gpointer *) weak_pointer_location); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); +} + +static void +engine_ups_discharging (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title; + gboolean ret; + gchar *remaining_text = NULL; + gdouble percentage; + GError *error = NULL; + GIcon *icon = NULL; + gint64 time_to_empty; + GString *message; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + if (kind != UP_DEVICE_KIND_UPS) + return; + + /* only show text if there is a valid time */ + if (time_to_empty > 0) + remaining_text = gpm_get_timestring (time_to_empty); + + /* TRANSLATORS: UPS is now discharging */ + title = _("UPS Discharging"); + + message = g_string_new (""); + if (remaining_text != NULL) { + /* TRANSLATORS: tell the user how much time they have got */ + g_string_append_printf (message, _("%s of UPS backup power remaining"), + remaining_text); + } else { + g_string_append (message, gpm_device_to_localised_string (device)); + } + g_string_append_printf (message, " (%.0f%%)", percentage); + + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_discharging); + + /* create a new notification */ + create_notification (title, message->str, + get_first_themed_icon_name (icon), + &manager->priv->notification_discharging); + notify_notification_set_timeout (manager->priv->notification_discharging, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_discharging, + NOTIFY_URGENCY_NORMAL); + /* TRANSLATORS: this is the notification application name */ + notify_notification_set_app_name (manager->priv->notification_discharging, _("Power")); + notify_notification_set_hint (manager->priv->notification_discharging, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_discharging, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_discharging); + } + g_string_free (message, TRUE); + if (icon != NULL) + g_object_unref (icon); + g_free (remaining_text); +} + +static GsdPowerActionType +manager_critical_action_get (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType policy; + + policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action"); + if (policy == GSD_POWER_ACTION_SUSPEND) { + if (is_ups == FALSE && + up_client_get_can_suspend (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_can_hibernate (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } + + return policy; +} + +static gboolean +manager_critical_action_do (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType action_type; + + /* stop playing the alert as it's too late to do anything now */ + if (manager->priv->critical_alert_timeout_id > 0) + play_loop_stop (manager); + + action_type = manager_critical_action_get (manager, is_ups); + do_power_action_type (manager, action_type); + + return FALSE; +} + +static gboolean +manager_critical_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, FALSE); + return FALSE; +} + +static gboolean +manager_critical_ups_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, TRUE); + return FALSE; +} + +static gboolean +engine_just_laptop_battery (GsdPowerManager *manager) +{ + UpDevice *device; + UpDeviceKind kind; + GPtrArray *array; + gboolean ret = TRUE; + guint i; + + /* find if there are any other device types that mean we have to + * be more specific in our wording */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, "kind", &kind, NULL); + if (kind != UP_DEVICE_KIND_BATTERY) { + ret = FALSE; + break; + } + } + return ret; +} + +static void +engine_charge_low (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gchar *tmp; + gchar *remaining_text; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery low, and we only have one battery */ + title = _("Battery low"); + } else { + /* TRANSLATORS: laptop battery low, and we have more than one kind of battery */ + title = _("Laptop battery low"); + } + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage); + g_free (remaining_text); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is starting to get a little low */ + title = _("UPS low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s of remaining UPS backup power (%.0f%%)"), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: mouse is getting a little low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless mouse is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: keyboard is getting a little low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless keyboard is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PDA) { + /* TRANSLATORS: PDA is getting a little low */ + title = _("PDA battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("PDA is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + /* TRANSLATORS: cell phone (mobile) is getting a little low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + /* TRANSLATORS: media player, e.g. mp3 is getting a little low */ + title = _("Media player battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_TABLET) { + /* TRANSLATORS: graphics tablet, e.g. wacom is getting a little low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + /* TRANSLATORS: computer, e.g. ipad is getting a little low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_NORMAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + notify_notification_set_hint (manager->priv->notification_low, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-low", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL); + +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_critical (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + GsdPowerActionType policy; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */ + title = _("Battery critically low"); + } else { + /* TRANSLATORS: laptop battery critically low, and we have more than one type of battery */ + title = _("Laptop battery critically low"); + } + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */ + message = g_strdup (_("Plug in your AC adapter to avoid losing data.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in.")); + } + + } else if (kind == UP_DEVICE_KIND_UPS) { + gchar *remaining_text; + gchar *tmp; + + /* TRANSLATORS: the UPS is very low */ + title = _("UPS critically low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Approximately %s of remaining UPS power (%.0f%%). " + "Restore AC power to your computer to avoid losing data."), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: the mouse battery is very low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless mouse is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: the keyboard battery is very low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless keyboard is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_PDA) { + + /* TRANSLATORS: the PDA battery is very low */ + title = _("PDA battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("PDA is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Media player is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_TABLET) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Attached computer is very low in power (%.0f%%). " + "The device will soon shutdown if not charged."), + percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + switch (kind) { + + case UP_DEVICE_KIND_BATTERY: + case UP_DEVICE_KIND_UPS: + g_debug ("critical charge level reached, starting sound loop"); + play_loop_start (manager, + "battery-caution", + _("Battery is critically low"), + TRUE, + GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT); + break; + + default: + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); + break; + } +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_action (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + GError *error = NULL; + GIcon *icon = NULL; + GsdPowerActionType policy; + guint timer_id; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* TRANSLATORS: laptop battery is really, really, low */ + title = _("Laptop battery critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("The battery is below the critical level and " + "this computer will power-off when the " + "battery becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: computer will suspend */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to suspend.\n" + "NOTE: A small amount of power is required " + "to keep your computer in a suspended state.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action"); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is really, really, low */ + title = _("UPS critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, TRUE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("UPS is below the critical level and " + "this computer will power-off when the " + "UPS becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_ups_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action"); + } + + /* not all types have actions */ + if (title == NULL) + return; + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + UpDeviceKind kind; + UpDeviceState state; + UpDeviceState state_old; + GsdPowerManagerWarning warning_old; + GsdPowerManagerWarning warning; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because %s changed", up_device_get_object_path (device)); + device = engine_update_composite_device (manager, device); + } + + /* get device properties (may be composite) */ + g_object_get (device, + "state", &state, + NULL); + + g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state)); + + /* see if any interesting state changes have happened */ + state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old")); + if (state_old != state) { + if (state == UP_DEVICE_STATE_DISCHARGING) { + g_debug ("discharging"); + engine_ups_discharging (manager, device); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED || + state == UP_DEVICE_STATE_CHARGING) { + g_debug ("fully charged or charging, hiding notifications if any"); + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + } + + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state)); + } + + /* check the warning state has not changed */ + warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old")); + warning = engine_get_warning (manager, device); + if (warning != warning_old) { + if (warning == WARNING_LOW) { + g_debug ("** EMIT: charge-low"); + engine_charge_low (manager, device); + } else if (warning == WARNING_CRITICAL) { + g_debug ("** EMIT: charge-critical"); + engine_charge_critical (manager, device); + } else if (warning == WARNING_ACTION) { + g_debug ("charge-action"); + engine_charge_action (manager, device); + } + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning)); + } + + engine_recalculate_state (manager); +} + +static UpDevice * +engine_get_primary_device (GsdPowerManager *manager) +{ + guint i; + UpDevice *device = NULL; + UpDevice *device_tmp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + for (i=0; ipriv->devices_array->len; i++) { + device_tmp = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device_tmp, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* not present */ + if (!is_present) + continue; + + /* not discharging */ + if (state != UP_DEVICE_STATE_DISCHARGING) + continue; + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + + /* use composite device to cope with multiple batteries */ + device = g_object_ref (engine_get_composite_device (manager, device_tmp)); + break; + } + return device; +} + +static void +phone_device_added_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + UpDevice *device; + device = up_device_new (); + + g_debug ("phone added %i", idx); + + /* get device properties */ + g_object_set (device, + "kind", UP_DEVICE_KIND_PHONE, + "is-rechargeable", TRUE, + "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "is-present", TRUE, + NULL); + + /* state changed */ + engine_device_add (manager, device); + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_recalculate_state (manager); +} + +static void +phone_device_removed_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + + g_debug ("phone removed %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + g_ptr_array_remove_index (manager->priv->devices_array, i); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +phone_device_refresh_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + + g_debug ("phone refresh %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + is_present = gpm_phone_get_present (phone, idx); + state = gpm_phone_get_on_ac (phone, idx) ? UP_DEVICE_STATE_CHARGING : UP_DEVICE_STATE_DISCHARGING; + percentage = gpm_phone_get_percentage (phone, idx); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +gnome_session_shutdown_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't shutdown using gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +gnome_session_shutdown (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* ask gnome-session to show the shutdown dialog with a timeout */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to gnome-session: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Shutdown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gnome_session_shutdown_cb, NULL); + g_object_unref (proxy); +} + +static void +do_power_action_type (GsdPowerManager *manager, + GsdPowerActionType action_type) +{ + gboolean ret; + GError *error = NULL; + + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + gnome_session_shutdown (); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_SHUTDOWN: + /* this is only used on critically low battery where + * hibernate is not available and is marginally better + * than just powering down the computer mid-write */ + gsd_power_poweroff (); + break; + case GSD_POWER_ACTION_BLANK: + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off for policy action: %s", + error->message); + g_error_free (error); + } + break; + case GSD_POWER_ACTION_NOTHING: + break; + } +} + +static gboolean +upower_kbd_set_brightness (GsdPowerManager *manager, guint value, GError **error) +{ + GVariant *retval; + + /* same as before */ + if (manager->priv->kbd_brightness_now == value) + return TRUE; + + /* update h/w value */ + retval = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "SetBrightness", + g_variant_new ("(i)", (gint) value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + error); + if (retval == NULL) + return FALSE; + + /* save new value */ + manager->priv->kbd_brightness_now = value; + g_variant_unref (retval); + return TRUE; +} + +static gboolean +upower_kbd_toggle (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + if (manager->priv->kbd_brightness_old >= 0) { + g_debug ("keyboard toggle off"); + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_old, + error); + if (ret) { + /* succeeded, set to -1 since now no old value */ + manager->priv->kbd_brightness_old = -1; + } + } else { + g_debug ("keyboard toggle on"); + /* save the current value to restore later when untoggling */ + manager->priv->kbd_brightness_old = manager->priv->kbd_brightness_now; + ret = upower_kbd_set_brightness (manager, 0, error); + if (!ret) { + /* failed, reset back to -1 */ + manager->priv->kbd_brightness_old = -1; + } + } + + return ret; +} + +static void +do_lid_open_action (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-open", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been opened"), + NULL); + + /* ensure we turn the panel back on after lid open */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after lid open: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy != NULL && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_error_free (error); + } + } + + kill_lid_close_safety_timer (manager); +} + +static gboolean +is_on (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + + crtc = gnome_rr_output_get_crtc (output); + if (!crtc) + return FALSE; + return gnome_rr_crtc_get_current_mode (crtc) != NULL; +} + +static gboolean +non_laptop_outputs_are_all_off (GnomeRRScreen *screen) +{ + GnomeRROutput **outputs; + int i; + + outputs = gnome_rr_screen_list_outputs (screen); + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_laptop (outputs[i])) + continue; + + if (is_on (outputs[i])) + return FALSE; + } + + return TRUE; +} + +/* Timeout callback used to check conditions when the laptop's lid is closed but + * the machine is not suspended yet. We try to suspend again, so that the laptop + * won't overheat if placed in a backpack. + */ +static gboolean +lid_close_safety_timer_cb (GsdPowerManager *manager) +{ + manager->priv->lid_close_safety_timer_id = 0; + + g_debug ("lid has been closed for a while; trying to suspend again"); + do_lid_closed_action (manager); + + return FALSE; +} + +/* Sets up a timer to be triggered some seconds after closing the laptop lid + * when the laptop is *not* suspended for some reason. We'll check conditions + * again in the timeout handler to see if we can suspend then. + */ +static void +setup_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) + return; + + manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT, + (GSourceFunc) lid_close_safety_timer_cb, + manager); + g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer"); +} + +static void +kill_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) { + g_source_remove (manager->priv->lid_close_safety_timer_id); + manager->priv->lid_close_safety_timer_id = 0; + } +} + +static void +suspend_with_lid_closed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + GsdPowerActionType action_type; + + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-battery-action"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-ac-action"); + } + + /* check we won't melt when the lid is closed */ + if (action_type != GSD_POWER_ACTION_SUSPEND && + action_type != GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_lid_force_sleep (manager->priv->up_client)) { + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; + } else { + /* maybe lock the screen if the lid is closed */ + lock_screensaver (manager); + } + } + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off after lid close: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + do_power_action_type (manager, action_type); +} + +static void +do_lid_closed_action (GsdPowerManager *manager) +{ + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-close", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been closed"), + NULL); + + /* refresh RANDR so we get an accurate view of what monitors are plugged in when the lid is closed */ + gnome_rr_screen_refresh (manager->priv->x11_screen, NULL); /* NULL-GError */ + + /* perform policy action */ + if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor") + || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) { + g_debug ("lid is closed; suspending or hibernating"); + suspend_with_lid_closed (manager); + } else { + g_debug ("lid is closed; not suspending nor hibernating since some external monitor outputs are still active"); + setup_lid_close_safety_timer (manager); + } +} + + +static void +up_client_changed_cb (UpClient *client, GsdPowerManager *manager) +{ + gboolean tmp; + + if (!up_client_get_on_battery (client)) { + /* if we are playing a critical charge sound loop on AC, stop it */ + if (manager->priv->critical_alert_timeout_id > 0) { + g_debug ("stopping alert loop due to ac being present"); + play_loop_stop (manager); + } + notify_close_if_showing (manager->priv->notification_low); + } + + /* same state */ + tmp = up_client_get_lid_is_closed (manager->priv->up_client); + if (manager->priv->lid_is_closed == tmp) + return; + manager->priv->lid_is_closed = tmp; + + /* fake a keypress */ + if (tmp) + do_lid_closed_action (manager); + else + do_lid_open_action (manager); +} + +typedef enum { + SESSION_STATUS_CODE_AVAILABLE = 0, + SESSION_STATUS_CODE_INVISIBLE, + SESSION_STATUS_CODE_BUSY, + SESSION_STATUS_CODE_IDLE, + SESSION_STATUS_CODE_UNKNOWN +} SessionStatusCode; + +typedef enum { + SESSION_INHIBIT_MASK_LOGOUT = 1, + SESSION_INHIBIT_MASK_SWITCH = 2, + SESSION_INHIBIT_MASK_SUSPEND = 4, + SESSION_INHIBIT_MASK_IDLE = 8 +} SessionInhibitMask; + +static const gchar * +idle_mode_to_string (GsdPowerIdleMode mode) +{ + if (mode == GSD_POWER_IDLE_MODE_NORMAL) + return "normal"; + if (mode == GSD_POWER_IDLE_MODE_DIM) + return "dim"; + if (mode == GSD_POWER_IDLE_MODE_BLANK) + return "blank"; + if (mode == GSD_POWER_IDLE_MODE_SLEEP) + return "sleep"; + return "unknown"; +} + +static GnomeRROutput * +get_primary_output (GsdPowerManager *manager) +{ + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + guint i; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL) + goto out; + + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i]) && + gnome_rr_output_is_laptop (outputs[i]) && + gnome_rr_output_get_backlight_min (outputs[i]) >= 0 && + gnome_rr_output_get_backlight_max (outputs[i]) > 0) { + output = outputs[i]; + break; + } + } +out: + return output; +} + +/** + * backlight_helper_get_value: + * + * Gets a brightness value from the PolicyKit helper. + * + * Return value: the signed integer value from the helper, or -1 + * for failure. If -1 then @error is set. + **/ +static gint64 +backlight_helper_get_value (const gchar *argument, GError **error) +{ + gboolean ret; + gchar *stdout_data = NULL; + gint exit_status = 0; + gint64 value = -1; + gchar *command = NULL; + gchar *endptr = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf (LIBEXECDIR "/gsd-backlight-helper --%s", + argument); + ret = g_spawn_command_line_sync (command, + &stdout_data, + NULL, + &exit_status, + error); + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret) + goto out; + + if (WEXITSTATUS (exit_status) != 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "gsd-backlight-helper failed: %s", + stdout_data ? stdout_data : "No reason"); + goto out; + } + + /* parse */ + value = g_ascii_strtoll (stdout_data, &endptr, 10); + + /* parsing error */ + if (endptr == stdout_data) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to parse value: %s", + stdout_data); + goto out; + } + + /* out of range */ + if (value > G_MAXINT) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value out of range: %s", + stdout_data); + goto out; + } + + /* Fetching the value failed, for some other reason */ + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value negative, but helper did not fail: %s", + stdout_data); + goto out; + } + +out: + g_free (command); + g_free (stdout_data); + return value; +} + +/** + * backlight_helper_set_value: + * + * Sets a brightness value using the PolicyKit helper. + * + * Return value: Success. If FALSE then @error is set. + **/ +static gboolean +backlight_helper_set_value (const gchar *argument, + gint value, + GError **error) +{ + gboolean ret; + gint exit_status = 0; + gchar *command = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-backlight-helper --%s %i", + argument, value); + ret = g_spawn_command_line_sync (command, + NULL, + NULL, + &exit_status, + error); + + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret || WEXITSTATUS (exit_status) != 0) + goto out; + +out: + g_free (command); + return ret; +} + +static gint +backlight_get_abs (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + return gnome_rr_output_get_backlight (output, + error); + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-brightness", error); +} + +static gint +backlight_get_percentage (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gint now; + gint value = -1; + gint min = 0; + gint max; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); +out: + return value; +} + +static gint +backlight_get_min (GsdPowerManager *manager) +{ + GnomeRROutput *output; + + /* if we have no xbacklight device, then hardcode zero as sysfs + * offsets everything to 0 as min */ + output = get_primary_output (manager); + if (output == NULL) + return 0; + + /* get xbacklight value, which maybe non-zero */ + return gnome_rr_output_get_backlight_min (output); +} + +static gint +backlight_get_max (GsdPowerManager *manager, GError **error) +{ + gint value; + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + value = gnome_rr_output_get_backlight_max (output); + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to get backlight max"); + } + return value; + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-max-brightness", error); +} + +static void +backlight_emit_changed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + ret = g_dbus_connection_emit_signal (manager->priv->connection, + GSD_DBUS_SERVICE, + GSD_POWER_DBUS_PATH, + GSD_POWER_DBUS_INTERFACE_SCREEN, + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit Changed: %s", error->message); + g_error_free (error); + } +} + +static gboolean +backlight_set_percentage (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint min = 0; + gint max; + guint discrete; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + if (min < 0 || max < 0) { + g_warning ("no xrandr backlight capability"); + goto out; + } + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gint +backlight_step_up (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_step_down (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_set_abs (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + ret = gnome_rr_output_set_backlight (output, + value, + error); + goto out; + } + + /* fall back to the polkit helper */ + ret = backlight_helper_set_value ("set-brightness", + value, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gboolean +display_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gint min; + gint max; + gint now; + gint idle; + gboolean ret = FALSE; + + now = backlight_get_abs (manager, error); + if (now < 0) { + goto out; + } + + /* is the dim brightness actually *dimmer* than the + * brightness we have now? */ + min = backlight_get_min (manager); + max = backlight_get_max (manager, error); + if (max < 0) { + goto out; + } + idle = PERCENTAGE_TO_ABS (min, max, idle_percentage); + if (idle > now) { + g_debug ("brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + ret = TRUE; + goto out; + } + ret = backlight_set_abs (manager, + idle, + FALSE, + error); + if (!ret) { + goto out; + } + + /* save for undim */ + manager->priv->pre_dim_brightness = now; + +out: + return ret; +} + +static gboolean +kbd_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gboolean ret; + gint idle; + gint max; + gint now; + + if (manager->priv->upower_kdb_proxy == NULL) + return TRUE; + + now = manager->priv->kbd_brightness_now; + max = manager->priv->kbd_brightness_max; + idle = PERCENTAGE_TO_ABS (0, max, idle_percentage); + if (idle > now) { + g_debug ("kbd brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + return TRUE; + } + ret = upower_kbd_set_brightness (manager, idle, error); + if (!ret) + return FALSE; + + /* save for undim */ + manager->priv->kbd_brightness_pre_dim = now; + return TRUE; +} + +static void +idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode) +{ + gboolean ret = FALSE; + GError *error = NULL; + gint idle_percentage; + GsdPowerActionType action_type; + GnomeSettingsSessionState state; + + if (mode == manager->priv->current_idle_mode) + return; + + /* Ignore attempts to set "less idle" modes */ + if (mode < manager->priv->current_idle_mode && + mode != GSD_POWER_IDLE_MODE_NORMAL) + return; + + /* ensure we're still on an active console */ + state = gnome_settings_session_get_state (manager->priv->session); + if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) { + g_debug ("ignoring state transition to %s as inactive", + idle_mode_to_string (mode)); + return; + } + + manager->priv->current_idle_mode = mode; + g_debug ("Doing a state transition: %s", idle_mode_to_string (mode)); + + /* don't do any power saving if we're a VM */ + if (manager->priv->is_virtual_machine) { + g_debug ("ignoring state transition to %s as virtual machine", + idle_mode_to_string (mode)); + return; + } + + /* save current brightness, and set dim level */ + if (mode == GSD_POWER_IDLE_MODE_DIM) { + + /* have we disabled the action */ + if (up_client_get_on_battery (manager->priv->up_client)) { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-battery"); + } else { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-ac"); + } + if (!ret) { + g_debug ("not dimming due to policy"); + return; + } + + /* display backlight */ + idle_percentage = g_settings_get_int (manager->priv->settings, + "idle-brightness"); + ret = display_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* keyboard backlight */ + ret = kbd_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim kbd backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* turn off screen and kbd */ + } else if (mode == GSD_POWER_IDLE_MODE_BLANK) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + /* sleep */ + } else if (mode == GSD_POWER_IDLE_MODE_SLEEP) { + + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-battery-type"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-ac-type"); + } + do_power_action_type (manager, action_type); + + /* turn on screen and restore user-selected brightness level */ + } else if (mode == GSD_POWER_IDLE_MODE_NORMAL) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on: %s", + error->message); + g_clear_error (&error); + } + + /* reset brightness if we dimmed */ + if (manager->priv->pre_dim_brightness >= 0) { + ret = backlight_set_abs (manager, + manager->priv->pre_dim_brightness, + FALSE, + &error); + if (!ret) { + g_warning ("failed to restore backlight to %i: %s", + manager->priv->pre_dim_brightness, + error->message); + g_clear_error (&error); + } else { + manager->priv->pre_dim_brightness = -1; + } + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_clear_error (&error); + } + } + + /* reset kbd brightness if we dimmed */ + if (manager->priv->kbd_brightness_pre_dim >= 0) { + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_pre_dim, + &error); + if (!ret) { + g_warning ("failed to restore kbd backlight to %i: %s", + manager->priv->kbd_brightness_pre_dim, + error->message); + g_error_free (error); + } + manager->priv->kbd_brightness_pre_dim = -1; + } + + } +} + +static gboolean +idle_is_session_idle (GsdPowerManager *manager) +{ + gboolean ret; + GVariant *result; + guint status; + + /* not yet connected to gnome-session */ + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("session idleness not available, gnome-session is not available"); + return FALSE; + } + + /* get the session status */ + result = g_dbus_proxy_get_cached_property (manager->priv->session_presence_proxy, + "status"); + if (result == NULL) { + g_warning ("no readable status property on %s", + g_dbus_proxy_get_interface_name (manager->priv->session_presence_proxy)); + return FALSE; + } + + g_variant_get (result, "u", &status); + ret = (status == SESSION_STATUS_CODE_IDLE); + g_variant_unref (result); + + return ret; +} + +static gboolean +idle_is_session_inhibited (GsdPowerManager *manager, guint mask) +{ + gboolean ret; + GVariant *retval = NULL; + GError *error = NULL; + + /* not yet connected to gnome-session */ + if (manager->priv->session_proxy == NULL) { + g_warning ("session inhibition not available, gnome-session is not available"); + return FALSE; + } + + retval = g_dbus_proxy_call_sync (manager->priv->session_proxy, + "IsInhibited", + g_variant_new ("(u)", + mask), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + &error); + if (retval == NULL) { + /* abort as the DBUS method failed */ + g_warning ("IsInhibited failed: %s", error->message); + g_error_free (error); + return FALSE; + } + + g_variant_get (retval, "(b)", &ret); + g_variant_unref (retval); + + return ret; +} + +/** + * idle_adjust_timeout: + * @idle_time: Current idle time, in seconds. + * @timeout: The new timeout we want to set, in seconds. + * + * On slow machines, or machines that have lots to load duing login, + * the current idle time could be bigger than the requested timeout. + * In this case the scheduled idle timeout will never fire, unless + * some user activity (keyboard, mouse) resets the current idle time. + * Instead of relying on user activity to correct this issue, we need + * to adjust timeout, as related to current idle time, so the idle + * timeout will fire as designed. + * + * Return value: timeout to set, adjusted acccording to current idle time. + **/ +static guint +idle_adjust_timeout (guint idle_time, guint timeout) +{ + /* allow 2 sec margin for messaging delay. */ + idle_time += 2; + + /* Double timeout until it's larger than current idle time. + * Give up for ultra slow machines. (86400 sec = 24 hours) */ + while (timeout < idle_time && + timeout < 86400 && + timeout > 0) { + timeout *= 2; + } + return timeout; +} + +/** + * idle_adjust_timeout_blank: + * @idle_time: current idle time, in seconds. + * @timeout: the new timeout we want to set, in seconds. + * + * Same as idle_adjust_timeout(), but also accounts for the duration + * of the fading animation in the screensaver (so that blanking happens + * exactly at the end of it, if configured with the same timeouts) + */ +static guint +idle_adjust_timeout_blank (guint idle_time, guint timeout) +{ + return idle_adjust_timeout (idle_time, + timeout + SCREENSAVER_FADE_TIME); +} + +static void +idle_configure (GsdPowerManager *manager) +{ + gboolean is_idle_inhibited; + guint current_idle_time; + guint timeout_blank; + guint timeout_sleep; + gboolean on_battery; + + /* are we inhibited from going idle */ + is_idle_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_IDLE); + if (is_idle_inhibited) { + g_debug ("inhibited, so using normal state"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); + + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + return; + } + + current_idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + + /* set up blank callback even when session is not idle, + * but only if we actually want to blank. */ + on_battery = up_client_get_on_battery (manager->priv->up_client); + if (on_battery) { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-battery"); + } else { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-ac"); + } + if (timeout_blank != 0) { + g_debug ("setting up blank callback for %is", timeout_blank); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID, + idle_adjust_timeout_blank (current_idle_time, timeout_blank) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + } + + /* only do the sleep timeout when the session is idle + * and we aren't inhibited from sleeping */ + if (on_battery) { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-battery-timeout"); + } else { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-ac-timeout"); + } + if (timeout_sleep != 0) { + g_debug ("setting up sleep callback %is", timeout_sleep); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID, + idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + } +} + +/** + * @timeout: The new timeout we want to set, in seconds + **/ +static gboolean +idle_set_timeout_dim (GsdPowerManager *manager, guint timeout) +{ + guint idle_time; + + idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + if (idle_time == 0) + return FALSE; + + g_debug ("Setting dim idle timeout: %ds", timeout); + if (timeout > 0) { + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID, + idle_adjust_timeout (idle_time, timeout) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID); + } + return TRUE; +} + +static void +refresh_idle_dim_settings (GsdPowerManager *manager) +{ + gint timeout_dim; + timeout_dim = g_settings_get_int (manager->priv->settings, + "idle-dim-time"); + g_debug ("idle dim set with timeout %i", timeout_dim); + idle_set_timeout_dim (manager, timeout_dim); +} + +static void +gsd_power_manager_class_init (GsdPowerManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_power_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPowerManagerPrivate)); +} + +static void +sleep_cb_screensaver_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->screensaver_proxy == NULL) { + g_warning ("Could not connect to gnome-screensaver: %s", + error->message); + g_error_free (error); + return; + } + + /* Finish the upower_notify_sleep_cb() call by locking the screen */ + g_debug ("gnome-screensaver activated, doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); +} + +static void +idle_dbus_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 || + g_strcmp0 (signal_name, "InhibitorRemoved") == 0) { + g_debug ("Received gnome session inhibitor change"); + idle_configure (manager); + } + if (g_strcmp0 (signal_name, "StatusChanged") == 0) { + guint status; + + g_variant_get (parameters, "(u)", &status); + g_dbus_proxy_set_cached_property (proxy, "status", + g_variant_new ("u", status)); + g_debug ("Received gnome session status change"); + idle_configure (manager); + } +} + +static void +session_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_proxy == NULL) { + g_warning ("Could not connect to gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (manager->priv->session_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); + } + + idle_configure (manager); +} + +static void +session_presence_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_presence_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("Could not connect to gnome-sesson: %s", + error->message); + g_error_free (error); + return; + } + g_signal_connect (manager->priv->session_presence_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); +} + +static void +power_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *k_now = NULL; + GVariant *k_max = NULL; + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_kdb_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_kdb_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + goto out; + } + + k_now = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_now == NULL) { + if (error->domain != G_DBUS_ERROR || + error->code != G_DBUS_ERROR_UNKNOWN_METHOD) { + g_warning ("Failed to get brightness: %s", + error->message); + } + g_error_free (error); + goto out; + } + + k_max = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetMaxBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_max == NULL) { + g_warning ("Failed to get max brightness: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (k_now, "(i)", &manager->priv->kbd_brightness_now); + g_variant_get (k_max, "(i)", &manager->priv->kbd_brightness_max); + + /* set brightness to max if not currently set so is something + * sensible */ + if (manager->priv->kbd_brightness_now <= 0) { + gboolean ret; + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_max, + &error); + if (!ret) { + g_warning ("failed to initialize kbd backlight to %i: %s", + manager->priv->kbd_brightness_max, + error->message); + g_error_free (error); + } + } +out: + if (k_now != NULL) + g_variant_unref (k_now); + if (k_max != NULL) + g_variant_unref (k_max); +} + +static void +lock_screensaver (GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "lock-enabled"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_sleep_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "ubuntu-lock-on-suspend"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_resume_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* this displays the unlock dialogue so the user doesn't have + * to move the mouse or press any key before the window comes up */ + if (manager->priv->screensaver_proxy != NULL) { + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "SimulateUserActivity", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + } + + /* close existing notifications on resume, the system power + * state is probably different now */ + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after resume: %s", + error->message); + g_error_free (error); + } +} + +static void +idle_send_to_sleep (GsdPowerManager *manager) +{ + gboolean is_inhibited; + gboolean is_idle; + + /* check the session is not now inhibited */ + is_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_SUSPEND); + if (is_inhibited) { + g_debug ("suspend inhibited"); + return; + } + + /* check the session is really idle*/ + is_idle = idle_is_session_idle (manager); + if (!is_idle) { + g_debug ("session is not idle, cannot SLEEP"); + return; + } + + /* send to sleep, and cancel timeout */ + g_debug ("sending to SLEEP"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP); +} + +static void +idle_idletime_alarm_expired_cb (GpmIdletime *idletime, + guint alarm_id, + GsdPowerManager *manager) +{ + g_debug ("idletime alarm: %i", alarm_id); + + switch (alarm_id) { + case GSD_POWER_IDLETIME_DIM_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM); + break; + case GSD_POWER_IDLETIME_BLANK_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK); + break; + case GSD_POWER_IDLETIME_SLEEP_ID: + idle_send_to_sleep (manager); + break; + } +} + +static void +idle_idletime_reset_cb (GpmIdletime *idletime, + GsdPowerManager *manager) +{ + g_debug ("idletime reset"); + + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +static void +engine_settings_key_changed_cb (GSettings *settings, + const gchar *key, + GsdPowerManager *manager) +{ + if (g_strcmp0 (key, "use-time-for-policy") == 0) { + manager->priv->use_time_primary = g_settings_get_boolean (settings, key); + return; + } + if (g_strcmp0 (key, "idle-dim-time") == 0) { + refresh_idle_dim_settings (manager); + return; + } + if (g_str_has_prefix (key, "sleep-inactive") || + g_str_has_prefix (key, "sleep-display")) { + idle_configure (manager); + return; + } +} + +static void +engine_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdPowerManager *manager) +{ + /* when doing the fast-user-switch into a new account, + * ensure the new account is undimmed and with the backlight on */ + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +/* This timer goes off every few minutes, whether the user is idle or not, + to try and clean up anything that has gone wrong. + + It calls disable_builtin_screensaver() so that if xset has been used, + or some other program (like xlock) has messed with the XSetScreenSaver() + settings, they will be set back to sensible values (if a server extension + is in use, messing with xlock can cause the screensaver to never get a wakeup + event, and could cause monitor power-saving to occur, and all manner of + heinousness.) + + This code was originally part of gnome-screensaver, see + http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530 + */ +static gboolean +disable_builtin_screensaver (gpointer unused) +{ + int current_server_timeout, current_server_interval; + int current_prefer_blank, current_allow_exp; + int desired_server_timeout, desired_server_interval; + int desired_prefer_blank, desired_allow_exp; + + XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + ¤t_server_timeout, + ¤t_server_interval, + ¤t_prefer_blank, + ¤t_allow_exp); + + desired_server_timeout = current_server_timeout; + desired_server_interval = current_server_interval; + desired_prefer_blank = current_prefer_blank; + desired_allow_exp = current_allow_exp; + + desired_server_interval = 0; + + /* I suspect (but am not sure) that DontAllowExposures might have + something to do with powering off the monitor as well, at least + on some systems that don't support XDPMS? Who know... */ + desired_allow_exp = AllowExposures; + + /* When we're not using an extension, set the server-side timeout to 0, + so that the server never gets involved with screen blanking, and we + do it all ourselves. (However, when we *are* using an extension, + we tell the server when to notify us, and rather than blanking the + screen, the server will send us an X event telling us to blank.) + */ + desired_server_timeout = 0; + + if (desired_server_timeout != current_server_timeout + || desired_server_interval != current_server_interval + || desired_prefer_blank != current_prefer_blank + || desired_allow_exp != current_allow_exp) { + + g_debug ("disabling server builtin screensaver:" + " (xset s %d %d; xset s %s; xset s %s)", + desired_server_timeout, + desired_server_interval, + (desired_prefer_blank ? "blank" : "noblank"), + (desired_allow_exp ? "expose" : "noexpose")); + + XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + desired_server_timeout, + desired_server_interval, + desired_prefer_blank, + desired_allow_exp); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + } + + return TRUE; +} + +static gboolean +is_hardware_a_virtual_machine (void) +{ + const gchar *str; + gboolean ret = FALSE; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.systemd1.Manager", + "Virtualization"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Virtualization", error->message); + g_error_free (error); + goto out; + } + + /* on bare-metal hardware this is the empty string, + * otherwise an identifier such as "kvm", "vmware", etc. */ + g_variant_get (variant, "(v)", &inner); + str = g_variant_get_string (inner, NULL); + if (str != NULL && str[0] != '\0') + ret = TRUE; +out: + if (connection != NULL) + g_object_unref (connection); + if (variant != NULL) + g_variant_unref (variant); + return ret; +} + +gboolean +gsd_power_manager_start (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting power manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (manager->priv->x11_screen == NULL) + return FALSE; + + /* track the active session */ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (engine_session_active_changed_cb), + manager); + + manager->priv->kbd_brightness_old = -1; + manager->priv->kbd_brightness_pre_dim = -1; + manager->priv->pre_dim_brightness = -1; + manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA); + g_signal_connect (manager->priv->settings, "changed", + G_CALLBACK (engine_settings_key_changed_cb), manager); + manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver"); + manager->priv->up_client = up_client_new (); + g_signal_connect (manager->priv->up_client, "notify-sleep", + G_CALLBACK (upower_notify_sleep_cb), manager); + g_signal_connect (manager->priv->up_client, "notify-resume", + G_CALLBACK (upower_notify_resume_cb), manager); + manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client); + g_signal_connect (manager->priv->up_client, "device-added", + G_CALLBACK (engine_device_added_cb), manager); + g_signal_connect (manager->priv->up_client, "device-removed", + G_CALLBACK (engine_device_removed_cb), manager); + g_signal_connect (manager->priv->up_client, "device-changed", + G_CALLBACK (engine_device_changed_cb), manager); + g_signal_connect_after (manager->priv->up_client, "changed", + G_CALLBACK (up_client_changed_cb), manager); + + /* use the fallback name from gnome-power-manager so the shell + * blocks this, and uses the power extension instead */ + manager->priv->status_icon = gtk_status_icon_new (); + gtk_status_icon_set_name (manager->priv->status_icon, + "gnome-power-manager"); + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH, + UPOWER_DBUS_INTERFACE, + NULL, + power_proxy_ready_cb, + manager); + + /* connect to UPower for keyboard backlight control */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH_KBDBACKLIGHT, + UPOWER_DBUS_INTERFACE_KBDBACKLIGHT, + NULL, + power_keyboard_proxy_ready_cb, + manager); + + /* connect to the session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + session_proxy_ready_cb, + manager); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + 0, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH_PRESENCE, + GNOME_SESSION_DBUS_INTERFACE_PRESENCE, + NULL, + session_presence_proxy_ready_cb, + manager); + + manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref); + manager->priv->canberra_context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + + manager->priv->phone = gpm_phone_new (); + g_signal_connect (manager->priv->phone, "device-added", + G_CALLBACK (phone_device_added_cb), manager); + g_signal_connect (manager->priv->phone, "device-removed", + G_CALLBACK (phone_device_removed_cb), manager); + g_signal_connect (manager->priv->phone, "device-refresh", + G_CALLBACK (phone_device_refresh_cb), manager); + + /* create a fake virtual composite battery */ + manager->priv->device_composite = up_device_new (); + g_object_set (manager->priv->device_composite, + "kind", UP_DEVICE_KIND_BATTERY, + "is-rechargeable", TRUE, + "native-path", "dummy:composite_battery", + "power-supply", TRUE, + "is-present", TRUE, + NULL); + + /* get percentage policy */ + manager->priv->low_percentage = g_settings_get_int (manager->priv->settings, + "percentage-low"); + manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings, + "percentage-critical"); + manager->priv->action_percentage = g_settings_get_int (manager->priv->settings, + "percentage-action"); + + /* get time policy */ + manager->priv->low_time = g_settings_get_int (manager->priv->settings, + "time-low"); + manager->priv->critical_time = g_settings_get_int (manager->priv->settings, + "time-critical"); + manager->priv->action_time = g_settings_get_int (manager->priv->settings, + "time-action"); + + /* we can disable this if the time remaining is inaccurate or just plain wrong */ + manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings, + "use-time-for-policy"); + + /* create IDLETIME watcher */ + manager->priv->idletime = gpm_idletime_new (); + g_signal_connect (manager->priv->idletime, "reset", + G_CALLBACK (idle_idletime_reset_cb), manager); + g_signal_connect (manager->priv->idletime, "alarm-expired", + G_CALLBACK (idle_idletime_alarm_expired_cb), manager); + + /* ensure the default dpms timeouts are cleared */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + error); + if (!ret) { + g_warning ("Failed set DPMS mode: %s", (*error)->message); + g_clear_error (error); + } + + /* coldplug the engine */ + engine_coldplug (manager); + + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); + /* don't blank inside a VM */ + manager->priv->is_virtual_machine = is_hardware_a_virtual_machine (); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_power_manager_stop (GsdPowerManager *manager) +{ + g_debug ("Stopping power manager"); + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + kill_lid_close_safety_timer (manager); + + g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager); + + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->session); + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->settings_screensaver); + g_clear_object (&manager->priv->up_client); + g_clear_object (&manager->priv->x11_screen); + + g_ptr_array_unref (manager->priv->devices_array); + manager->priv->devices_array = NULL; + g_clear_object (&manager->priv->phone); + g_clear_object (&manager->priv->device_composite); + g_clear_object (&manager->priv->previous_icon); + + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = NULL; + + g_clear_object (&manager->priv->upower_proxy); + g_clear_object (&manager->priv->session_proxy); + g_clear_object (&manager->priv->session_presence_proxy); + + if (manager->priv->critical_alert_timeout_id > 0) { + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } + g_signal_handlers_disconnect_by_func (manager->priv->idletime, + idle_idletime_reset_cb, + manager); + g_signal_handlers_disconnect_by_func (manager->priv->idletime, + idle_idletime_alarm_expired_cb, + manager); + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); + + if (manager->priv->xscreensaver_watchdog_timer_id > 0) { + g_source_remove (manager->priv->xscreensaver_watchdog_timer_id); + manager->priv->xscreensaver_watchdog_timer_id = 0; + } +} + +static void +gsd_power_manager_init (GsdPowerManager *manager) +{ + manager->priv = GSD_POWER_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_power_manager_finalize (GObject *object) +{ + GsdPowerManager *manager; + + manager = GSD_POWER_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + + G_OBJECT_CLASS (gsd_power_manager_parent_class)->finalize (object); +} + +/* returns new level */ +static void +handle_method_call_keyboard (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint step; + gint value = -1; + gboolean ret; + guint percentage; + GError *error = NULL; + + if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("keyboard step up"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MIN (manager->priv->kbd_brightness_now + step, + manager->priv->kbd_brightness_max); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("keyboard step down"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MAX (manager->priv->kbd_brightness_now - step, 0); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "Toggle") == 0) { + ret = upower_kbd_toggle (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (!ret) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + percentage = ABS_TO_PERCENTAGE (0, + manager->priv->kbd_brightness_max, + value); + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + percentage)); + } +} + +static void +handle_method_call_screen (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gboolean ret = FALSE; + gint value = -1; + guint value_tmp; + GError *error = NULL; + + if (g_strcmp0 (method_name, "GetPercentage") == 0) { + g_debug ("screen get percentage"); + value = backlight_get_percentage (manager, &error); + + } else if (g_strcmp0 (method_name, "SetPercentage") == 0) { + g_debug ("screen set percentage"); + g_variant_get (parameters, "(u)", &value_tmp); + ret = backlight_set_percentage (manager, value_tmp, TRUE, &error); + if (ret) + value = value_tmp; + + } else if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("screen step up"); + value = backlight_step_up (manager, &error); + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("screen step down"); + value = backlight_step_down (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (value < 0) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + value)); + } +} + +static GVariant * +device_to_variant_blob (UpDevice *device) +{ + const gchar *object_path; + gchar *device_icon; + gdouble percentage; + GIcon *icon; + guint64 time_empty, time_full; + guint64 time_state = 0; + GVariant *value; + UpDeviceKind kind; + UpDeviceState state; + + icon = gpm_upower_get_device_icon (device, TRUE); + device_icon = g_icon_to_string (icon); + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "state", &state, + "time-to-empty", &time_empty, + "time-to-full", &time_full, + NULL); + + /* only return time for these simple states */ + if (state == UP_DEVICE_STATE_DISCHARGING) + time_state = time_empty; + else if (state == UP_DEVICE_STATE_CHARGING) + time_state = time_full; + + /* get an object path, even for the composite device */ + object_path = up_device_get_object_path (device); + if (object_path == NULL) + object_path = GSD_DBUS_PATH; + + /* format complex object */ + value = g_variant_new ("(susdut)", + object_path, + kind, + device_icon, + percentage, + state, + time_state); + g_free (device_icon); + g_object_unref (icon); + return value; +} + +static void +handle_method_call_main (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GPtrArray *array; + guint i; + GVariantBuilder *builder; + GVariant *tuple = NULL; + GVariant *value = NULL; + UpDevice *device; + + /* return object */ + if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) { + + /* get the virtual device */ + device = engine_get_primary_device (manager); + if (device == NULL) { + g_dbus_method_invocation_return_dbus_error (invocation, + "org.gnome.SettingsDaemon.Power.Failed", + "There is no primary device."); + return; + } + + /* return the value */ + value = device_to_variant_blob (device); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_object_unref (device); + return; + } + + /* return array */ + if (g_strcmp0 (method_name, "GetDevices") == 0) { + + /* create builder */ + builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)")); + + /* add each tuple to the array */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + value = device_to_variant_blob (device); + g_variant_builder_add_value (builder, value); + } + + /* return the value */ + value = g_variant_builder_end (builder); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_variant_builder_unref (builder); + return; + } + + g_assert_not_reached (); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for Power", + interface_name, method_name); + + if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE) == 0) { + handle_method_call_main (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_SCREEN) == 0) { + handle_method_call_screen (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_KEYBOARD) == 0) { + handle_method_call_keyboard (manager, + method_name, + parameters, + invocation); + } else { + g_warning ("not recognised interface: %s", interface_name); + } +} + +static GVariant * +handle_get_property (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + GVariant *retval = NULL; + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return NULL; + } + + if (g_strcmp0 (property_name, "Icon") == 0) { + retval = engine_get_icon_property_variant (manager); + } else if (g_strcmp0 (property_name, "Tooltip") == 0) { + retval = engine_get_tooltip_property_variant (manager); + } + + return retval; +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdPowerManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + guint i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_POWER_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdPowerManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdPowerManager * +gsd_power_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_POWER_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + return GSD_POWER_MANAGER (manager_object); +} diff --git a/.pc/revert_new_ibus_use.patch/configure.ac b/.pc/revert_new_ibus_use.patch/configure.ac new file mode 100644 index 00000000..9d0da61a --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/configure.ac @@ -0,0 +1,609 @@ +AC_PREREQ([2.60]) + +AC_INIT([gnome-settings-daemon], + [3.6.4], + [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon]) + +AC_CONFIG_SRCDIR([gnome-settings-daemon/gnome-settings-manager.c]) + +AM_INIT_AUTOMAKE([1.9 tar-ustar dist-xz no-dist-gzip check-news]) +AM_MAINTAINER_MODE([enable]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +m4_define([gsd_api_version_major],[3]) +m4_define([gsd_api_version_minor],[0]) +m4_define([gsd_api_version],[gsd_api_version_major.gsd_api_version_minor]) +GSD_API_VERSION="gsd_api_version" +AC_SUBST(GSD_API_VERSION) + +AC_STDC_HEADERS +AC_PROG_CXX +AM_PROG_CC_C_O +AC_PROG_LIBTOOL + +AC_HEADER_STDC + +AC_SUBST(VERSION) + +AC_CONFIG_HEADERS([config.h]) + +IT_PROG_INTLTOOL([0.37.1]) + +GETTEXT_PACKAGE=gnome-settings-daemon +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain]) + +AM_GLIB_GNU_GETTEXT + +GSD_INTLTOOL_PLUGIN_RULE='%.gnome-settings-plugin: %.gnome-settings-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +AC_SUBST([GSD_INTLTOOL_PLUGIN_RULE]) + +dnl --------------------------------------------------------------------------- +dnl - Dependencies +dnl --------------------------------------------------------------------------- + +GLIB_REQUIRED_VERSION=2.31.0 +GTK_REQUIRED_VERSION=3.3.18 +GCONF_REQUIRED_VERSION=2.6.1 +GIO_REQUIRED_VERSION=2.26.0 +GNOME_DESKTOP_REQUIRED_VERSION=3.5.3 +LIBNOTIFY_REQUIRED_VERSION=0.7.3 +UPOWER_GLIB_REQUIRED_VERSION=0.9.1 +PA_REQUIRED_VERSION=0.9.16 +LIBWACOM_REQUIRED_VERSION=0.6 +UPOWER_REQUIRED_VERSION=0.9.11 +APPINDICATOR_REQUIRED_VERSION=0.3.0 +IBUS_REQUIRED_VERSION=1.4.99 + +EXTRA_COMPILE_WARNINGS(yes) + +PKG_CHECK_MODULES(SETTINGS_DAEMON, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +) + +PKG_CHECK_MODULES(SETTINGS_PLUGIN, + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +) + +GSD_PLUGIN_LDFLAGS="-export_dynamic -module -avoid-version -no-undefined" +case $host_os in + darwin*) + GSD_PLUGIN_LDFLAGS="${GSD_PLUGIN_LDFLAGS} -Wl,-bundle_loader,\$(top_builddir)/gnome-settings-daemon/gnome-settings-daemon" + ;; +esac +AC_SUBST([GSD_PLUGIN_LDFLAGS]) + +AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + +dnl ================================================================ +dnl GSettings stuff +dnl ================================================================ + +GLIB_GSETTINGS + +dnl --------------------------------------------------------------------------- +dnl - Check for gnome-desktop +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Check for LCMS2 +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2, have_new_lcms=yes, have_new_lcms=no) +if test x$have_new_lcms = xyes; then + AC_DEFINE(HAVE_NEW_LCMS,1,[Got new lcms2]) +else + PKG_CHECK_MODULES(LCMS, lcms2) +fi + +dnl --------------------------------------------------------------------------- +dnl - Check for libnotify +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_libnotify=yes], have_libnotify=no) +if test "x$have_libnotify" = xno ; then + AC_MSG_ERROR([libnotify is required to build gnome-settings-daemon]) +fi +AC_SUBST(LIBNOTIFY_CFLAGS) +AC_SUBST(LIBNOTIFY_LIBS) + +dnl --------------------------------------------------------------------------- +dnl - GUdev integration (default enabled) +dnl --------------------------------------------------------------------------- +GUDEV_PKG="" +AC_ARG_ENABLE(gudev, AS_HELP_STRING([--disable-gudev],[Disable GUdev support (not optional on Linux platforms)]), enable_gudev=$enableval) +if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(GUDEV, gudev-1.0, have_gudev="yes", have_gudev="no") + if test "x$have_gudev" = "xyes"; then + AC_DEFINE(HAVE_GUDEV, 1, [define if GUdev is available]) + GUDEV_PKG="gudev-1.0" + else + if test x$enable_gudev = xyes; then + AC_MSG_ERROR([GUdev enabled but not found]) + fi + fi +else + have_gudev=no +fi +AM_CONDITIONAL(HAVE_GUDEV, test x$have_gudev = xyes) + +dnl --------------------------------------------------------------------------- +dnl - common +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COMMON, x11 kbproto xi) + +dnl --------------------------------------------------------------------------- +dnl - automount +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(AUTOMOUNT, x11 kbproto) + +dnl --------------------------------- +dnl - Application indicator +dnl --------------------------------- + +AC_ARG_ENABLE([appindicator], + AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators]), + [enable_appindicator=$enableval], + [enable_appindicator="auto"]) + + +if test x$enable_appindicator = xauto ; then + PKG_CHECK_EXISTS(appindicator3-0.1 >= $APPINDICATOR_REQUIRED_VERSION, + [enable_appindicator="yes"], + [enable_appindicator="no"]) +fi + +if test x$enable_appindicator = xyes ; then + PKG_CHECK_MODULES(APPINDICATOR, + [appindicator3-0.1 >= $APPINDICATOR_REQUIRED_VERSION], + [AC_DEFINE(HAVE_APPINDICATOR, 1, [Have AppIndicator])]) +fi + +AM_CONDITIONAL(HAVE_APPINDICATOR, test x$enable_appindicator = xyes) +AC_SUBST(APPINDICATOR_CFLAGS) +AC_SUBST(APPINDICATOR_LIBS) + +dnl --------------------------------------------------------------------------- +dnl - background +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(BACKGROUND, x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - mouse +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MOUSE, x11 xi) + +dnl --------------------------------------------------------------------------- +dnl - cursor +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(CURSOR, xfixes) + +dnl --------------------------------------------------------------------------- +dnl - xsettings +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XSETTINGS, fontconfig) + +dnl --------------------------------------------------------------------------- +dnl - Keyboard plugin stuff +dnl --------------------------------------------------------------------------- + +AC_ARG_ENABLE(ibus, + AS_HELP_STRING([--disable-ibus], + [Disable IBus support]), + enable_ibus=$enableval, + enable_ibus=yes) + +if test "x$enable_ibus" = "xyes" ; then + IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" + AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled]) +else + IBUS_MODULE= +fi +AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes") + +PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Housekeeping plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(GIOUNIX, [gio-unix-2.0]) + +dnl --------------------------------------------------------------------------- +dnl - media-keys plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra libnotify]) + +dnl --------------------------------------------------------------------------- +dnl - xrandr plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XRANDR, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION]) + +dnl --------------------------------------------------------------------------- +dnl - orientation plugin stuff +dnl --------------------------------------------------------------------------- + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(ORIENTATION, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0]) +fi + +dnl --------------------------------------------------------------------------- +dnl - sound plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(SOUND, [libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION]) + +# --------------------------------------------------------------------------- +# Power +# --------------------------------------------------------------------------- +PKG_CHECK_MODULES(POWER, upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext) + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(BACKLIGHT_HELPER, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ) +fi + +dnl --------------------------------------------------------------------------- +dnl - color +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COLOR, [colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3]) + +dnl --------------------------------------------------------------------------- +dnl - wacom (disabled for s390/s390x and non Linux platforms) +dnl --------------------------------------------------------------------------- + +case $host_os in + linux*) + if test "$host_cpu" = s390 -o "$host_cpu" = s390x; then + have_wacom=no + else + if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(WACOM, [libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom]) + else + AC_MSG_ERROR([GUdev is necessary to compile Wacom support]) + fi + have_wacom=yes + fi + ;; + *) + have_wacom=no + ;; +esac +AM_CONDITIONAL(HAVE_WACOM, test x$have_wacom = xyes) + +dnl ============================================== +dnl PackageKit section +dnl ============================================== + +have_packagekit=false +AC_ARG_ENABLE(packagekit, + AC_HELP_STRING([--disable-packagekit], + [turn off PackageKit support]), + [case "${enableval}" in + yes) WANT_PACKAGEKIT=yes ;; + no) WANT_PACKAGEKIT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-packagekit) ;; + esac], + [WANT_PACKAGEKIT=yes]) dnl Default value + +if test x$WANT_PACKAGEKIT = xyes ; then + PK_REQUIRED_VERSION=0.7.4 + PKG_CHECK_MODULES(PACKAGEKIT, glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_packagekit=true + AC_DEFINE(HAVE_PACKAGEKIT, 1, [Define if PackageKit should be used])], + [have_packagekit=false]) +fi +AM_CONDITIONAL(HAVE_PACKAGEKIT, test "x$have_packagekit" = "xtrue") + +AC_SUBST(PACKAGEKIT_CFLAGS) +AC_SUBST(PACKAGEKIT_LIBS) + +dnl ============================================== +dnl smartcard section +dnl ============================================== +have_smartcard_support=false +AC_ARG_ENABLE(smartcard-support, + AC_HELP_STRING([--disable-smartcard-support], + [turn off smartcard support]), + [case "${enableval}" in + yes) WANT_SMARTCARD_SUPPORT=yes ;; + no) WANT_SMARTCARD_SUPPORT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-smartcard-support) ;; + esac], + [WANT_SMARTCARD_SUPPORT=yes]) + +if test x$WANT_SMARTCARD_SUPPORT = xyes ; then + NSS_REQUIRED_VERSION=3.11.2 + PKG_CHECK_MODULES(NSS, nss >= $NSS_REQUIRED_VERSION, + [have_smartcard_support=true + AC_DEFINE(SMARTCARD_SUPPORT, 1, [Define if smartcard support should be enabled])], + [have_smartcard_support=false]) +fi +AM_CONDITIONAL(SMARTCARD_SUPPORT, test "x$have_smartcard_support" = "xtrue") + +AC_SUBST(NSS_CFLAGS) +AC_SUBST(NSS_LIBS) + +AC_ARG_WITH(nssdb, + AC_HELP_STRING([--with-nssdb], + [where system NSS database is])) + +NSS_DATABASE="" +if test "x$have_smartcard_support" = "xtrue"; then + if ! test -z "$with_nssdb" ; then + NSS_DATABASE="$with_nssdb" + else + NSS_DATABASE="${sysconfdir}/pki/nssdb" + fi +else + if ! test -z "$with_nssdb" ; then + AC_MSG_WARN([nssdb specified when smartcard support is disabled]) + fi +fi + +AC_SUBST(NSS_DATABASE) + + +dnl ============================================== +dnl systemd check +dnl ============================================== + +AC_ARG_ENABLE([systemd], + AS_HELP_STRING([--enable-systemd], [Use systemd for session tracking]), + [with_systemd=$enableval], + [with_systemd=no]) +if test "$with_systemd" = "yes" ; then + PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login]) + AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking]) + SESSION_TRACKING=systemd +else + SESSION_TRACKING=ConsoleKit +fi + +AC_SUBST(SYSTEMD_CFLAGS) +AC_SUBST(SYSTEMD_LIBS) + +AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = "yes"], [Using systemd]) + +# --------------------------------------------------------------------------- +# CUPS +# --------------------------------------------------------------------------- + +AC_ARG_ENABLE(cups, + AS_HELP_STRING([--disable-cups], [disable CUPS support (default: enabled)]),, + enable_cups=yes) + +if test x"$enable_cups" != x"no" ; then + AC_PROG_SED + + AC_PATH_PROG(CUPS_CONFIG, cups-config) + + if test x$CUPS_CONFIG = x; then + AC_MSG_ERROR([cups-config not found but CUPS support requested]) + fi + + CUPS_API_VERSION=`$CUPS_CONFIG --api-version` + CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 1` + CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 2` + + AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h],, + AC_MSG_ERROR([CUPS headers not found but CUPS support requested])) + + if ! test $CUPS_API_MAJOR -gt 1 -o \ + $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4 ; then + AC_MSG_ERROR([CUPS 1.4 or newer not found, but CUPS support requested]) + fi + + CUPS_CFLAGS=`$CUPS_CONFIG --cflags | $SED -e 's/-O\w*//g' -e 's/-m\w*//g'` + CUPS_LIBS=`$CUPS_CONFIG --libs` + AC_SUBST(CUPS_CFLAGS) + AC_SUBST(CUPS_LIBS) +fi + +AM_CONDITIONAL(BUILD_PRINT_NOTIFICATIONS, [test x"$enable_cups" = x"yes"]) + +# --------------------------------------------------------------------------- +# Enable Profiling +# --------------------------------------------------------------------------- +AC_ARG_ENABLE(profiling, + [AC_HELP_STRING([--enable-profiling], + [turn on profiling])], + , enable_profiling=no) +if test "x$enable_profiling" = "xyes"; then + AC_DEFINE(ENABLE_PROFILING,1,[enable profiling]) +fi + + +# --------------------------------------------------------------------------- +# Plugins +# --------------------------------------------------------------------------- + +plugindir='$(libdir)/gnome-settings-daemon-gsd_api_version' +AC_SUBST([plugindir]) + +PLUGIN_CFLAGS="-DG_LOG_DOMAIN=\"\\\"\$(plugin_name)-plugin\\\"\" -DPLUGIN_NAME=\"\\\"\$(plugin_name)\\\"\" " +AC_SUBST(PLUGIN_CFLAGS) + +AC_ARG_ENABLE(man, + [AS_HELP_STRING([--enable-man], + [generate man pages [default=yes]])],, + enable_man=yes) +if test "$enable_man" != no; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test -z "$XSLTPROC"; then + AC_MSG_ERROR([xsltproc is required for --enable-man]) + fi +fi +AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) + +dnl --------------------------------------------------------------------------- +dnl - Finish +dnl --------------------------------------------------------------------------- + + +# Turn on the additional warnings last, so warnings don't affect other tests. + +AC_ARG_ENABLE(more-warnings, + [AC_HELP_STRING([--enable-more-warnings], + [Maximum compiler warnings])], + set_more_warnings="$enableval",[ + if test -d $srcdir/.git; then + set_more_warnings=yes + else + set_more_warnings=no + fi + ]) +AC_MSG_CHECKING(for more warnings) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + CFLAGS="\ + -Wall \ + -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ + -Wnested-externs -Wpointer-arith \ + -Wcast-align -Wsign-compare \ + $CFLAGS" + + for option in -Wno-strict-aliasing -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + AC_MSG_RESULT($has_option) + unset has_option + unset SAVE_CFLAGS + done + unset option +else + AC_MSG_RESULT(no) +fi + +# +# Enable Debug +# +AC_ARG_ENABLE(debug, + [AC_HELP_STRING([--enable-debug], + [turn on debugging])], + , enable_debug=yes) +if test "$enable_debug" = "yes"; then + DEBUG_CFLAGS="-DG_ENABLE_DEBUG" +else + if test "x$enable_debug" = "xno"; then + DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" + else + DEBUG_CFLAGS="" + fi +fi +AC_SUBST(DEBUG_CFLAGS) + +AC_OUTPUT([ +Makefile +gnome-settings-daemon/Makefile +plugins/Makefile +plugins/a11y-keyboard/Makefile +plugins/a11y-settings/Makefile +plugins/automount/Makefile +plugins/background/Makefile +plugins/clipboard/Makefile +plugins/color/Makefile +plugins/common/Makefile +plugins/cursor/Makefile +plugins/dummy/Makefile +plugins/power/Makefile +plugins/housekeeping/Makefile +plugins/keyboard/Makefile +plugins/media-keys/Makefile +plugins/media-keys/cut-n-paste/Makefile +plugins/mouse/Makefile +plugins/orientation/Makefile +plugins/print-notifications/Makefile +plugins/screensaver-proxy/Makefile +plugins/smartcard/Makefile +plugins/sound/Makefile +plugins/updates/Makefile +plugins/wacom/Makefile +plugins/xrandr/Makefile +plugins/xsettings/Makefile +data/Makefile +data/gnome-settings-daemon.pc +data/gnome-settings-daemon-uninstalled.pc +data/org.gnome.settings-daemon.plugins.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in +data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in +data/org.gnome.settings-daemon.plugins.power.gschema.xml.in +data/org.gnome.settings-daemon.plugins.color.gschema.xml.in +data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.gschema.xml.in +data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in +data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in +data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in +data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in +po/Makefile.in +man/Makefile +]) + +dnl --------------------------------------------------------------------------- +dnl - Show summary +dnl --------------------------------------------------------------------------- + +echo " + gnome-settings-daemon $VERSION + ============================= + + prefix: ${prefix} + exec_prefix: ${exec_prefix} + libdir: ${libdir} + bindir: ${bindir} + sbindir: ${sbindir} + sysconfdir: ${sysconfdir} + sysconfsubdir: ${sysconfsubdir} + localstatedir: ${localstatedir} + plugindir: ${plugindir} + datadir: ${datadir} + source code location: ${srcdir} + compiler: ${CC} + cflags: ${CFLAGS} + Maintainer mode: ${USE_MAINTAINER_MODE} + + Session tracking: ${SESSION_TRACKING} + LCMS DICT support: ${have_new_lcms} + IBus support: ${enable_ibus} + Libnotify support: ${have_libnotify} + App indicator support: ${enable_appindicator} + PackageKit support: ${have_packagekit} + Smartcard support: ${have_smartcard_support} + Cups support: ${enable_cups} + Wacom support: ${have_wacom} +${NSS_DATABASE:+\ + System nssdb: ${NSS_DATABASE} +}\ + Profiling support: ${enable_profiling} +" diff --git a/.pc/revert_new_ibus_use.patch/data/Makefile.am b/.pc/revert_new_ibus_use.patch/data/Makefile.am new file mode 100644 index 00000000..ecfe00a9 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/data/Makefile.am @@ -0,0 +1,78 @@ +NULL = + +apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon +api_DATA = gsd-enums.h + +gsettings_ENUM_NAMESPACE = org.gnome.settings-daemon +gsettings_ENUM_FILES = $(top_srcdir)/data/$(api_DATA) + +gsettings_SCHEMAS = \ + org.gnome.settings-daemon.peripherals.gschema.xml \ + org.gnome.settings-daemon.plugins.gschema.xml \ + org.gnome.settings-daemon.plugins.keyboard.gschema.xml \ + org.gnome.settings-daemon.plugins.power.gschema.xml \ + org.gnome.settings-daemon.plugins.color.gschema.xml \ + org.gnome.settings-daemon.plugins.media-keys.gschema.xml \ + org.gnome.settings-daemon.plugins.xsettings.gschema.xml \ + org.gnome.settings-daemon.plugins.housekeeping.gschema.xml \ + org.gnome.settings-daemon.plugins.print-notifications.gschema.xml \ + org.gnome.settings-daemon.plugins.xrandr.gschema.xml \ + org.gnome.settings-daemon.plugins.updates.gschema.xml \ + org.gnome.settings-daemon.plugins.orientation.gschema.xml \ + org.gnome.settings-daemon.peripherals.wacom.gschema.xml + +@INTLTOOL_XML_NOMERGE_RULE@ + +@GSETTINGS_RULES@ + +convertdir = $(datadir)/GConf/gsettings +convert_DATA = gnome-settings-daemon.convert + +@INTLTOOL_DESKTOP_RULE@ +desktopdir = $(sysconfdir)/xdg/autostart +desktop_in_files = gnome-settings-daemon.desktop.in.in +desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop) + +gnome-settings-daemon.desktop.in: gnome-settings-daemon.desktop.in.in + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@.tmp && mv $@.tmp $@ + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gnome-settings-daemon.pc + +@INTLTOOL_XML_NOMERGE_RULE@ + +man_MANS = gnome-settings-daemon.1 + +dbusservice_in_files = org.freedesktop.IBus.service.in + +EXTRA_DIST = \ + $(man_MANS) \ + $(convert_DATA) \ + $(gsettings_SCHEMAS:.xml=.xml.in.in) \ + $(desktop_in_files) \ + $(gsettings_ENUM_FILES) \ + gnome-settings-daemon.pc.in \ + $(api_DATA) \ + $(dbusservice_in_files) \ + $(NULL) + +DISTCLEANFILES = \ + $(gsettings_SCHEMAS) \ + $(desktop_DATA) \ + gnome-settings-daemon.desktop.in \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in \ + $(gsettings_SCHEMAS:.xml=.valid) + +if HAVE_IBUS +dbusservicedir=${datadir}/dbus-1/services +dbusservice_DATA = $(dbusservice_in_files:.service.in=.service) + +org.freedesktop.IBus.service: org.freedesktop.IBus.service.in + $(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@.tmp && mv $@.tmp $@ + +CLEANFILES = $(dbusservice_DATA) +endif diff --git a/.pc/revert_new_ibus_use.patch/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in b/.pc/revert_new_ibus_use.patch/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in new file mode 100644 index 00000000..63b63ae4 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in @@ -0,0 +1,212 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + [] + <_summary>Custom keybindings + <_description>List of custom keybindings + + + 'XF86Calculator' + <_summary>Launch calculator + <_description>Binding to launch the calculator. + + + 'XF86Mail' + <_summary>Launch email client + <_description>Binding to launch the email client. + + + 'XF86Eject' + <_summary>Eject + <_description>Binding to eject an optical disc. + + + '' + <_summary>Launch help browser + <_description>Binding to launch the help browser. + + + 'XF86Explorer' + <_summary>Home folder + <_description>Binding to open the Home folder. + + + 'XF86AudioMedia' + <_summary>Launch media player + <_description>Binding to launch the media player. + + + 'XF86AudioNext' + <_summary>Next track + <_description>Binding to skip to next track. + + + 'XF86AudioPause' + <_summary>Pause playback + <_description>Binding to pause playback. + + + 'XF86AudioPlay' + <_summary>Play (or play/pause) + <_description>Binding to start playback (or toggle play/pause). + + + '<Control><Alt>Delete' + <_summary>Log out + <_description>Binding to log out. + + + 'XF86AudioPrev' + <_summary>Previous track + <_description>Binding to skip to previous track. + + + 98 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + '<Control><Alt>l' + <_summary>Lock screen + <_description>Binding to lock the screen. + + + 'XF86Search' + <_summary>Search + <_description>Binding to launch the search tool. + + + 'XF86AudioStop' + <_summary>Stop playback + <_description>Binding to stop playback. + + + 'XF86AudioLowerVolume' + <_summary>Volume down + <_description>Binding to lower the system volume. + + + 'XF86AudioMute' + <_summary>Volume mute + <_description>Binding to mute the system volume. + + + 'XF86AudioRaiseVolume' + <_summary>Volume up + <_description>Binding to raise the system volume. + + + 'Print' + <_summary>Take a screenshot + <_description>Binding to take a screenshot. + + + '<Alt>Print' + <_summary>Take a screenshot of a window + <_description>Binding to take a screenshot of a window. + + + '<Shift>Print' + <_summary>Take a screenshot of an area + <_description>Binding to take a screenshot of an area. + + + '<Ctrl>Print' + <_summary>Copy a screenshot to clipboard + <_description>Binding to copy a screenshot to clipboard. + + + '<Ctrl><Alt>Print' + <_summary>Copy a screenshot of a window to clipboard + <_description>Binding to copy a screenshot of a window to clipboard. + + + '<Ctrl><Shift>Print' + <_summary>Copy a screenshot of an area to clipboard + <_description>Binding to copy a screenshot of an area to clipboard. + + + '<Primary><Alt>t' + <_summary>Launch terminal + <_description>Binding to launch the terminal. + + + 'XF86WWW' + <_summary>Launch web browser + <_description>Binding to launch the web browser. + + + '<Alt><Super>8' + <_summary>Toggle magnifier + <_description>Binding to show the screen magnifier + + + '' + <_summary>Toggle screen reader + <_description>Binding to start the screen reader + + + '' + <_summary>Toggle on-screen keyboard + <_description>Binding to show the on-screen keyboard + + + '' + <_summary>Increase text size + <_description>Binding to increase the text size + + + '' + <_summary>Decrease text size + <_description>Binding to decrease the text size + + + '' + <_summary>Toggle contrast + <_description>Binding to toggle the interface contrast + + + '<Alt><Super>equal' + <_summary>Magnifier zoom in + <_description>Binding for the magnifier to zoom in + + + '<Alt><Super>minus' + <_summary>Magnifier zoom out + <_description>Binding for the magnifier to zoom out + + + '' + <_summary>Switch input source + <_description>Binding to select the next input source + + + '' + <_summary>Switch input source backward + <_description>Binding to select the previous input source + + + + + + '' + <_summary>Name + <_description>Name of the custom binding + + + '' + <_summary>Binding + <_description>Binding for the custom binding + + + '' + <_summary>Command + <_description>Command to run when the binding is invoked + + + diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/Makefile.am b/.pc/revert_new_ibus_use.patch/plugins/keyboard/Makefile.am new file mode 100644 index 00000000..9c5f3957 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/keyboard/Makefile.am @@ -0,0 +1,115 @@ +NULL = + +plugin_name = keyboard + +plugin_LTLIBRARIES = \ + libkeyboard.la \ + $(NULL) + +themedir = $(pkgdatadir)/icons/hicolor +size = 64x64 +context = devices + +iconsdir = $(themedir)/$(size)/$(context) +icons_DATA = \ + kbd-capslock-off.png kbd-numlock-off.png kbd-scrolllock-off.png \ + kbd-capslock-on.png kbd-numlock-on.png kbd-scrolllock-on.png + +libkeyboard_la_SOURCES = \ + gsd-keyboard-plugin.h \ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ + $(NULL) + +libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/data \ + -I$(top_srcdir)/plugins/common \ + -DDATADIR=\""$(pkgdatadir)"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libkeyboard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(KEYBOARD_CFLAGS) \ + $(AM_CFLAGS) + +libkeyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libkeyboard_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(KEYBOARD_LIBS) \ + $(NULL) + +libexec_PROGRAMS = gsd-test-keyboard +gsd_test_keyboard_SOURCES = \ + test-keyboard.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ + $(NULL) + +gsd_test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS) +gsd_test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +gsd_test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la + +plugin_in_files = \ + keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +if HAVE_IBUS +noinst_PROGRAMS = test-keyboard-ibus-utils +test_keyboard_ibus_utils_SOURCES = test-keyboard-ibus-utils.c +test_keyboard_ibus_utils_CFLAGS = $(libkeyboard_la_CFLAGS) +test_keyboard_ibus_utils_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +test_keyboard_ibus_utils_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la + +check-local: test-keyboard-ibus-utils + $(builddir)/test-keyboard-ibus-utils > /dev/null +endif + +libexec_PROGRAMS += gsd-input-sources-switcher + +gsd_input_sources_switcher_SOURCES = \ + gsd-input-sources-switcher.c \ + $(NULL) + +gsd_input_sources_switcher_CPPFLAGS = \ + -I$(top_srcdir)/data \ + -I$(top_srcdir)/plugins/common \ + $(AM_CPPFLAGS) \ + $(NULL) + +gsd_input_sources_switcher_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) \ + $(NULL) + +gsd_input_sources_switcher_LDADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ + $(ui_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/Makefile.in b/.pc/revert_new_ibus_use.patch/plugins/keyboard/Makefile.in new file mode 100644 index 00000000..bb441135 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/keyboard/Makefile.in @@ -0,0 +1,1048 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-keyboard$(EXEEXT) \ + gsd-input-sources-switcher$(EXEEXT) +@HAVE_IBUS_TRUE@noinst_PROGRAMS = test-keyboard-ibus-utils$(EXEEXT) +subdir = plugins/keyboard +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libkeyboard_la_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_libkeyboard_la_OBJECTS = libkeyboard_la-gsd-keyboard-plugin.lo \ + libkeyboard_la-gsd-keyboard-manager.lo $(am__objects_1) +libkeyboard_la_OBJECTS = $(am_libkeyboard_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libkeyboard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libkeyboard_la_CFLAGS) $(CFLAGS) $(libkeyboard_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS) +am_gsd_input_sources_switcher_OBJECTS = gsd_input_sources_switcher-gsd-input-sources-switcher.$(OBJEXT) \ + $(am__objects_1) +gsd_input_sources_switcher_OBJECTS = \ + $(am_gsd_input_sources_switcher_OBJECTS) +gsd_input_sources_switcher_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_input_sources_switcher_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_gsd_test_keyboard_OBJECTS = \ + gsd_test_keyboard-test-keyboard.$(OBJEXT) \ + gsd_test_keyboard-gsd-keyboard-manager.$(OBJEXT) \ + $(am__objects_1) +gsd_test_keyboard_OBJECTS = $(am_gsd_test_keyboard_OBJECTS) +am__DEPENDENCIES_2 = $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_test_keyboard_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/gnome-settings-daemon/libgsd.la +gsd_test_keyboard_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_keyboard_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__test_keyboard_ibus_utils_SOURCES_DIST = \ + test-keyboard-ibus-utils.c +@HAVE_IBUS_TRUE@am_test_keyboard_ibus_utils_OBJECTS = test_keyboard_ibus_utils-test-keyboard-ibus-utils.$(OBJEXT) +test_keyboard_ibus_utils_OBJECTS = \ + $(am_test_keyboard_ibus_utils_OBJECTS) +@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_DEPENDENCIES = \ +@HAVE_IBUS_TRUE@ $(am__DEPENDENCIES_2) \ +@HAVE_IBUS_TRUE@ $(top_builddir)/gnome-settings-daemon/libgsd.la +test_keyboard_ibus_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libkeyboard_la_SOURCES) \ + $(gsd_input_sources_switcher_SOURCES) \ + $(gsd_test_keyboard_SOURCES) \ + $(test_keyboard_ibus_utils_SOURCES) +DIST_SOURCES = $(libkeyboard_la_SOURCES) \ + $(gsd_input_sources_switcher_SOURCES) \ + $(gsd_test_keyboard_SOURCES) \ + $(am__test_keyboard_ibus_utils_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(icons_DATA) $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +plugin_name = keyboard +plugin_LTLIBRARIES = \ + libkeyboard.la \ + $(NULL) + +themedir = $(pkgdatadir)/icons/hicolor +size = 64x64 +context = devices +iconsdir = $(themedir)/$(size)/$(context) +icons_DATA = \ + kbd-capslock-off.png kbd-numlock-off.png kbd-scrolllock-off.png \ + kbd-capslock-on.png kbd-numlock-on.png kbd-scrolllock-on.png + +libkeyboard_la_SOURCES = \ + gsd-keyboard-plugin.h \ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ + $(NULL) + +libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/data \ + -I$(top_srcdir)/plugins/common \ + -DDATADIR=\""$(pkgdatadir)"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libkeyboard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(KEYBOARD_CFLAGS) \ + $(AM_CFLAGS) + +libkeyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libkeyboard_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(KEYBOARD_LIBS) \ + $(NULL) + +gsd_test_keyboard_SOURCES = \ + test-keyboard.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ + $(NULL) + +gsd_test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS) +gsd_test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +gsd_test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la +plugin_in_files = \ + keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_SOURCES = test-keyboard-ibus-utils.c +@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_CFLAGS = $(libkeyboard_la_CFLAGS) +@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la +gsd_input_sources_switcher_SOURCES = \ + gsd-input-sources-switcher.c \ + $(NULL) + +gsd_input_sources_switcher_CPPFLAGS = \ + -I$(top_srcdir)/data \ + -I$(top_srcdir)/plugins/common \ + $(AM_CPPFLAGS) \ + $(NULL) + +gsd_input_sources_switcher_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) \ + $(NULL) + +gsd_input_sources_switcher_LDADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ + $(ui_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/keyboard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/keyboard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libkeyboard.la: $(libkeyboard_la_OBJECTS) $(libkeyboard_la_DEPENDENCIES) $(EXTRA_libkeyboard_la_DEPENDENCIES) + $(AM_V_CCLD)$(libkeyboard_la_LINK) -rpath $(plugindir) $(libkeyboard_la_OBJECTS) $(libkeyboard_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-input-sources-switcher$(EXEEXT): $(gsd_input_sources_switcher_OBJECTS) $(gsd_input_sources_switcher_DEPENDENCIES) $(EXTRA_gsd_input_sources_switcher_DEPENDENCIES) + @rm -f gsd-input-sources-switcher$(EXEEXT) + $(AM_V_CCLD)$(gsd_input_sources_switcher_LINK) $(gsd_input_sources_switcher_OBJECTS) $(gsd_input_sources_switcher_LDADD) $(LIBS) +gsd-test-keyboard$(EXEEXT): $(gsd_test_keyboard_OBJECTS) $(gsd_test_keyboard_DEPENDENCIES) $(EXTRA_gsd_test_keyboard_DEPENDENCIES) + @rm -f gsd-test-keyboard$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_keyboard_LINK) $(gsd_test_keyboard_OBJECTS) $(gsd_test_keyboard_LDADD) $(LIBS) +test-keyboard-ibus-utils$(EXEEXT): $(test_keyboard_ibus_utils_OBJECTS) $(test_keyboard_ibus_utils_DEPENDENCIES) $(EXTRA_test_keyboard_ibus_utils_DEPENDENCIES) + @rm -f test-keyboard-ibus-utils$(EXEEXT) + $(AM_V_CCLD)$(test_keyboard_ibus_utils_LINK) $(test_keyboard_ibus_utils_OBJECTS) $(test_keyboard_ibus_utils_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_keyboard-test-keyboard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libkeyboard_la-gsd-keyboard-plugin.lo: gsd-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-gsd-keyboard-plugin.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Tpo -c -o libkeyboard_la-gsd-keyboard-plugin.lo `test -f 'gsd-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Tpo $(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-plugin.c' object='libkeyboard_la-gsd-keyboard-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-plugin.lo `test -f 'gsd-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-keyboard-plugin.c + +libkeyboard_la-gsd-keyboard-manager.lo: gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-gsd-keyboard-manager.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Tpo -c -o libkeyboard_la-gsd-keyboard-manager.lo `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Tpo $(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-manager.c' object='libkeyboard_la-gsd-keyboard-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-manager.lo `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c + +gsd_input_sources_switcher-gsd-input-sources-switcher.o: gsd-input-sources-switcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -MT gsd_input_sources_switcher-gsd-input-sources-switcher.o -MD -MP -MF $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.o `test -f 'gsd-input-sources-switcher.c' || echo '$(srcdir)/'`gsd-input-sources-switcher.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-input-sources-switcher.c' object='gsd_input_sources_switcher-gsd-input-sources-switcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.o `test -f 'gsd-input-sources-switcher.c' || echo '$(srcdir)/'`gsd-input-sources-switcher.c + +gsd_input_sources_switcher-gsd-input-sources-switcher.obj: gsd-input-sources-switcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -MT gsd_input_sources_switcher-gsd-input-sources-switcher.obj -MD -MP -MF $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.obj `if test -f 'gsd-input-sources-switcher.c'; then $(CYGPATH_W) 'gsd-input-sources-switcher.c'; else $(CYGPATH_W) '$(srcdir)/gsd-input-sources-switcher.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-input-sources-switcher.c' object='gsd_input_sources_switcher-gsd-input-sources-switcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.obj `if test -f 'gsd-input-sources-switcher.c'; then $(CYGPATH_W) 'gsd-input-sources-switcher.c'; else $(CYGPATH_W) '$(srcdir)/gsd-input-sources-switcher.c'; fi` + +gsd_test_keyboard-test-keyboard.o: test-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-test-keyboard.o -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo -c -o gsd_test_keyboard-test-keyboard.o `test -f 'test-keyboard.c' || echo '$(srcdir)/'`test-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo $(DEPDIR)/gsd_test_keyboard-test-keyboard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard.c' object='gsd_test_keyboard-test-keyboard.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-test-keyboard.o `test -f 'test-keyboard.c' || echo '$(srcdir)/'`test-keyboard.c + +gsd_test_keyboard-test-keyboard.obj: test-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-test-keyboard.obj -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo -c -o gsd_test_keyboard-test-keyboard.obj `if test -f 'test-keyboard.c'; then $(CYGPATH_W) 'test-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo $(DEPDIR)/gsd_test_keyboard-test-keyboard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard.c' object='gsd_test_keyboard-test-keyboard.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-test-keyboard.obj `if test -f 'test-keyboard.c'; then $(CYGPATH_W) 'test-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard.c'; fi` + +gsd_test_keyboard-gsd-keyboard-manager.o: gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-gsd-keyboard-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo -c -o gsd_test_keyboard-gsd-keyboard-manager.o `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-manager.c' object='gsd_test_keyboard-gsd-keyboard-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-gsd-keyboard-manager.o `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c + +gsd_test_keyboard-gsd-keyboard-manager.obj: gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-gsd-keyboard-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo -c -o gsd_test_keyboard-gsd-keyboard-manager.obj `if test -f 'gsd-keyboard-manager.c'; then $(CYGPATH_W) 'gsd-keyboard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-keyboard-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-manager.c' object='gsd_test_keyboard-gsd-keyboard-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-gsd-keyboard-manager.obj `if test -f 'gsd-keyboard-manager.c'; then $(CYGPATH_W) 'gsd-keyboard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-keyboard-manager.c'; fi` + +test_keyboard_ibus_utils-test-keyboard-ibus-utils.o: test-keyboard-ibus-utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -MT test_keyboard_ibus_utils-test-keyboard-ibus-utils.o -MD -MP -MF $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.o `test -f 'test-keyboard-ibus-utils.c' || echo '$(srcdir)/'`test-keyboard-ibus-utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard-ibus-utils.c' object='test_keyboard_ibus_utils-test-keyboard-ibus-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.o `test -f 'test-keyboard-ibus-utils.c' || echo '$(srcdir)/'`test-keyboard-ibus-utils.c + +test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj: test-keyboard-ibus-utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -MT test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj -MD -MP -MF $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj `if test -f 'test-keyboard-ibus-utils.c'; then $(CYGPATH_W) 'test-keyboard-ibus-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard-ibus-utils.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard-ibus-utils.c' object='test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj `if test -f 'test-keyboard-ibus-utils.c'; then $(CYGPATH_W) 'test-keyboard-ibus-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard-ibus-utils.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-iconsDATA: $(icons_DATA) + @$(NORMAL_INSTALL) + @list='$(icons_DATA)'; test -n "$(iconsdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(iconsdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(iconsdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(iconsdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(iconsdir)" || exit $$?; \ + done + +uninstall-iconsDATA: + @$(NORMAL_UNINSTALL) + @list='$(icons_DATA)'; test -n "$(iconsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(iconsdir)'; $(am__uninstall_files_from_dir) +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +@HAVE_IBUS_FALSE@check-local: +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-noinstPROGRAMS clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-iconsDATA install-pluginDATA \ + install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-iconsDATA uninstall-libexecPROGRAMS \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-noinstPROGRAMS clean-pluginLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-iconsDATA \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-iconsDATA uninstall-libexecPROGRAMS \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@HAVE_IBUS_TRUE@check-local: test-keyboard-ibus-utils +@HAVE_IBUS_TRUE@ $(builddir)/test-keyboard-ibus-utils > /dev/null + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/delayed-dialog.c b/.pc/revert_new_ibus_use.patch/plugins/keyboard/delayed-dialog.c new file mode 100644 index 00000000..e69de29b diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/delayed-dialog.h b/.pc/revert_new_ibus_use.patch/plugins/keyboard/delayed-dialog.h new file mode 100644 index 00000000..e69de29b diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/gkbd-configuration.c b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gkbd-configuration.c new file mode 100644 index 00000000..e69de29b diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/gkbd-configuration.h b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gkbd-configuration.h new file mode 100644 index 00000000..e69de29b diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-manager.c b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-manager.c new file mode 100644 index 00000000..bd69be70 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-manager.c @@ -0,0 +1,1708 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann + * Written by Sergey V. Oudaltsov + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#ifdef HAVE_IBUS +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-keyboard-manager.h" +#include "gsd-input-helper.h" +#include "gsd-enums.h" + +#define GSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerPrivate)) + +#define GSD_KEYBOARD_DIR "org.gnome.settings-daemon.peripherals.keyboard" + +#define KEY_REPEAT "repeat" +#define KEY_CLICK "click" +#define KEY_INTERVAL "repeat-interval" +#define KEY_DELAY "delay" +#define KEY_CLICK_VOLUME "click-volume" +#define KEY_REMEMBER_NUMLOCK_STATE "remember-numlock-state" +#define KEY_NUMLOCK_STATE "numlock-state" + +#define KEY_BELL_VOLUME "bell-volume" +#define KEY_BELL_PITCH "bell-pitch" +#define KEY_BELL_DURATION "bell-duration" +#define KEY_BELL_MODE "bell-mode" + +#define KEY_SWITCHER "input-sources-switcher" + +#define GNOME_DESKTOP_INTERFACE_DIR "org.gnome.desktop.interface" + +#define KEY_GTK_IM_MODULE "gtk-im-module" +#define GTK_IM_MODULE_SIMPLE "gtk-im-context-simple" +#define GTK_IM_MODULE_IBUS "ibus" + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" + +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" +#define KEY_KEYBOARD_OPTIONS "xkb-options" + +#define INPUT_SOURCE_TYPE_XKB "xkb" +#define INPUT_SOURCE_TYPE_IBUS "ibus" + +#define DEFAULT_LANGUAGE "en_US" + +struct GsdKeyboardManagerPrivate +{ + guint start_idle_id; + GSettings *settings; + GSettings *input_sources_settings; + GSettings *interface_settings; + GnomeXkbInfo *xkb_info; +#ifdef HAVE_IBUS + IBusBus *ibus; + GHashTable *ibus_engines; + GHashTable *ibus_xkb_engines; + GCancellable *ibus_cancellable; + gboolean session_is_fallback; +#endif + gint xkb_event_base; + GsdNumLockState old_state; + GdkDeviceManager *device_manager; + guint device_added_id; + guint device_removed_id; + + gboolean input_sources_switcher_spawned; + GPid input_sources_switcher_pid; +}; + +static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass); +static void gsd_keyboard_manager_init (GsdKeyboardManager *keyboard_manager); +static void gsd_keyboard_manager_finalize (GObject *object); +static gboolean apply_input_sources_settings (GSettings *settings, + gpointer keys, + gint n_keys, + GsdKeyboardManager *manager); +static void set_gtk_im_module (GsdKeyboardManager *manager, + const gchar *new_module); + +G_DEFINE_TYPE (GsdKeyboardManager, gsd_keyboard_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +init_builder_with_sources (GVariantBuilder *builder, + GSettings *settings) +{ + const gchar *type; + const gchar *id; + GVariantIter iter; + GVariant *sources; + + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + + g_variant_builder_init (builder, G_VARIANT_TYPE ("a(ss)")); + + g_variant_iter_init (&iter, sources); + while (g_variant_iter_next (&iter, "(&s&s)", &type, &id)) + g_variant_builder_add (builder, "(ss)", type, id); + + g_variant_unref (sources); +} + +static gboolean +schema_is_installed (const gchar *name) +{ + const gchar * const *schemas; + const gchar * const *s; + + schemas = g_settings_list_schemas (); + for (s = schemas; *s; ++s) + if (g_str_equal (*s, name)) + return TRUE; + + return FALSE; +} + +#ifdef HAVE_IBUS +static void +clear_ibus (GsdKeyboardManager *manager) +{ + GsdKeyboardManagerPrivate *priv = manager->priv; + + g_cancellable_cancel (priv->ibus_cancellable); + g_clear_object (&priv->ibus_cancellable); + g_clear_pointer (&priv->ibus_engines, g_hash_table_destroy); + g_clear_pointer (&priv->ibus_xkb_engines, g_hash_table_destroy); + g_clear_object (&priv->ibus); +} + +static gchar * +make_xkb_source_id (const gchar *engine_id) +{ + gchar *id; + gchar *p; + gint n_colons = 0; + + /* engine_id is like "xkb:layout:variant:lang" where + * 'variant' and 'lang' might be empty */ + + engine_id += 4; + + for (p = (gchar *)engine_id; *p; ++p) + if (*p == ':') + if (++n_colons == 2) + break; + if (!*p) + return NULL; + + id = g_strndup (engine_id, p - engine_id + 1); + + id[p - engine_id] = '\0'; + + /* id is "layout:variant" where 'variant' might be empty */ + + for (p = id; *p; ++p) + if (*p == ':') { + if (*(p + 1) == '\0') + *p = '\0'; + else + *p = '+'; + break; + } + + /* id is "layout+variant" or "layout" */ + + return id; +} + +static void +fetch_ibus_engines_result (GObject *object, + GAsyncResult *result, + GsdKeyboardManager *manager) +{ + GsdKeyboardManagerPrivate *priv = manager->priv; + GList *list, *l; + GError *error = NULL; + + /* engines shouldn't be there yet */ + g_return_if_fail (priv->ibus_engines == NULL); + + g_clear_object (&priv->ibus_cancellable); + + list = ibus_bus_list_engines_async_finish (priv->ibus, + result, + &error); + if (!list && error) { + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_warning ("Couldn't finish IBus request: %s", error->message); + g_error_free (error); + + clear_ibus (manager); + return; + } + + /* Maps IBus engine ids to engine description objects */ + priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); + /* Maps XKB source id strings to engine description objects */ + priv->ibus_xkb_engines = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + + for (l = list; l; l = l->next) { + IBusEngineDesc *engine = l->data; + const gchar *engine_id = ibus_engine_desc_get_name (engine); + + g_hash_table_replace (priv->ibus_engines, (gpointer)engine_id, engine); + + if (strncmp ("xkb:", engine_id, 4) == 0) { + gchar *xkb_source_id = make_xkb_source_id (engine_id); + if (xkb_source_id) + g_hash_table_replace (priv->ibus_xkb_engines, + xkb_source_id, + engine); + } + } + g_list_free (list); + + apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager); +} + +static void +fetch_ibus_engines (GsdKeyboardManager *manager) +{ + GsdKeyboardManagerPrivate *priv = manager->priv; + + /* engines shouldn't be there yet */ + g_return_if_fail (priv->ibus_engines == NULL); + g_return_if_fail (priv->ibus_cancellable == NULL); + + priv->ibus_cancellable = g_cancellable_new (); + + ibus_bus_list_engines_async (priv->ibus, + -1, + priv->ibus_cancellable, + (GAsyncReadyCallback)fetch_ibus_engines_result, + manager); +} + +static void +maybe_start_ibus (GsdKeyboardManager *manager, + GVariant *sources) +{ + gboolean need_ibus = FALSE; + GVariantIter iter; + const gchar *type; + + if (manager->priv->session_is_fallback) + return; + + g_variant_iter_init (&iter, sources); + while (g_variant_iter_next (&iter, "(&s&s)", &type, NULL)) + if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) { + need_ibus = TRUE; + break; + } + + if (!need_ibus) + return; + + if (!manager->priv->ibus) { + ibus_init (); + manager->priv->ibus = ibus_bus_new_async (); + g_signal_connect_swapped (manager->priv->ibus, "connected", + G_CALLBACK (fetch_ibus_engines), manager); + g_signal_connect_swapped (manager->priv->ibus, "disconnected", + G_CALLBACK (clear_ibus), manager); + } + /* IBus doesn't export API in the session bus. The only thing + * we have there is a well known name which we can use as a + * sure-fire way to activate it. */ + g_bus_unwatch_name (g_bus_watch_name (G_BUS_TYPE_SESSION, + IBUS_SERVICE_IBUS, + G_BUS_NAME_WATCHER_FLAGS_AUTO_START, + NULL, + NULL, + NULL, + NULL)); +} + +static void +got_session_name (GObject *object, + GAsyncResult *res, + GsdKeyboardManager *manager) +{ + GVariant *result, *variant; + GDBusConnection *connection = G_DBUS_CONNECTION (object); + GsdKeyboardManagerPrivate *priv = manager->priv; + const gchar *session_name = NULL; + GError *error = NULL; + + /* IBus shouldn't have been touched yet */ + g_return_if_fail (priv->ibus == NULL); + + g_clear_object (&priv->ibus_cancellable); + + result = g_dbus_connection_call_finish (connection, res, &error); + if (!result) { + g_warning ("Couldn't get session name: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (result, "(v)", &variant); + g_variant_unref (result); + + g_variant_get (variant, "&s", &session_name); + + if (g_strcmp0 (session_name, "gnome") == 0) + manager->priv->session_is_fallback = FALSE; + + g_variant_unref (variant); + out: + apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); + g_object_unref (connection); +} + +static void +got_bus (GObject *object, + GAsyncResult *res, + GsdKeyboardManager *manager) +{ + GDBusConnection *connection; + GsdKeyboardManagerPrivate *priv = manager->priv; + GError *error = NULL; + + /* IBus shouldn't have been touched yet */ + g_return_if_fail (priv->ibus == NULL); + + g_clear_object (&priv->ibus_cancellable); + + connection = g_bus_get_finish (res, &error); + if (!connection) { + g_warning ("Couldn't get session bus: %s", error->message); + g_error_free (error); + apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager); + return; + } + + priv->ibus_cancellable = g_cancellable_new (); + + g_dbus_connection_call (connection, + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.gnome.SessionManager", + "SessionName"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->ibus_cancellable, + (GAsyncReadyCallback)got_session_name, + manager); +} + +static void +set_ibus_engine_finish (GObject *object, + GAsyncResult *res, + GsdKeyboardManager *manager) +{ + gboolean result; + IBusBus *ibus = IBUS_BUS (object); + GsdKeyboardManagerPrivate *priv = manager->priv; + GError *error = NULL; + + g_clear_object (&priv->ibus_cancellable); + + result = ibus_bus_set_global_engine_async_finish (ibus, res, &error); + if (!result) { + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_warning ("Couldn't set IBus engine: %s", error->message); + g_error_free (error); + } +} + +static void +set_ibus_engine (GsdKeyboardManager *manager, + const gchar *engine_id) +{ + GsdKeyboardManagerPrivate *priv = manager->priv; + + g_return_if_fail (priv->ibus != NULL); + g_return_if_fail (priv->ibus_engines != NULL); + + g_cancellable_cancel (priv->ibus_cancellable); + g_clear_object (&priv->ibus_cancellable); + priv->ibus_cancellable = g_cancellable_new (); + + ibus_bus_set_global_engine_async (priv->ibus, + engine_id, + -1, + priv->ibus_cancellable, + (GAsyncReadyCallback)set_ibus_engine_finish, + manager); +} + +static void +set_ibus_xkb_engine (GsdKeyboardManager *manager, + const gchar *xkb_id) +{ + IBusEngineDesc *engine; + GsdKeyboardManagerPrivate *priv = manager->priv; + + if (!priv->ibus_xkb_engines) + return; + + engine = g_hash_table_lookup (priv->ibus_xkb_engines, xkb_id); + if (!engine) + return; + + set_ibus_engine (manager, ibus_engine_desc_get_name (engine)); +} + +/* XXX: See upstream bug: + * https://codereview.appspot.com/6586075/ */ +static gchar * +layout_from_ibus_layout (const gchar *ibus_layout) +{ + const gchar *p; + + /* we get something like "layout(variant)[option1,option2]" */ + + p = ibus_layout; + while (*p) { + if (*p == '(' || *p == '[') + break; + p += 1; + } + + return g_strndup (ibus_layout, p - ibus_layout); +} + +static gchar * +variant_from_ibus_layout (const gchar *ibus_layout) +{ + const gchar *a, *b; + + /* we get something like "layout(variant)[option1,option2]" */ + + a = ibus_layout; + while (*a) { + if (*a == '(') + break; + a += 1; + } + if (!*a) + return NULL; + + a += 1; + b = a; + while (*b) { + if (*b == ')') + break; + b += 1; + } + if (!*b) + return NULL; + + return g_strndup (a, b - a); +} + +static gchar ** +options_from_ibus_layout (const gchar *ibus_layout) +{ + const gchar *a, *b; + GPtrArray *opt_array; + + /* we get something like "layout(variant)[option1,option2]" */ + + a = ibus_layout; + while (*a) { + if (*a == '[') + break; + a += 1; + } + if (!*a) + return NULL; + + opt_array = g_ptr_array_new (); + + do { + a += 1; + b = a; + while (*b) { + if (*b == ',' || *b == ']') + break; + b += 1; + } + if (!*b) + goto out; + + g_ptr_array_add (opt_array, g_strndup (a, b - a)); + + a = b; + } while (*a && *a == ','); + +out: + g_ptr_array_add (opt_array, NULL); + return (gchar **) g_ptr_array_free (opt_array, FALSE); +} + +static const gchar * +engine_from_locale (void) +{ + const gchar *locale; + const gchar *locale_engine[][2] = { + { "as_IN", "m17n:as:phonetic" }, + { "bn_IN", "m17n:bn:inscript" }, + { "gu_IN", "m17n:gu:inscript" }, + { "hi_IN", "m17n:hi:inscript" }, + { "ja_JP", "anthy" }, + { "kn_IN", "m17n:kn:kgp" }, + { "ko_KR", "hangul" }, + { "mai_IN", "m17n:mai:inscript" }, + { "ml_IN", "m17n:ml:inscript" }, + { "mr_IN", "m17n:mr:inscript" }, + { "or_IN", "m17n:or:inscript" }, + { "pa_IN", "m17n:pa:inscript" }, + { "sd_IN", "m17n:sd:inscript" }, + { "ta_IN", "m17n:ta:tamil99" }, + { "te_IN", "m17n:te:inscript" }, + { "zh_CN", "pinyin" }, + { "zh_HK", "cangjie3" }, + { "zh_TW", "chewing" }, + }; + gint i; + + locale = setlocale (LC_CTYPE, NULL); + if (!locale) + return NULL; + + for (i = 0; i < G_N_ELEMENTS (locale_engine); ++i) + if (g_str_has_prefix (locale, locale_engine[i][0])) + return locale_engine[i][1]; + + return NULL; +} + +static void +add_ibus_sources_from_locale (GSettings *settings) +{ + const gchar *locale_engine; + GVariantBuilder builder; + + locale_engine = engine_from_locale (); + if (!locale_engine) + return; + + init_builder_with_sources (&builder, settings); + g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, locale_engine); + g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +} + +static void +convert_ibus (GSettings *settings) +{ + GVariantBuilder builder; + GSettings *ibus_settings; + gchar **engines, **e; + + if (!schema_is_installed ("org.freedesktop.ibus.general")) + return; + + init_builder_with_sources (&builder, settings); + + ibus_settings = g_settings_new ("org.freedesktop.ibus.general"); + engines = g_settings_get_strv (ibus_settings, "preload-engines"); + for (e = engines; *e; ++e) { + if (g_str_has_prefix (*e, "xkb:")) + continue; + g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, *e); + } + + g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); + + g_strfreev (engines); + g_object_unref (ibus_settings); +} +#endif /* HAVE_IBUS */ + +static gboolean +xkb_set_keyboard_autorepeat_rate (guint delay, guint interval) +{ + return XkbSetAutoRepeatRate (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XkbUseCoreKbd, + delay, + interval); +} + +static gboolean +check_xkb_extension (GsdKeyboardManager *manager) +{ + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + int opcode, error_base, major, minor; + gboolean have_xkb; + + have_xkb = XkbQueryExtension (dpy, + &opcode, + &manager->priv->xkb_event_base, + &error_base, + &major, + &minor); + return have_xkb; +} + +static void +xkb_init (GsdKeyboardManager *manager) +{ + Display *dpy; + + dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + XkbSelectEventDetails (dpy, + XkbUseCoreKbd, + XkbStateNotify, + XkbModifierLockMask, + XkbModifierLockMask); +} + +static unsigned +numlock_NumLock_modifier_mask (void) +{ + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + return XkbKeysymToModifiers (dpy, XK_Num_Lock); +} + +static void +numlock_set_xkb_state (GsdNumLockState new_state) +{ + unsigned int num_mask; + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + if (new_state != GSD_NUM_LOCK_STATE_ON && new_state != GSD_NUM_LOCK_STATE_OFF) + return; + num_mask = numlock_NumLock_modifier_mask (); + XkbLockModifiers (dpy, XkbUseCoreKbd, num_mask, new_state == GSD_NUM_LOCK_STATE_ON ? num_mask : 0); +} + +static const char * +num_lock_state_to_string (GsdNumLockState numlock_state) +{ + switch (numlock_state) { + case GSD_NUM_LOCK_STATE_UNKNOWN: + return "GSD_NUM_LOCK_STATE_UNKNOWN"; + case GSD_NUM_LOCK_STATE_ON: + return "GSD_NUM_LOCK_STATE_ON"; + case GSD_NUM_LOCK_STATE_OFF: + return "GSD_NUM_LOCK_STATE_OFF"; + default: + return "UNKNOWN"; + } +} + +static GdkFilterReturn +xkb_events_filter (GdkXEvent *xev_, + GdkEvent *gdkev_, + gpointer user_data) +{ + XEvent *xev = (XEvent *) xev_; + XkbEvent *xkbev = (XkbEvent *) xev; + GsdKeyboardManager *manager = (GsdKeyboardManager *) user_data; + + if (xev->type != manager->priv->xkb_event_base || + xkbev->any.xkb_type != XkbStateNotify) + return GDK_FILTER_CONTINUE; + + if (xkbev->state.changed & XkbModifierLockMask) { + unsigned num_mask = numlock_NumLock_modifier_mask (); + unsigned locked_mods = xkbev->state.locked_mods; + GsdNumLockState numlock_state; + + numlock_state = (num_mask & locked_mods) ? GSD_NUM_LOCK_STATE_ON : GSD_NUM_LOCK_STATE_OFF; + + if (numlock_state != manager->priv->old_state) { + g_debug ("New num-lock state '%s' != Old num-lock state '%s'", + num_lock_state_to_string (numlock_state), + num_lock_state_to_string (manager->priv->old_state)); + g_settings_set_enum (manager->priv->settings, + KEY_NUMLOCK_STATE, + numlock_state); + manager->priv->old_state = numlock_state; + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +install_xkb_filter (GsdKeyboardManager *manager) +{ + gdk_window_add_filter (NULL, + xkb_events_filter, + manager); +} + +static void +remove_xkb_filter (GsdKeyboardManager *manager) +{ + gdk_window_remove_filter (NULL, + xkb_events_filter, + manager); +} + +static void +free_xkb_component_names (XkbComponentNamesRec *p) +{ + g_return_if_fail (p != NULL); + + free (p->keymap); + free (p->keycodes); + free (p->types); + free (p->compat); + free (p->symbols); + free (p->geometry); + + g_free (p); +} + +static void +upload_xkb_description (const gchar *rules_file_path, + XkbRF_VarDefsRec *var_defs, + XkbComponentNamesRec *comp_names) +{ + Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + XkbDescRec *xkb_desc; + gchar *rules_file; + + /* Upload it to the X server using the same method as setxkbmap */ + xkb_desc = XkbGetKeyboardByName (display, + XkbUseCoreKbd, + comp_names, + XkbGBN_AllComponentsMask, + XkbGBN_AllComponentsMask & + (~XkbGBN_GeometryMask), True); + if (!xkb_desc) { + g_warning ("Couldn't upload new XKB keyboard description"); + return; + } + + XkbFreeKeyboard (xkb_desc, 0, True); + + rules_file = g_path_get_basename (rules_file_path); + + if (!XkbRF_SetNamesProp (display, rules_file, var_defs)) + g_warning ("Couldn't update the XKB root window property"); + + g_free (rules_file); +} + +static gchar * +language_code_from_locale (const gchar *locale) +{ + if (!locale || !locale[0] || !locale[1]) + return NULL; + + if (!locale[2] || locale[2] == '_' || locale[2] == '.') + return g_strndup (locale, 2); + + if (!locale[3] || locale[3] == '_' || locale[3] == '.') + return g_strndup (locale, 3); + + return NULL; +} + +static gchar * +build_xkb_group_string (const gchar *user, + const gchar *locale, + const gchar *latin) +{ + gchar *string; + gsize length = 0; + guint commas = 2; + + if (latin) + length += strlen (latin); + else + commas -= 1; + + if (locale) + length += strlen (locale); + else + commas -= 1; + + length += strlen (user) + commas + 1; + + string = malloc (length); + + if (locale && latin) + sprintf (string, "%s,%s,%s", user, locale, latin); + else if (locale) + sprintf (string, "%s,%s", user, locale); + else if (latin) + sprintf (string, "%s,%s", user, latin); + else + sprintf (string, "%s", user); + + return string; +} + +static gboolean +layout_equal (const gchar *layout_a, + const gchar *variant_a, + const gchar *layout_b, + const gchar *variant_b) +{ + return !g_strcmp0 (layout_a, layout_b) && !g_strcmp0 (variant_a, variant_b); +} + +static void +replace_layout_and_variant (GsdKeyboardManager *manager, + XkbRF_VarDefsRec *xkb_var_defs, + const gchar *layout, + const gchar *variant) +{ + /* Toolkits need to know about both a latin layout to handle + * accelerators which are usually defined like Ctrl+C and a + * layout with the symbols for the language used in UI strings + * to handle mnemonics like Alt+Ф, so we try to find and add + * them in XKB group slots after the layout which the user + * actually intends to type with. */ + const gchar *latin_layout = "us"; + const gchar *latin_variant = ""; + const gchar *locale_layout = NULL; + const gchar *locale_variant = NULL; + const gchar *locale; + gchar *language; + + if (!layout) + return; + + if (!variant) + variant = ""; + + locale = setlocale (LC_MESSAGES, NULL); + /* If LANG is empty, default to en_US */ + if (!locale) + language = g_strdup (DEFAULT_LANGUAGE); + else + language = language_code_from_locale (locale); + + if (!language) + language = language_code_from_locale (DEFAULT_LANGUAGE); + + gnome_xkb_info_get_layout_info_for_language (manager->priv->xkb_info, + language, + NULL, + NULL, + NULL, + &locale_layout, + &locale_variant); + g_free (language); + + /* We want to minimize the number of XKB groups if we have + * duplicated layout+variant pairs. + * + * Also, if a layout doesn't have a variant we still have to + * include it in the variants string because the number of + * variants must agree with the number of layouts. For + * instance: + * + * layouts: "us,ru,us" + * variants: "dvorak,," + */ + if (layout_equal (latin_layout, latin_variant, locale_layout, locale_variant) || + layout_equal (latin_layout, latin_variant, layout, variant)) { + latin_layout = NULL; + latin_variant = NULL; + } + + if (layout_equal (locale_layout, locale_variant, layout, variant)) { + locale_layout = NULL; + locale_variant = NULL; + } + + free (xkb_var_defs->layout); + xkb_var_defs->layout = build_xkb_group_string (layout, locale_layout, latin_layout); + + free (xkb_var_defs->variant); + xkb_var_defs->variant = build_xkb_group_string (variant, locale_variant, latin_variant); +} + +static gchar * +build_xkb_options_string (gchar **options) +{ + gchar *string; + + if (*options) { + gint i; + gsize len; + gchar *ptr; + + /* First part, getting length */ + len = 1 + strlen (options[0]); + for (i = 1; options[i] != NULL; i++) + len += strlen (options[i]); + len += (i - 1); /* commas */ + + /* Second part, building string */ + string = malloc (len); + ptr = g_stpcpy (string, *options); + for (i = 1; options[i] != NULL; i++) { + ptr = g_stpcpy (ptr, ","); + ptr = g_stpcpy (ptr, options[i]); + } + } else { + string = malloc (1); + *string = '\0'; + } + + return string; +} + +static gchar ** +append_options (gchar **a, + gchar **b) +{ + gchar **c, **p; + + if (!a && !b) + return NULL; + else if (!a) + return g_strdupv (b); + else if (!b) + return g_strdupv (a); + + c = g_new0 (gchar *, g_strv_length (a) + g_strv_length (b) + 1); + p = c; + + while (*a) { + *p = g_strdup (*a); + p += 1; + a += 1; + } + while (*b) { + *p = g_strdup (*b); + p += 1; + b += 1; + } + + return c; +} + +static void +add_xkb_options (GsdKeyboardManager *manager, + XkbRF_VarDefsRec *xkb_var_defs, + gchar **extra_options) +{ + gchar **options; + gchar **settings_options; + + settings_options = g_settings_get_strv (manager->priv->input_sources_settings, + KEY_KEYBOARD_OPTIONS); + options = append_options (settings_options, extra_options); + g_strfreev (settings_options); + + free (xkb_var_defs->options); + xkb_var_defs->options = build_xkb_options_string (options); + + g_strfreev (options); +} + +static void +apply_xkb_settings (GsdKeyboardManager *manager, + const gchar *layout, + const gchar *variant, + gchar **options) +{ + XkbRF_RulesRec *xkb_rules; + XkbRF_VarDefsRec *xkb_var_defs; + gchar *rules_file_path; + + gnome_xkb_info_get_var_defs (&rules_file_path, &xkb_var_defs); + + add_xkb_options (manager, xkb_var_defs, options); + replace_layout_and_variant (manager, xkb_var_defs, layout, variant); + + gdk_error_trap_push (); + + xkb_rules = XkbRF_Load (rules_file_path, NULL, True, True); + if (xkb_rules) { + XkbComponentNamesRec *xkb_comp_names; + xkb_comp_names = g_new0 (XkbComponentNamesRec, 1); + + XkbRF_GetComponents (xkb_rules, xkb_var_defs, xkb_comp_names); + upload_xkb_description (rules_file_path, xkb_var_defs, xkb_comp_names); + + free_xkb_component_names (xkb_comp_names); + XkbRF_Free (xkb_rules, True); + } else { + g_warning ("Couldn't load XKB rules"); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error loading XKB rules"); + + gnome_xkb_info_free_var_defs (xkb_var_defs); + g_free (rules_file_path); +} + +static void +set_gtk_im_module (GsdKeyboardManager *manager, + const gchar *new_module) +{ + GsdKeyboardManagerPrivate *priv = manager->priv; + gchar *current_module; + + current_module = g_settings_get_string (priv->interface_settings, + KEY_GTK_IM_MODULE); + if (!g_str_equal (current_module, new_module)) + g_settings_set_string (priv->interface_settings, + KEY_GTK_IM_MODULE, + new_module); + g_free (current_module); +} + +static gboolean +apply_input_sources_settings (GSettings *settings, + gpointer keys, + gint n_keys, + GsdKeyboardManager *manager) +{ + GsdKeyboardManagerPrivate *priv = manager->priv; + GVariant *sources; + guint current; + guint n_sources; + const gchar *type = NULL; + const gchar *id = NULL; + gchar *layout = NULL; + gchar *variant = NULL; + gchar **options = NULL; + + sources = g_settings_get_value (priv->input_sources_settings, KEY_INPUT_SOURCES); + current = g_settings_get_uint (priv->input_sources_settings, KEY_CURRENT_INPUT_SOURCE); + n_sources = g_variant_n_children (sources); + + if (n_sources < 1) + goto exit; + + if (current >= n_sources) { + g_settings_set_uint (priv->input_sources_settings, + KEY_CURRENT_INPUT_SOURCE, + n_sources - 1); + goto exit; + } + +#ifdef HAVE_IBUS + maybe_start_ibus (manager, sources); +#endif + + g_variant_get_child (sources, current, "(&s&s)", &type, &id); + + if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) { + const gchar *l, *v; + gnome_xkb_info_get_layout_info (priv->xkb_info, id, NULL, NULL, &l, &v); + + layout = g_strdup (l); + variant = g_strdup (v); + + if (!layout || !layout[0]) { + g_warning ("Couldn't find XKB input source '%s'", id); + goto exit; + } + set_gtk_im_module (manager, GTK_IM_MODULE_SIMPLE); +#ifdef HAVE_IBUS + set_ibus_xkb_engine (manager, id); +#endif + } else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) { +#ifdef HAVE_IBUS + IBusEngineDesc *engine_desc = NULL; + + if (priv->session_is_fallback) + goto exit; + + if (priv->ibus_engines) + engine_desc = g_hash_table_lookup (priv->ibus_engines, id); + else + goto exit; /* we'll be called again when ibus is up and running */ + + if (engine_desc) { + const gchar *ibus_layout; + ibus_layout = ibus_engine_desc_get_layout (engine_desc); + + if (ibus_layout) { + layout = layout_from_ibus_layout (ibus_layout); + variant = variant_from_ibus_layout (ibus_layout); + options = options_from_ibus_layout (ibus_layout); + } + } else { + g_warning ("Couldn't find IBus input source '%s'", id); + goto exit; + } + + set_gtk_im_module (manager, GTK_IM_MODULE_IBUS); + set_ibus_engine (manager, id); +#else + g_warning ("IBus input source type specified but IBus support was not compiled"); +#endif + } else { + g_warning ("Unknown input source type '%s'", type); + } + + exit: + apply_xkb_settings (manager, layout, variant, options); + g_variant_unref (sources); + g_free (layout); + g_free (variant); + g_strfreev (options); + /* Prevent individual "changed" signal invocations since we + don't need them. */ + return TRUE; +} + +static void +apply_bell (GsdKeyboardManager *manager) +{ + GSettings *settings; + XKeyboardControl kbdcontrol; + gboolean click; + int bell_volume; + int bell_pitch; + int bell_duration; + GsdBellMode bell_mode; + int click_volume; + + g_debug ("Applying the bell settings"); + settings = manager->priv->settings; + click = g_settings_get_boolean (settings, KEY_CLICK); + click_volume = g_settings_get_int (settings, KEY_CLICK_VOLUME); + + bell_pitch = g_settings_get_int (settings, KEY_BELL_PITCH); + bell_duration = g_settings_get_int (settings, KEY_BELL_DURATION); + + bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE); + bell_volume = (bell_mode == GSD_BELL_MODE_ON) ? 50 : 0; + + /* as percentage from 0..100 inclusive */ + if (click_volume < 0) { + click_volume = 0; + } else if (click_volume > 100) { + click_volume = 100; + } + kbdcontrol.key_click_percent = click ? click_volume : 0; + kbdcontrol.bell_percent = bell_volume; + kbdcontrol.bell_pitch = bell_pitch; + kbdcontrol.bell_duration = bell_duration; + + gdk_error_trap_push (); + XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, + &kbdcontrol); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + gdk_error_trap_pop_ignored (); +} + +static void +apply_numlock (GsdKeyboardManager *manager) +{ + GSettings *settings; + gboolean rnumlock; + + g_debug ("Applying the num-lock settings"); + settings = manager->priv->settings; + rnumlock = g_settings_get_boolean (settings, KEY_REMEMBER_NUMLOCK_STATE); + manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE); + + gdk_error_trap_push (); + if (rnumlock) { + g_debug ("Remember num-lock is set, so applying setting '%s'", + num_lock_state_to_string (manager->priv->old_state)); + numlock_set_xkb_state (manager->priv->old_state); + } + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + gdk_error_trap_pop_ignored (); +} + +static void +apply_repeat (GsdKeyboardManager *manager) +{ + GSettings *settings; + gboolean repeat; + guint interval; + guint delay; + + g_debug ("Applying the repeat settings"); + settings = manager->priv->settings; + repeat = g_settings_get_boolean (settings, KEY_REPEAT); + interval = g_settings_get_uint (settings, KEY_INTERVAL); + delay = g_settings_get_uint (settings, KEY_DELAY); + + gdk_error_trap_push (); + if (repeat) { + gboolean rate_set = FALSE; + + XAutoRepeatOn (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + /* Use XKB in preference */ + rate_set = xkb_set_keyboard_autorepeat_rate (delay, interval); + + if (!rate_set) + g_warning ("Neither XKeyboard not Xfree86's keyboard extensions are available,\n" + "no way to support keyboard autorepeat rate settings"); + } else { + XAutoRepeatOff (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + } + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + gdk_error_trap_pop_ignored (); +} + +static void +apply_all_settings (GsdKeyboardManager *manager) +{ + apply_repeat (manager); + apply_bell (manager); + apply_numlock (manager); +} + +static void +set_input_sources_switcher (GsdKeyboardManager *manager, + gboolean state) +{ + if (state) { + GError *error = NULL; + char *args[2]; + + if (manager->priv->input_sources_switcher_spawned) + set_input_sources_switcher (manager, FALSE); + + args[0] = LIBEXECDIR "/gsd-input-sources-switcher"; + args[1] = NULL; + + g_spawn_async (NULL, args, NULL, + 0, NULL, NULL, + &manager->priv->input_sources_switcher_pid, &error); + + manager->priv->input_sources_switcher_spawned = (error == NULL); + + if (error) { + g_warning ("Couldn't spawn %s: %s", args[0], error->message); + g_error_free (error); + } + } else if (manager->priv->input_sources_switcher_spawned) { + kill (manager->priv->input_sources_switcher_pid, SIGHUP); + g_spawn_close_pid (manager->priv->input_sources_switcher_pid); + manager->priv->input_sources_switcher_spawned = FALSE; + } +} + +static gboolean +enable_switcher (GsdKeyboardManager *manager) +{ + GsdInputSourcesSwitcher switcher; + + switcher = g_settings_get_enum (manager->priv->settings, KEY_SWITCHER); + + return switcher != GSD_INPUT_SOURCES_SWITCHER_OFF; +} + +static void +settings_changed (GSettings *settings, + const char *key, + GsdKeyboardManager *manager) +{ + if (g_strcmp0 (key, KEY_CLICK) == 0|| + g_strcmp0 (key, KEY_CLICK_VOLUME) == 0 || + g_strcmp0 (key, KEY_BELL_PITCH) == 0 || + g_strcmp0 (key, KEY_BELL_DURATION) == 0 || + g_strcmp0 (key, KEY_BELL_MODE) == 0) { + g_debug ("Bell setting '%s' changed, applying bell settings", key); + apply_bell (manager); + } else if (g_strcmp0 (key, KEY_REMEMBER_NUMLOCK_STATE) == 0) { + g_debug ("Remember Num-Lock state '%s' changed, applying num-lock settings", key); + apply_numlock (manager); + } else if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) { + g_debug ("Num-Lock state '%s' changed, will apply at next startup", key); + } else if (g_strcmp0 (key, KEY_REPEAT) == 0 || + g_strcmp0 (key, KEY_INTERVAL) == 0 || + g_strcmp0 (key, KEY_DELAY) == 0) { + g_debug ("Key repeat setting '%s' changed, applying key repeat settings", key); + apply_repeat (manager); + } else if (g_strcmp0 (key, KEY_SWITCHER) == 0) { + set_input_sources_switcher (manager, enable_switcher (manager)); + } else { + g_warning ("Unhandled settings change, key '%s'", key); + } + +} + +static void +device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdKeyboardManager *manager) +{ + GdkInputSource source; + + source = gdk_device_get_source (device); + if (source == GDK_SOURCE_KEYBOARD) { + g_debug ("New keyboard plugged in, applying all settings"); + apply_all_settings (manager); + apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); + run_custom_command (device, COMMAND_DEVICE_ADDED); + } +} + +static void +device_removed_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdKeyboardManager *manager) +{ + GdkInputSource source; + + source = gdk_device_get_source (device); + if (source == GDK_SOURCE_KEYBOARD) { + run_custom_command (device, COMMAND_DEVICE_REMOVED); + } +} + +static void +set_devicepresence_handler (GsdKeyboardManager *manager) +{ + GdkDeviceManager *device_manager; + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + + manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (device_added_cb), manager); + manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", + G_CALLBACK (device_removed_cb), manager); + manager->priv->device_manager = device_manager; +} + +static void +create_sources_from_current_xkb_config (GSettings *settings) +{ + GVariantBuilder builder; + XkbRF_VarDefsRec *xkb_var_defs; + gchar *tmp; + gchar **layouts = NULL; + gchar **variants = NULL; + guint i, n; + + gnome_xkb_info_get_var_defs (&tmp, &xkb_var_defs); + g_free (tmp); + + if (xkb_var_defs->layout) + layouts = g_strsplit (xkb_var_defs->layout, ",", 0); + if (xkb_var_defs->variant) + variants = g_strsplit (xkb_var_defs->variant, ",", 0); + + gnome_xkb_info_free_var_defs (xkb_var_defs); + + if (!layouts) + goto out; + + if (variants && variants[0]) + n = MIN (g_strv_length (layouts), g_strv_length (variants)); + else + n = g_strv_length (layouts); + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); + for (i = 0; i < n && layouts[i][0]; ++i) { + if (variants && variants[i] && variants[i][0]) + tmp = g_strdup_printf ("%s+%s", layouts[i], variants[i]); + else + tmp = g_strdup (layouts[i]); + + g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, tmp); + g_free (tmp); + } + g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +out: + g_strfreev (layouts); + g_strfreev (variants); +} + +static void +convert_libgnomekbd_options (GSettings *settings) +{ + GPtrArray *opt_array; + GSettings *libgnomekbd_settings; + gchar **options, **o; + + if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard")) + return; + + opt_array = g_ptr_array_new_with_free_func (g_free); + + libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard"); + options = g_settings_get_strv (libgnomekbd_settings, "options"); + + for (o = options; *o; ++o) { + gchar **strv; + + strv = g_strsplit (*o, "\t", 2); + if (strv[0] && strv[1]) { + /* We don't want the group switcher because + * it's incompatible with the way we use XKB + * groups. */ + if (!g_str_has_prefix (strv[1], "grp:")) + g_ptr_array_add (opt_array, g_strdup (strv[1])); + } + g_strfreev (strv); + } + g_ptr_array_add (opt_array, NULL); + + g_settings_set_strv (settings, KEY_KEYBOARD_OPTIONS, (const gchar * const*) opt_array->pdata); + + g_strfreev (options); + g_object_unref (libgnomekbd_settings); + g_ptr_array_free (opt_array, TRUE); +} + +static void +convert_libgnomekbd_layouts (GSettings *settings) +{ + GVariantBuilder builder; + GSettings *libgnomekbd_settings; + gchar **layouts, **l; + + if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard")) + return; + + init_builder_with_sources (&builder, settings); + + libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard"); + layouts = g_settings_get_strv (libgnomekbd_settings, "layouts"); + + for (l = layouts; *l; ++l) { + gchar *id; + gchar **strv; + + strv = g_strsplit (*l, "\t", 2); + if (strv[0] && !strv[1]) + id = g_strdup (strv[0]); + else if (strv[0] && strv[1]) + id = g_strdup_printf ("%s+%s", strv[0], strv[1]); + else + id = NULL; + + if (id) + g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, id); + + g_free (id); + g_strfreev (strv); + } + + g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); + + g_strfreev (layouts); + g_object_unref (libgnomekbd_settings); +} + +static void +maybe_convert_old_settings (GSettings *settings) +{ + GVariant *sources; + gchar **options; + gchar *stamp_dir_path = NULL; + gchar *stamp_file_path = NULL; + GError *error = NULL; + + stamp_dir_path = g_build_filename (g_get_user_data_dir (), PACKAGE_NAME, NULL); + if (g_mkdir_with_parents (stamp_dir_path, 0755)) { + g_warning ("Failed to create directory %s: %s", stamp_dir_path, g_strerror (errno)); + goto out; + } + + stamp_file_path = g_build_filename (stamp_dir_path, "input-sources-converted", NULL); + if (g_file_test (stamp_file_path, G_FILE_TEST_EXISTS)) + goto out; + + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + if (g_variant_n_children (sources) < 1) { + convert_libgnomekbd_layouts (settings); +#ifdef HAVE_IBUS + convert_ibus (settings); +#endif + } + g_variant_unref (sources); + + options = g_settings_get_strv (settings, KEY_KEYBOARD_OPTIONS); + if (g_strv_length (options) < 1) + convert_libgnomekbd_options (settings); + g_strfreev (options); + + if (!g_file_set_contents (stamp_file_path, "", 0, &error)) { + g_warning ("%s", error->message); + g_error_free (error); + } +out: + g_free (stamp_file_path); + g_free (stamp_dir_path); +} + +static void +maybe_create_input_sources (GsdKeyboardManager *manager) +{ + GSettings *settings; + GVariant *sources; + + settings = manager->priv->input_sources_settings; + + if (g_getenv ("RUNNING_UNDER_GDM")) { + create_sources_from_current_xkb_config (settings); + return; + } + + maybe_convert_old_settings (settings); + + /* if we still don't have anything do some educated guesses */ + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + if (g_variant_n_children (sources) < 1) { + create_sources_from_current_xkb_config (settings); +#ifdef HAVE_IBUS + add_ibus_sources_from_locale (settings); +#endif + } + g_variant_unref (sources); +} + +static gboolean +start_keyboard_idle_cb (GsdKeyboardManager *manager) +{ + gnome_settings_profile_start (NULL); + + g_debug ("Starting keyboard manager"); + + manager->priv->settings = g_settings_new (GSD_KEYBOARD_DIR); + + xkb_init (manager); + + set_devicepresence_handler (manager); + + manager->priv->input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + manager->priv->interface_settings = g_settings_new (GNOME_DESKTOP_INTERFACE_DIR); + manager->priv->xkb_info = gnome_xkb_info_new (); + + maybe_create_input_sources (manager); + +#ifdef HAVE_IBUS + /* We don't want to touch IBus until we are sure this isn't a + fallback session. */ + manager->priv->session_is_fallback = TRUE; + manager->priv->ibus_cancellable = g_cancellable_new (); + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->ibus_cancellable, + (GAsyncReadyCallback)got_bus, + manager); +#else + apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); +#endif + /* apply current settings before we install the callback */ + g_debug ("Started the keyboard plugin, applying all settings"); + apply_all_settings (manager); + + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (settings_changed), manager); + g_signal_connect (G_OBJECT (manager->priv->input_sources_settings), "change-event", + G_CALLBACK (apply_input_sources_settings), manager); + + install_xkb_filter (manager); + set_input_sources_switcher (manager, enable_switcher (manager)); + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_keyboard_manager_start (GsdKeyboardManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + if (check_xkb_extension (manager) == FALSE) { + g_debug ("XKB is not supported, not applying any settings"); + return TRUE; + } + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_keyboard_manager_stop (GsdKeyboardManager *manager) +{ + GsdKeyboardManagerPrivate *p = manager->priv; + + g_debug ("Stopping keyboard manager"); + + g_clear_object (&p->settings); + g_clear_object (&p->input_sources_settings); + g_clear_object (&p->interface_settings); + g_clear_object (&p->xkb_info); + +#ifdef HAVE_IBUS + clear_ibus (manager); +#endif + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); + g_signal_handler_disconnect (p->device_manager, p->device_removed_id); + p->device_manager = NULL; + } + + remove_xkb_filter (manager); + + set_input_sources_switcher (manager, FALSE); +} + +static void +gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdKeyboardManagerPrivate)); +} + +static void +gsd_keyboard_manager_init (GsdKeyboardManager *manager) +{ + manager->priv = GSD_KEYBOARD_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_keyboard_manager_finalize (GObject *object) +{ + GsdKeyboardManager *keyboard_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_KEYBOARD_MANAGER (object)); + + keyboard_manager = GSD_KEYBOARD_MANAGER (object); + + g_return_if_fail (keyboard_manager->priv != NULL); + + if (keyboard_manager->priv->start_idle_id != 0) + g_source_remove (keyboard_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_keyboard_manager_parent_class)->finalize (object); +} + +GsdKeyboardManager * +gsd_keyboard_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_KEYBOARD_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_KEYBOARD_MANAGER (manager_object); +} diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-manager.h b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-manager.h new file mode 100644 index 00000000..42e26006 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_KEYBOARD_MANAGER_H +#define __GSD_KEYBOARD_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_KEYBOARD_MANAGER (gsd_keyboard_manager_get_type ()) +#define GSD_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManager)) +#define GSD_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerClass)) +#define GSD_IS_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_KEYBOARD_MANAGER)) +#define GSD_IS_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_KEYBOARD_MANAGER)) +#define GSD_KEYBOARD_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerClass)) + +typedef struct GsdKeyboardManagerPrivate GsdKeyboardManagerPrivate; + +typedef struct +{ + GObject parent; + GsdKeyboardManagerPrivate *priv; +} GsdKeyboardManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdKeyboardManagerClass; + +GType gsd_keyboard_manager_get_type (void); + +GsdKeyboardManager * gsd_keyboard_manager_new (void); +gboolean gsd_keyboard_manager_start (GsdKeyboardManager *manager, + GError **error); +void gsd_keyboard_manager_stop (GsdKeyboardManager *manager); + +G_END_DECLS + +#endif /* __GSD_KEYBOARD_MANAGER_H */ diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-xkb.c b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-xkb.c new file mode 100644 index 00000000..e69de29b diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-xkb.h b/.pc/revert_new_ibus_use.patch/plugins/keyboard/gsd-keyboard-xkb.h new file mode 100644 index 00000000..e69de29b diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/test-keyboard-ibus-utils.c b/.pc/revert_new_ibus_use.patch/plugins/keyboard/test-keyboard-ibus-utils.c new file mode 100644 index 00000000..0bfc2e52 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/keyboard/test-keyboard-ibus-utils.c @@ -0,0 +1,116 @@ +#include "gsd-keyboard-manager.c" + +static void +test_make_xkb_source_id (void) +{ + gint i; + const gchar *test_strings[][2] = { + /* input output */ + { "xkb:aa:bb:cc", "aa+bb" }, + { "xkb:aa:bb:", "aa+bb" }, + { "xkb:aa::cc", "aa" }, + { "xkb:aa::", "aa" }, + { "xkb::bb:cc", "+bb" }, + { "xkb::bb:", "+bb" }, + { "xkb:::cc", "" }, + { "xkb:::", "" }, + }; + + for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) + g_assert_cmpstr (make_xkb_source_id (test_strings[i][0]), ==, test_strings[i][1]); +} + +static void +test_layout_from_ibus_layout (void) +{ + gint i; + const gchar *test_strings[][2] = { + /* input output */ + { "", "" }, + { "a", "a" }, + { "a(", "a" }, + { "a[", "a" }, + }; + + for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) + g_assert_cmpstr (layout_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]); +} + +static void +test_variant_from_ibus_layout (void) +{ + gint i; + const gchar *test_strings[][2] = { + /* input output */ + { "", NULL }, + { "a", NULL }, + { "(", NULL }, + { "()", "" }, + { "(b)", "b" }, + { "a(", NULL }, + { "a()", "" }, + { "a(b)", "b" }, + }; + + for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) + g_assert_cmpstr (variant_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]); +} + +static void +test_options_from_ibus_layout (void) +{ + gint i, j; + gchar *output_0[] = { + NULL + }; + gchar *output_1[] = { + "", + NULL + }; + gchar *output_2[] = { + "b", + NULL + }; + gchar *output_3[] = { + "b", "", + NULL + }; + gchar *output_4[] = { + "b", "c", + NULL + }; + const gpointer tests[][2] = { + /* input output */ + { "", NULL }, + { "a", NULL }, + { "a[", output_0 }, + { "a[]", output_1 }, + { "a[b]", output_2 }, + { "a[b,]", output_3 }, + { "a[b,c]", output_4 }, + }; + + for (i = 0; i < G_N_ELEMENTS (tests); ++i) { + if (tests[i][1] == NULL) { + g_assert (options_from_ibus_layout (tests[i][0]) == NULL); + } else { + gchar **strv_a = options_from_ibus_layout (tests[i][0]); + gchar **strv_b = tests[i][1]; + + g_assert (g_strv_length (strv_a) == g_strv_length (strv_b)); + for (j = 0; j < g_strv_length (strv_a); ++j) + g_assert_cmpstr (strv_a[j], ==, strv_b[j]); + } + } +} + +int +main (void) +{ + test_make_xkb_source_id (); + test_layout_from_ibus_layout (); + test_variant_from_ibus_layout (); + test_options_from_ibus_layout (); + + return 0; +} diff --git a/.pc/revert_new_ibus_use.patch/plugins/keyboard/test-keyboard.c b/.pc/revert_new_ibus_use.patch/plugins/keyboard/test-keyboard.c new file mode 100644 index 00000000..35b8880f --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/keyboard/test-keyboard.c @@ -0,0 +1,7 @@ +#define NEW gsd_keyboard_manager_new +#define START gsd_keyboard_manager_start +#define STOP gsd_keyboard_manager_stop +#define MANAGER GsdKeyboardManager +#include "gsd-keyboard-manager.h" + +#include "test-plugin.h" diff --git a/.pc/revert_new_ibus_use.patch/plugins/media-keys/gsd-media-keys-manager.c b/.pc/revert_new_ibus_use.patch/plugins/media-keys/gsd-media-keys-manager.c new file mode 100644 index 00000000..b9547794 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/media-keys/gsd-media-keys-manager.c @@ -0,0 +1,2795 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GUDEV +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-marshal.h" +#include "gsd-media-keys-manager.h" + +#include "shortcuts-list.h" +#include "gsd-osd-window.h" +#include "gsd-input-helper.h" +#include "gsd-power-helper.h" +#include "gsd-enums.h" + +#include +#include +#include "gvc-mixer-control.h" + +#include + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" +#define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +#define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +#define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring" +#define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon" +#define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon" + +#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +#define SETTINGS_INTERFACE_DIR "org.gnome.desktop.interface" +#define SETTINGS_POWER_DIR "org.gnome.settings-daemon.plugins.power" +#define SETTINGS_XSETTINGS_DIR "org.gnome.settings-daemon.plugins.xsettings" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" +#define TOUCHPAD_ENABLED_KEY "touchpad-enabled" +#define HIGH_CONTRAST "HighContrast" + +#define VOLUME_STEP 6 /* percents for one volume button press */ +#define MAX_VOLUME 65536.0 + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" + +#define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + +typedef struct { + char *application; + char *name; + guint32 time; + guint watch_id; +} MediaPlayer; + +typedef struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; + char *custom_path; + char *custom_command; + Key *key; +} MediaKey; + +struct GsdMediaKeysManagerPrivate +{ + /* Volume bits */ + GvcMixerControl *volume; + GvcMixerStream *stream; + ca_context *ca; + GtkSettings *gtksettings; +#ifdef HAVE_GUDEV + GHashTable *streams; /* key = X device ID, value = stream id */ + GUdevClient *udev_client; +#endif /* HAVE_GUDEV */ + + GtkWidget *dialog; + GSettings *settings; + GHashTable *custom_settings; + + GPtrArray *keys; + + /* HighContrast theme settings */ + GSettings *interface_settings; + char *icon_theme; + char *gtk_theme; + + /* Power stuff */ + GSettings *power_settings; + GDBusProxy *upower_proxy; + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; + int opcode; + + GList *media_players; + + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + guint start_idle_id; + + /* Ubuntu notifications */ + NotifyNotification *volume_notification; + NotifyNotification *brightness_notification; + NotifyNotification *kb_backlight_notification; +}; + +static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +static void gsd_media_keys_manager_init (GsdMediaKeysManager *media_keys_manager); +static void gsd_media_keys_manager_finalize (GObject *object); +static void register_manager (GsdMediaKeysManager *manager); +static void custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager); +G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous" +#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only" +#define NOTIFY_HINT_TRUE "true" + +typedef struct { + GsdMediaKeysManager *manager; + MediaKeyType type; + guint old_percentage; + +} GsdBrightnessActionData; + +static const char *volume_icons[] = { + "notification-audio-volume-muted", + "notification-audio-volume-low", + "notification-audio-volume-medium", + "notification-audio-volume-high", + NULL +}; + +static const char *brightness_icons[] = { + "notification-display-brightness-off", + "notification-display-brightness-low", + "notification-display-brightness-medium", + "notification-display-brightness-high", + "notification-display-brightness-full", + NULL +}; + +static const char *kb_backlight_icons[] = { + "notification-keyboard-brightness-off", + "notification-keyboard-brightness-low", + "notification-keyboard-brightness-medium", + "notification-keyboard-brightness-high", + "notification-keyboard-brightness-full", + NULL +}; + +static const char * +calculate_icon_name (gint value, const char **icon_names) +{ + value = CLAMP (value, 0, 100); + gint length = g_strv_length (icon_names); + gint s = (length - 1) * value / 100 + 1; + s = CLAMP (s, 1, length - 1); + + return icon_names[s]; +} + +static gboolean +ubuntu_osd_notification_is_supported (void) +{ + GList *caps; + gboolean has_cap; + + caps = notify_get_server_caps (); + has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL); + g_list_foreach (caps, (GFunc) g_free, NULL); + g_list_free (caps); + + return has_cap; +} + +static gboolean +ubuntu_osd_notification_show_icon (const char *icon, + const char *hint) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + NotifyNotification *notification = notify_notification_new (" ", "", icon); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE); + + gboolean res = notify_notification_show (notification, NULL); + g_object_unref (notification); + + return res; +} + +static gboolean +ubuntu_osd_do_notification (NotifyNotification **notification, + const char *hint, + gint value, + gboolean muted, + const char **icon_names) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + if (!*notification) { + *notification = notify_notification_new (" ", "", NULL); + notify_notification_set_hint_string (*notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + } + + value = CLAMP (value, -1, 101); + const char *icon = muted ? icon_names[0] : calculate_icon_name (value, icon_names); + notify_notification_set_hint_int32 (*notification, "value", value); + notify_notification_update (*notification, " ", "", icon); + + return notify_notification_show (*notification, NULL); +} + +static gboolean +ubuntu_osd_notification_show_volume (GsdMediaKeysManager *manager, + gint value, + gboolean muted) +{ + return ubuntu_osd_do_notification (&manager->priv->volume_notification, + "volume", value, muted, volume_icons); +} + +static gboolean +ubuntu_osd_notification_show_brightness (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->brightness_notification, + "brightness", value, value <= 0, brightness_icons); +} + +static gboolean +ubuntu_osd_notification_show_kb_backlight (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->kb_backlight_notification, + "keyboard", value, value <= 0, kb_backlight_icons); +} + +static void +init_screens (GsdMediaKeysManager *manager) +{ + GdkDisplay *display; + int i; + + display = gdk_display_get_default (); + for (i = 0; i < gdk_display_get_n_screens (display); i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + if (screen == NULL) { + continue; + } + manager->priv->screens = g_slist_append (manager->priv->screens, screen); + } + + manager->priv->current_screen = manager->priv->screens->data; +} + +static void +media_key_free (MediaKey *key) +{ + if (key == NULL) + return; + g_free (key->custom_path); + g_free (key->custom_command); + free_key (key->key); + g_free (key); +} + +static char * +get_term_command (GsdMediaKeysManager *manager) +{ + char *cmd_term, *cmd_args;; + char *cmd = NULL; + GSettings *settings; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + cmd_term = g_settings_get_string (settings, "exec"); + if (cmd_term[0] == '\0') + cmd_term = g_strdup ("gnome-terminal"); + + cmd_args = g_settings_get_string (settings, "exec-arg"); + if (strcmp (cmd_term, "") != 0) { + cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args); + } else { + cmd = g_strdup_printf ("%s -e", cmd_term); + } + + g_free (cmd_args); + g_free (cmd_term); + g_object_unref (settings); + + return cmd; +} + +static char ** +get_keyring_env (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant, *item; + GVariantIter *iter; + char **envp; + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_KEYRING_DBUS_NAME, + GNOME_KEYRING_DBUS_PATH, + GNOME_KEYRING_DBUS_INTERFACE, + "GetEnvironment", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call GetEnvironment on keyring daemon: %s", error->message); + g_error_free (error); + return NULL; + } + + envp = g_get_environ (); + + g_variant_get (variant, "(a{ss})", &iter); + + while ((item = g_variant_iter_next_value (iter))) { + char *key; + char *value; + + g_variant_get (item, + "{ss}", + &key, + &value); + + envp = g_environ_setenv (envp, key, value, TRUE); + + g_variant_unref (item); + g_free (key); + g_free (value); + } + + g_variant_iter_free (iter); + g_variant_unref (variant); + + return envp; +} + +static void +execute (GsdMediaKeysManager *manager, + char *cmd, + gboolean need_term) +{ + gboolean retval; + char **argv; + int argc; + char *exec; + char *term = NULL; + GError *error = NULL; + + retval = FALSE; + + if (need_term) + term = get_term_command (manager); + + if (term) { + exec = g_strdup_printf ("%s %s", term, cmd); + g_free (term); + } else { + exec = g_strdup (cmd); + } + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + char **envp; + + envp = get_keyring_env (manager); + + retval = g_spawn_async (g_get_home_dir (), + argv, + envp, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + &error); + + g_strfreev (argv); + g_strfreev (envp); + } + + if (retval == FALSE) { + g_warning ("Couldn't execute command: %s: %s", exec, error->message); + g_error_free (error); + } + g_free (exec); +} + +static void +dialog_init (GsdMediaKeysManager *manager) +{ + if (manager->priv->dialog != NULL + && !gsd_osd_window_is_valid (GSD_OSD_WINDOW (manager->priv->dialog))) { + gtk_widget_destroy (manager->priv->dialog); + manager->priv->dialog = NULL; + } + + if (manager->priv->dialog == NULL) { + manager->priv->dialog = gsd_osd_window_new (); + } +} + +static void +print_key_parse_error (MediaKey *key, + const char *str) +{ + if (str == NULL || *str == '\0') + return; + if (key->settings_key != NULL) + g_debug ("Unable to parse key '%s' for GSettings entry '%s'", str, key->settings_key); + else + g_debug ("Unable to parse hard-coded key '%s'", key->hard_coded); +} + +static char * +get_key_string (GsdMediaKeysManager *manager, + MediaKey *key) +{ + if (key->settings_key != NULL) + return g_settings_get_string (manager->priv->settings, key->settings_key); + else if (key->hard_coded != NULL) + return g_strdup (key->hard_coded); + else if (key->custom_path != NULL) { + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->custom_settings, + key->custom_path); + return g_settings_get_string (settings, "binding"); + } else + g_assert_not_reached (); +} + +static gboolean +grab_media_key (MediaKey *key, + GsdMediaKeysManager *manager) +{ + char *tmp; + gboolean need_flush; + + need_flush = FALSE; + + if (key->key != NULL) { + need_flush = TRUE; + ungrab_key_unsafe (key->key, manager->priv->screens); + } + + free_key (key->key); + key->key = NULL; + + tmp = get_key_string (manager, key); + + key->key = parse_key (tmp); + if (key->key == NULL) { + print_key_parse_error (key, tmp); + g_free (tmp); + return need_flush; + } + + grab_key_unsafe (key->key, GSD_KEYGRAB_NORMAL, manager->priv->screens); + + g_free (tmp); + + return TRUE; +} + +static void +gsettings_changed_cb (GSettings *settings, + const gchar *settings_key, + GsdMediaKeysManager *manager) +{ + int i; + gboolean need_flush = TRUE; + + /* handled in gsettings_custom_changed_cb() */ + if (g_str_equal (settings_key, "custom-keybindings")) + return; + + gdk_error_trap_push (); + + /* Find the key that was modified */ + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + /* Skip over hard-coded and GConf keys */ + if (key->settings_key == NULL) + continue; + if (strcmp (settings_key, key->settings_key) == 0) { + if (grab_media_key (key, manager)) + need_flush = TRUE; + break; + } + } + + if (need_flush) + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); +} + +static MediaKey * +media_key_new_for_path (GsdMediaKeysManager *manager, + char *path) +{ + GSettings *settings; + char *command, *binding; + MediaKey *key; + + g_debug ("media_key_new_for_path: %s", path); + + settings = g_hash_table_lookup (manager->priv->custom_settings, path); + if (settings == NULL) { + settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path); + + g_signal_connect (settings, "changed", + G_CALLBACK (custom_binding_changed), manager); + g_hash_table_insert (manager->priv->custom_settings, + g_strdup (path), settings); + } + + command = g_settings_get_string (settings, "command"); + binding = g_settings_get_string (settings, "binding"); + + if (*command == '\0' && *binding == '\0') { + g_debug ("Key binding (%s) is incomplete", path); + g_free (command); + g_free (binding); + return NULL; + } + g_free (binding); + + key = g_new0 (MediaKey, 1); + key->key_type = CUSTOM_KEY; + key->custom_path = g_strdup (path); + key->custom_command = command; + + return key; +} + +static void +update_custom_binding (GsdMediaKeysManager *manager, + char *path) +{ + MediaKey *key; + int i; + + /* Remove the existing key */ + for (i = 0; i < manager->priv->keys->len; i++) { + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->custom_path == NULL) + continue; + if (strcmp (key->custom_path, path) == 0) { + g_debug ("Removing custom key binding %s", path); + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", path); + } + g_ptr_array_remove_index_fast (manager->priv->keys, i); + break; + } + } + + /* And create a new one! */ + key = media_key_new_for_path (manager, path); + if (key) { + g_debug ("Adding new custom key binding %s", path); + g_ptr_array_add (manager->priv->keys, key); + + gdk_error_trap_push (); + + grab_media_key (key, manager); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for custom key '%s'", + key->custom_path); + } +} + +static void +custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char *path; + + if (strcmp (settings_key, "name") == 0) + return; /* we don't care */ + + g_object_get (settings, "path", &path, NULL); + update_custom_binding (manager, path); + g_free (path); +} + +static void +gsettings_custom_changed_cb (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char **bindings; + int i, j, n_bindings; + + bindings = g_settings_get_strv (settings, settings_key); + n_bindings = g_strv_length (bindings); + + /* Handle additions */ + for (i = 0; i < n_bindings; i++) { + if (g_hash_table_lookup (manager->priv->custom_settings, + bindings[i])) + continue; + update_custom_binding (manager, bindings[i]); + } + + /* Handle removals */ + for (i = 0; i < manager->priv->keys->len; i++) { + gboolean found = FALSE; + MediaKey *key = g_ptr_array_index (manager->priv->keys, i); + if (key->key_type != CUSTOM_KEY) + continue; + + for (j = 0; j < n_bindings && !found; j++) + found = strcmp (bindings[j], key->custom_path) == 0; + + if (found) + continue; + + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", key->custom_path); + } + g_hash_table_remove (manager->priv->custom_settings, + key->custom_path); + g_ptr_array_remove_index_fast (manager->priv->keys, i); + --i; /* make up for the removed key */ + } + g_strfreev (bindings); +} + +static void +add_key (GsdMediaKeysManager *manager, guint i) +{ + MediaKey *key; + + key = g_new0 (MediaKey, 1); + key->key_type = media_keys[i].key_type; + key->settings_key = media_keys[i].settings_key; + key->hard_coded = media_keys[i].hard_coded; + + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); +} + +static void +init_kbd (GsdMediaKeysManager *manager) +{ + char **custom_paths; + int i; + + gnome_settings_profile_start (NULL); + + gdk_error_trap_push (); + + manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free); + + /* Media keys + * Add hard-coded shortcuts first so that they can't be preempted */ + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded) + add_key (manager, i); + } + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded == NULL) + add_key (manager, i); + } + + /* Custom shortcuts */ + custom_paths = g_settings_get_strv (manager->priv->settings, + "custom-keybindings"); + + for (i = 0; i < g_strv_length (custom_paths); i++) { + MediaKey *key; + + g_debug ("Setting up custom keybinding %s", custom_paths[i]); + + key = media_key_new_for_path (manager, custom_paths[i]); + if (!key) { + continue; + } + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); + } + g_strfreev (custom_paths); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); + + gnome_settings_profile_end (NULL); +} + +static void +dialog_show (GsdMediaKeysManager *manager) +{ + int orig_w; + int orig_h; + int screen_w; + int screen_h; + int x; + int y; + GdkRectangle geometry; + int monitor; + + gtk_window_set_screen (GTK_WINDOW (manager->priv->dialog), + manager->priv->current_screen); + + /* + * get the window size + * if the window hasn't been mapped, it doesn't necessarily + * know its true size, yet, so we need to jump through hoops + */ + gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h); + + monitor = gdk_screen_get_primary_monitor (manager->priv->current_screen); + + gdk_screen_get_monitor_geometry (manager->priv->current_screen, + monitor, + &geometry); + + screen_w = geometry.width; + screen_h = geometry.height; + + x = ((screen_w - orig_w) / 2) + geometry.x; + y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; + + gtk_window_move (GTK_WINDOW (manager->priv->dialog), x, y); + + gtk_widget_show (manager->priv->dialog); + + gdk_display_sync (gdk_screen_get_display (manager->priv->current_screen)); +} + +static void +launch_app (GAppInfo *app_info, + gint64 timestamp) +{ + GError *error = NULL; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + if (!g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) { + g_warning ("Could not launch '%s': %s", + g_app_info_get_commandline (app_info), + error->message); + g_error_free (error); + } + g_object_unref (launch_context); +} + +static void +do_url_action (GsdMediaKeysManager *manager, + const char *scheme, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_uri_scheme (scheme); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' scheme", scheme); + } +} + +static void +do_media_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg"); + } +} + +static void +do_terminal_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + char *term; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + term = g_settings_get_string (settings, "exec"); + + if (term) + execute (manager, term, FALSE); + + g_free (term); + g_object_unref (settings); +} + +static void +gnome_session_shutdown (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + /* Shouldn't happen, but you never know */ + if (manager->priv->connection == NULL) { + execute (manager, "gnome-session-quit --logout", FALSE); + return; + } + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + "Shutdown", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call Shutdown on session manager: %s", error->message); + g_error_free (error); + return; + } + g_variant_unref (variant); +} + +static void +do_logout_action (GsdMediaKeysManager *manager) +{ + execute (manager, "gnome-session-quit --logout", FALSE); +} + +static void +do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + g_drive_eject_with_operation_finish (drive, res, NULL); +} + +#define NO_SCORE 0 +#define SCORE_CAN_EJECT 50 +#define SCORE_HAS_MEDIA 100 +static void +do_eject_action (GsdMediaKeysManager *manager) +{ + GList *drives, *l; + GDrive *fav_drive; + guint score; + GVolumeMonitor *volume_monitor; + + volume_monitor = g_volume_monitor_get (); + + + /* Find the best drive to eject */ + fav_drive = NULL; + score = NO_SCORE; + drives = g_volume_monitor_get_connected_drives (volume_monitor); + for (l = drives; l != NULL; l = l->next) { + GDrive *drive = l->data; + + if (g_drive_can_eject (drive) == FALSE) + continue; + if (g_drive_is_media_removable (drive) == FALSE) + continue; + if (score < SCORE_CAN_EJECT) { + fav_drive = drive; + score = SCORE_CAN_EJECT; + } + if (g_drive_has_media (drive) == FALSE) + continue; + if (score < SCORE_HAS_MEDIA) { + fav_drive = drive; + score = SCORE_HAS_MEDIA; + break; + } + } + + /* Show the dialogue */ + if (!ubuntu_osd_notification_show_icon ("notification-device-eject", "Eject")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "media-eject-symbolic", + FALSE); + dialog_show (manager); + } + + /* Clean up the drive selection and exit if no suitable + * drives are found */ + if (fav_drive != NULL) + fav_drive = g_object_ref (fav_drive); + + g_list_foreach (drives, (GFunc) g_object_unref, NULL); + if (fav_drive == NULL) + return; + + /* Eject! */ + g_drive_eject_with_operation (fav_drive, G_MOUNT_UNMOUNT_FORCE, + NULL, NULL, + (GAsyncReadyCallback) do_eject_action_cb, + manager); + g_object_unref (fav_drive); + g_object_unref (volume_monitor); +} + +static void +do_home_key_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GFile *file; + GError *error = NULL; + char *uri; + + file = g_file_new_for_path (g_get_home_dir ()); + uri = g_file_get_uri (file); + g_object_unref (file); + + if (gtk_show_uri (NULL, uri, timestamp, &error) == FALSE) { + g_warning ("Failed to launch '%s': %s", uri, error->message); + g_error_free (error); + } + g_free (uri); +} + +static void +do_execute_desktop (GsdMediaKeysManager *manager, + const char *desktop, + gint64 timestamp) +{ + GDesktopAppInfo *app_info; + + app_info = g_desktop_app_info_new (desktop); + if (app_info != NULL) { + launch_app (G_APP_INFO (app_info), timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find application '%s'", desktop); + } +} + +static void +do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) +{ + if (!ubuntu_osd_notification_show_icon ((!state) ? "touchpad-disabled-symbolic" : "input-touchpad-symbolic", "Touchpad")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", + FALSE); + dialog_show (manager); + } +} + +static void +do_touchpad_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + gboolean state; + + if (touchpad_is_present () == FALSE) { + do_touchpad_osd_action (manager, FALSE); + return; + } + + settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY); + + do_touchpad_osd_action (manager, !state); + + g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state); + g_object_unref (settings); +} + +static void +update_dialog (GsdMediaKeysManager *manager, + GvcMixerStream *stream, + guint vol, + gboolean muted, + gboolean sound_changed, + gboolean quiet) +{ + if (ubuntu_osd_notification_show_volume (manager, vol, muted)) + goto done; + + vol = CLAMP (vol, 0, 100); + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), + muted); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), vol); + gsd_osd_window_set_action (GSD_OSD_WINDOW (manager->priv->dialog), + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + +done: + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); + ca_context_play (manager->priv->ca, 1, + CA_PROP_EVENT_ID, "audio-volume-change", + CA_PROP_EVENT_DESCRIPTION, "volume changed through key press", + CA_PROP_CANBERRA_CACHE_CONTROL, "permanent", + NULL); + } +} + +#ifdef HAVE_GUDEV +/* PulseAudio gives us /devices/... paths, when udev + * expects /sys/devices/... paths. */ +static GUdevDevice * +get_udev_device_for_sysfs_path (GsdMediaKeysManager *manager, + const char *sysfs_path) +{ + char *path; + GUdevDevice *dev; + + path = g_strdup_printf ("/sys%s", sysfs_path); + dev = g_udev_client_query_by_sysfs_path (manager->priv->udev_client, path); + g_free (path); + + return dev; +} + +static GvcMixerStream * +get_stream_for_device_id (GsdMediaKeysManager *manager, + guint deviceid) +{ + char *devnode; + gpointer id_ptr; + GvcMixerStream *res; + GUdevDevice *dev, *parent; + GSList *sinks, *l; + + id_ptr = g_hash_table_lookup (manager->priv->streams, GUINT_TO_POINTER (deviceid)); + if (id_ptr != NULL) { + if (GPOINTER_TO_UINT (id_ptr) == (guint) -1) + return NULL; + else + return gvc_mixer_control_lookup_stream_id (manager->priv->volume, GPOINTER_TO_UINT (id_ptr)); + } + + devnode = xdevice_get_device_node (deviceid); + if (devnode == NULL) { + g_debug ("Could not find device node for XInput device %d", deviceid); + return NULL; + } + + dev = g_udev_client_query_by_device_file (manager->priv->udev_client, devnode); + if (dev == NULL) { + g_debug ("Could not find udev device for device path '%s'", devnode); + g_free (devnode); + return NULL; + } + g_free (devnode); + + if (g_strcmp0 (g_udev_device_get_property (dev, "ID_BUS"), "usb") != 0) { + g_debug ("Not handling XInput device %d, not USB", deviceid); + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + g_object_unref (dev); + return NULL; + } + + parent = g_udev_device_get_parent_with_subsystem (dev, "usb", "usb_device"); + if (parent == NULL) { + g_warning ("No USB device parent for XInput device %d even though it's USB", deviceid); + g_object_unref (dev); + return NULL; + } + + res = NULL; + sinks = gvc_mixer_control_get_sinks (manager->priv->volume); + for (l = sinks; l; l = l->next) { + GvcMixerStream *stream = l->data; + const char *sysfs_path; + GUdevDevice *sink_dev, *sink_parent; + + sysfs_path = gvc_mixer_stream_get_sysfs_path (stream); + sink_dev = get_udev_device_for_sysfs_path (manager, sysfs_path); + if (sink_dev == NULL) + continue; + sink_parent = g_udev_device_get_parent_with_subsystem (sink_dev, "usb", "usb_device"); + g_object_unref (sink_dev); + if (sink_parent == NULL) + continue; + + if (g_strcmp0 (g_udev_device_get_sysfs_path (sink_parent), + g_udev_device_get_sysfs_path (parent)) == 0) { + res = stream; + } + g_object_unref (sink_parent); + if (res != NULL) + break; + } + + if (res) + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER (gvc_mixer_stream_get_id (res))); + else + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + + return res; +} +#endif /* HAVE_GUDEV */ + +static void +do_sound_action (GsdMediaKeysManager *manager, + guint deviceid, + int type, + gboolean quiet) +{ + GvcMixerStream *stream; + gboolean old_muted, new_muted; + guint old_vol, new_vol, norm_vol_step, osd_vol; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +#ifdef HAVE_GUDEV + stream = get_stream_for_device_id (manager, deviceid); + if (stream == NULL) +#endif /* HAVE_GUDEV */ + stream = manager->priv->stream; + if (stream == NULL) + return; + + norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100; + + /* FIXME: this is racy */ + new_vol = old_vol = gvc_mixer_stream_get_volume (stream); + new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream); + sound_changed = FALSE; + + switch (type) { + case MUTE_KEY: + new_muted = !old_muted; + break; + case VOLUME_DOWN_KEY: + if (old_vol <= norm_vol_step) { + new_vol = 0; + new_muted = TRUE; + } else { + new_vol = old_vol - norm_vol_step; + } + break; + case VOLUME_UP_KEY: + new_muted = FALSE; + /* When coming out of mute only increase the volume if it was 0 */ + if (!old_muted || old_vol == 0) + new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME); + break; + } + + if (old_muted != new_muted) { + gvc_mixer_stream_change_is_muted (stream, new_muted); + sound_changed = TRUE; + } + + if (old_vol != new_vol) { + if (gvc_mixer_stream_set_volume (stream, new_vol) != FALSE) { + gvc_mixer_stream_push_volume (stream); + sound_changed = TRUE; + } + } + + if (type == VOLUME_DOWN_KEY && old_vol == 0 && old_muted) + osd_vol = -1; + else if (type == VOLUME_UP_KEY && old_vol == PA_VOLUME_NORM && !old_muted) + osd_vol = 101; + else if (!new_muted) + osd_vol = (int) (100 * (double) new_vol / PA_VOLUME_NORM); + else + osd_vol = 0; + + update_dialog (manager, stream, osd_vol, new_muted, sound_changed, quiet); +} + +static void +sound_theme_changed (GtkSettings *settings, + GParamSpec *pspec, + GsdMediaKeysManager *manager) +{ + char *theme_name; + + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); +} + +static void +update_default_sink (GsdMediaKeysManager *manager) +{ + GvcMixerStream *stream; + + stream = gvc_mixer_control_get_default_sink (manager->priv->volume); + if (stream == manager->priv->stream) + return; + + if (manager->priv->stream != NULL) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + + if (stream != NULL) { + manager->priv->stream = g_object_ref (stream); + } else { + g_warning ("Unable to get default sink"); + } +} + +static void +on_control_state_changed (GvcMixerControl *control, + GvcMixerControlState new_state, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +static void +on_control_default_sink_changed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +#ifdef HAVE_GUDEV +static gboolean +remove_stream (gpointer key, + gpointer value, + gpointer id) +{ + if (GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (id)) + return TRUE; + return FALSE; +} +#endif /* HAVE_GUDEV */ + +static void +on_control_stream_removed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + if (manager->priv->stream != NULL) { + if (gvc_mixer_stream_get_id (manager->priv->stream) == id) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + } + +#ifdef HAVE_GUDEV + g_hash_table_foreach_remove (manager->priv->streams, (GHRFunc) remove_stream, GUINT_TO_POINTER (id)); +#endif +} + +static void +free_media_player (MediaPlayer *player) +{ + if (player->watch_id > 0) { + g_bus_unwatch_name (player->watch_id); + player->watch_id = 0; + } + g_free (player->application); + g_free (player->name); + g_free (player); +} + +static gint +find_by_application (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->application, b); +} + +static gint +find_by_name (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->name, b); +} + +static gint +find_by_time (gconstpointer a, + gconstpointer b) +{ + return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time; +} + +static void +name_vanished_handler (GDBusConnection *connection, + const gchar *name, + GsdMediaKeysManager *manager) +{ + GList *iter; + + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering vanished %s (name: %s)", player->application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +/* + * Register a new media player. Most applications will want to call + * this with time = GDK_CURRENT_TIME. This way, the last registered + * player will receive media events. In some cases, applications + * may want to register with a lower priority (usually 1), to grab + * events only nobody is interested. + */ +static void +gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name, + guint32 time) +{ + GList *iter; + MediaPlayer *media_player; + guint watch_id; + + if (time == GDK_CURRENT_TIME) { + GTimeVal tv; + + g_get_current_time (&tv); + time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + } + + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + + if (iter != NULL) { + if (((MediaPlayer *)iter->data)->time < time) { + MediaPlayer *player = iter->data; + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } else { + return; + } + } + + watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_handler, + manager, + NULL); + + g_debug ("Registering %s at %u", application, time); + media_player = g_new0 (MediaPlayer, 1); + media_player->application = g_strdup (application); + media_player->name = g_strdup (name); + media_player->time = time; + media_player->watch_id = watch_id; + + manager->priv->media_players = g_list_insert_sorted (manager->priv->media_players, + media_player, + find_by_time); +} + +static void +gsd_media_keys_manager_release_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name) +{ + GList *iter = NULL; + + g_return_if_fail (application != NULL || name != NULL); + + if (application != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + } + + if (iter == NULL && name != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + } + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering %s (name: %s)", application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +static gboolean +gsd_media_player_key_pressed (GsdMediaKeysManager *manager, + const char *key) +{ + const char *application; + gboolean have_listeners; + GError *error = NULL; + MediaPlayer *player; + + g_return_val_if_fail (key != NULL, FALSE); + + g_debug ("Media key '%s' pressed", key); + + have_listeners = (manager->priv->media_players != NULL); + + if (!have_listeners) { + /* Popup a dialog with an (/) icon */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "action-unavailable-symbolic", + FALSE); + dialog_show (manager); + return TRUE; + } + + player = manager->priv->media_players->data; + application = player->application; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + player->name, + GSD_MEDIA_KEYS_DBUS_PATH, + GSD_MEDIA_KEYS_DBUS_NAME, + "MediaPlayerKeyPressed", + g_variant_new ("(ss)", application ? application : "", key), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + + return !have_listeners; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdMediaKeysManager *manager = (GsdMediaKeysManager *) user_data; + + g_debug ("Calling method '%s' for media-keys", method_name); + + if (g_strcmp0 (method_name, "ReleaseMediaPlayerKeys") == 0) { + const char *app_name; + + g_variant_get (parameters, "(&s)", &app_name); + gsd_media_keys_manager_release_media_player_keys (manager, app_name, sender); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "GrabMediaPlayerKeys") == 0) { + const char *app_name; + guint32 time; + + g_variant_get (parameters, "(&su)", &app_name, &time); + gsd_media_keys_manager_grab_media_player_keys (manager, app_name, sender, time); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static gboolean +do_multimedia_player_action (GsdMediaKeysManager *manager, + const char *icon, + const char *key) +{ + if (icon != NULL) + ubuntu_osd_notification_show_icon (icon, key); + return gsd_media_player_key_pressed (manager, key); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + char *action; + + action = g_object_get_data (G_OBJECT (source_object), + "gsd-media-keys-manager-xrandr-action"); + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call '%s': %s", action, error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } + + g_free (action); +} + +static void +do_xrandr_action (GsdMediaKeysManager *manager, + const char *action, + gint64 timestamp) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + priv->cancellable = g_cancellable_new (); + + g_object_set_data (G_OBJECT (priv->xrandr_proxy), + "gsd-media-keys-manager-xrandr-action", + g_strdup (action)); + + g_dbus_proxy_call (priv->xrandr_proxy, + action, + g_variant_new ("(x)", timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static gboolean +do_video_out_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "VideoModeSwitch", timestamp); + return FALSE; +} + +static gboolean +do_video_rotate_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "Rotate", timestamp); + return FALSE; +} + +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + +static void +do_text_size_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + gdouble factor, best, distance; + guint i; + + /* Same values used in the Seeing tab of the Universal Access panel */ + static gdouble factors[] = { + 0.75, + 1.0, + 1.25, + 1.5 + }; + + /* Figure out the current DPI scaling factor */ + factor = g_settings_get_double (manager->priv->interface_settings, "text-scaling-factor"); + factor += (type == INCREASE_TEXT_KEY ? 0.25 : -0.25); + + /* Try to find a matching value */ + distance = 1e6; + best = 1.0; + for (i = 0; i < G_N_ELEMENTS(factors); i++) { + gdouble d; + d = fabs (factor - factors[i]); + if (d < distance) { + best = factors[i]; + distance = d; + } + } + + if (best == 1.0) + g_settings_reset (manager->priv->interface_settings, "text-scaling-factor"); + else + g_settings_set_double (manager->priv->interface_settings, "text-scaling-factor", best); +} + +static void +do_magnifier_zoom_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + gdouble offset, value; + + if (type == MAGNIFIER_ZOOM_IN_KEY) + offset = 1.0; + else + offset = -1.0; + + settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + value = g_settings_get_double (settings, "mag-factor"); + value += offset; + value = roundl (value); + g_settings_set_double (settings, "mag-factor", value); + g_object_unref (settings); +} + +static void +do_toggle_contrast_action (GsdMediaKeysManager *manager) +{ + gboolean high_contrast; + char *theme; + + /* Are we using HighContrast now? */ + theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + high_contrast = g_str_equal (theme, HIGH_CONTRAST); + g_free (theme); + + if (high_contrast != FALSE) { + if (manager->priv->gtk_theme == NULL) + g_settings_reset (manager->priv->interface_settings, "gtk-theme"); + else + g_settings_set (manager->priv->interface_settings, "gtk-theme", manager->priv->gtk_theme); + g_settings_set (manager->priv->interface_settings, "icon-theme", manager->priv->icon_theme); + } else { + g_settings_set (manager->priv->interface_settings, "gtk-theme", HIGH_CONTRAST); + g_settings_set (manager->priv->interface_settings, "icon-theme", HIGH_CONTRAST); + } +} + +static void +do_config_power_action (GsdMediaKeysManager *manager, + const gchar *config_key) +{ + GsdPowerActionType action_type; + + action_type = g_settings_get_enum (manager->priv->power_settings, + config_key); + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + case GSD_POWER_ACTION_SHUTDOWN: + gnome_session_shutdown (manager); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_BLANK: + case GSD_POWER_ACTION_NOTHING: + /* these actions cannot be handled by media-keys and + * are not used in this context */ + break; + } +} + +static void +update_screen_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); + g_free (data); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + guint osd_percentage; + + if (data->old_percentage == 100 && data->type == SCREEN_BRIGHTNESS_UP_KEY) + osd_percentage = 101; + else if (data->old_percentage == 0 && data->type == SCREEN_BRIGHTNESS_DOWN_KEY) + osd_percentage = -1; + else + osd_percentage = CLAMP (percentage, 0, 100); + + if (!ubuntu_osd_notification_show_brightness (manager, osd_percentage)) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "display-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_free (data); + g_variant_unref (new_percentage); +} + +static void +do_screen_brightness_action_real (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + GError *error = NULL; + + GVariant *old_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (old_percentage == NULL) { + g_warning ("Failed to get old screen percentage: %s", error->message); + g_error_free (error); + g_free (data); + return; + } + + g_variant_get (old_percentage, "(u)", &data->old_percentage); + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_screen_proxy, + data->type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_screen_cb, + data); + + g_variant_unref (old_percentage); +} + +static void +do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + if (manager->priv->connection == NULL || + manager->priv->power_screen_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + GsdBrightnessActionData *data = g_new0 (GsdBrightnessActionData, 1); + data->manager = manager; + data->type = type; + + g_dbus_proxy_call (manager->priv->power_screen_proxy, + "GetPercentage", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + do_screen_brightness_action_real, + data); +} + +static void +update_keyboard_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new keyboard percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + + /* FIXME: No overshoot effect for keyboard, as the power plugin has no interface + * to get the old brightness */ + if (!ubuntu_osd_notification_show_kb_backlight (manager, CLAMP (percentage, 0, 100))) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "keyboard-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_variant_unref (new_percentage); +} + +static void +do_keyboard_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + const char *cmd; + + if (manager->priv->connection == NULL || + manager->priv->power_keyboard_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + switch (type) { + case KEYBOARD_BRIGHTNESS_UP_KEY: + cmd = "StepUp"; + break; + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + cmd = "StepDown"; + break; + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + cmd = "Toggle"; + break; + default: + g_assert_not_reached (); + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_keyboard_proxy, + cmd, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_keyboard_cb, + manager); +} + +static void +do_switch_input_source_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + GVariant *sources; + gint i, n; + + settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); + + n = g_variant_n_children (sources); + if (n < 2) + goto out; + + i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); + + if (type == SWITCH_INPUT_SOURCE_KEY) + i += 1; + else + i -= 1; + + if (i < 0) + i = n - 1; + else if (i >= n) + i = 0; + + g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); + + out: + g_variant_unref (sources); + g_object_unref (settings); +} + +static void +do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +{ + execute (manager, key->custom_command, FALSE); +} + +static gboolean +do_action (GsdMediaKeysManager *manager, + guint deviceid, + MediaKeyType type, + gint64 timestamp) +{ + char *cmd; + + g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid); + + switch (type) { + case TOUCHPAD_KEY: + do_touchpad_action (manager); + break; + case TOUCHPAD_ON_KEY: + do_touchpad_osd_action (manager, TRUE); + break; + case TOUCHPAD_OFF_KEY: + do_touchpad_osd_action (manager, FALSE); + break; + case MUTE_KEY: + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + do_sound_action (manager, deviceid, type, FALSE); + break; + case MUTE_QUIET_KEY: + do_sound_action (manager, deviceid, MUTE_KEY, TRUE); + break; + case VOLUME_DOWN_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_DOWN_KEY, TRUE); + break; + case VOLUME_UP_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: + do_logout_action (manager); + break; + case EJECT_KEY: + do_eject_action (manager); + break; + case HOME_KEY: + do_home_key_action (manager, timestamp); + break; + case SEARCH_KEY: + cmd = NULL; + if ((cmd = g_find_program_in_path ("tracker-search-tool"))) + do_execute_desktop (manager, "tracker-needle.desktop", timestamp); + else + do_execute_desktop (manager, "gnome-search-tool.desktop", timestamp); + g_free (cmd); + break; + case EMAIL_KEY: + do_url_action (manager, "mailto", timestamp); + break; + case SCREENSAVER_KEY: + execute (manager, "gnome-screensaver-command --lock", FALSE); + break; + case HELP_KEY: + do_url_action (manager, "ghelp", timestamp); + break; + case SCREENSHOT_KEY: + execute (manager, "gnome-screenshot", FALSE); + break; + case WINDOW_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --window", FALSE); + break; + case AREA_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --area", FALSE); + break; + case SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --clipboard", FALSE); + break; + case WINDOW_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --window --clipboard", FALSE); + break; + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; + case TERMINAL_KEY: + do_terminal_action (manager); + break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; + case MEDIA_KEY: + do_media_action (manager, timestamp); + break; + case CALCULATOR_KEY: + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: + return do_multimedia_player_action (manager, NULL, "Play"); + case PAUSE_KEY: + return do_multimedia_player_action (manager, NULL, "Pause"); + case STOP_KEY: + return do_multimedia_player_action (manager, NULL, "Stop"); + case PREVIOUS_KEY: + return do_multimedia_player_action (manager, NULL, "Previous"); + case NEXT_KEY: + return do_multimedia_player_action (manager, NULL, "Next"); + case REWIND_KEY: + return do_multimedia_player_action (manager, NULL, "Rewind"); + case FORWARD_KEY: + return do_multimedia_player_action (manager, NULL, "FastForward"); + case REPEAT_KEY: + return do_multimedia_player_action (manager, NULL, "Repeat"); + case RANDOM_KEY: + return do_multimedia_player_action (manager, NULL, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; + case ROTATE_VIDEO_KEY: + do_video_rotate_action (manager, timestamp); + break; + case MAGNIFIER_KEY: + do_magnifier_action (manager); + break; + case SCREENREADER_KEY: + do_screenreader_action (manager); + break; + case ON_SCREEN_KEYBOARD_KEY: + do_on_screen_keyboard_action (manager); + break; + case INCREASE_TEXT_KEY: + case DECREASE_TEXT_KEY: + do_text_size_action (manager, type); + break; + case MAGNIFIER_ZOOM_IN_KEY: + case MAGNIFIER_ZOOM_OUT_KEY: + do_magnifier_zoom_action (manager, type); + break; + case TOGGLE_CONTRAST_KEY: + do_toggle_contrast_action (manager); + break; + case POWER_KEY: + do_config_power_action (manager, "button-power"); + break; + case SLEEP_KEY: + do_config_power_action (manager, "button-sleep"); + break; + case SUSPEND_KEY: + do_config_power_action (manager, "button-suspend"); + break; + case HIBERNATE_KEY: + do_config_power_action (manager, "button-hibernate"); + break; + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + do_screen_brightness_action (manager, type); + break; + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + do_keyboard_brightness_action (manager, type); + break; + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; + case SWITCH_INPUT_SOURCE_KEY: + case SWITCH_INPUT_SOURCE_BACKWARD_KEY: + do_switch_input_source_action (manager, type); + break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); + } + + return FALSE; +} + +static GdkScreen * +get_screen_from_root (GsdMediaKeysManager *manager, + Window root) +{ + GSList *l; + + /* Look for which screen we're receiving events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + GdkScreen *screen = (GdkScreen *) l->data; + GdkWindow *window = gdk_screen_get_root_window (screen); + + if (GDK_WINDOW_XID (window) == root) + return screen; + } + + return NULL; +} + +static GdkFilterReturn +filter_key_events (XEvent *xevent, + GdkEvent *event, + GsdMediaKeysManager *manager) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XGenericEventCookie *cookie; + guint i; + guint deviceid; + + /* verify we have a key event */ + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + cookie = &xevent->xcookie; + if (cookie->extension != manager->priv->opcode) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + deviceid = xev->sourceid; + + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (match_xi2_key (key->key, xev)) { + switch (key->key_type) { + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + /* auto-repeatable keys */ + if (xiev->evtype != XI_KeyPress) + return GDK_FILTER_CONTINUE; + break; + default: + if (xiev->evtype != XI_KeyRelease) { + return GDK_FILTER_CONTINUE; + } + } + + manager->priv->current_screen = get_screen_from_root (manager, xev->root); + + if (key->key_type == CUSTOM_KEY) { + do_custom_action (manager, key, xev->time); + return GDK_FILTER_REMOVE; + } + + if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +update_theme_settings (GSettings *settings, + const char *key, + GsdMediaKeysManager *manager) +{ + char *theme; + + theme = g_settings_get_string (manager->priv->interface_settings, key); + if (g_str_equal (theme, HIGH_CONTRAST)) { + g_free (theme); + } else { + if (g_str_equal (key, "gtk-theme")) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = theme; + } else { + g_free (manager->priv->icon_theme); + manager->priv->icon_theme = theme; + } + } +} + +static gboolean +start_media_keys_idle_cb (GsdMediaKeysManager *manager) +{ + GSList *l; + char *theme_name; + + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + + + gvc_mixer_control_open (manager->priv->volume); + + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::custom-keybindings", + G_CALLBACK (gsettings_custom_changed_cb), manager); + + manager->priv->custom_settings = + g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + /* Sound events */ + ca_context_create (&manager->priv->ca); + ca_context_set_driver (manager->priv->ca, "pulse"); + ca_context_change_props (manager->priv->ca, 0, + CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", + NULL); + manager->priv->gtksettings = gtk_settings_get_for_screen (gdk_screen_get_default ()); + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); + g_signal_connect (manager->priv->gtksettings, "notify::gtk-sound-theme-name", + G_CALLBACK (sound_theme_changed), manager); + + /* for the power plugin interface code */ + manager->priv->power_settings = g_settings_new (SETTINGS_POWER_DIR); + + /* Logic from http://git.gnome.org/browse/gnome-shell/tree/js/ui/status/accessibility.js#n163 */ + manager->priv->interface_settings = g_settings_new (SETTINGS_INTERFACE_DIR); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::gtk-theme", + G_CALLBACK (update_theme_settings), manager); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::icon-theme", + G_CALLBACK (update_theme_settings), manager); + manager->priv->gtk_theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + if (g_str_equal (manager->priv->gtk_theme, HIGH_CONTRAST)) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = NULL; + } + manager->priv->icon_theme = g_settings_get_string (manager->priv->interface_settings, "icon-theme"); + + init_screens (manager); + init_kbd (manager); + + /* Start filtering the events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + gnome_settings_profile_start ("gdk_window_add_filter"); + + g_debug ("adding key filter for screen: %d", + gdk_screen_get_number (l->data)); + + gdk_window_add_filter (gdk_screen_get_root_window (l->data), + (GdkFilterFunc) filter_key_events, + manager); + gnome_settings_profile_end ("gdk_window_add_filter"); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error) +{ + const char * const subsystems[] = { "input", "usb", "sound", NULL }; + + gnome_settings_profile_start (NULL); + + if (supports_xinput2_devices (&manager->priv->opcode) == FALSE) { + g_debug ("No Xinput2 support, disabling plugin"); + return TRUE; + } + +#ifdef HAVE_GUDEV + manager->priv->streams = g_hash_table_new (g_direct_hash, g_direct_equal); + manager->priv->udev_client = g_udev_client_new (subsystems); +#endif + + /* initialise Volume handler + * + * We do this one here to force checking gstreamer cache, etc. + * The rest (grabbing and setting the keys) can happen in an + * idle. + */ + gnome_settings_profile_start ("gvc_mixer_control_new"); + + manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys"); + + g_signal_connect (manager->priv->volume, + "state-changed", + G_CALLBACK (on_control_state_changed), + manager); + g_signal_connect (manager->priv->volume, + "default-sink-changed", + G_CALLBACK (on_control_default_sink_changed), + manager); + g_signal_connect (manager->priv->volume, + "stream-removed", + G_CALLBACK (on_control_stream_removed), + manager); + + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); + + register_manager (manager_object); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_media_keys_manager_stop (GsdMediaKeysManager *manager) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + GSList *ls; + GList *l; + int i; + + g_debug ("Stopping media_keys manager"); + + if (priv->bus_cancellable != NULL) { + g_cancellable_cancel (priv->bus_cancellable); + g_object_unref (priv->bus_cancellable); + priv->bus_cancellable = NULL; + } + + for (ls = priv->screens; ls != NULL; ls = ls->next) { + gdk_window_remove_filter (gdk_screen_get_root_window (ls->data), + (GdkFilterFunc) filter_key_events, + manager); + } + + if (manager->priv->gtksettings != NULL) { + g_signal_handlers_disconnect_by_func (manager->priv->gtksettings, sound_theme_changed, manager); + manager->priv->gtksettings = NULL; + } + + if (manager->priv->ca) { + ca_context_destroy (manager->priv->ca); + manager->priv->ca = NULL; + } + +#ifdef HAVE_GUDEV + if (priv->streams) { + g_hash_table_destroy (priv->streams); + priv->streams = NULL; + } + if (priv->udev_client) { + g_object_unref (priv->udev_client); + priv->udev_client = NULL; + } +#endif /* HAVE_GUDEV */ + + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; + } + + if (priv->power_settings) { + g_object_unref (priv->power_settings); + priv->power_settings = NULL; + } + + if (priv->power_screen_proxy) { + g_object_unref (priv->power_screen_proxy); + priv->power_screen_proxy = NULL; + } + + if (priv->power_keyboard_proxy) { + g_object_unref (priv->power_keyboard_proxy); + priv->power_keyboard_proxy = NULL; + } + + if (priv->upower_proxy) { + g_object_unref (priv->upower_proxy); + priv->upower_proxy = NULL; + } + + if (priv->cancellable != NULL) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + + if (priv->introspection_data) { + g_dbus_node_info_unref (priv->introspection_data); + priv->introspection_data = NULL; + } + + if (priv->connection != NULL) { + g_object_unref (priv->connection); + priv->connection = NULL; + } + + if (priv->volume_notification != NULL) { + notify_notification_close (priv->volume_notification, NULL); + g_object_unref (priv->volume_notification); + priv->volume_notification = NULL; + } + + if (priv->brightness_notification != NULL) { + notify_notification_close (priv->brightness_notification, NULL); + g_object_unref (priv->brightness_notification); + priv->brightness_notification = NULL; + } + + if (priv->kb_backlight_notification != NULL) { + notify_notification_close (priv->kb_backlight_notification, NULL); + g_object_unref (priv->kb_backlight_notification); + priv->kb_backlight_notification = NULL; + } + + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->key) + ungrab_key_unsafe (key->key, priv->screens); + } + g_ptr_array_free (priv->keys, TRUE); + priv->keys = NULL; + + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (priv->screens != NULL) { + g_slist_free (priv->screens); + priv->screens = NULL; + } + + if (priv->stream) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + if (priv->volume) { + g_object_unref (priv->volume); + priv->volume = NULL; + } + + if (priv->dialog != NULL) { + gtk_widget_destroy (priv->dialog); + priv->dialog = NULL; + } + + if (priv->media_players != NULL) { + for (l = priv->media_players; l; l = l->next) { + MediaPlayer *mp = l->data; + g_free (mp->application); + g_free (mp); + } + g_list_free (priv->media_players); + priv->media_players = NULL; + } +} + +static GObject * +gsd_media_keys_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMediaKeysManager *media_keys_manager; + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (media_keys_manager); +} + +static void +gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_media_keys_manager_constructor; + object_class->finalize = gsd_media_keys_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysManagerPrivate)); +} + +static void +gsd_media_keys_manager_init (GsdMediaKeysManager *manager) +{ + manager->priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_media_keys_manager_finalize (GObject *object) +{ + GsdMediaKeysManager *media_keys_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_MANAGER (object)); + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (object); + + g_return_if_fail (media_keys_manager->priv != NULL); + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object); +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +upower_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->upower_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Failed to get proxy for upower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_screen_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_screen_proxy == NULL) { + g_warning ("Failed to get proxy for power (screen): %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_keyboard_proxy == NULL) { + g_warning ("Failed to get proxy for power (keyboard): %s", + error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MEDIA_KEYS_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Screen", + NULL, + (GAsyncReadyCallback) power_screen_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Keyboard", + NULL, + (GAsyncReadyCallback) power_keyboard_ready_cb, + manager); +} + +static void +register_manager (GsdMediaKeysManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + NULL, + (GAsyncReadyCallback) upower_ready_cb, + manager); +} + +GsdMediaKeysManager * +gsd_media_keys_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MEDIA_KEYS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MEDIA_KEYS_MANAGER (manager_object); +} diff --git a/.pc/revert_new_ibus_use.patch/plugins/media-keys/shortcuts-list.h b/.pc/revert_new_ibus_use.patch/plugins/media-keys/shortcuts-list.h new file mode 100644 index 00000000..103d2e82 --- /dev/null +++ b/.pc/revert_new_ibus_use.patch/plugins/media-keys/shortcuts-list.h @@ -0,0 +1,158 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001 Bastien Nocera + * + * 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 __ACME_H__ +#define __ACME_H__ + +#include "gsd-keygrab.h" + +#define SETTINGS_BINDING_DIR "org.gnome.settings-daemon.plugins.media-keys" + +typedef enum { + TOUCHPAD_KEY, + TOUCHPAD_ON_KEY, + TOUCHPAD_OFF_KEY, + MUTE_KEY, + VOLUME_DOWN_KEY, + VOLUME_UP_KEY, + MUTE_QUIET_KEY, + VOLUME_DOWN_QUIET_KEY, + VOLUME_UP_QUIET_KEY, + LOGOUT_KEY, + EJECT_KEY, + HOME_KEY, + MEDIA_KEY, + CALCULATOR_KEY, + SEARCH_KEY, + EMAIL_KEY, + SCREENSAVER_KEY, + HELP_KEY, + SCREENSHOT_KEY, + WINDOW_SCREENSHOT_KEY, + AREA_SCREENSHOT_KEY, + SCREENSHOT_CLIP_KEY, + WINDOW_SCREENSHOT_CLIP_KEY, + AREA_SCREENSHOT_CLIP_KEY, + TERMINAL_KEY, + WWW_KEY, + PLAY_KEY, + PAUSE_KEY, + STOP_KEY, + PREVIOUS_KEY, + NEXT_KEY, + REWIND_KEY, + FORWARD_KEY, + REPEAT_KEY, + RANDOM_KEY, + VIDEO_OUT_KEY, + ROTATE_VIDEO_KEY, + MAGNIFIER_KEY, + SCREENREADER_KEY, + ON_SCREEN_KEYBOARD_KEY, + INCREASE_TEXT_KEY, + DECREASE_TEXT_KEY, + TOGGLE_CONTRAST_KEY, + MAGNIFIER_ZOOM_IN_KEY, + MAGNIFIER_ZOOM_OUT_KEY, + POWER_KEY, + SLEEP_KEY, + SUSPEND_KEY, + HIBERNATE_KEY, + SCREEN_BRIGHTNESS_UP_KEY, + SCREEN_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_UP_KEY, + KEYBOARD_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_TOGGLE_KEY, + BATTERY_KEY, + SWITCH_INPUT_SOURCE_KEY, + SWITCH_INPUT_SOURCE_BACKWARD_KEY, + CUSTOM_KEY +} MediaKeyType; + +static struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; +} media_keys[] = { + { TOUCHPAD_KEY, NULL, "XF86TouchpadToggle" }, + { TOUCHPAD_ON_KEY, NULL, "XF86TouchpadOn" }, + { TOUCHPAD_OFF_KEY, NULL, "XF86TouchpadOff" }, + { MUTE_KEY, "volume-mute", NULL }, + { VOLUME_DOWN_KEY, "volume-down", NULL }, + { VOLUME_UP_KEY, "volume-up", NULL }, + { MUTE_QUIET_KEY, NULL, "XF86AudioMute" }, + { VOLUME_DOWN_QUIET_KEY, NULL, "XF86AudioLowerVolume" }, + { VOLUME_UP_QUIET_KEY, NULL, "XF86AudioRaiseVolume" }, + { LOGOUT_KEY, "logout", NULL }, + { EJECT_KEY, "eject", NULL }, + { HOME_KEY, "home", NULL }, + { MEDIA_KEY, "media", NULL }, + { CALCULATOR_KEY, "calculator", NULL }, + { SEARCH_KEY, "search", NULL }, + { EMAIL_KEY, "email", NULL }, + { SCREENSAVER_KEY, "screensaver", NULL }, + { SCREENSAVER_KEY, NULL, "XF86ScreenSaver" }, + { HELP_KEY, "help", NULL }, + { SCREENSHOT_KEY, "screenshot", NULL }, + { WINDOW_SCREENSHOT_KEY, "window-screenshot", NULL }, + { AREA_SCREENSHOT_KEY, "area-screenshot", NULL }, + { SCREENSHOT_CLIP_KEY, "screenshot-clip", NULL }, + { WINDOW_SCREENSHOT_CLIP_KEY, "window-screenshot-clip", NULL }, + { AREA_SCREENSHOT_CLIP_KEY, "area-screenshot-clip", NULL }, + { TERMINAL_KEY, "terminal", NULL }, + { WWW_KEY, "www", NULL }, + { PLAY_KEY, "play", NULL }, + { PAUSE_KEY, "pause", NULL }, + { STOP_KEY, "stop", NULL }, + { PREVIOUS_KEY, "previous", NULL }, + { NEXT_KEY, "next", NULL }, + { REWIND_KEY, NULL, "XF86AudioRewind" }, + { FORWARD_KEY, NULL, "XF86AudioForward" }, + { REPEAT_KEY, NULL, "XF86AudioRepeat" }, + { RANDOM_KEY, NULL, "XF86AudioRandomPlay"}, + { VIDEO_OUT_KEY, NULL, "p" }, + /* Key code of the XF86Display key (Fn-F7 on Thinkpads, Fn-F4 on HP machines, etc.) */ + { VIDEO_OUT_KEY, NULL, "XF86Display" }, + /* Key code of the XF86RotateWindows key (present on some tablets) */ + { ROTATE_VIDEO_KEY, NULL, "XF86RotateWindows" }, + { MAGNIFIER_KEY, "magnifier", NULL }, + { SCREENREADER_KEY, "screenreader", NULL }, + { ON_SCREEN_KEYBOARD_KEY, "on-screen-keyboard", NULL }, + { INCREASE_TEXT_KEY, "increase-text-size", NULL }, + { DECREASE_TEXT_KEY, "decrease-text-size", NULL }, + { TOGGLE_CONTRAST_KEY, "toggle-contrast", NULL }, + { MAGNIFIER_ZOOM_IN_KEY, "magnifier-zoom-in", NULL }, + { MAGNIFIER_ZOOM_OUT_KEY, "magnifier-zoom-out", NULL }, + { POWER_KEY, NULL, "XF86PowerOff" }, + /* the kernel / Xorg names really are like this... */ + { SLEEP_KEY, NULL, "XF86Suspend" }, + { SUSPEND_KEY, NULL, "XF86Sleep" }, + { HIBERNATE_KEY, NULL, "XF86Hibernate" }, + { SCREEN_BRIGHTNESS_UP_KEY, NULL, "XF86MonBrightnessUp" }, + { SCREEN_BRIGHTNESS_DOWN_KEY, NULL, "XF86MonBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_UP_KEY, NULL, "XF86KbdBrightnessUp" }, + { KEYBOARD_BRIGHTNESS_DOWN_KEY, NULL, "XF86KbdBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_TOGGLE_KEY, NULL, "XF86KbdLightOnOff" }, + { SWITCH_INPUT_SOURCE_KEY, "switch-input-source", NULL }, + { SWITCH_INPUT_SOURCE_BACKWARD_KEY, "switch-input-source-backward", NULL }, + { BATTERY_KEY, NULL, "XF86Battery" }, +}; + +#endif /* __ACME_H__ */ diff --git a/.pc/touchscreen_rotation.patch/plugins/xrandr/gsd-xrandr-manager.c b/.pc/touchscreen_rotation.patch/plugins/xrandr/gsd-xrandr-manager.c new file mode 100644 index 00000000..5711c2d5 --- /dev/null +++ b/.pc/touchscreen_rotation.patch/plugins/xrandr/gsd-xrandr-manager.c @@ -0,0 +1,2288 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2007, 2008 Red Hat, Inc + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API + +#include +#include +#include + +#ifdef HAVE_WACOM +#include +#endif /* HAVE_WACOM */ + +#include "gsd-enums.h" +#include "gsd-input-helper.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-xrandr-manager.h" + +#define GSD_XRANDR_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_XRANDR_MANAGER, GsdXrandrManagerPrivate)) + +#define CONF_SCHEMA "org.gnome.settings-daemon.plugins.xrandr" +#define CONF_KEY_DEFAULT_MONITORS_SETUP "default-monitors-setup" +#define CONF_KEY_DEFAULT_CONFIGURATION_FILE "default-configuration-file" + +/* Number of seconds that the confirmation dialog will last before it resets the + * RANDR configuration to its old state. + */ +#define CONFIRMATION_DIALOG_SECONDS 30 + +/* name of the icon files (gsd-xrandr.svg, etc.) */ +#define GSD_XRANDR_ICON_NAME "gsd-xrandr" + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_XRANDR_DBUS_PATH GSD_DBUS_PATH "/XRANDR" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +struct GsdXrandrManagerPrivate +{ + GnomeRRScreen *rw_screen; + gboolean running; + + UpClient *upower_client; + gboolean laptop_lid_is_closed; + + GSettings *settings; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + + /* fn-F7 status */ + int current_fn_f7_config; /* -1 if no configs */ + GnomeRRConfig **fn_f7_configs; /* NULL terminated, NULL if there are no configs */ + + /* Last time at which we got a "screen got reconfigured" event; see on_randr_event() */ + guint32 last_config_timestamp; + +#ifdef HAVE_WACOM + WacomDeviceDatabase *wacom_db; +#endif /* HAVE_WACOM */ +}; + +static const GnomeRRRotation possible_rotations[] = { + GNOME_RR_ROTATION_0, + GNOME_RR_ROTATION_90, + GNOME_RR_ROTATION_180, + GNOME_RR_ROTATION_270 + /* We don't allow REFLECT_X or REFLECT_Y for now, as gnome-display-properties doesn't allow them, either */ +}; + +static void gsd_xrandr_manager_class_init (GsdXrandrManagerClass *klass); +static void gsd_xrandr_manager_init (GsdXrandrManager *xrandr_manager); +static void gsd_xrandr_manager_finalize (GObject *object); + +static void error_message (GsdXrandrManager *mgr, const char *primary_text, GError *error_to_display, const char *secondary_text); + +static void get_allowed_rotations_for_output (GnomeRRConfig *config, + GnomeRRScreen *rr_screen, + GnomeRROutputInfo *output, + int *out_num_rotations, + GnomeRRRotation *out_rotations); +static void handle_fn_f7 (GsdXrandrManager *mgr, guint32 timestamp); +static void handle_rotate_windows (GsdXrandrManager *mgr, GnomeRRRotation rotation, guint32 timestamp); + +G_DEFINE_TYPE (GsdXrandrManager, gsd_xrandr_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static FILE *log_file; + +static void +log_open (void) +{ + char *toggle_filename; + char *log_filename; + struct stat st; + + if (log_file) + return; + + toggle_filename = g_build_filename (g_get_home_dir (), "gsd-debug-randr", NULL); + log_filename = g_build_filename (g_get_home_dir (), "gsd-debug-randr.log", NULL); + + if (stat (toggle_filename, &st) != 0) + goto out; + + log_file = fopen (log_filename, "a"); + + if (log_file && ftell (log_file) == 0) + fprintf (log_file, "To keep this log from being created, please rm ~/gsd-debug-randr\n"); + +out: + g_free (toggle_filename); + g_free (log_filename); +} + +static void +log_close (void) +{ + if (log_file) { + fclose (log_file); + log_file = NULL; + } +} + +static void +log_msg (const char *format, ...) +{ + if (log_file) { + va_list args; + + va_start (args, format); + vfprintf (log_file, format, args); + va_end (args); + } +} + +static void +log_output (GnomeRROutputInfo *output) +{ + gchar *name = gnome_rr_output_info_get_name (output); + gchar *display_name = gnome_rr_output_info_get_display_name (output); + + log_msg (" %s: ", name ? name : "unknown"); + + if (gnome_rr_output_info_is_connected (output)) { + if (gnome_rr_output_info_is_active (output)) { + int x, y, width, height; + gnome_rr_output_info_get_geometry (output, &x, &y, &width, &height); + log_msg ("%dx%d@%d +%d+%d", + width, + height, + gnome_rr_output_info_get_refresh_rate (output), + x, + y); + } else + log_msg ("off"); + } else + log_msg ("disconnected"); + + if (display_name) + log_msg (" (%s)", display_name); + + if (gnome_rr_output_info_get_primary (output)) + log_msg (" (primary output)"); + + log_msg ("\n"); +} + +static void +log_configuration (GnomeRRConfig *config) +{ + int i; + GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (config); + + log_msg (" cloned: %s\n", gnome_rr_config_get_clone (config) ? "yes" : "no"); + + for (i = 0; outputs[i] != NULL; i++) + log_output (outputs[i]); + + if (i == 0) + log_msg (" no outputs!\n"); +} + +static char +timestamp_relationship (guint32 a, guint32 b) +{ + if (a < b) + return '<'; + else if (a > b) + return '>'; + else + return '='; +} + +static void +log_screen (GnomeRRScreen *screen) +{ + GnomeRRConfig *config; + int min_w, min_h, max_w, max_h; + guint32 change_timestamp, config_timestamp; + + if (!log_file) + return; + + config = gnome_rr_config_new_current (screen, NULL); + + gnome_rr_screen_get_ranges (screen, &min_w, &max_w, &min_h, &max_h); + gnome_rr_screen_get_timestamps (screen, &change_timestamp, &config_timestamp); + + log_msg (" Screen min(%d, %d), max(%d, %d), change=%u %c config=%u\n", + min_w, min_h, + max_w, max_h, + change_timestamp, + timestamp_relationship (change_timestamp, config_timestamp), + config_timestamp); + + log_configuration (config); + g_object_unref (config); +} + +static void +log_configurations (GnomeRRConfig **configs) +{ + int i; + + if (!configs) { + log_msg (" No configurations\n"); + return; + } + + for (i = 0; configs[i]; i++) { + log_msg (" Configuration %d\n", i); + log_configuration (configs[i]); + } +} + +static void +show_timestamps_dialog (GsdXrandrManager *manager, const char *msg) +{ +#if 1 + return; +#else + struct GsdXrandrManagerPrivate *priv = manager->priv; + GtkWidget *dialog; + guint32 change_timestamp, config_timestamp; + static int serial; + + gnome_rr_screen_get_timestamps (priv->rw_screen, &change_timestamp, &config_timestamp); + + dialog = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "RANDR timestamps (%d):\n%s\nchange: %u\nconfig: %u", + serial++, + msg, + change_timestamp, + config_timestamp); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + gtk_widget_show (dialog); +#endif +} + +static void +print_output (GnomeRROutputInfo *info) +{ + int x, y, width, height; + + g_print (" Output: %s attached to %s\n", gnome_rr_output_info_get_display_name (info), gnome_rr_output_info_get_name (info)); + g_print (" status: %s\n", gnome_rr_output_info_is_active (info) ? "on" : "off"); + + gnome_rr_output_info_get_geometry (info, &x, &y, &width, &height); + g_print (" width: %d\n", width); + g_print (" height: %d\n", height); + g_print (" rate: %d\n", gnome_rr_output_info_get_refresh_rate (info)); + g_print (" primary: %s\n", gnome_rr_output_info_get_primary (info) ? "true" : "false"); + g_print (" position: %d %d\n", x, y); +} + +static void +print_configuration (GnomeRRConfig *config, const char *header) +{ + int i; + GnomeRROutputInfo **outputs; + + g_print ("=== %s Configuration ===\n", header); + if (!config) { + g_print (" none\n"); + return; + } + + g_print (" Clone: %s\n", gnome_rr_config_get_clone (config) ? "true" : "false"); + + outputs = gnome_rr_config_get_outputs (config); + for (i = 0; outputs[i] != NULL; ++i) + print_output (outputs[i]); +} + +static gboolean +is_laptop (GnomeRRScreen *screen, GnomeRROutputInfo *output) +{ + GnomeRROutput *rr_output; + + rr_output = gnome_rr_screen_get_output_by_name (screen, gnome_rr_output_info_get_name (output)); + + return gnome_rr_output_is_laptop (rr_output); +} + +static GnomeRROutputInfo * +get_laptop_output_info (GnomeRRScreen *screen, GnomeRRConfig *config) +{ + int i; + GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (config); + + for (i = 0; outputs[i] != NULL; i++) { + if (is_laptop (screen, outputs[i])) + return outputs[i]; + } + + return NULL; +} + +static gboolean +non_laptop_outputs_are_active (GnomeRRConfig *config, GnomeRROutputInfo *laptop_info) +{ + GnomeRROutputInfo **outputs; + int i; + + outputs = gnome_rr_config_get_outputs (config); + for (i = 0; outputs[i] != NULL; i++) { + if (outputs[i] == laptop_info) + continue; + + if (gnome_rr_output_info_is_active (outputs[i])) + return TRUE; + } + + return FALSE; +} + +static void +turn_off_laptop_display_in_configuration (GnomeRRScreen *screen, GnomeRRConfig *config) +{ + GnomeRROutputInfo *laptop_info; + + laptop_info = get_laptop_output_info (screen, config); + if (laptop_info) { + /* Turn off the laptop's screen only if other displays are on. This is to avoid an all-black-screens scenario. */ + if (non_laptop_outputs_are_active (config, laptop_info)) + gnome_rr_output_info_set_active (laptop_info, FALSE); + } + + /* Adjust the offsets of outputs so they start at (0, 0) */ + gnome_rr_config_sanitize (config); +} + +/* This function effectively centralizes the use of gnome_rr_config_apply_from_filename_with_time(). + * + * Optionally filters out GNOME_RR_ERROR_NO_MATCHING_CONFIG from the matching + * process(), since that is not usually an error. + */ +static gboolean +apply_configuration_from_filename (GsdXrandrManager *manager, + const char *filename, + gboolean no_matching_config_is_an_error, + guint32 timestamp, + GError **error) +{ + struct GsdXrandrManagerPrivate *priv = manager->priv; + GnomeRRConfig *config; + GError *my_error; + gboolean success; + char *str; + + str = g_strdup_printf ("Applying %s with timestamp %d", filename, timestamp); + show_timestamps_dialog (manager, str); + g_free (str); + + my_error = NULL; + + config = g_object_new (GNOME_TYPE_RR_CONFIG, "screen", priv->rw_screen, NULL); + if (!gnome_rr_config_load_filename (config, filename, &my_error)) { + g_object_unref (config); + + if (g_error_matches (my_error, GNOME_RR_ERROR, GNOME_RR_ERROR_NO_MATCHING_CONFIG)) { + if (no_matching_config_is_an_error) { + g_propagate_error (error, my_error); + return FALSE; + } else { + /* This is not an error; the user probably changed his monitors + * and so they don't match any of the stored configurations. + */ + g_error_free (my_error); + return TRUE; + } + } else { + g_propagate_error (error, my_error); + return FALSE; + } + } + + if (up_client_get_lid_is_closed (priv->upower_client)) + turn_off_laptop_display_in_configuration (priv->rw_screen, config); + + gnome_rr_config_ensure_primary (config); + success = gnome_rr_config_apply_with_time (config, priv->rw_screen, timestamp, error); + + g_object_unref (config); + + return success; +} + +/* This function centralizes the use of gnome_rr_config_apply_with_time(). + * + * Applies a configuration and displays an error message if an error happens. + * We just return whether setting the configuration succeeded. + */ +static gboolean +apply_configuration (GsdXrandrManager *manager, GnomeRRConfig *config, guint32 timestamp, gboolean show_error, gboolean save_configuration) +{ + GsdXrandrManagerPrivate *priv = manager->priv; + GError *error; + gboolean success; + + gnome_rr_config_ensure_primary (config); + + print_configuration (config, "Applying Configuration"); + + error = NULL; + success = gnome_rr_config_apply_with_time (config, priv->rw_screen, timestamp, &error); + if (success) { + if (save_configuration) + gnome_rr_config_save (config, NULL); /* NULL-GError - there's not much we can do if this fails */ + } else { + log_msg ("Could not switch to the following configuration (timestamp %u): %s\n", timestamp, error->message); + log_configuration (config); + if (show_error) + error_message (manager, _("Could not switch the monitor configuration"), error, NULL); + g_error_free (error); + } + + return success; +} + +static void +restore_backup_configuration_without_messages (const char *backup_filename, const char *intended_filename) +{ + backup_filename = gnome_rr_config_get_backup_filename (); + rename (backup_filename, intended_filename); +} + +static void +restore_backup_configuration (GsdXrandrManager *manager, const char *backup_filename, const char *intended_filename, guint32 timestamp) +{ + int saved_errno; + + if (rename (backup_filename, intended_filename) == 0) { + GError *error; + + error = NULL; + if (!apply_configuration_from_filename (manager, intended_filename, FALSE, timestamp, &error)) { + error_message (manager, _("Could not restore the display's configuration"), error, NULL); + + if (error) + g_error_free (error); + } + + return; + } + + saved_errno = errno; + + /* ENOENT means the original file didn't exist. That is *not* an error; + * the backup was not created because there wasn't even an original + * monitors.xml (such as on a first-time login). Note that *here* there + * is a "didn't work" monitors.xml, so we must delete that one. + */ + if (saved_errno == ENOENT) + unlink (intended_filename); + else { + char *msg; + + msg = g_strdup_printf ("Could not rename %s to %s: %s", + backup_filename, intended_filename, + g_strerror (saved_errno)); + error_message (manager, + _("Could not restore the display's configuration from a backup"), + NULL, + msg); + g_free (msg); + } + + unlink (backup_filename); +} + +typedef struct { + GsdXrandrManager *manager; + GtkWidget *dialog; + + int countdown; + int response_id; +} TimeoutDialog; + +static void +print_countdown_text (TimeoutDialog *timeout) +{ + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (timeout->dialog), + ngettext ("The display will be reset to its previous configuration in %d second", + "The display will be reset to its previous configuration in %d seconds", + timeout->countdown), + timeout->countdown); +} + +static gboolean +timeout_cb (gpointer data) +{ + TimeoutDialog *timeout = data; + + timeout->countdown--; + + if (timeout->countdown == 0) { + timeout->response_id = GTK_RESPONSE_CANCEL; + gtk_main_quit (); + } else { + print_countdown_text (timeout); + } + + return TRUE; +} + +static void +timeout_response_cb (GtkDialog *dialog, int response_id, gpointer data) +{ + TimeoutDialog *timeout = data; + + if (response_id == GTK_RESPONSE_DELETE_EVENT) { + /* The user closed the dialog or pressed ESC, revert */ + timeout->response_id = GTK_RESPONSE_CANCEL; + } else + timeout->response_id = response_id; + + gtk_main_quit (); +} + +static gboolean +user_says_things_are_ok (GsdXrandrManager *manager, GdkWindow *parent_window) +{ + TimeoutDialog timeout; + guint timeout_id; + + timeout.manager = manager; + + timeout.dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + _("Does the display look OK?")); + + timeout.countdown = CONFIRMATION_DIALOG_SECONDS; + + print_countdown_text (&timeout); + + gtk_window_set_icon_name (GTK_WINDOW (timeout.dialog), "preferences-desktop-display"); + gtk_dialog_add_button (GTK_DIALOG (timeout.dialog), _("_Restore Previous Configuration"), GTK_RESPONSE_CANCEL); + gtk_dialog_add_button (GTK_DIALOG (timeout.dialog), _("_Keep This Configuration"), GTK_RESPONSE_ACCEPT); + gtk_dialog_set_default_response (GTK_DIALOG (timeout.dialog), GTK_RESPONSE_ACCEPT); /* ah, the optimism */ + + g_signal_connect (timeout.dialog, "response", + G_CALLBACK (timeout_response_cb), + &timeout); + + gtk_widget_realize (timeout.dialog); + + if (parent_window) + gdk_window_set_transient_for (gtk_widget_get_window (timeout.dialog), parent_window); + + gtk_widget_show_all (timeout.dialog); + /* We don't use g_timeout_add_seconds() since we actually care that the user sees "real" second ticks in the dialog */ + timeout_id = g_timeout_add (1000, + timeout_cb, + &timeout); + gtk_main (); + + gtk_widget_destroy (timeout.dialog); + g_source_remove (timeout_id); + + if (timeout.response_id == GTK_RESPONSE_ACCEPT) + return TRUE; + else + return FALSE; +} + +struct confirmation { + GsdXrandrManager *manager; + GdkWindow *parent_window; + guint32 timestamp; +}; + +static gboolean +confirm_with_user_idle_cb (gpointer data) +{ + struct confirmation *confirmation = data; + char *backup_filename; + char *intended_filename; + + backup_filename = gnome_rr_config_get_backup_filename (); + intended_filename = gnome_rr_config_get_intended_filename (); + + if (user_says_things_are_ok (confirmation->manager, confirmation->parent_window)) + unlink (backup_filename); + else + restore_backup_configuration (confirmation->manager, backup_filename, intended_filename, confirmation->timestamp); + + g_free (confirmation); + + return FALSE; +} + +static void +queue_confirmation_by_user (GsdXrandrManager *manager, GdkWindow *parent_window, guint32 timestamp) +{ + struct confirmation *confirmation; + + confirmation = g_new (struct confirmation, 1); + confirmation->manager = manager; + confirmation->parent_window = parent_window; + confirmation->timestamp = timestamp; + + g_idle_add (confirm_with_user_idle_cb, confirmation); +} + +static gboolean +try_to_apply_intended_configuration (GsdXrandrManager *manager, GdkWindow *parent_window, guint32 timestamp, GError **error) +{ + char *backup_filename; + char *intended_filename; + gboolean result; + + /* Try to apply the intended configuration */ + + backup_filename = gnome_rr_config_get_backup_filename (); + intended_filename = gnome_rr_config_get_intended_filename (); + + result = apply_configuration_from_filename (manager, intended_filename, FALSE, timestamp, error); + if (!result) { + error_message (manager, _("The selected configuration for displays could not be applied"), error ? *error : NULL, NULL); + restore_backup_configuration_without_messages (backup_filename, intended_filename); + goto out; + } else { + /* We need to return as quickly as possible, so instead of + * confirming with the user right here, we do it in an idle + * handler. The caller only expects a status for "could you + * change the RANDR configuration?", not "is the user OK with it + * as well?". + */ + queue_confirmation_by_user (manager, parent_window, timestamp); + } + +out: + g_free (backup_filename); + g_free (intended_filename); + + return result; +} + +/* DBus method for org.gnome.SettingsDaemon.XRANDR_2 ApplyConfiguration; see gsd-xrandr-manager.xml for the interface definition */ +static gboolean +gsd_xrandr_manager_2_apply_configuration (GsdXrandrManager *manager, + gint64 parent_window_id, + gint64 timestamp, + GError **error) +{ + GdkWindow *parent_window; + gboolean result; + + if (parent_window_id != 0) + parent_window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), (Window) parent_window_id); + else + parent_window = NULL; + + result = try_to_apply_intended_configuration (manager, parent_window, (guint32) timestamp, error); + + if (parent_window) + g_object_unref (parent_window); + + return result; +} + +/* DBus method for org.gnome.SettingsDaemon.XRANDR_2 VideoModeSwitch; see gsd-xrandr-manager.xml for the interface definition */ +static gboolean +gsd_xrandr_manager_2_video_mode_switch (GsdXrandrManager *manager, + guint32 timestamp, + GError **error) +{ + handle_fn_f7 (manager, timestamp); + return TRUE; +} + +/* DBus method for org.gnome.SettingsDaemon.XRANDR_2 Rotate; see gsd-xrandr-manager.xml for the interface definition */ +static gboolean +gsd_xrandr_manager_2_rotate (GsdXrandrManager *manager, + guint32 timestamp, + GError **error) +{ + handle_rotate_windows (manager, GNOME_RR_ROTATION_NEXT, timestamp); + return TRUE; +} + +/* DBus method for org.gnome.SettingsDaemon.XRANDR_2 RotateTo; see gsd-xrandr-manager.xml for the interface definition */ +static gboolean +gsd_xrandr_manager_2_rotate_to (GsdXrandrManager *manager, + GnomeRRRotation rotation, + guint32 timestamp, + GError **error) +{ + guint i; + gboolean found; + + found = FALSE; + for (i = 0; i < G_N_ELEMENTS (possible_rotations); i++) { + if (rotation == possible_rotations[i]) { + found = TRUE; + break; + } + } + + if (found == FALSE) { + g_debug ("Not setting out of bounds rotation '%d'", rotation); + return FALSE; + } + + handle_rotate_windows (manager, rotation, timestamp); + return TRUE; +} + +static gboolean +get_clone_size (GnomeRRScreen *screen, int *width, int *height) +{ + GnomeRRMode **modes = gnome_rr_screen_list_clone_modes (screen); + int best_w, best_h; + int i; + + best_w = 0; + best_h = 0; + + for (i = 0; modes[i] != NULL; ++i) { + GnomeRRMode *mode = modes[i]; + int w, h; + + w = gnome_rr_mode_get_width (mode); + h = gnome_rr_mode_get_height (mode); + + if (w * h > best_w * best_h) { + best_w = w; + best_h = h; + } + } + + if (best_w > 0 && best_h > 0) { + if (width) + *width = best_w; + if (height) + *height = best_h; + + return TRUE; + } + + return FALSE; +} + +static gboolean +config_is_all_off (GnomeRRConfig *config) +{ + int j; + GnomeRROutputInfo **outputs; + + outputs = gnome_rr_config_get_outputs (config); + + for (j = 0; outputs[j] != NULL; ++j) { + if (gnome_rr_output_info_is_active (outputs[j])) { + return FALSE; + } + } + + return TRUE; +} + +static gboolean +laptop_lid_is_closed (GsdXrandrManager *manager) +{ + return up_client_get_lid_is_closed (manager->priv->upower_client); +} + +static gboolean +is_laptop_with_closed_lid (GsdXrandrManager *manager, GnomeRRScreen *screen, GnomeRROutputInfo *info) +{ + return is_laptop (screen, info) && laptop_lid_is_closed (manager); +} + +static GnomeRRConfig * +make_clone_setup (GsdXrandrManager *manager, GnomeRRScreen *screen) +{ + GnomeRRConfig *result; + GnomeRROutputInfo **outputs; + int width, height; + int i; + + if (!get_clone_size (screen, &width, &height)) + return NULL; + + result = gnome_rr_config_new_current (screen, NULL); + outputs = gnome_rr_config_get_outputs (result); + + for (i = 0; outputs[i] != NULL; ++i) { + GnomeRROutputInfo *info = outputs[i]; + + gnome_rr_output_info_set_active (info, FALSE); + if (!is_laptop_with_closed_lid (manager, screen, info) && gnome_rr_output_info_is_connected (info)) { + GnomeRROutput *output = + gnome_rr_screen_get_output_by_name (screen, gnome_rr_output_info_get_name (info)); + GnomeRRMode **modes = gnome_rr_output_list_modes (output); + int j; + int best_rate = 0; + + for (j = 0; modes[j] != NULL; ++j) { + GnomeRRMode *mode = modes[j]; + int w, h; + + w = gnome_rr_mode_get_width (mode); + h = gnome_rr_mode_get_height (mode); + + if (w == width && h == height) { + int r = gnome_rr_mode_get_freq (mode); + if (r > best_rate) + best_rate = r; + } + } + + if (best_rate > 0) { + gnome_rr_output_info_set_active (info, TRUE); + gnome_rr_output_info_set_rotation (info, GNOME_RR_ROTATION_0); + gnome_rr_output_info_set_refresh_rate (info, best_rate); + gnome_rr_output_info_set_geometry (info, 0, 0, width, height); + } + } + } + + if (config_is_all_off (result)) { + g_object_unref (G_OBJECT (result)); + result = NULL; + } + + gnome_rr_config_set_clone (result, TRUE); + + print_configuration (result, "clone setup"); + + return result; +} + +static GnomeRRMode * +find_best_mode (GnomeRROutput *output) +{ + GnomeRRMode *preferred; + GnomeRRMode **modes; + int best_size; + int best_width, best_height, best_rate; + int i; + GnomeRRMode *best_mode; + + preferred = gnome_rr_output_get_preferred_mode (output); + if (preferred) + return preferred; + + modes = gnome_rr_output_list_modes (output); + if (!modes) + return NULL; + + best_size = best_width = best_height = best_rate = 0; + best_mode = NULL; + + for (i = 0; modes[i] != NULL; i++) { + int w, h, r; + int size; + + w = gnome_rr_mode_get_width (modes[i]); + h = gnome_rr_mode_get_height (modes[i]); + r = gnome_rr_mode_get_freq (modes[i]); + + size = w * h; + + if (size > best_size) { + best_size = size; + best_width = w; + best_height = h; + best_rate = r; + best_mode = modes[i]; + } else if (size == best_size) { + if (r > best_rate) { + best_rate = r; + best_mode = modes[i]; + } + } + } + + return best_mode; +} + +static gboolean +turn_on (GnomeRRScreen *screen, + GnomeRROutputInfo *info, + int x, int y) +{ + GnomeRROutput *output = gnome_rr_screen_get_output_by_name (screen, gnome_rr_output_info_get_name (info)); + GnomeRRMode *mode = find_best_mode (output); + + if (mode) { + gnome_rr_output_info_set_active (info, TRUE); + gnome_rr_output_info_set_geometry (info, x, y, gnome_rr_mode_get_width (mode), gnome_rr_mode_get_height (mode)); + gnome_rr_output_info_set_rotation (info, GNOME_RR_ROTATION_0); + gnome_rr_output_info_set_refresh_rate (info, gnome_rr_mode_get_freq (mode)); + + return TRUE; + } + + return FALSE; +} + +static GnomeRRConfig * +make_laptop_setup (GsdXrandrManager *manager, GnomeRRScreen *screen) +{ + /* Turn on the laptop, disable everything else */ + GnomeRRConfig *result = gnome_rr_config_new_current (screen, NULL); + GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (result); + int i; + + for (i = 0; outputs[i] != NULL; ++i) { + GnomeRROutputInfo *info = outputs[i]; + + if (is_laptop (screen, info) && !laptop_lid_is_closed (manager)) { + if (!turn_on (screen, info, 0, 0)) { + g_object_unref (G_OBJECT (result)); + result = NULL; + break; + } + } + else { + gnome_rr_output_info_set_active (info, FALSE); + } + } + + if (config_is_all_off (result)) { + g_object_unref (G_OBJECT (result)); + result = NULL; + } + + gnome_rr_config_set_clone (result, FALSE); + + print_configuration (result, "Laptop setup"); + + /* FIXME - Maybe we should return NULL if there is more than + * one connected "laptop" screen? + */ + return result; + +} + +static int +turn_on_and_get_rightmost_offset (GnomeRRScreen *screen, GnomeRROutputInfo *info, int x) +{ + if (turn_on (screen, info, x, 0)) { + int width; + gnome_rr_output_info_get_geometry (info, NULL, NULL, &width, NULL); + x += width; + } + + return x; +} + +/* Used from qsort(); compares outputs based on their X position */ +static int +compare_output_positions (const void *a, const void *b) +{ + GnomeRROutputInfo *oa = (GnomeRROutputInfo *) a; + GnomeRROutputInfo *ob = (GnomeRROutputInfo *) b; + int xa, xb; + + gnome_rr_output_info_get_geometry (oa, &xa, NULL, NULL, NULL); + gnome_rr_output_info_get_geometry (ob, &xb, NULL, NULL, NULL); + + return xb - xa; +} + +/* A set of outputs with already-set sizes and positions may not fit in the + * frame buffer that is available. Turn off outputs right-to-left until we find + * a size that fits. Returns whether something applicable was found + * (i.e. something that fits and that does not consist of only-off outputs). + */ +static gboolean +trim_rightmost_outputs_that_dont_fit_in_framebuffer (GnomeRRScreen *rr_screen, GnomeRRConfig *config) +{ + GnomeRROutputInfo **outputs; + GnomeRROutputInfo **sorted_outputs; + int num_on_outputs; + int i, j; + gboolean applicable; + + outputs = gnome_rr_config_get_outputs (config); + + /* How many are on? */ + + num_on_outputs = 0; + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_info_is_active (outputs[i])) + num_on_outputs++; + } + + /* Lay them out from left to right */ + + sorted_outputs = g_new (GnomeRROutputInfo *, num_on_outputs); + j = 0; + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_info_is_active (outputs[i])) { + sorted_outputs[j] = outputs[i]; + j++; + } + } + + qsort (sorted_outputs, num_on_outputs, sizeof (sorted_outputs[0]), compare_output_positions); + + /* Trim! */ + + applicable = FALSE; + + for (i = num_on_outputs - 1; i >= 0; i--) { + GError *error = NULL; + gboolean is_bounds_error; + + applicable = gnome_rr_config_applicable (config, rr_screen, &error); + if (applicable) + break; + + is_bounds_error = g_error_matches (error, GNOME_RR_ERROR, GNOME_RR_ERROR_BOUNDS_ERROR); + g_error_free (error); + + if (!is_bounds_error) + break; + + gnome_rr_output_info_set_active (sorted_outputs[i], FALSE); + } + + if (config_is_all_off (config)) + applicable = FALSE; + + g_free (sorted_outputs); + + return applicable; +} + +static GnomeRRConfig * +make_xinerama_setup (GsdXrandrManager *manager, GnomeRRScreen *screen) +{ + /* Turn on everything that has a preferred mode, and + * position it from left to right + */ + GnomeRRConfig *result = gnome_rr_config_new_current (screen, NULL); + GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (result); + int i; + int x; + + x = 0; + for (i = 0; outputs[i] != NULL; ++i) { + GnomeRROutputInfo *info = outputs[i]; + + if (is_laptop (screen, info)) { + if (laptop_lid_is_closed (manager)) + gnome_rr_output_info_set_active (info, FALSE); + else { + gnome_rr_output_info_set_primary (info, TRUE); + x = turn_on_and_get_rightmost_offset (screen, info, x); + } + } + } + + for (i = 0; outputs[i] != NULL; ++i) { + GnomeRROutputInfo *info = outputs[i]; + + if (gnome_rr_output_info_is_connected (info) && !is_laptop (screen, info)) { + gnome_rr_output_info_set_primary (info, FALSE); + x = turn_on_and_get_rightmost_offset (screen, info, x); + } + } + + if (!trim_rightmost_outputs_that_dont_fit_in_framebuffer (screen, result)) { + g_object_unref (G_OBJECT (result)); + result = NULL; + } + + gnome_rr_config_set_clone (result, FALSE); + + print_configuration (result, "xinerama setup"); + + return result; +} + +static GnomeRRConfig * +make_other_setup (GnomeRRScreen *screen) +{ + /* Turn off all laptops, and make all external monitors clone + * from (0, 0) + */ + + GnomeRRConfig *result = gnome_rr_config_new_current (screen, NULL); + GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (result); + int i; + + for (i = 0; outputs[i] != NULL; ++i) { + GnomeRROutputInfo *info = outputs[i]; + + if (is_laptop (screen, info)) { + gnome_rr_output_info_set_active (info, FALSE); + } + else { + if (gnome_rr_output_info_is_connected (info)) + turn_on (screen, info, 0, 0); + } + } + + if (!trim_rightmost_outputs_that_dont_fit_in_framebuffer (screen, result)) { + g_object_unref (G_OBJECT (result)); + result = NULL; + } + + gnome_rr_config_set_clone (result, FALSE); + + print_configuration (result, "other setup"); + + return result; +} + +static GPtrArray * +sanitize (GsdXrandrManager *manager, GPtrArray *array) +{ + int i; + GPtrArray *new; + + g_debug ("before sanitizing"); + + for (i = 0; i < array->len; ++i) { + if (array->pdata[i]) { + print_configuration (array->pdata[i], "before"); + } + } + + + /* Remove configurations that are duplicates of + * configurations earlier in the cycle + */ + for (i = 0; i < array->len; i++) { + int j; + + for (j = i + 1; j < array->len; j++) { + GnomeRRConfig *this = array->pdata[j]; + GnomeRRConfig *other = array->pdata[i]; + + if (this && other && gnome_rr_config_equal (this, other)) { + g_debug ("removing duplicate configuration"); + g_object_unref (this); + array->pdata[j] = NULL; + break; + } + } + } + + for (i = 0; i < array->len; ++i) { + GnomeRRConfig *config = array->pdata[i]; + + if (config && config_is_all_off (config)) { + g_debug ("removing configuration as all outputs are off"); + g_object_unref (array->pdata[i]); + array->pdata[i] = NULL; + } + } + + /* Do a final sanitization pass. This will remove configurations that + * don't fit in the framebuffer's Virtual size. + */ + + for (i = 0; i < array->len; i++) { + GnomeRRConfig *config = array->pdata[i]; + + if (config) { + GError *error; + + error = NULL; + if (!gnome_rr_config_applicable (config, manager->priv->rw_screen, &error)) { /* NULL-GError */ + g_debug ("removing configuration which is not applicable because %s", error->message); + g_error_free (error); + + g_object_unref (config); + array->pdata[i] = NULL; + } + } + } + + /* Remove NULL configurations */ + new = g_ptr_array_new (); + + for (i = 0; i < array->len; ++i) { + if (array->pdata[i]) { + g_ptr_array_add (new, array->pdata[i]); + print_configuration (array->pdata[i], "Final"); + } + } + + if (new->len > 0) { + g_ptr_array_add (new, NULL); + } else { + g_ptr_array_free (new, TRUE); + new = NULL; + } + + g_ptr_array_free (array, TRUE); + + return new; +} + +static void +generate_fn_f7_configs (GsdXrandrManager *mgr) +{ + GPtrArray *array = g_ptr_array_new (); + GnomeRRScreen *screen = mgr->priv->rw_screen; + + g_debug ("Generating configurations"); + + /* Free any existing list of configurations */ + if (mgr->priv->fn_f7_configs) { + int i; + + for (i = 0; mgr->priv->fn_f7_configs[i] != NULL; ++i) + g_object_unref (mgr->priv->fn_f7_configs[i]); + g_free (mgr->priv->fn_f7_configs); + + mgr->priv->fn_f7_configs = NULL; + mgr->priv->current_fn_f7_config = -1; + } + + g_ptr_array_add (array, gnome_rr_config_new_current (screen, NULL)); + g_ptr_array_add (array, make_clone_setup (mgr, screen)); + g_ptr_array_add (array, make_xinerama_setup (mgr, screen)); + g_ptr_array_add (array, make_other_setup (screen)); + g_ptr_array_add (array, make_laptop_setup (mgr, screen)); + + array = sanitize (mgr, array); + + if (array) { + mgr->priv->fn_f7_configs = (GnomeRRConfig **)g_ptr_array_free (array, FALSE); + mgr->priv->current_fn_f7_config = 0; + } +} + +static void +error_message (GsdXrandrManager *mgr, const char *primary_text, GError *error_to_display, const char *secondary_text) +{ + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + "%s", primary_text); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", + error_to_display ? error_to_display->message : secondary_text); + + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); +} + +static void +handle_fn_f7 (GsdXrandrManager *mgr, guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = mgr->priv; + GnomeRRScreen *screen = priv->rw_screen; + GnomeRRConfig *current; + GError *error; + + /* Theory of fn-F7 operation + * + * We maintain a datastructure "fn_f7_status", that contains + * a list of GnomeRRConfig's. Each of the GnomeRRConfigs has a + * mode (or "off") for each connected output. + * + * When the user hits fn-F7, we cycle to the next GnomeRRConfig + * in the data structure. If the data structure does not exist, it + * is generated. If the configs in the data structure do not match + * the current hardware reality, it is regenerated. + * + */ + g_debug ("Handling fn-f7"); + + log_open (); + log_msg ("Handling XF86Display hotkey - timestamp %u\n", timestamp); + + error = NULL; + if (!gnome_rr_screen_refresh (screen, &error) && error) { + char *str; + + str = g_strdup_printf (_("Could not refresh the screen information: %s"), error->message); + g_error_free (error); + + log_msg ("%s\n", str); + error_message (mgr, str, NULL, _("Trying to switch the monitor configuration anyway.")); + g_free (str); + } + + if (!priv->fn_f7_configs) { + log_msg ("Generating stock configurations:\n"); + generate_fn_f7_configs (mgr); + log_configurations (priv->fn_f7_configs); + } + + current = gnome_rr_config_new_current (screen, NULL); + + if (priv->fn_f7_configs && + (!gnome_rr_config_match (current, priv->fn_f7_configs[0]) || + !gnome_rr_config_equal (current, priv->fn_f7_configs[mgr->priv->current_fn_f7_config]))) { + /* Our view of the world is incorrect, so regenerate the + * configurations + */ + generate_fn_f7_configs (mgr); + log_msg ("Regenerated stock configurations:\n"); + log_configurations (priv->fn_f7_configs); + } + + g_object_unref (current); + + if (priv->fn_f7_configs) { + guint32 server_timestamp; + gboolean success; + + mgr->priv->current_fn_f7_config++; + + if (priv->fn_f7_configs[mgr->priv->current_fn_f7_config] == NULL) + mgr->priv->current_fn_f7_config = 0; + + g_debug ("cycling to next configuration (%d)", mgr->priv->current_fn_f7_config); + + print_configuration (priv->fn_f7_configs[mgr->priv->current_fn_f7_config], "new config"); + + g_debug ("applying"); + + /* See https://bugzilla.gnome.org/show_bug.cgi?id=610482 + * + * Sometimes we'll get two rapid XF86Display keypress events, + * but their timestamps will be out of order with respect to the + * RANDR timestamps. This *may* be due to stupid BIOSes sending + * out display-switch keystrokes "to make Windows work". + * + * The X server will error out if the timestamp provided is + * older than a previous change configuration timestamp. We + * assume here that we do want this event to go through still, + * since kernel timestamps may be skewed wrt the X server. + */ + gnome_rr_screen_get_timestamps (screen, NULL, &server_timestamp); + if (timestamp < server_timestamp) + timestamp = server_timestamp; + + success = apply_configuration (mgr, priv->fn_f7_configs[mgr->priv->current_fn_f7_config], timestamp, TRUE, TRUE); + + if (success) { + log_msg ("Successfully switched to configuration (timestamp %u):\n", timestamp); + log_configuration (priv->fn_f7_configs[mgr->priv->current_fn_f7_config]); + } + } + else { + g_debug ("no configurations generated"); + } + + log_close (); + + g_debug ("done handling fn-f7"); +} + +static GnomeRRRotation +get_next_rotation (GnomeRRRotation allowed_rotations, GnomeRRRotation current_rotation) +{ + int i; + int current_index; + + /* First, find the index of the current rotation */ + + current_index = -1; + + for (i = 0; i < G_N_ELEMENTS (possible_rotations); i++) { + GnomeRRRotation r; + + r = possible_rotations[i]; + if (r == current_rotation) { + current_index = i; + break; + } + } + + if (current_index == -1) { + /* Huh, the current_rotation was not one of the supported rotations. Bail out. */ + return current_rotation; + } + + /* Then, find the next rotation that is allowed */ + + i = (current_index + 1) % G_N_ELEMENTS (possible_rotations); + + while (1) { + GnomeRRRotation r; + + r = possible_rotations[i]; + if (r == current_rotation) { + /* We wrapped around and no other rotation is suported. Bummer. */ + return current_rotation; + } else if (r & allowed_rotations) + return r; + + i = (i + 1) % G_N_ELEMENTS (possible_rotations); + } +} + +struct { + GnomeRRRotation rotation; + /* evdev */ + gboolean x_axis_inversion; + gboolean y_axis_inversion; + gboolean axes_swap; +} evdev_rotations[] = { + { GNOME_RR_ROTATION_0, 0, 0, 0 }, + { GNOME_RR_ROTATION_90, 1, 0, 1 }, + { GNOME_RR_ROTATION_180, 1, 1, 0 }, + { GNOME_RR_ROTATION_270, 0, 1, 1 } +}; + +static guint +get_rotation_index (GnomeRRRotation rotation) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (evdev_rotations); i++) { + if (evdev_rotations[i].rotation == rotation) + return i; + } + g_assert_not_reached (); +} + +static gboolean +is_wacom_tablet_device (GsdXrandrManager *mgr, + XDeviceInfo *device_info) +{ +#ifdef HAVE_WACOM + GsdXrandrManagerPrivate *priv = mgr->priv; + gchar *device_node; + WacomDevice *wacom_device; + gboolean is_tablet = FALSE; + + if (priv->wacom_db == NULL) + priv->wacom_db = libwacom_database_new (); + + device_node = xdevice_get_device_node (device_info->id); + if (device_node == NULL) + return FALSE; + + wacom_device = libwacom_new_from_path (priv->wacom_db, device_node, FALSE, NULL); + g_free (device_node); + if (wacom_device == NULL) { + g_free (device_node); + return FALSE; + } + is_tablet = libwacom_has_touch (wacom_device) && + libwacom_is_builtin (wacom_device); + + libwacom_destroy (wacom_device); + + return is_tablet; +#else /* HAVE_WACOM */ + return FALSE; +#endif /* HAVE_WACOM */ +} + +static void +rotate_touchscreens (GsdXrandrManager *mgr, + GnomeRRRotation rotation) +{ + XDeviceInfo *device_info; + gint n_devices; + guint i, rot_idx; + + if (!supports_xinput_devices ()) + return; + + g_debug ("Rotating touchscreen devices"); + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return; + + rot_idx = get_rotation_index (rotation); + + for (i = 0; i < n_devices; i++) { + if (is_wacom_tablet_device (mgr, &device_info[i])) { + g_debug ("Not rotating tablet device '%s'", device_info[i].name); + continue; + } + + if (device_info_is_touchscreen (&device_info[i])) { + XDevice *device; + char c = evdev_rotations[rot_idx].axes_swap; + PropertyHelper axes_swap = { + .name = "Evdev Axes Swap", + .nitems = 1, + .format = 8, + .type = XA_INTEGER, + .data.c = &c, + }; + + g_debug ("About to rotate '%s'", device_info[i].name); + + gdk_error_trap_push (); + device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device_info[i].id); + if (gdk_error_trap_pop () || (device == NULL)) + continue; + + if (device_set_property (device, device_info[i].name, &axes_swap) != FALSE) { + char axis[] = { + evdev_rotations[rot_idx].x_axis_inversion, + evdev_rotations[rot_idx].y_axis_inversion + }; + PropertyHelper axis_invert = { + .name = "Evdev Axis Inversion", + .nitems = 2, + .format = 8, + .type = XA_INTEGER, + .data.c = axis, + }; + + device_set_property (device, device_info[i].name, &axis_invert); + + g_debug ("Rotated '%s' to configuration '%d, %d, %d'", + device_info[i].name, + evdev_rotations[rot_idx].x_axis_inversion, + evdev_rotations[rot_idx].y_axis_inversion, + evdev_rotations[rot_idx].axes_swap); + } + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device); + } + } + XFreeDeviceList (device_info); +} + +/* We use this when the XF86RotateWindows key is pressed, or the + * orientation of a tablet changes. The key is present + * on some tablet PCs; they use it so that the user can rotate the tablet + * easily. Some other tablet PCs will have an accelerometer instead. + */ +static void +handle_rotate_windows (GsdXrandrManager *mgr, + GnomeRRRotation rotation, + guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = mgr->priv; + GnomeRRScreen *screen = priv->rw_screen; + GnomeRRConfig *current; + GnomeRROutputInfo *rotatable_output_info; + int num_allowed_rotations; + GnomeRRRotation allowed_rotations; + GnomeRRRotation next_rotation; + gboolean success, show_error; + + g_debug ("Handling XF86RotateWindows"); + + /* Which output? */ + + current = gnome_rr_config_new_current (screen, NULL); + + rotatable_output_info = get_laptop_output_info (screen, current); + if (rotatable_output_info == NULL) { + g_debug ("No laptop outputs found to rotate; XF86RotateWindows key will do nothing"); + goto out; + } + + if (rotation <= GNOME_RR_ROTATION_NEXT) { + /* Which rotation? */ + + get_allowed_rotations_for_output (current, priv->rw_screen, rotatable_output_info, &num_allowed_rotations, &allowed_rotations); + next_rotation = get_next_rotation (allowed_rotations, gnome_rr_output_info_get_rotation (rotatable_output_info)); + + if (next_rotation == gnome_rr_output_info_get_rotation (rotatable_output_info)) { + g_debug ("No rotations are supported other than the current one; XF86RotateWindows key will do nothing"); + goto out; + } + show_error = TRUE; + } else { + next_rotation = rotation; + show_error = FALSE; + } + + /* Rotate */ + + gnome_rr_output_info_set_rotation (rotatable_output_info, next_rotation); + + success = apply_configuration (mgr, current, timestamp, show_error, TRUE); + if (success) + rotate_touchscreens (mgr, next_rotation); + +out: + g_object_unref (current); +} + +static void +auto_configure_outputs (GsdXrandrManager *manager, guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = manager->priv; + GnomeRRConfig *config; + + config = make_xinerama_setup (manager, priv->rw_screen); + if (config) { + print_configuration (config, "auto-configure - xinerama mode"); + apply_configuration (manager, config, timestamp, TRUE, FALSE); + g_object_unref (config); + } else { + g_debug ("No applicable configuration found during auto-configure"); + } +} + +static void +use_stored_configuration_or_auto_configure_outputs (GsdXrandrManager *manager, guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = manager->priv; + char *intended_filename; + GError *error; + gboolean success; + + intended_filename = gnome_rr_config_get_intended_filename (); + + error = NULL; + success = apply_configuration_from_filename (manager, intended_filename, TRUE, timestamp, &error); + g_free (intended_filename); + + if (!success) { + /* We don't bother checking the error type. + * + * Both G_FILE_ERROR_NOENT and + * GNOME_RR_ERROR_NO_MATCHING_CONFIG would mean, "there + * was no configuration to apply, or none that matched + * the current outputs", and in that case we need to run + * our fallback. + * + * Any other error means "we couldn't do the smart thing + * of using a previously- saved configuration, anyway, + * for some other reason. In that case, we also need to + * run our fallback to avoid leaving the user with a + * bogus configuration. + */ + + if (error) + g_error_free (error); + + if (timestamp != priv->last_config_timestamp || timestamp == GDK_CURRENT_TIME) { + priv->last_config_timestamp = timestamp; + auto_configure_outputs (manager, timestamp); + log_msg (" Automatically configured outputs\n"); + } else + log_msg (" Ignored autoconfiguration as old and new config timestamps are the same\n"); + } else + log_msg ("Applied stored configuration\n"); +} + +static void +on_randr_event (GnomeRRScreen *screen, gpointer data) +{ + GsdXrandrManager *manager = GSD_XRANDR_MANAGER (data); + GsdXrandrManagerPrivate *priv = manager->priv; + guint32 change_timestamp, config_timestamp; + + if (!priv->running) + return; + + gnome_rr_screen_get_timestamps (screen, &change_timestamp, &config_timestamp); + + log_open (); + log_msg ("Got RANDR event with timestamps change=%u %c config=%u\n", + change_timestamp, + timestamp_relationship (change_timestamp, config_timestamp), + config_timestamp); + + if (change_timestamp >= config_timestamp) { + GnomeRRConfig *rr_config; + + /* The event is due to an explicit configuration change. + * + * If the change was performed by us, then we need to do nothing. + * + * If the change was done by some other X client, we don't need + * to do anything, either; the screen is already configured. + */ + + /* Check if we need to update the primary */ + rr_config = gnome_rr_config_new_current (priv->rw_screen, NULL); + if (gnome_rr_config_ensure_primary (rr_config)) { + if (gnome_rr_config_applicable (rr_config, priv->rw_screen, NULL)) { + print_configuration (rr_config, "Updating for primary"); + priv->last_config_timestamp = config_timestamp; + gnome_rr_config_apply_with_time (rr_config, priv->rw_screen, config_timestamp, NULL); + } + } + g_object_unref (rr_config); + + show_timestamps_dialog (manager, "ignoring since change > config"); + log_msg (" Ignoring event since change >= config\n"); + } else { + /* Here, config_timestamp > change_timestamp. This means that + * the screen got reconfigured because of hotplug/unplug; the X + * server is just notifying us, and we need to configure the + * outputs in a sane way. + */ + + show_timestamps_dialog (manager, "need to deal with reconfiguration, as config > change"); + use_stored_configuration_or_auto_configure_outputs (manager, config_timestamp); + } + + log_close (); +} + +static void +get_allowed_rotations_for_output (GnomeRRConfig *config, + GnomeRRScreen *rr_screen, + GnomeRROutputInfo *output, + int *out_num_rotations, + GnomeRRRotation *out_rotations) +{ + GnomeRRRotation current_rotation; + int i; + + *out_num_rotations = 0; + *out_rotations = 0; + + current_rotation = gnome_rr_output_info_get_rotation (output); + + /* Yay for brute force */ + + for (i = 0; i < G_N_ELEMENTS (possible_rotations); i++) { + GnomeRRRotation rotation_to_test; + + rotation_to_test = possible_rotations[i]; + + gnome_rr_output_info_set_rotation (output, rotation_to_test); + + if (gnome_rr_config_applicable (config, rr_screen, NULL)) { /* NULL-GError */ + (*out_num_rotations)++; + (*out_rotations) |= rotation_to_test; + } + } + + gnome_rr_output_info_set_rotation (output, current_rotation); + + if (*out_num_rotations == 0 || *out_rotations == 0) { + g_warning ("Huh, output %p says it doesn't support any rotations, and yet it has a current rotation?", output); + *out_num_rotations = 1; + *out_rotations = gnome_rr_output_info_get_rotation (output); + } +} + +static gboolean +apply_intended_configuration (GsdXrandrManager *manager, const char *intended_filename, guint32 timestamp) +{ + GError *my_error; + gboolean result; + + my_error = NULL; + result = apply_configuration_from_filename (manager, intended_filename, TRUE, timestamp, &my_error); + if (!result) { + if (my_error) { + if (!g_error_matches (my_error, G_FILE_ERROR, G_FILE_ERROR_NOENT) && + !g_error_matches (my_error, GNOME_RR_ERROR, GNOME_RR_ERROR_NO_MATCHING_CONFIG)) + error_message (manager, _("Could not apply the stored configuration for monitors"), my_error, NULL); + + g_error_free (my_error); + } + } + + return result; +} + +static void +apply_default_boot_configuration (GsdXrandrManager *mgr, guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = mgr->priv; + GnomeRRScreen *screen = priv->rw_screen; + GnomeRRConfig *config; + GsdXrandrBootBehaviour boot; + + boot = g_settings_get_enum (priv->settings, CONF_KEY_DEFAULT_MONITORS_SETUP); + + switch (boot) { + case GSD_XRANDR_BOOT_BEHAVIOUR_DO_NOTHING: + return; + case GSD_XRANDR_BOOT_BEHAVIOUR_CLONE: + config = make_clone_setup (mgr, screen); + break; + case GSD_XRANDR_BOOT_BEHAVIOUR_DOCK: + config = make_other_setup (screen); + break; + default: + g_assert_not_reached (); + } + + if (config) { + /* We don't save the configuration (the "false" parameter to the following function) because we don't want to + * install a user-side setting when *here* we are using a system-default setting. + */ + apply_configuration (mgr, config, timestamp, TRUE, FALSE); + g_object_unref (config); + } +} + +static gboolean +apply_stored_configuration_at_startup (GsdXrandrManager *manager, guint32 timestamp) +{ + GError *my_error; + gboolean success; + char *backup_filename; + char *intended_filename; + + backup_filename = gnome_rr_config_get_backup_filename (); + intended_filename = gnome_rr_config_get_intended_filename (); + + /* 1. See if there was a "saved" configuration. If there is one, it means + * that the user had selected to change the display configuration, but the + * machine crashed. In that case, we'll apply *that* configuration and save it on top of the + * "intended" one. + */ + + my_error = NULL; + + success = apply_configuration_from_filename (manager, backup_filename, FALSE, timestamp, &my_error); + if (success) { + /* The backup configuration existed, and could be applied + * successfully, so we must restore it on top of the + * failed/intended one. + */ + restore_backup_configuration (manager, backup_filename, intended_filename, timestamp); + goto out; + } + + if (!g_error_matches (my_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) { + /* Epic fail: there (probably) was a backup configuration, but + * we could not apply it. The only thing we can do is delete + * the backup configuration. Let's hope that the user doesn't + * get left with an unusable display... + */ + + unlink (backup_filename); + goto out; + } + + /* 2. There was no backup configuration! This means we are + * good. Apply the intended configuration instead. + */ + + success = apply_intended_configuration (manager, intended_filename, timestamp); + +out: + + if (my_error) + g_error_free (my_error); + + g_free (backup_filename); + g_free (intended_filename); + + return success; +} + +static gboolean +apply_default_configuration_from_file (GsdXrandrManager *manager, guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = manager->priv; + char *default_config_filename; + gboolean result; + + default_config_filename = g_settings_get_string (priv->settings, CONF_KEY_DEFAULT_CONFIGURATION_FILE); + if (!default_config_filename) + return FALSE; + + result = apply_configuration_from_filename (manager, default_config_filename, TRUE, timestamp, NULL); + + g_free (default_config_filename); + return result; +} + +static void +turn_off_laptop_display (GsdXrandrManager *manager, guint32 timestamp) +{ + GsdXrandrManagerPrivate *priv = manager->priv; + GnomeRRConfig *config; + + config = gnome_rr_config_new_current (priv->rw_screen, NULL); + + turn_off_laptop_display_in_configuration (priv->rw_screen, config); + + /* We don't turn the laptop's display off if it is the only display present. */ + if (!config_is_all_off (config)) { + /* We don't save the configuration (the "false" parameter to the following function) because we + * wouldn't want to restore a configuration with the laptop's display turned off, if at some + * point later the user booted his laptop with the lid open. + */ + apply_configuration (manager, config, timestamp, FALSE, FALSE); + } + + g_object_unref (config); +} + +static void +power_client_changed_cb (UpClient *client, gpointer data) +{ + GsdXrandrManager *manager = data; + GsdXrandrManagerPrivate *priv = manager->priv; + gboolean is_closed; + + is_closed = up_client_get_lid_is_closed (priv->upower_client); + + if (is_closed != priv->laptop_lid_is_closed) { + priv->laptop_lid_is_closed = is_closed; + + /* Refresh the RANDR state. The lid just got opened/closed, so we can afford to + * probe the outputs right now. It will also help the case where we can't detect + * hotplug/unplug, but the fact that the lid's state changed lets us know that the + * user probably did something interesting. + */ + + gnome_rr_screen_refresh (priv->rw_screen, NULL); /* NULL-GError */ + + if (is_closed) + turn_off_laptop_display (manager, GDK_CURRENT_TIME); /* sucks not to have a timestamp for the notification */ + else + use_stored_configuration_or_auto_configure_outputs (manager, GDK_CURRENT_TIME); + } +} + +gboolean +gsd_xrandr_manager_start (GsdXrandrManager *manager, + GError **error) +{ + g_debug ("Starting xrandr manager"); + gnome_settings_profile_start (NULL); + + log_open (); + log_msg ("------------------------------------------------------------\nSTARTING XRANDR PLUGIN\n"); + + manager->priv->rw_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + + if (manager->priv->rw_screen == NULL) { + log_msg ("Could not initialize the RANDR plugin%s%s\n", + (error && *error) ? ": " : "", + (error && *error) ? (*error)->message : ""); + log_close (); + return FALSE; + } + + g_signal_connect (manager->priv->rw_screen, "changed", G_CALLBACK (on_randr_event), manager); + + manager->priv->upower_client = up_client_new (); + manager->priv->laptop_lid_is_closed = up_client_get_lid_is_closed (manager->priv->upower_client); + g_signal_connect (manager->priv->upower_client, "changed", + G_CALLBACK (power_client_changed_cb), manager); + + log_msg ("State of screen at startup:\n"); + log_screen (manager->priv->rw_screen); + + manager->priv->running = TRUE; + manager->priv->settings = g_settings_new (CONF_SCHEMA); + + show_timestamps_dialog (manager, "Startup"); + if (!apply_stored_configuration_at_startup (manager, GDK_CURRENT_TIME)) /* we don't have a real timestamp at startup anyway */ + if (!apply_default_configuration_from_file (manager, GDK_CURRENT_TIME)) + apply_default_boot_configuration (manager, GDK_CURRENT_TIME); + + log_msg ("State of screen after initial configuration:\n"); + log_screen (manager->priv->rw_screen); + + log_close (); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_xrandr_manager_stop (GsdXrandrManager *manager) +{ + g_debug ("Stopping xrandr manager"); + + manager->priv->running = FALSE; + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->settings != NULL) { + g_object_unref (manager->priv->settings); + manager->priv->settings = NULL; + } + + if (manager->priv->rw_screen != NULL) { + g_object_unref (manager->priv->rw_screen); + manager->priv->rw_screen = NULL; + } + + if (manager->priv->upower_client != NULL) { + g_signal_handlers_disconnect_by_data (manager->priv->upower_client, manager); + g_object_unref (manager->priv->upower_client); + manager->priv->upower_client = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + if (manager->priv->connection != NULL) { + g_object_unref (manager->priv->connection); + manager->priv->connection = NULL; + } + +#ifdef HAVE_WACOM + if (manager->priv->wacom_db != NULL) { + libwacom_database_destroy (manager->priv->wacom_db); + manager->priv->wacom_db = NULL; + } +#endif /* HAVE_WACOM */ + + log_open (); + log_msg ("STOPPING XRANDR PLUGIN\n------------------------------------------------------------\n"); + log_close (); +} + +static GObject * +gsd_xrandr_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdXrandrManager *xrandr_manager; + + xrandr_manager = GSD_XRANDR_MANAGER (G_OBJECT_CLASS (gsd_xrandr_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (xrandr_manager); +} + +static void +gsd_xrandr_manager_class_init (GsdXrandrManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_xrandr_manager_constructor; + object_class->finalize = gsd_xrandr_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdXrandrManagerPrivate)); +} + +static void +gsd_xrandr_manager_init (GsdXrandrManager *manager) +{ + manager->priv = GSD_XRANDR_MANAGER_GET_PRIVATE (manager); + + manager->priv->current_fn_f7_config = -1; + manager->priv->fn_f7_configs = NULL; +} + +static void +gsd_xrandr_manager_finalize (GObject *object) +{ + GsdXrandrManager *xrandr_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_XRANDR_MANAGER (object)); + + xrandr_manager = GSD_XRANDR_MANAGER (object); + + g_return_if_fail (xrandr_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_xrandr_manager_parent_class)->finalize (object); +} + +static void +handle_method_call_xrandr_2 (GsdXrandrManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint64 timestamp; + GError *error = NULL; + + g_debug ("Calling method '%s' for org.gnome.SettingsDaemon.XRANDR_2", method_name); + + if (g_strcmp0 (method_name, "ApplyConfiguration") == 0) { + gint64 parent_window_id; + + g_variant_get (parameters, "(xx)", &parent_window_id, ×tamp); + if (gsd_xrandr_manager_2_apply_configuration (manager, parent_window_id, + timestamp, &error) == FALSE) { + g_dbus_method_invocation_return_gerror (invocation, error); + } else { + g_dbus_method_invocation_return_value (invocation, NULL); + } + } else if (g_strcmp0 (method_name, "VideoModeSwitch") == 0) { + g_variant_get (parameters, "(x)", ×tamp); + gsd_xrandr_manager_2_video_mode_switch (manager, timestamp, NULL); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "Rotate") == 0) { + g_variant_get (parameters, "(x)", ×tamp); + gsd_xrandr_manager_2_rotate (manager, timestamp, NULL); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "RotateTo") == 0) { + GnomeRRRotation rotation; + g_variant_get (parameters, "(ix)", &rotation, ×tamp); + gsd_xrandr_manager_2_rotate_to (manager, rotation, timestamp, NULL); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdXrandrManager *manager = (GsdXrandrManager *) user_data; + + g_debug ("Handling method call %s.%s", interface_name, method_name); + + if (g_strcmp0 (interface_name, "org.gnome.SettingsDaemon.XRANDR_2") == 0) + handle_method_call_xrandr_2 (manager, method_name, parameters, invocation); + else + g_warning ("unknown interface: %s", interface_name); +} + + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdXrandrManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + GDBusInterfaceInfo **infos; + int i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_XRANDR_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdXrandrManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdXrandrManager * +gsd_xrandr_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_XRANDR_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + + register_manager_dbus (manager_object); + } + + return GSD_XRANDR_MANAGER (manager_object); +} diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..3c74ab0a --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Jonathan Blandford +William Jon McCann diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..623b6258 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYING.LIB b/COPYING.LIB new file mode 100644 index 00000000..5ab7695a --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..5b02f1e2 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3913 @@ +2008-08-03 C de-Avillez + + * plugins/mouse/gsd-mouse-manager.c: add '-k' to syndaemon + call, in order to ignore modifier keys when monitoring keyboard. + Thanks to Dag Asheim for spotting this, and proposing a patch. + +2008-07-01 Sergey Udaltsov + + * configure.ac, plugins/keyboard/gsd-keyboard-xkb.c: depend on + libxklavier 4.0, updated API + +2009-06-01 Jens Granseuer + + * plugins/housekeeping/gsd-disk-space.c: include config.h so the + notifications stuff can actually be built (bug #584217) + +2009-05-06 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c + (make_menu_item_for_output_title): Make the menu item label + explicitly black. We don't want to follow the theme's colors, as + the label is always shown against a light pastel background --- + using the theme's colors makes the label hard to read on "inverse" + themes. Fixes the gnome-settings-daemon part of bug #556050. + +2009-04-15 Thomas H.P. Andersen + + * plugins/xrandr/gsd-xrandr-manager.c: (status_icon_start): + * configure.ac: Replace deprecated gtk symbol gtk_status_icon_set_tooltip. + Bump required gtk to 2.16. (bug #578480) + +2009-04-14 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (print_countdown_text): use + ngettext for the reset dialog (bug #575409) + +==================== 2.26.1 ==================== + +2009-04-14 Jens Granseuer + + * NEWS: + * configure.ac: release 2.26.1 + +2009-04-11 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: + (gsd_keybindings_manager_start): move the lookup of allowed keys + after the directory has been cached in callback registration to avoid + GConf roundtrip (bug #578539) + +2009-04-11 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-manager.c: + (start_keyboard_idle_cb): preload GConf keyboard directory recursively + to avoid roundtrips (bug #578542) + +2009-04-08 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (user_says_things_are_ok): + Use 30 seconds for the confirmation timeout, so that monitors can + settle down and the user will have a chance to read the message. + +2009-04-03 Jens Granseuer + + Patch by: + + * plugins/media-keys/Makefile.am: don't install the plugin + descriptor if the plugin isn't installed (bug #577815) + +2009-04-02 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-manager.c: + (numlock_gconf_state_key): use info level instead of warning for + the "NumLock remembering disabled" message (bug #577578) + +2009-03-28 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (sanitize), + (generate_fn_f7_configs): if the sanitized array ends up having no + members at all return a NULL configuration since the following code + assumes it has at least one valid setup if it's not NULL. Fixes a + crash when closing the lid on some laptops (bug #576875) + +2009-03-27 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (on_notification_closed), (on_slow_keys_action), + (on_sticky_keys_action), (ax_slowkeys_warning_post_bubble), + (ax_stickykeys_warning_post_bubble), + (gsd_a11y_keyboard_manager_stop): fix crash when closing the a11y + notification bubble caused by incompatible changes in libnotify API + (bug #576535). Also remove workarounds for bugs in libnotify < 0.4.5 + +2009-03-27 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: + (restore_backup_configuration), + (try_to_apply_intended_configuration): remove unused variables + +2009-03-26 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c + (ensure_current_configuration_is_saved): New helper function. + Ensures that a monitors.xml exists with the current/unchanged + configuration, so that a latter gnome_rr_config_save() will create + a backup file out of *that* original configuration. This lets the + "revert" function from gnome-display-properties work properly on + an initial login, even when there is no monitors.xml already + present. + +2009-03-25 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c + (restore_backup_configuration): Handle the case where no backup + file was created for monitors.xml, because *that* file didn't + exist (such as on a first-time login). + +2009-03-25 Federico Mena Quintero + + Centralize the handling of GNOME_RR_ERROR_NO_MATCHING_CONFIG, as + that is not really an error. + + * plugins/xrandr/gsd-xrandr-manager.c + (apply_configuration_from_filename): New helper function; + centralizes the handling of gnome_rr_config_apply_from_filename() + and ignores GNOME_RR_ERROR_NO_MATCHING_CONFIG. That is not + actually an error; it just means that the user probably changed + his monitors and the stored set of configurations doesn't have a + config that is usable for the new monitors. + (restore_backup_configuration): Use apply_configuration_from_filename(). + (try_to_apply_intended_configuration): Likewise. + (apply_intended_configuration): Likewise. + (apply_stored_configuration_at_startup): Likewise. + +2009-03-19 Federico Mena Quintero + + http://bugzilla.gnome.org/show_bug.cgi?id=576006 - The + confirmation dialog from the RANDR plugin can appear behind the + window from gnome-display-properties. This also depends on a + change to gnome-control-center. + + * plugins/xrandr/gsd-xrandr-manager.xml: Add an + org.gnome.SettingsDaemon.XRANDR_2 interface + in addition to the old XRANDR one, with an ApplyConfiguration + method that also takes a parent window ID and a timestamp. + + * plugins/xrandr/gsd-xrandr-manager.c (gsd_xrandr_manager_2_apply_configuration): + Implement the new DBus method with the parent window and + timestamp. + (user_says_things_are_ok): Use the parent window. + +2009-03-19 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (user_says_things_are_ok): + Revert the use of g_timeout_add_seconds(), since we actually care + that the user sees real second ticks in the dialog. This isn't a + neverending timeout anyway. + +2009-03-18 Jens Granseuer + + * gnome-settings-daemon/Makefile.am: + * plugins/a11y-keyboard/Makefile.am: + * plugins/background/Makefile.am: + * plugins/clipboard/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/font/Makefile.am: + * plugins/housekeeping/Makefile.am: + * plugins/keybindings/Makefile.am: + * plugins/keyboard/Makefile.am: + * plugins/media-keys/Makefile.am: + * plugins/mouse/Makefile.am: + * plugins/screensaver/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/typing-break/Makefile.am: + * plugins/xrandr/Makefile.am: + * plugins/xrdb/Makefile.am: + * plugins/xsettings/Makefile.am: revert build patch from r763 + +==================== 2.26.0 ==================== + +2009-03-16 Rodrigo Moya + + * NEWS: + * configure.ac: release 2.26.0 + +2009-03-07 Jens Granseuer + + Based on patch by: Christopher Taylor + + * gnome-settings-daemon/Makefile.am: + * plugins/a11y-keyboard/Makefile.am: + * plugins/background/Makefile.am: + * plugins/clipboard/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/font/Makefile.am: + * plugins/housekeeping/Makefile.am: + * plugins/keybindings/Makefile.am: + * plugins/keyboard/Makefile.am: + * plugins/media-keys/Makefile.am: + * plugins/mouse/Makefile.am: + * plugins/screensaver/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/typing-break/Makefile.am: + * plugins/xrandr/Makefile.am: + * plugins/xrdb/Makefile.am: + * plugins/xsettings/Makefile.am: make build work with -Wl,-z,defs + linker options (bug #574452) + +==================== 2.25.92 ==================== + +2009-03-02 Jens Granseuer + + * NEWS: + * configure.ac: release 2.25.92 + +2009-03-02 Jens Granseuer + + * gnome-settings-daemon/Makefile.am: also install the plugin header + file because it is needed for custom plugins (bug #573610) + +2009-02-23 Jens Granseuer + + * data/gnome-settings-daemon.schemas.in: add missing keys for a11y + shortcut names (bug #572807) + +2009-02-22 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (user_says_things_are_ok): use + g_timeout_add_seconds instead of g_timeout_add + +2009-02-21 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (timeout_response_cb): + revert the screen resolution change if the user closes the window + or hits escape (bug #571492) + +2009-02-21 Jens Granseuer + + Fix compiler warnings. + + * plugins/housekeeping/gsd-disk-space.c: add missing include + * plugins/housekeeping/gsd-housekeeping-manager.c: ditto + * plugins/housekeeping/gsd-disk-space.h: don't declare public + functions static + +2009-02-20 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: (parse_binding), + (bindings_get_entry): don't output a warning for disabled shortcuts + +2009-02-15 Jens Granseuer + + Patch by: Leo Iannacone + + * plugins/media-keys/gsd-media-keys-window.c: (on_expose_event): fix + alignment of the composited media window (bug #567249) + +2009-02-15 Luca Ferretti + + reviewed by: Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (ax_slowkeys_warning_post_dialog), + (ax_stickykeys_warning_post_dialog): + * plugins/mouse/gsd-mouse-manager.c: (set_mousetweaks_daemon): + Don't use legacy icons for keyboard and mouse (bug #571823) + +2009-02-15 Luca Ferretti + + reviewed by: Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (user_says_things_are_ok): + HIG fix for button labels (bug #571819) + +2009-02-15 Luca Ferretti + + reviewed by: Jens Granseuer + + * plugins/keyboard/modmap-dialog.glade: + Fix label for "Don't show this message again" checkbox, isn't a + `string change` due to reusing a yet available label (bug #571821) + +2009-02-11 Jens Granseuer + + * plugins/common/eggaccelerators.c: + (egg_accelerator_parse_virtual): don't return TRUE if we can't parse + the accelerator at all; fixes crash with invalid keyboard shortuts + (bug #571329) + +2009-02-11 Matthias Clasen + + Bug 570590 – a11y plugin warning + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: Avoid warnings + due to notifications on nonexisting statusicons. + +2009-02-08 Jens Granseuer + + Patch by: Nirbheek Chauhan + + * configure.ac: add --without-libnotify to disable notifications + (bug #570885) + +2009-02-06 Matthias Clasen + + Bug 570743 – restart on crash + + * data/gnome-settings-daemon.desktop.in.in: Have gnome-session + restart g-s-d if it crashes (heaven forbid!). + +2009-02-04 Vincent Untz + + * configure.in: post-release bump to 2.25.91 + +==================== 2.25.90 ==================== + +2009-02-04 Vincent Untz + + * NEWS: + * configure.in: version 2.25.90 + +2009-02-04 Vincent Untz + + * data/Makefile.am: fix distcheck + +2009-02-03 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c + (restore_backup_configuration): Use + gnome_rr_config_apply_from_filename(), as that's the new, + non-deprecated API. + (try_to_apply_intended_configuration): Likewise. + (apply_intended_configuration): Likewise. + (apply_stored_configuration_at_startup): Likewise. + +2009-02-01 Frederic Peters + + * plugins/housekeeping/Makefile.am: + * plugins/housekeeping/gsd-disk-space.c: add low diskspace checker + files to housekeeping plug-in Makefile.am; and make its clean and + setup methods available are made available. (bug #570132) + +2009-01-31 Theppitak Karoonboonyanan + + * plugins/media-keys/Makefile.am: Fix include paths for + non-source-dir builds. (bug #569955) + +2009-01-28 Jens Granseuer + + * configure.ac: require gnome-desktop 2.25.6 due to recent changes + +2009-01-27 Federico Mena Quintero + + http://bugzilla.gnome.org/show_bug.cgi?id=545115 - Ask for + confirmation, with a timeout, after changing the RANDR + configuration for if we leave the user with an unusable display. + This also handles the case where the machine may crash after + changing the configuration; the old/known-good configuration will + be restored when the user restarts his session. + + Refactor: + + * plugins/xrandr/gsd-xrandr-manager.c + (apply_stored_configuration_at_startup): Factor out the logic to + apply the stored configuration at startup. + (gsd_xrandr_manager_start): Use the function above. + + During startup, restore the backup configuration if it existed, to + recover from the case when the machine crashes while applying an + intended configuration. + + * plugins/xrandr/gsd-xrandr-manager.c + (apply_stored_configuration_at_startup): First see if we have a + backup configuration; if so, it means the machine or g-s-d crashed + while changing the RANDR parameters. If there is no backup + configuration, then we have a known-good configuration which we + can use. + (apply_intended_configuration): New function, used to load the + intended configuration (i.e. the non-backup one). + (restore_backup_configuration): Utility function to overwrite the + known-bad configuration with the known-good backup one. + + Use a timeout-confirmation dialog after changing the display + configuration: + + * plugins/xrandr/gsd-xrandr-manager.c + (try_to_apply_intended_configuration): New function; applies the + intended configuration, restores the backup configuration if that + fails, or asks the user to confirm if the intended configuration + is usable. + (gsd_xrandr_manager_apply_configuration): Use + try_to_apply_intended_configuration() in the implementation of the + D-Bus method to apply RANDR configurations. This way all apps + which use this D-Bus method will get confirmation for free. + (output_rotation_item_activate_cb): Use + try_to_apply_intended_configuration() so that the RANDR tray-icon + also uses the confirmation/backup logic. + (restore_backup_configuration): Restore the screen configuration + itself in addition to restoring the file on disk from the backup. + (user_says_things_are_ok): New utility function to handle a + timeout-confirmation dialog. + + Fix error reporting at startup: + + * plugins/xrandr/gsd-xrandr-manager.c (error_message): Handle the + case where the status_icon is not created yet; this happens during + startup or when the status_icon is disabled by the user. + + Handle the case where there is no matching configuration at + startup; this is not an error: + + * plugins/xrandr/gsd-xrandr-manager.c + (apply_intended_configuration): "no matching configuration" is not + an error when looking for a suitable configuration in + monitors.xml; it simply means that the user has a different set of + monitors than the ones that are available in that file. + +2009-01-24 Jens Granseuer + + Patch by: Andres Freund + + Fix possible crash when pressing Fn-F7 (bug #568713) + + * plugins/xrandr/gsd-xrandr-manager.c: (handle_fn_f7): only try to + dereference the error when it was actually set + +2009-01-27 Federico Mena Quintero + + http://bugzilla.gnome.org/show_bug.cgi?id=545115 - Ask for + confirmation, with a timeout, after changing the RANDR + configuration for if we leave the user with an unusable display. + This also handles the case where the machine may crash after + changing the configuration; the old/known-good configuration will + be restored when the user restarts his session. + + Refactor: + + * plugins/xrandr/gsd-xrandr-manager.c + (apply_stored_configuration_at_startup): Factor out the logic to + apply the stored configuration at startup. + (gsd_xrandr_manager_start): Use the function above. + +2009-01-26 Ray Strode + + Delay drawing the background until SessionRunning. + + * plugins/background/gsd-background-manager.c: + (queue_draw_background): Cancel queued draw if nautilus + is now running. + (on_bus_message), (draw_background_after_session_loads), + (gsd_background_manager_start): wait for SessionRunning + and then queue background draw + (gsd_background_manager_stop): remove message filter + +2009-01-24 Jens Granseuer + + Patch by: Andres Freund + + Fix possible crash when pressing Fn-F7 (bug #568713) + + * plugins/xrandr/gsd-xrandr-manager.c: (handle_fn_f7): only try to + dereference the error when it was actually set + +2009-01-22 Bastien Nocera + + * data/apps_gnome_settings_daemon_keybindings.schemas.in: + KEY_FILE maps to XF86Explorer, so use that to launch the + file manager in the user's home directory + +2009-01-19 Ray Strode + + Add crossfade transition when switching bgs + (bug 552857) + + * plugins/background/gsd-background-manager.c + (draw_background): Add use_crossfade argument + that initiates the fade if TRUE. + (on_bg_changed): call draw_background with crossfade. + (on_bg_transitioned): new function that calls + draw_background without crossfade during slide show + transitioning. + (setup_bg): set up transitioned signal handler. + (queue_draw_background): draw_background without + crossfade after 8 second timeout waiting for + nautilus. + +2009-01-19 Ray Strode + + * plugins/background/gsd-background-manager.c + (gsd_background_manager_start): Don't draw_background + immediately when nautilus is disabled. + gnome_bg_load_from_preferences forces a "changed" signal + to get emitted which will queue a draw anyway + +2009-01-18 Jens Granseuer + + * plugins/media-keys/Makefile.am: fix automake warning + +2009-01-18 Jens Granseuer + + * configure.ac: fix build with PulseAudio, too (bug #568179) + +2009-01-17 Jens Granseuer + + * plugins/media-keys/Makefile.am: fix build without PulseAudio + (bug #568015) + +2009-01-15 Bastien Nocera + + * plugins/media-keys/cut-n-paste/*: + Cut'n'paste code from the PulseAudio enabled code in + gnome-media's gnome-volume-control + + * plugins/media-keys/actions/acme-volume-*.[ch]: + Remove the old AcmeVolume code + + * plugins/media-keys/actions/acme.glade: + * plugins/media-keys/actions/acme.h: Move to plugins/media-keys/ + + * configure.ac: Tell config.h when PulseAudio support is disabled + + * plugins/media-keys/gsd-media-keys-manager.c (update_dialog), + (on_stream_event_notify), (do_sound_action), (update_default_sink), + (on_control_ready), (on_control_default_sink_changed), (do_action), + (gsd_media_keys_manager_start), (gsd_media_keys_manager_stop): + Use PulseAudio directly to change the volume. It will automatically + change the volume of the default audio output for the machine + (Closes: #567177) + + * plugins/media-keys/Makefile.am: + * plugins/media-keys/actions/Makefile.am: Changes for the above + +2009-01-15 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: + (binding_unregister_keys), (gsd_keybindings_manager_stop): also ungrab + keys when this module is disabled + +2009-01-15 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: + (gsd_media_keys_manager_stop): ungrab shortcut keys when the plugin + is disabled (bug #567867) + +2009-01-14 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (gsd_xrandr_manager_start): + If there was no file with a stored configuration, don't pop up an + error message --- this is not an error when the daemon starts up. + Fixes https://bugzilla.novell.com/show_bug.cgi?id=465968 + +2009-01-10 William Jon McCann + + * plugins/sound/gsd-sound-manager.c (register_config_callback): + Fix typo. + +2009-01-08 Jens Granseuer + + Based on a patch by: Lennart Poettering + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/sound/gsd-sound-manager.c: + * plugins/sound/gsd-sound-plugin.h: + * plugins/sound/sound.gnome-settings-plugin.in: + Add a new sound plugin that tells PulseAudio to drop its sample + cache when the sound theme changes (bug #545386). + +2009-01-08 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: + (gsd_media_keys_manager_grab_media_player_keys), + (gsd_media_keys_manager_release_media_player_keys): add a little + debugging output when de/registering media players (bug #564433) + +2009-01-05 Bastien Nocera + + * plugins/xrdb/gsd-xrdb-manager.c (apply_settings): Quiet xrdb + when there are duplicate rules in the .ad files (Closes: #566610) + +2008-12-30 Matthias Clasen + + Bug 565310 – support hotkeys for a11y tools + + * configure.ac: Set GNOME_KEYBINDINGS_KEYSDIR. + + * data/gnome-settings-daemon.schemas.in: Add missing schemas for + the keys in /destkop/gnome/applications/at, and also add new + schemas for keys in /desktop/gnome/keybindings that define + global keybindings for turning ATs on and off. Todo: There are no + default key combinations in the schema yet. + + * data/50-accessibility.xml.in: Keybinding file to group the + new keybindings in an "Accessibility" section in the keybinding + capplet. + + * data/Makefile.am: Install the keybinding file in the proper + location. + + * po/POTFILES.in: Add 50-accessibility.xml.in. + +2008-12-31 Rodrigo Moya + + Patch by Vincent Untz from openSUSE package (bug #557647) + + * configure.ac: require giounix for diskspace checker + + * Makefile.am: + * plugins/housekeeping/gsd-disk-space.[ch]: add low diskspace + checker to housekeeping plugin. + + * plugins/housekeeping/gsd-housekeeping-manager.c + (gsd_housekeeping_manager_start, gsd_housekeeping_manager_stop): + start/stop the low diskspace checker. + + * plugins/housekeeping/housekeeping.gnome-settings-plugin.in: add new + plugin capability to description + + * po/POTFILES.in: add new files + +2008-12-28 Jens Granseuer + + * plugins/screensaver/gsd-screensaver-manager.c: + (start_screensaver_cb), (gsd_screensaver_manager_start): spawn + screensaver after a 30 second timeout instead of when idle so that + it doesn't compete with other processes when the session starts + (bug #564059). Also plug a few small leaks. + +2008-12-28 Jens Granseuer + + Based on patch by: Jasper Lievisse Adriaanse + + * plugins/media-keys/gsd-media-keys-manager.c: (do_eject_action), + (do_action): better support for Eject and Sleep actions on OpenBSD + and FreeBSD (bug #565472) + +2008-12-28 Jens Granseuer + + Patch by: Jasper Lievisse Adriaanse + + * plugins/typing-break/gsd-typing-break-manager.c: include signal.h to + fix build on OpenBSD (bug #565470) + +2008-12-28 Jens Granseuer + + Patch by: Frederic Peters + + * gnome-settings-daemon/main.c: (main): initialize thread system since + ORBit no longer does it for us (#565515) + +==================== 2.25.3 ==================== + +2008-12-18 Bastien Nocera + + * NEWS: upd + * configure.ac: 2.25.3 + update gnome-desktop requirements for the new GnomeRR API + * plugins/xrandr/Makefile.am: Fix distcheck + +2008-12-07 Ray Strode + + Restore AccessX bits to original values on exit + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (struct GsdA11yKeyboardManagerPrivate): add new + field to cache original AccessX bits. + (start_a11y_keyboard_idle_cb): save bits. + (restore_server_xkb_config), + (gsd_a11y_keyboard_manager_stop): restore bits + when stopping. + +2008-12-07 Ray Strode + + Shutdown properly when bus goes away. Previously + we were just letting libdbus call exit(1) for us. + + * gnome-settings-daemon/main.c (get_session_bus): + Set up a filter function to catch disconection + events. + (bus_message_handler): quit event loop when + disconnected from bus. + +2008-12-07 Ray Strode + + Shutdown properly when killed. + + * gnome-settings-daemon/main.c (on_term_signal): + top half of signal handling code. close a pipe + when getting SIGTERM. + (on_term_signal_pipe_closed), + (watch_for_term_signal), + (set_session_over_handler): bottom half. Quit + event loop when term pipe gets closed. + +2008-12-07 Ray Strode + + * gnome-settings-daemon/main.c: Rename pipefds to + daemon_pipe_fds. This fits the naming style of the + surrounding code better. Also, we're going to need + another pipe, so better to use a specific name here. + +2008-12-09 Jens Granseuer + + Patch by: Pedro Fragoso + + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h: + * plugins/common/eggaccelerators.c: + * plugins/common/eggaccelerators.h: + * plugins/mouse/gsd-locate-pointer.h: only use top-level headers for + glib and GTK+ (bug #563796) + +2008-12-08 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (error_message): make libnotify + optional again (bug #563226) + (handle_fn_f7): fix memory leak, use g_debug instead of g_print + +2008-12-07 Behdad Esfahbod + + * gnome-settings-daemon/main.c (daemon_detach): Don't call umask (bug + #563543) + +2008-12-04 Jens Granseuer + + * plugins/mouse/gsd-mouse-manager.c: (set_devicepresence_handler): + fix crash with X servers that don't provide XInput (bug #562977) + +2008-12-02 Federico Mena Quintero + + Use a DBus interface to tell the XRANDR manager to apply the + stored configuration, instead of an X client message, so that we + can pass errors back to the caller. + + * plugins/xrandr/gsd-xrandr-manager.xml: Trivial DBus interface to + tell the XRANDR manager to apply the stored configuration. + + * plugins/xrandr/gsd-xrandr-manager.c + (gsd_xrandr_manager_apply_configuration): Moved from + on_client_message(). Now we are a DBus-Glib method, so that we + can pass back errors to the remote caller. + + * plugins/xrandr/Makefile.am: Add the machinery to generate DBus + glue. + +2008-12-02 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (error_message): Renamed + from error_dialog(); use libnotify instead of ugly dialogs for + error messages. + (gsd_xrandr_manager_start): Proxy the error from + gnome_rr_screen_new() to our caller. + (gsd_xrandr_manager_start): Display an error if we cannot apply + the initially-loaded configuration. + (generate_fn_f7_configs, get_allowed_rotations_for_output): Pass + GError arguments to the gnome_rr_*() functions. + (handle_fn_f7): Display an error if we cannot refresh the screen + configuration or apply the new one. + (output_rotation_item_activate_cb): Display an error if the + rotation cannot be applied. + +Tue Dec 2 15:37:21 2008 Søren Sandmann + + * plugins/xrandr/gsd-xrandr-manager.c: Add support for fn-F7 type + keys. + +==================== 2.25.2 ==================== + +2008-12-01 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.25.2 release. + +2008-11-29 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-xkb.c: (gsd_keyboard_xkb_init): fix + check for xklavier device discovery + +2008-11-29 Jens Granseuer + + * configure.ac: fix checks for various X11 libraries (bug #562661) + + * plugins/mouse/gsd-mouse-manager.c: (set_left_handed), + (gsd_mouse_manager_idle_cb), (gsd_mouse_manager_stop): + * plugins/xrandr/gsd-xrandr-manager.c: adapt ifdefs accordingly + +2008-11-27 Sergey Udaltsov + + * configure.ac, plugins/keyboard/gsd-keyboard-xkb.c: introduce + dependency on libxklavier 3.8. Use "new device" notification to reload + XKB configuration when new keyboard is plugged in + +2008-11-24 Behdad Esfahbod + + * gnome-settings-daemon/main.c (parse_args), (main): Fix --no-daemon + (bug #562175) + +2008-11-24 Jens Granseuer + + When multiple keys (keycodes) were mapped to the same keysym, g-s-d + would only accept the first of those keycodes in the keymap as a + valid shortcut. To fix this, instead of checking against a single + keycode, we need to grab all keycodes that match the respective + keysym (bug #561275). + + With thanks to Mario Limonciello + + * plugins/common/eggaccelerators.c: + (egg_accelerator_parse_virtual): + * plugins/common/eggaccelerators.h: possibly return multiple keycodes + * plugins/common/gsd-keygrab.c: (grab_key_unsafe), + (key_uses_keycode), (match_key): grab all matching keys + * plugins/common/gsd-keygrab.h: + * plugins/keybindings/gsd-keybindings-manager.c: (parse_binding), + (bindings_get_entry), (same_keycode), (same_key), + (key_already_used), (binding_register_keys), + (gsd_keybindings_manager_stop): + * plugins/media-keys/gsd-media-keys-manager.c: (update_kbd_cb), + (init_kbd), (gsd_media_keys_manager_stop): update to handle changes + in data structures + +2008-11-23 Jens Granseuer + + Patch by: + + * configure.ac: add bundle_loader linker flag to fix compilation on + MacOS X (bug #522673) + +2008-11-20 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: (find_by_time), + (gsd_media_keys_manager_grab_media_player_keys): fix handling of + time = GDK_CURRENT_TIME. Previously, apps that registered with + GDK_CURRENT_TIME would be trumped by any app that registered with + time != 0 (bug #559797) + +2008-11-20 Jens Granseuer + + * plugins/mouse/gsd-mouse-manager.c: (set_devicepresence_handler): + trap X errors so we don't crash on X servers that don't support + DevicePresence (bug #560618) + +2008-11-13 Jens Granseuer + + * data/desktop_gnome_keybindings.schemas.in: fix typo + +2008-11-11 Matthias Clasen + + Bug 553434 – lockdown in the keybinding plugin + + * data/Makefile.am: Install the new schema file. + + * data/desktop_gnome_keybindings.schemas.in: Add schema for + /desktop/gnome/keybindings/allowed_keys. + + * plugins/keybindings/gsd-keybinding-manager.c: Support locking + down keybindings with a list of allowed keys. + +2008-11-10 Behdad Esfahbod + + * gnome-settings-daemon/main.c (daemon_start): Check return value of + pipe(). + +2008-11-10 Behdad Esfahbod + + * gnome-settings-daemon/main.c (daemon_start), (daemon_detach), + (daemon_terminate_parent), (main): Fork before gtk_init (bug #559695) + +2008-11-09 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: (do_sound_action): + add debugging output for volume_step + +2008-11-08 Jens Granseuer + + Patch by: William Grant + + * plugins/mouse/gsd-mouse-manager.c: (devicepresence_filter): listen + for DeviceEnabled instead of DeviceAdded so we can be sure it has been + initialized (bug #559827) + +2008-11-06 Behdad Esfahbod + + * plugins/background/gsd-background-manager.c (setup_bg), + (queue_draw_background), (gsd_background_manager_start): + Delay constructing the GnomeBg object until we need it. This avoids + unneeded change triggers caused by a bug in gnome-screensaver (fixed + in trunk it seems). (bug #559639) + +2008-11-06 Behdad Esfahbod + + * data/gnome-settings-daemon.schemas.in: Reshuffle plugin priorities a + bit. Now that we do many of the plugins in idle callback, those can + be put at the end. + +2008-11-06 Behdad Esfahbod + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (maybe_show_status_icon), (ax_slowkeys_warning_post_bubble), + (ax_stickykeys_warning_post_bubble), + (gsd_a11y_keyboard_manager_stop), + (gsd_a11y_keyboard_manager_ensure_status_icon), + (gsd_a11y_keyboard_manager_init): + Init status icon only when needed (bug #559558) + +2008-11-06 Behdad Esfahbod + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (start_a11y_keyboard_idle_cb), (gsd_a11y_keyboard_manager_start): + Start manager in idle callback (bug #559564) + + * plugins/media-keys/gsd-media-keys-manager.c + (start_media_keys_idle_cb), (gsd_media_keys_manager_start): + Start manager in idle callback (bug #559564). Leave the acme + initialization in the main start function to force gstreamer + cache up to date check before we let other applications start. + +2008-11-06 Behdad Esfahbod + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (get_xkb_desc_rec): + * plugins/common/gsd-keygrab.c (have_xkb): + Remove more unnecessary X error traps and synchs (bug #559562) + +2008-11-06 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: (xkb_enabled), + (gsd_a11y_keyboard_manager_start): remove unnecessary X error traps + (bug #559562) + +2008-11-05 Behdad Esfahbod + + * plugins/xsettings/fontconfig-monitor.c (fontconfig_cache_init): + * plugins/xsettings/fontconfig-monitor.h: + * plugins/xsettings/gsd-xsettings-manager.c + (start_fontconfig_monitor): Only initialize fontconfig when starting + up. A cache update is redundant there. (bug #559550) + +2008-11-05 Behdad Esfahbod + + * plugins/keyboard/gsd-keyboard-manager.c (start_keyboard_idle_cb), + (gsd_keyboard_manager_start): Start manager in idle callback (bug + #559482) + +2008-11-05 Behdad Esfahbod + + * plugins/keyboard/gsd-keyboard-xkb.c (gsd_keyboard_xkb_init): Add + some performance logging annotations around libxklavier calls. + +2008-11-05 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-manager.c: (numlock_xkb_init): + XkbQueryExtension and friends shouldn't cause errors, so no need to + try and trap them (bug #559346) + +==================== 2.25.1 ==================== + +2008-11-04 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.25.1 release + +2008-11-04 Behdad Esfahbod + + * gnome-settings-daemon/main.c (daemonize), (main): Use a pipe + to communicate between child and parent process instead of a + signal. Signals are not queued, so if the child tried to signal + the parent before the parent got a chance to wait for it, the signal + would be lost and parent wait indefinitely for a signal that would + never arrive. + +2008-11-04 Behdad Esfahbod + + * gnome-settings-daemon/main.c (daemonize): Don't close stderr. + Otherwise we just lose all our warnings that will not end up + in ~/.xsession-errors. + + Also fix indentation. + +2008-11-03 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-xkb.c: add missing include + +2008-11-03 Behdad Esfahbod + + * gnome-settings-daemon/main.c (daemonize), (main): + Make parent wait for initialization in children to finish before + returning. This makes gnome-session to wait for initialization + to be done before spawning other processes. This way, apps + start up with the right xsettings and other settings, and don't + have to handle change signals right after starting up. (bug #559168) + +2008-11-03 Behdad Esfahbod + + * gnome-settings-daemon/gnome-settings-manager.c (_load_file), + (gnome_settings_manager_start), (gnome_settings_manager_stop): + * gnome-settings-daemon/gnome-settings-plugin-info.c + (gnome_settings_plugin_info_set_enabled_key_name): + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (register_config_callback): + * plugins/keybindings/gsd-keybindings-manager.c + (register_config_callback), (gsd_keybindings_manager_start): + * plugins/keyboard/gsd-keyboard-manager.c + (gsd_keyboard_manager_start): + * plugins/keyboard/gsd-keyboard-xkb.c (register_config_callback): + * plugins/mouse/gsd-mouse-manager.c (register_config_callback): + * plugins/typing-break/gsd-typing-break-manager.c + (gsd_typing_break_manager_start): + * plugins/xrandr/gsd-xrandr-manager.c (gsd_xrandr_manager_start): + * plugins/xsettings/gsd-xsettings-manager.c + (register_config_callback), (gnome_xsettings_manager_start): + Preload gconf dirs when feasible (bug #559167) + +2008-11-03 Behdad Esfahbod + + * plugins/clipboard/gsd-clipboard-manager.c + (start_clipboard_idle_cb), (gsd_clipboard_manager_start): + Start manager in idle callback (bug #559166) + + * plugins/mouse/gsd-mouse-manager.c (gsd_mouse_manager_idle_cb), + (gsd_mouse_manager_start): + Start manager in idle callback (bug #559166) + + * plugins/xsettings/fontconfig-monitor.c (fontconfig_cache_update), + (update): + * plugins/xsettings/fontconfig-monitor.h: + * plugins/xsettings/gsd-xsettings-manager.c + (start_fontconfig_monitor_idle_cb), (start_fontconfig_monitor), + (stop_fontconfig_monitor): + Start fontconfig monitors in idle callback. However, make sure + fontconfig caches are up to date during initialization (bug #559166) + +2008-11-03 Behdad Esfahbod + + * plugins/mouse/gsd-mouse-manager.c (set_mousetweaks_daemon): + Don't run "mousetweaks -s" at startup time (#559165) + + All "mousetweaks -s" does is shutdown the already-running daemon. + When g-s-d starts, there is no daemon running. So, remember that and + do not try to shut the non-existing daemon down. + +2008-11-03 Behdad Esfahbod + + * plugins/common/gsd-keygrab.c (setup_modifiers), (grab_key_real), + (grab_key_unsafe): + * plugins/common/gsd-keygrab.h: + * plugins/keybindings/gsd-keybindings-manager.c + (binding_register_keys): + * plugins/media-keys/gsd-media-keys-manager.c (update_kbd_cb), + (init_kbd): + Don't trap errors around grab_key (bug #559164) + + Such that we can do a single gdk_flush for multiple keys. + The only downside is that we cannot write out in the warning + which key is being accessed by another app. Not that we really + care. + +2008-11-03 Behdad Esfahbod + + * plugins/font/gsd-font-manager.c (setup_dir), (empty_check_dir), + (setup_font_dir), (setup_cursor_dir), (load_font_paths), + (gsd_font_manager_start): Cleanup font module (bug #559163) + + The old code had several flaws: + + - It tried to create directories in user's home even if we didn't have + any use for them. + + - It called mkfontdir and XSync even if there was no fonts installed. + + The new code does the following: + + - Only call mkfontdir and XSync if there's actually any fonts in the + relevant dirs. + + - Remove the ~/.gnome2/share/fonts and/or ~/.gnome2/share/cursor-fonts + if they are empty and no cursor font is set. + +2008-11-03 Behdad Esfahbod + + * gnome-settings-daemon/gnome-settings-manager.c (_load_file): + * gnome-settings-daemon/gnome-settings-plugin-info.c + (gnome_settings_plugin_info_fill_from_file), (load_plugin_module): + * plugins/font/gsd-font-manager.c (child_watch_cb), + (spawn_with_input): + * plugins/keyboard/gsd-keyboard-xkb.c (gsd_keyboard_xkb_init): + * plugins/xrandr/gsd-xrandr-manager.c (gsd_xrandr_manager_start): + * plugins/xsettings/gsd-xsettings-manager.c (child_watch_cb), + (spawn_with_input), (start_fontconfig_monitor), + (stop_fontconfig_monitor), (gnome_xsettings_manager_start), + (gnome_xsettings_manager_stop): + Improve performance logging annotations (bug #559162) + +2008-11-03 Behdad Esfahbod + + * data/gnome-settings-daemon.schemas.in: Disable xrdb plugin by + default (#bug #557807) + +2008-11-02 Jens Granseuer + + * configure.ac: remove AM_MAINTAINER_MODE because it is deprecated + and supposedly unsafe (bug #558503) + +2008-11-01 Jens Granseuer + + Patch by: William Grant + + * plugins/mouse/gsd-mouse-manager.c: (devicepresence_filter), + (set_devicepresence_handler), (set_mouse_settings), + (gsd_mouse_manager_start), (gsd_mouse_manager_stop): listen for + X device changes, and reconfigure the mouse if necessary so that the + settings aren't ignored when hotplugging (bug #549267) + +2008-10-29 Jens Granseuer + + Get rid of libgnome (bug #557808). + + * configure.ac: bump required gtk+ version to 2.13.1 + * gnome-settings-daemon/main.c: (main): don't use g_program_init + * plugins/a11y-keyboard/Makefile.am: + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (ax_response_callback), (ax_stickykeys_response), + (ax_slowkeys_response), (on_slow_keys_action), + (on_sticky_keys_action): replace gnome_help_display_desktop with + gtk_show_uri + +2008-10-29 Jens Granseuer + + * plugins/screensaver/gsd-screensaver-manager.c: + (gsd_screensaver_manager_start): fix plugin activation, too + +2008-10-29 Jens Granseuer + + * plugins/screensaver/gsd-screensaver-manager.c: + (start_screensaver_idle_cb), (gsd_screensaver_manager_start): fix + broken changes to screensaver plugin + +2008-10-29 Jens Granseuer + + Remove ESD-based sound plugin (bug #557806). This means that g-s-d + will no longer start a sound server (esd or PulseAudio) at session + startup. This should be handled using the autostart mechanism of + gnome-session instead. + + * configure.ac: + * plugins/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/sound/gsd-sound-manager.c: + * plugins/sound/gsd-sound-manager.h: + * plugins/sound/gsd-sound-plugin.c: + * plugins/sound/gsd-sound-plugin.h: + * plugins/sound/sound.gnome-settings-plugin.in: + remove sound plugin + +2008-10-29 Rodrigo Moya + + * plugins/screensaver/gsd-screensaver-manager.c + (gsd_screensaver_manager_start): spawn screensaver process + in idle callback as it was before. + +2008-10-23 Jens Granseuer + + Based on a patch by: Bogdan Butnaru + + * plugins/media-keys/gsd-media-keys-window.c: (draw_waves), + (draw_cross), (draw_action_volume): make the composited volume images + more clear: draw waves matching current volume and show a cross when + muted (bug #557307) + +2008-10-23 Jens Granseuer + + * plugins/media-keys/actions/acme-volume-gstreamer.c: + (acme_volume_gstreamer_finalize), + (acme_volume_gstreamer_close_real), (acme_volume_gstreamer_open), + (acme_volume_gstreamer_close), (acme_volume_gstreamer_init), + (acme_volume_gstreamer_class_init): + * plugins/media-keys/actions/acme-volume-gstreamer.h: + clean up Volume initialization so that we don't get non-functional + volume keys when the plugin starts up with an invalid configuration + initially, even if the configuration is fixed afterwards (bug #552383) + +2008-10-19 Matthias Clasen + + Bug 556797 – support the Gtk/ButtonImages XSetting + + * plugins/xsettings/gsd-xsettings-manager.c: Support the + Gtk/ButtonImages xsetting. + +2008-10-15 Matthias Clasen + + Bug 556307 – show the shutdown dialog when the power button is pressed + + * plugins/media-keys/gsd-media-keys-manager.c (do_exit_action): + Show the shutdown dialog when the power button is pressed, + not the logout dialog. + +2008-10-12 Christian Persch + + Bug 555553 – format not a string literal and no format arguments + + * gnome-settings-daemon/gnome-settings-manager.c + * gnome-settings-daemon/gnome-settings-module.c + * gnome-settings-daemon/main.c + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + * plugins/xrdb/gsd-xrdb-manager.c: Use printf safely. + +2008-10-06 Matthias Clasen + + Bug 555873 – fix gdm keyboard layout handling even more + + * plugins/keyboard/gsd-keyboard-xkb.c (apply_xkb_settings): + Try harder to handle initial-login situations correctly, while + not overwriting any user configuration. + +2008-10-06 Matthias Clasen + + Bug 554525 – fix the picking up of the gdm layout + + * plugins/keyboard/gsd-keyboard-xkb.c (apply_xkb_settings): Active + a specific group only after activating the right keyboard + configuration. Because the other way around doesn't work. + +2008-10-05 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (set_server_from_gconf): don't make togglekeys_enable depend on + global AccessX state (bug #555009) + +2008-10-04 Jens Granseuer + + Patch by: Eric Piel + + * plugins/xrandr/gsd-xrandr-manager.c: + (output_rotation_item_activate_cb): ignore the "activate" signal for + deselected items so that the rotation setting doesn't reset when the + systray menu is opened (bug #554951) + +==================== 2.24.0 ==================== + +2008-09-23 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.24.0 release. + +2008-09-22 Michael J. Chudobiak + + * plugins/housekeeping/gsd-housekeeping-manager.c: + Made the housekeeping plugin less aggressive by default (bug #552680). + Code freeze break approved by release team. + +2008-09-16 Matthias Clasen + + * plugins/keyboard/gsd-keyboard-xkb.c: Remove an accidentally + added debug printf. + +2008-09-12 Jens Granseuer + + Also allow linking the module state to other boolean keys by using a + string value that is the name of the key to use. Note that in this + case the state won't be updated at runtime due to GConf limitations. + + * plugins/xsettings/gsd-xsettings-manager.c: (get_gtk_modules): + enable linking to other keys + +2008-09-12 Jens Granseuer + + Specify GTK modules to load in a GConf directory instead of the single + /desktop/gnome/gtk-modules key. Apps can now easily install additional + modules by dropping a key with the name of the module and a boolean + value (enabled/disabled) into /apps/gnome_settings_daemon/gtk-modules/ + (bug #539840). + + * plugins/xsettings/gsd-xsettings-manager.c: (get_gtk_modules), + (gtk_modules_callback), (gnome_xsettings_manager_start), + (gnome_xsettings_manager_stop): remove the old gtk-modules key in + favor of a GConf directory + +2008-09-12 Jens Granseuer + + * COPYING: add GPLv2 copyright notice explicitly so that newer + versions of autotools don't declare us GPLv3 (bug #551956) + +2008-09-11 Jens Granseuer + + Make the volume popup not crash when invoking it on any screen but the + first when using a compositing manager (bug #551677) + + * plugins/media-keys/gsd-media-keys-window.c: + (gsd_media_keys_window_real_realize), (gsd_media_keys_window_init): + do not set the window colormap at init time where we'll only use the + colormap of the default screen. Instead, whenever the window is + realized, update the colormap to match the current screen. + +2008-09-10 Jens Granseuer + + Patch by: Simon Zheng + + * gnome-settings-daemon/main.c: (main): fix the fix for read-only + home directories from bug #530975 + +==================== 2.23.92 ==================== + +2008-09-08 Rodrigo Moya + + * NEWS: prepare for 2.23.92 release. + +2008-09-06 Matthias Clasen + + Bug 551062 – try harder to use the keyboard layout passed by gdm + + * plugins/keyboard/gsd-keyboard-xkb.c: Be tolerant of variants + when trying to match the gdm-provided keyboard layout to the + existing keyboard configuration. + +==================== 2.23.91 ==================== + +2008-09-01 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.23.91 release. + +2008-08-28 William Jon McCann + + * configure.ac: Belated post release version bump + +2008-08-27 Jens Granseuer + + * plugins/xsettings/gsd-xsettings-manager.c: + (setup_xsettings_managers): use g_warning instead of g_error when + setup fails so we don't abort (bug #549483) + +2008-08-26 William Jon McCann + + * plugins/a11y-keyboard/Makefile.am: + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c + (dpi_from_pixels_and_mm), (get_dpi_from_x_server), + (config_get_large_print), (config_set_large_print): + * plugins/a11y-keyboard/test-a11y-preferences-dialog.c + (test_window), (main): + Use a scale factor instead of a fixed DPI. Add a test + program. + +2008-08-22 William Jon McCann + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (on_notification_closed): Oops. Missing comma. + +2008-08-22 William Jon McCann + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c + (on_notification_closed): + Fix a crash due to an incorrect signal handler definition. + +2008-08-21 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-xkb.c: (apply_xkb_settings): fix a + constness warning + +2008-08-19 Claude Paroz + + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.glade: + Removed the translatable property on stock gtk-close. + +==================== 2.23.90 ==================== + +2008-08-18 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.23.90 release. + +2008-08-14 William Jon McCann + + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c + (get_dpi_from_x_server): + Use gdk api to get dpi. + +2008-08-13 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (status_icon_popup_menu): + Create the RANDR configuration and labeler before the menu items. + +2008-08-13 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (status_icon_popup_menu): + Add a separator to the menu before "Configure display settings". + +2008-08-13 Federico Mena Quintero + + * plugins/xrandr/gsd-xrandr-manager.c (status_icon_popup_menu): + When the menu comes up, create a GnomeRRLabeler so that the user + can identify which physical monitors we are talking about. This + will actually be visible in the popup menu once we implement the + rotation commands. + (status_icon_popup_menu_selection_done_cb): Hide and destroy the + GnomeRRLabeler. + (struct GsdXrandrManagerPrivate): New field "labeler". + +2008-08-12 Federico Mena Quintero + + * configure.ac: For LIBSOUNDS, check for libgnomeui, not just libgnome. + +2008-08-12 Jens Granseuer + + Even if we can't properly remove a client message handler at least + make sure everything works as expected when enabling/disabling the + plugin at runtime + + * plugins/xrandr/gsd-xrandr-manager.c: (on_client_message), + (gsd_xrandr_manager_start): pass the manager as user data instead of + the screen because the manager will remain stable during the lifetime + of the daemon; also, don't filter messages when the plugin is disabled + +2008-08-12 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (status_icon_start): remove + obsolete comment + +2008-08-11 Jens Granseuer + + * configure.ac: require gnome-desktop 2.23.90 + * plugins/xrandr/gsd-xrandr-manager.c: (gsd_xrandr_manager_start), + (gsd_xrandr_manager_stop), (gsd_xrandr_manager_init): try harder to + clean up in _stop so we can enable/disable the plugin on the fly; + not quite there, yet + +2008-08-10 Jens Granseuer + + Patch by: Matthias Clasen + + * plugins/xrandr/gsd-xrandr-manager.c: (gsd_xrandr_manager_start): + fail on start if we couldn't set up xrandr (bug #546446) + +2008-08-08 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (gsd_xrandr_manager_init): + pass the manager as callback data so we don't crash with a NULL + pointer in on_randr_event + +2008-08-08 Jens Granseuer + + * plugins/xrandr/gsd-xrandr-manager.c: (gsd_xrandr_manager_start): + remove warning that isn't + +2008-08-05 Jens Granseuer + + * configure.ac: require glib >= 2.17.3 + + * plugins/xsettings/fontconfig-monitor.c: (monitor_files): use + g_file_monitor instead of g_file_monitor_file/directory (bug #546372) + +2008-08-05 Jens Granseuer + + * plugins/font/gsd-font-manager.c: (gsd_font_manager_class_init), + (gsd_font_manager_init): remove some unneccessary boilerplate + +2008-08-05 Jens Granseuer + + * plugins/a11y-keyboard/Makefile.am: put the glade file where all the + others are + +2008-08-05 Jens Granseuer + + * configure.ac: simplify libnotify check, fix fontconfig result + output + +2008-08-05 William Jon McCann + + * configure.ac: + * plugins/a11y-keyboard/Makefile.am: + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c (get_int), + (set_clear), (maybe_show_status_icon), (on_notification_closed), + (on_slow_keys_action), (on_sticky_keys_action), + (ax_slowkeys_warning_post_bubble), + (ax_slowkeys_warning_post_dialog), (ax_slowkeys_warning_post), + (ax_stickykeys_warning_post_bubble), + (ax_stickykeys_warning_post_dialog), (ax_stickykeys_warning_post), + (set_gconf_from_server), (keyboard_callback), + (gsd_a11y_keyboard_manager_start), + (gsd_a11y_keyboard_manager_stop), (on_preferences_dialog_response), + (on_status_icon_activate), (gsd_a11y_keyboard_manager_init): + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c + (gsd_a11y_preferences_dialog_set_property), + (gsd_a11y_preferences_dialog_get_property), + (gsd_a11y_preferences_dialog_constructor), + (gsd_a11y_preferences_dialog_dispose), + (gsd_a11y_preferences_dialog_class_init), (on_response), + (config_get_string), (config_get_bool), (dpi_from_pixels_and_mm), + (get_dpi_from_x_server), (config_get_large_print), + (config_set_large_print), (config_get_high_contrast), + (config_set_high_contrast), (config_get_sticky_keys), + (config_set_sticky_keys), (config_get_bounce_keys), + (config_set_bounce_keys), (config_get_slow_keys), + (config_set_slow_keys), (config_have_at_gconf_condition), + (config_get_at_screen_reader), (config_get_at_screen_keyboard), + (config_get_at_screen_magnifier), (config_set_at_screen_reader), + (config_set_at_screen_keyboard), (config_set_at_screen_magnifier), + (on_sticky_keys_checkbutton_toggled), + (on_bounce_keys_checkbutton_toggled), + (on_slow_keys_checkbutton_toggled), + (on_high_contrast_checkbutton_toggled), + (on_at_screen_reader_checkbutton_toggled), + (on_at_screen_keyboard_checkbutton_toggled), + (on_at_screen_magnifier_checkbutton_toggled), + (on_large_print_checkbutton_toggled), (ui_set_sticky_keys), + (ui_set_bounce_keys), (ui_set_slow_keys), (ui_set_high_contrast), + (ui_set_at_screen_reader), (ui_set_at_screen_keyboard), + (ui_set_at_screen_magnifier), (ui_set_large_print), + (key_changed_cb), (setup_dialog), + (gsd_a11y_preferences_dialog_init), + (gsd_a11y_preferences_dialog_finalize), + (gsd_a11y_preferences_dialog_new): + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.glade: + * plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h: + Add status icon when a11y hotkeys are enabled. Display + Universal Access Preferences when it is clicked. + Fixes #526070 + +2008-08-04 Jens Granseuer + + * configure.ac: fix PulseAudio check to not output "no" twice + +==================== 2.23.6 ==================== + +2008-08-04 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.23.6 release. + +2008-08-03 Jens Granseuer + + * plugins/common/gsd-keygrab.c: (setup_modifiers), (grab_key), + (match_key): resolve NumLock dynamically and make sure we ignore it + so using e.g. the media keys works even when NumLock is on (still + bug #165343) + +Tue Jul 29 01:09:46 2008 Søren Sandmann + + * plugins/xrandr/gsd-xrandr-manager.c (start_or_stop_icon): Make + the display notification icon configurable. + +2008-07-26 Matthias Clasen + + Bug 544733 – use standard icon names in the volume OSD, initially + + * plugins/media-keys/actions/acme.glade: Use standard + icon names for the OSD. + +2008-07-26 Wouter Bolsterlee + + * configure.ac: + + Bump glib dependency to 2.15. Fixes bug #544737. + +2008-07-25 Rob Bradford + + * configure.ac: + libsounds needs to use gtk+-2.0 now libgnomeui is removed. + +2008-07-24 James Sharpe + + * configure.ac: + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + * plugins/sound/gsd-sound-manager.c: + Remove libgnomeui. + (bug #544347) + +==================== 2.23.5 ==================== + +Thu Jul 24 14:48:04 2008 Søren Sandmann + + * Downgrade intltool requirement to 0.37.1. + + This bug + + http://bugzilla.gnome.org/show_bug.cgi?id=537352 + + says that's what I'm supposed to do. + + * Bump version number to 2.23.5 + + * NEWS: Update this file. + +2008-07-22 Lennart Poettering + + Fixes #539786 + + * plugins/xsettings/gsd-xsettings-manager.c: add three new + xsettings for event sounds. + +2008-07-16 Jens Granseuer + + Patch by: Damien Carbery + + * data/gnome-settings-daemon-uninstalled.pc.in: fix include path for + building against the uninstalled package (bug #543289) + +2008-07-15 Gerd Kohlberger + + * plugins/mouse/gsd-mouse-manager.c: (set_mousetweaks_daemon): + Remove 'daemon' from the warning message (see bug #543095). + +2008-07-15 Jens Granseuer + + * plugins/common/gsd-keygrab.c: (match_key): always remove Shift + from the consumed modifiers if we're matching the lowercase + symbol to make more shortcuts with Shift work (bug #542275) + +Wed Jul 9 11:48:02 2008 Søren Sandmann + + * plugins/xrandr/gsd-xrandr-manager.c: Call the new gnome_rr + functions instead of the old ones. + +2008-06-28 Jens Granseuer + + * plugins/common/gsd-keygrab.c: don't ignore any ModX modifiers. + This should finally make g-s-d recognize keybindings with Super + and Meta although we still don't handle the corresponding virtual + modifiers (bug #165343) + +2008-06-20 Jens Granseuer + + * plugins/common/gsd-keygrab.c: (match_key): fix accel check so + that we don't match e.g. XF86RaiseVolume if + XF86RaiseVolume + was pressed (bug #538699). Also fix build without XKB + +2008-06-18 Jens Granseuer + + * Makefile.am: + * configure.ac: require intltool >= 0.40 + +2008-06-18 Jens Granseuer + + * configure.ac: bump gnome-desktop requirement to 2.23.5 + +Tue Jun 17 19:41:55 2008 Søren Sandmann + + * Merge randr-12 branch into trunk + +Mon Jun 16 14:50:53 2008 Søren Sandmann + + * Port to new gnome-desktop API + +Mon Jun 16 14:30:13 2008 Søren Sandmann + + * Merge from trunk. + +2008-06-17 Colin Walters + + http://bugzilla.gnome.org/show_bug.cgi?id=533198 + + * configure.ac: Detect PulseAudio at build time; if available, + default to always starting it (ignore the legacy esd GConf + key /desktop/gnome/sound/enable_esd). If you're a system + administrator or OS builder and want to disable PulseAudio, + you should preferably figure out what the problem you have + with it is; but failing that, just remove it from the install + image. + * plugins/sound/gsd-sound-manager.c: If we're not compiled with + legacy sound pref, always start sound. + +==================== 2.23.4 ==================== + +2008-06-17 Rodrigo Moya + + * configure.ac: + * NEWS: update for 2.23.4 release. + +2008-06-14 Jens Granseuer + + Based on a patch by: Brian Cameron + + * configure.ac: + * plugins/sound/Makefile.am: + * plugins/sound/gsd-sound-manager.c: (start_gnome_sound): if + available use the esd_serverdir variable to locate the esd daemon + so it can be started even if it's not in the PATH (bug #531868) + +2008-06-13 Jens Granseuer + + Based on a patch by: Bastien Nocera + + * plugins/common/gsd-keygrab.c: (match_key): properly match + keybindings that need Shift for resolving the keysym (bug #536581) + +2008-06-07 Behdad Esfahbod + + (Commit this again) + + * configure.ac: Check for fontconfig instead of xft2. + + * plugins/xsettings/Makefile.am: + * plugins/xsettings/gsd-xsettings-manager.c (fontconfig_callback), + (gnome_xsettings_manager_start), (gnome_xsettings_manager_stop): + Send a Fontconfig/Timestamp xsettings notification whenever + fontconfig configurations change. (bug #490374) + + * plugins/xsettings/fontconfig-monitor.c: + * plugins/xsettings/fontconfig-monitor.h: + Monitor fontconfig configuration files using gio. + +==================== 2.23.3 ====================== + +2008-06-03 Jens Granseuer + + * configure.ac: use correct release number + +2008-06-03 Jens Granseuer + + * NEWS: Update for 2.23.3 release. + +2008-06-02 Behdad Esfahbod + + * configure.ac: + * plugins/xsettings/Makefile.am: + * plugins/xsettings/fontconfig-monitor.c: + * plugins/xsettings/fontconfig-monitor.h: + * plugins/xsettings/gsd-xsettings-manager.c + (gnome_xsettings_manager_start), (gnome_xsettings_manager_stop): + Revert previous change. Working on a slightly different design. + (bug #490374) + +2008-06-02 Behdad Esfahbod + + * configure.ac: Check for fontconfig instead of xft2. + + * plugins/xsettings/Makefile.am: + * plugins/xsettings/gsd-xsettings-manager.c (fontconfig_callback), + (gnome_xsettings_manager_start), (gnome_xsettings_manager_stop): + Send a Fontconfig/Timestamp xsettings notification whenever + fontconfig configurations change. (bug #490374) + + * plugins/xsettings/fontconfig-monitor.c: + * plugins/xsettings/fontconfig-monitor.h: + Monitor fontconfig configuration files using gio. + +2008-06-02 Jens Granseuer + + * configure.ac: do not add stuff to GST_LIBS when gstreamer is + disabled. Fixes build without gstreamer (bug #536177) + +2008-06-02 Gerd Kohlberger + + * plugins/mouse/gsd-locate-pointer.c: (timeline_frame_cb): + Keep animation centered below pointer. Bug #531665 + +2008-05-30 Jens Granseuer + + * plugins/font/gsd-font-manager.c: (load_xcursor_theme): fix a few + leaks + +2008-05-27 Jens Granseuer + + * gnome-settings-daemon/gnome-settings-manager.c: (_unload_plugin), + (_unload_all): stop all plugins on shutdown + +2008-05-27 Lucas Rocha + + * gnome-settings-daemon/main.c (set_session_over_handler, + on_session_over, main): listen to "SessionOver" D-Bus signal from + Session Manager to know when to shutdown. Bug #522017. + +2008-05-14 William Jon McCann + + * plugins/mouse/gsd-mouse-manager.c (filter): + Bummer. Revert part of last commit. + +2008-05-14 William Jon McCann + + * plugins/mouse/gsd-mouse-manager.c (filter): + Don't eat keypresses for multimedia key events + Patch by Bastien Nocera + +2008-05-13 Jens Granseuer + + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_start): reuse the GConf client we already + have + +2008-05-13 William Jon McCann + + * configure.ac: + * plugins/background/Makefile.am: + * plugins/background/gsd-background-manager.c (draw_background), + (queue_draw_background), (on_bg_changed), (gconf_changed_callback), + (watch_bg_preferences), (gsd_background_manager_start), + (gsd_background_manager_stop): + Use new gnome-desktop background preference loading api. + Drop use of libbackground. + +2008-05-08 Carlos Garnacho + + * plugins/media-keys/gsd-media-keys-window.c + (gsd_media_keys_window_real_realize): New function, sets a fully + transparent input shape, so that clicks go through the media keys + windows. Bug #531862. + (gsd_media_keys_window_class_init): The usual glue. + +2008-05-08 Carlos Garnacho + + * plugins/mouse/gsd-locate-pointer.c (set_transparent_shape): new + function, sets a fully transparent shape to the whole window. + (timeline_finished_cb) (gsd_locate_pointer): set the window + transparent once the animation is finished, and before it's shown for + the first time. The shape will be changed afterwards while running the + animation. This fixes some artifacts shown when showing/moving the + window, bug #531861. + (locate_pointer_expose): Plug a leak. + +2008-05-02 Jens Granseuer + + Patch by: Brian Cameron + + * gnome-settings-daemon/main.c: (main): don't die when the + user's home directory is read-only (bug #530975) + +2008-05-02 Jens Granseuer + + Based on a patch by: Matthias Clasen + + * plugins/keyboard/gsd-keyboard-xkb.c: (apply_xkb_settings), + (gsd_keyboard_xkb_init): if the user set a keyboard layout from + the login screen, try to keep that setting (bug #531589) + +2008-05-02 Jens Granseuer + + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_start): add a comment explaining why we + are applying the prefs regardless of nautilus + +2008-05-02 Jens Granseuer + + Patch by: Matthias Clasen + + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_start): eventually apply the settings + even if nautilus is supposed to be handling the background to make + people running without nautilus happy (bug #531487) + +2008-04-29 Bastien Nocera + + * plugins/common/gsd-keygrab.c (have_xkb), (match_key): + When checking whether a key matches our key event, check + the keysym from the key event, to avoid triggering another + keybindings with the same keycode, but different keysym, + Fixes Eject being triggered when pressing the Stop key with the + default inet keymap (Closes: #530356) + +2008-04-23 Vincent Untz + + * configure.ac: post release version bump. + +==================== 2.23.1.1 ==================== + +2008-04-23 Vincent Untz + + * configure.in: + * NEWS: Update for 2.23.1.1 release. + +2008-04-21 Lucas Rocha + + Install .desktop for gnome-settings-daemon in a standard autostart + directory as required by new gnome-session (bug #526984). + + * configure.ac: expand $libexecdir to be used on .desktop file. + * acinclude.m4: added new m4 macro (AS_AC_EXPAND) for expanding + variables. + * data/Makefile.am, data/gnome-settings-daemon.desktop.in.in: install + g-s-d .desktop file. + +2008-04-21 Rodrigo Moya + + * configure.ac: post release version bump. + +==== 2.23.1 ==== + +2008-04-21 Rodrigo Moya + + * configure.in: + * NEWS: Update for release. + +2008-04-20 Jens Granseuer + + * plugins/media-keys/actions/acme-volume-alsa.c: + (acme_volume_alsa_finalize), (acme_volume_alsa_class_init): + * plugins/media-keys/actions/acme-volume-dummy.c: + (acme_volume_dummy_finalize), (acme_volume_dummy_class_init): + * plugins/media-keys/actions/acme-volume-gstreamer.c: + (acme_volume_gstreamer_finalize), + (acme_volume_gstreamer_class_init): + * plugins/media-keys/actions/acme-volume-oss.c: + (acme_volume_oss_finalize), (acme_volume_oss_class_init): + * plugins/media-keys/actions/acme-volume.c: + (acme_volume_class_init): drop redundant GType stuff + +2008-04-19 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: + (bindings_get_entry): remove some code (and translatable strings) for + error that can never happen + +2008-04-18 Jens Granseuer + + * plugins/mouse/gsd-mouse-manager.c: (set_mousetweaks_daemon): when we + can't launch the daemon reset the GConf keys before showing the error + dialog. If we wait until after the dialog is closed, the user can + still toggle the settings while it's open + +2008-04-13 Jens Granseuer + + Extract some functionality used by several plugins into a separate + shared helper library (bug #525426). + + * configure.ac: + * plugins/Makefile.am: + * plugins/common/Makefile.am: + * plugins/common/gsd-keygrab.c: + * plugins/common/gsd-keygrab.h: + * plugins/common/eggaccelerators.c: + * plugins/common/eggaccelerators.h: new shared components + + * plugins/keybindings/Makefile.am: + * plugins/keybindings/eggaccelerators.c: + * plugins/keybindings/eggaccelerators.h: + * plugins/keybindings/gsd-keybindings-manager.c: + (binding_register_keys), (keybindings_filter): + * plugins/media-keys/Makefile.am: + * plugins/media-keys/actions/Makefile.am: + * plugins/media-keys/actions/acme.h: + * plugins/media-keys/eggaccelerators.c: + * plugins/media-keys/eggaccelerators.h: + * plugins/media-keys/gsd-media-keys-manager.c: (update_kbd_cb), + (init_kbd), (acme_filter_events): + make keybindings and media-keys plugins use the shared components + +2008-04-13 Sergey Udaltsov + + * plugins/keyboard/gsd-keyboard-xkb.c: dropped gconf backup + +2008-04-12 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: (do_grab): + * plugins/media-keys/gsd-media-keys-manager.c: (grab_key): make some + tiny optimizations and add some more comments on what's happening + +2008-04-12 Jens Granseuer + + * gnome-settings-daemon/main.c: + * plugins/media-keys/gsd-media-keys-manager.c: DBus API has been + stable for a while; don't define DBUS_API_SUBJECT_TO_CHANGE anymore + +2008-04-12 Jens Granseuer + + * gnome-settings-daemon/main.c: (acquire_name_on_proxy), + (bus_register), (main): fix a few small leaks + +2008-04-12 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: (init_screens): + drop redundant code + +2008-04-11 Jens Granseuer + + * gnome-settings-daemon/main.c: turn into a daemon by default and + make --no-daemon work + +2008-04-11 Jens Granseuer + + * plugins/sound/gsd-sound-plugin.c: (impl_deactivate): fix typo + +2008-04-11 Jens Granseuer + + Make xrandr, xrdb, and xsettings plugin deactivation work + + * plugins/xrandr/gsd-xrandr-manager.c: (apply_settings): cleanup + + * plugins/xrandr/gsd-xrandr-plugin.c: (impl_deactivate): + * plugins/xrdb/gsd-xrdb-plugin.c: (impl_deactivate): + * plugins/xsettings/gsd-xsettings-plugin.c: (impl_deactivate): + stop manager on deactivation + + * plugins/xrdb/gsd-xrdb-manager.c: (gsd_xrdb_manager_start), + (gsd_xrdb_manager_stop): + * plugins/xsettings/gsd-xsettings-manager.c: + (gsd_xsettings_error_quark), (find_translation_entry), + (xsettings_callback), (register_config_callback), (terminate_cb), + (setup_xsettings_managers), (gnome_xsettings_manager_start), + (gnome_xsettings_manager_stop), (gnome_xsettings_manager_init): + clean up properly on stop + +2008-04-11 Jens Granseuer + + Make typing-break plugin deactivation work + + * plugins/typing-break/gsd-typing-break-manager.c: + (register_config_callback), (gsd_typing_break_manager_start), + (gsd_typing_break_manager_stop): clean up properly on stop + * plugins/typing-break/gsd-typing-break-plugin.c: + (impl_deactivate): stop manager on deactivation + +2008-04-11 Jens Granseuer + + Make screensaver and sound plugin deactivation work (sort of). The + screensaver is currently not reaped when deactivating the plugin, but + since the plugin should go away anyway, it doesn't seem worth adding + that right now. For the sound plugin, esd is currently not reaped + when HAVE_ESD is set. Maybe we want to get rid of the esd API + altogether? + + * plugins/sound/gsd-sound-manager.c: (apply_settings), + (register_config_callback), (gsd_sound_manager_start), + (gsd_sound_manager_stop): clean up a bit more on stop + * plugins/screensaver/gsd-screensaver-plugin.c: (impl_deactivate): + * plugins/sound/gsd-sound-plugin.c: (impl_deactivate): stop manager + on deactivation + +2008-04-11 Jens Granseuer + + Make mouse plugin deactivation work + + * plugins/mouse/gsd-mouse-manager.c: (register_config_callback), + (gsd_mouse_manager_init), (gsd_mouse_manager_start), + (gsd_mouse_manager_stop): clean up properly on stop + * plugins/mouse/gsd-mouse-plugin.c: (impl_deactivate): stop manager on + deactivation + +2008-04-11 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-xkb.c: (gsd_keyboard_xkb_shutdown): + clear the user callback data even if initialiation failed + * plugins/keyboard/gsd-xmodmap.c: (gsd_load_modmap_files): + properly NULL-terminate g_build_filename + +2008-04-11 Jens Granseuer + + Make media-keys plugin deactivation work + + * plugins/media-keys/gsd-media-keys-manager.c: (acme_error), + (dialog_init), (init_kbd), (gsd_media_keys_manager_stop), + (register_manager): clean up properly on stop + * plugins/media-keys/gsd-media-keys-plugin.c: (impl_deactivate): + stop manager on deactivation + +2008-04-11 Jens Granseuer + + * plugins/keyboard/gsd-xmodmap.c: (check_button_callback), + (gsd_load_modmap_files), (response_callback), + (remove_string_from_list), (remove_button_clicked_callback), + (load_button_clicked_callback), (gsd_modmap_dialog_call): fix + memory leaks + +2008-04-10 Jens Granseuer + + Make keyboard plugin deactivation work + + * plugins/keyboard/gsd-keyboard-manager.c: + (register_config_callback), (gsd_keyboard_manager_start), + (gsd_keyboard_manager_stop): + * plugins/keyboard/gsd-keyboard-xkb.c: (register_config_callback), + (gsd_keyboard_xkb_init), (gsd_keyboard_xkb_shutdown): + * plugins/keyboard/gsd-keyboard-xkb.h: clean up properly on stop + * plugins/keyboard/gsd-keyboard-plugin.c: (impl_deactivate): stop + manager on deactivation + +2008-04-10 Jens Granseuer + + Make keybinding plugin deactivation work + + * plugins/keybindings/gsd-keybindings-manager.c: + (register_config_callback), (gsd_keybindings_manager_start), + (gsd_keybindings_manager_stop): clean up properly on stop + * plugins/keybindings/gsd-keybindings-plugin.c: (impl_deactivate): + stop manager on deactivation + +2008-04-10 Jens Granseuer + + * plugins/font/gsd-font-plugin.c: (impl_deactivate): stop manager on + deactivation + +2008-04-10 Jens Granseuer + + * plugins/dummy/gsd-dummy-plugin.c: (impl_deactivate): stop manager + on deactivation + +2008-04-10 Jens Granseuer + + * plugins/clipboard/gsd-clipboard-plugin.c: (impl_deactivate): stop + manager on deactivation + +2008-04-10 Jens Granseuer + + Make background plugin deactivation work + + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_start), (gsd_background_manager_stop): + clean up properly on stop + * plugins/background/gsd-background-plugin.c: (impl_deactivate): + stop manager on deactivation + +2008-04-10 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (gsd_a11y_keyboard_manager_stop): also remove GConf watch directory + +2008-04-10 Jens Granseuer + + Make housekeeping plugin deactivation work + + * plugins/housekeeping/gsd-housekeeping-manager.c: + (register_config_callback), (gsd_housekeeping_manager_start), + (gsd_housekeeping_manager_stop), (gsd_housekeeping_manager_init): + clean up properly on stop + * plugins/housekeeping/gsd-housekeeping-plugin.c: + (impl_deactivate): stop manager on deactivation + +2008-04-10 Jens Granseuer + + Make a11y-keyboard plugin deactivation work + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (register_config_callback), (gsd_a11y_keyboard_manager_start), + (gsd_a11y_keyboard_manager_stop): properly clean up on _stop + * plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c: + (impl_deactivate): stop manager on deactivation + +2008-04-10 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (get_xkb_desc_rec), (set_server_from_gconf), + (ax_slowkeys_warning_dialog_post), + (ax_stickykeys_warning_dialog_post), (set_gconf_from_server), + (cb_xkb_event_filter), (gsd_a11y_keyboard_manager_init): more + cleanup + +2008-04-10 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: (grab_key_real): + remove excessive key grab logging + +2008-04-09 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-manager.c: (numlock_xkb_init), + (numlock_set_xkb_state), (numlock_gconf_state_key), + (numlock_xkb_callback), (numlock_install_xkb_callback), + (apply_settings), (gsd_keyboard_manager_start): split XKB + initialization and calbback installation which allows us to get rid of + some more special-casing and yet another static variable + +2008-04-09 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: (xkb_enabled), + (get_xkb_desc_rec), (gsd_a11y_keyboard_manager_start): don't install + any listeners or callbacks when XKB is not available + +2008-04-09 Michael J. Chudobiak + + * plugins/housekeeping/gsd-housekeeping-manager.c: + (gsd_housekeeping_manager_stop): + Purge thumbnail cache on shutdown if and only if the max size or + max age parameters have been set to zero (for paranoid people) + (bug #526999). + +2008-04-07 Jens Granseuer + + Currently, the percentage by which to lower or raise the volume when + hitting the multimedia keys is taken from GConf, with 6 being the + default. We don't have any settings dialogs to actually change it, + though. If the user now selects a mixer that supports fewer volume + levels than the GConf setting implies (100/6) it becomes impossible + to change the volume (without fiddling with the GConf setting). This + patch adds a "threshold" property to the AcmeVolume class that denotes + the minimum percentage required to actually affect the volume. The + plugin now uses the step size read from GConf or the mixer threshold, + depending on which one is bigger. (bug #441910) + + * plugins/media-keys/actions/acme-volume-alsa.c: + (acme_volume_alsa_get_threshold), (acme_volume_alsa_class_init): + * plugins/media-keys/actions/acme-volume-dummy.c: + (acme_volume_dummy_get_threshold), (acme_volume_dummy_class_init): + * plugins/media-keys/actions/acme-volume-gstreamer.c: + (acme_volume_gstreamer_get_threshold), + (acme_volume_gstreamer_class_init): + * plugins/media-keys/actions/acme-volume-oss.c: + (acme_volume_oss_get_threshold), (acme_volume_oss_class_init), + (acme_volume_oss_mixer_check): + * plugins/media-keys/actions/acme-volume.c: + (acme_volume_get_threshold): + * plugins/media-keys/actions/acme-volume.h: add get_threshold method + * plugins/media-keys/gsd-media-keys-manager.c: (do_sound_action): use + gconf value or threshold, depending on what's bigger + +2008-04-07 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: (do_sound_action): only + use the built-in default for volume_step if we get an error from GConf, + not just when the value is 0 which might be what the user wants (see + the discussion on the Thinkpad driver again) + +2008-04-07 Jens Granseuer + + Remove the Thinkpad driver again. See bug #524425 for some discussion. + + * configure.ac: + * plugins/media-keys/actions/Makefile.am: + * plugins/media-keys/actions/acme-volume-thinkpad.c: + * plugins/media-keys/actions/acme-volume-thinkpad.h: + * plugins/media-keys/actions/acme-volume.c: (acme_volume_new): remove + extra Thinkpad support + +2008-04-06 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-manager.c: + (gsd_keyboard_get_hostname_key), (numlock_set_xkb_state), + (numlock_gconf_state_key), (numlock_get_gconf_state), + (numlock_set_gconf_state), (numlock_xkb_callback), + (numlock_install_xkb_callback), (apply_settings), + (gsd_keyboard_manager_start), (gsd_keyboard_manager_init): + * plugins/keyboard/gsd-keyboard-xkb.c: (gsd_keyboard_xkb_init): + * plugins/keyboard/gsd-keyboard-xkb.h: continued attempt at making XKB + setup and error handling a bit less arcane and crufty + +2008-04-06 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-xkb.c: + * plugins/keyboard/gsd-keyboard-xkb.h: initialize inited_ok or + behaviour is undefined when xkb setup fails; don't export XklEngine + +2008-04-06 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: (do_action): make "Home" + keybinding work again + +2008-04-05 Jens Granseuer + + * configure.ac: + * plugins/media-keys/actions/Makefile.am: hook up the Thinkpad support + +2008-04-05 Jens Granseuer + + Patch by: Lorne Applebaum <4lorne@gmail.com> + + * plugins/media-keys/actions/acme-volume-thinkpad.c: + * plugins/media-keys/actions/acme-volume-thinkpad.h: + * plugins/media-keys/actions/acme-volume.c: (acme_volume_new): add a + special volume subclass for better support of IBM Thinkpad hardware + volume buttons (bug #524425) + +2008-04-05 Jens Granseuer + + Patch by: Lorne Applebaum <4lorne@gmail.com> + + * plugins/media-keys/actions/acme-volume-dummy.h: fix TYPE macro and + remove an unimplemented prototype + +2008-04-01 Jens Granseuer + + * plugins/keyboard/gsd-keyboard-manager.c: + (gsd_keyboard_manager_start): apply keyboard settings on startup, too + (bug #525440) + +2008-03-31 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: + (bindings_get_entry): fix various leaks and other memory management + issues + +2008-03-31 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: + (bindings_get_entry), (binding_register_keys): remove trailing newlines + from messages since g_warning already takes care of those + +2008-03-31 Jens Granseuer + + * plugins/keybindings/gsd-keybindings-manager.c: (do_grab): + * plugins/media-keys/gsd-media-keys-manager.c: (grab_key): don't try to + add grabs with invalid modifiers + +2008-03-30 Gerd Kohlberger + + * plugins/mouse/gsd-mouse-manager.c: + (set_mousetweaks_daemon): Set gconf keys back to false, + if mousetweaks isn't installed. Bug #525042. + +2008-03-30 Jens Granseuer + + * plugins/xsettings/gsd-xsettings-manager.c: add mapping for + Gtk/Modules xsetting using GConf path /desktop/gnome/gtk-modules + (bug #507386) + +2008-03-30 Jens Granseuer + + * plugins/housekeeping/gsd-housekeeping-manager.c: change data types to + match glib; avoid using time_t + +2008-03-30 Jens Granseuer + + * plugins/media-keys/actions/acme-volume-dummy.c: + (acme_volume_dummy_init), (acme_volume_dummy_class_init): change to use + G_DEFINE_TYPE instead of open-coding it + +2008-03-29 Jens Granseuer + + * configure.ac: fix profiling to be off by default + +2008-03-29 Jens Granseuer + + * gnome-settings-daemon/main.c: mark string for translation + +2008-03-29 Jens Granseuer + + * plugins/keybindings/eggaccelerators.c: + (egg_accelerator_parse_virtual): + * plugins/media-keys/eggaccelerators.c: + (egg_accelerator_parse_virtual): readd a chunk that got lost in the + last commit. *sigh*. Why do we have several differing copies of those + files? + +2008-03-29 Jens Granseuer + + * plugins/keybindings/eggaccelerators.c: + (egg_accelerator_parse_virtual), (egg_virtual_accelerator_name), + (egg_virtual_accelerator_label), + (egg_keymap_resolve_virtual_modifiers), + (egg_keymap_virtualize_modifiers), (reload_modmap), + (egg_keymap_get_modmap): + * plugins/keybindings/eggaccelerators.h: fix mismatched modifier + mapping between egg and GTK (so that e.g. works) and replace + some custom functionality with stock GTK + +2008-03-29 Jens Granseuer + + * plugins/media-keys/eggaccelerators.c: + (egg_accelerator_parse_virtual), (egg_virtual_accelerator_name), + (egg_virtual_accelerator_label), + (egg_keymap_resolve_virtual_modifiers), + (egg_keymap_virtualize_modifiers), (reload_modmap), + (egg_keymap_get_modmap): + * plugins/media-keys/eggaccelerators.h: fix mismatched modifier + mapping between egg and GTK (so that e.g. works) and replace + some custom functionality with stock GTK + +2008-03-29 Jens Granseuer + + * plugins/housekeeping/gsd-housekeeping-manager.c: + (get_gconf_int_with_default): rename to better reflect what it does, + and also use the default passed in if we don't get an int from GConf, + or we'll end up with a value of 0 which is certainly not what we want + + (purge_thumbnail_cache): update callers + +2008-03-28 Michael J. Chudobiak + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/housekeeping/Makefile.am: + * plugins/housekeeping/gsd-housekeeping-manager.c: + (thumb_data_free), (read_dir_for_purge), (purge_old_thumbnails), + (sort_file_mtime), (get_gconf_int_with_nonzero_default), + (purge_thumbnail_cache), (do_cleanup), (do_cleanup_once), + (do_cleanup_soon), (bindings_callback), (register_config_callback), + (gsd_housekeeping_manager_start), (gsd_housekeeping_manager_stop), + (gsd_housekeeping_manager_class_init), + (gsd_housekeeping_manager_init), (gsd_housekeeping_manager_new): + * plugins/housekeeping/gsd-housekeeping-manager.h: + * plugins/housekeeping/gsd-housekeeping-plugin.c: + (gsd_housekeeping_plugin_init), (gsd_housekeeping_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_housekeeping_plugin_class_init): + * plugins/housekeeping/gsd-housekeeping-plugin.h: + * plugins/housekeeping/housekeeping.gnome-settings-plugin.in: + Added a new "housekeeping" plugin to set limits on the size and + age of the thumbnail cache (bug #523159). + +2008-03-25 Jens Granseuer + + Patch by: Matthias Clasen + + * plugins/mouse/gsd-mouse-manager.c: (filter): don't eat key events; + other plugins might need them as well (bug #523676) + +2008-03-24 William Jon McCann + + * configure.ac: + Add some stuff to the configuration summary. + + * plugins/media-keys/gsd-media-keys-manager.c: + (gsd_media_keys_manager_start): + Add a few more profiling points. + +2008-03-24 William Jon McCann + + * gnome-settings-daemon/Makefile.am: + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (set_server_from_gconf), (gsd_a11y_keyboard_manager_start): + * plugins/background/Makefile.am: + * plugins/background/gsd-background-manager.c: (apply_prefs), + (gsd_background_manager_start): + * plugins/clipboard/gsd-clipboard-manager.c: + (gsd_clipboard_manager_start): + * plugins/dummy/gsd-dummy-manager.c: (gsd_dummy_manager_start): + * plugins/font/gsd-font-manager.c: (load_xcursor_theme), + (load_cursor), (gsd_font_manager_start): + * plugins/keybindings/gsd-keybindings-manager.c: + (gsd_keybindings_manager_start): + * plugins/keyboard/gsd-keyboard-manager.c: + (gsd_keyboard_manager_start): + * plugins/media-keys/Makefile.am: + * plugins/media-keys/gsd-media-keys-manager.c: (init_kbd), + (gsd_media_keys_manager_start): + * plugins/mouse/gsd-mouse-manager.c: (gsd_mouse_manager_start): + * plugins/screensaver/gsd-screensaver-manager.c: + (gsd_screensaver_manager_start): + * plugins/sound/gsd-sound-manager.c: (start_gnome_sound), + (reload_foreach_cb), (apply_settings), (gsd_sound_manager_start): + * plugins/typing-break/gsd-typing-break-manager.c: + (setup_typing_break), (gsd_typing_break_manager_start): + * plugins/xrandr/gsd-xrandr-manager.c: (apply_settings): + * plugins/xrdb/gsd-xrdb-manager.c: (apply_settings), + (gsd_xrdb_manager_start): + * plugins/xsettings/gsd-xsettings-manager.c: + (xft_settings_set_xsettings), (xft_settings_set_xresources), + (update_xft_settings), (gnome_xsettings_manager_start): + Add profiling points to plugins. + +2008-03-24 William Jon McCann + + * gnome-settings-daemon/gnome-settings-manager.c: + (compare_location), (_load_file), (_load_dir): + * gnome-settings-daemon/gnome-settings-plugin-info.c: (debug_info), + (gnome_settings_plugin_info_fill_from_file), + (gnome_settings_plugin_info_deactivate), (load_plugin_module), + (gnome_settings_plugin_info_activate), + (gnome_settings_plugin_info_is_active), + (gnome_settings_plugin_info_get_enabled), + (gnome_settings_plugin_info_is_available), + (gnome_settings_plugin_info_get_name), + (gnome_settings_plugin_info_get_description), + (gnome_settings_plugin_info_get_authors), + (gnome_settings_plugin_info_get_website), + (gnome_settings_plugin_info_get_copyright), + (gnome_settings_plugin_info_get_location), + (gnome_settings_plugin_info_get_priority), + (gnome_settings_plugin_info_set_priority): + Fix a refcounting bug. Add a few more checks. Fix up a leak. + Fixes #524183 + +2008-03-24 William Jon McCann + + * plugins/media-keys/gsd-media-keys-manager.c: + (acme_filter_events): + * plugins/sound/gsd-sound-manager.c: (start_gnome_sound): + Fix two compiler warnings. + +2008-03-24 William Jon McCann + + * gnome-settings-daemon/gnome-settings-manager.c: + (gnome_settings_manager_start): + * gnome-settings-daemon/gnome-settings-profile.c: + (_gnome_settings_profile_log): + * gnome-settings-daemon/gnome-settings-profile.h: + * gnome-settings-daemon/main.c: (main): + Add missing files. Add some more profiling points. + +2008-03-24 William Jon McCann + + * configure.ac: + * gnome-settings-daemon/Makefile.am: + * gnome-settings-daemon/gnome-settings-manager.c: (_load_file), + (_load_dir), (_load_all), (gnome_settings_manager_start): + * gnome-settings-daemon/gnome-settings-plugin-info.c: + (gnome_settings_plugin_info_fill_from_file), (load_plugin_module), + (_activate_plugin): + * gnome-settings-daemon/main.c: (bus_register), (main): + Add some profiling code. Must specify --enable-profiling to + configure. + + Can now be profiled like so: + strace -ttt -f -o /tmp/logfile.strace gnome-settings-daemon + python plot-timeline.py -o prettygraph.png /tmp/logfile.strace + + See: http://www.gnome.org/~federico/news-2006-03.html#09 + +2008-03-24 Jens Granseuer + + Patch by: Alexey Shabalin + + * plugins/sound/gsd-sound-manager.c: (apply_settings): now that + "starting esd" can mean either esd or PulseAudio, check the GConf + setting for starting the sound server even when esd is disabled + (bug #523743) + +2008-03-24 Jens Granseuer + + * plugins/dummy/Makefile.am: remove NULL definition so authors using + this as the base for their own plugins don't get strange ideas + +2008-03-20 William Jon McCann + + * plugins/media-keys/Makefile.am: + * plugins/media-keys/gsd-media-keys-manager.c: (grab_key_real), + (init_kbd), (acme_filter_events), (gsd_media_keys_manager_start): + * plugins/media-keys/test-media-keys.c: (main): + Add a tool to test media keys. + +2008-03-16 William Jon McCann + + * plugins/sound/gsd-sound-manager.c: (reset_esd_pid), + (start_gnome_sound), (wait_on_child), (stop_child), + (stop_gnome_sound), (apply_settings), (gsd_sound_manager_dispose): + Fix handling of child process. + +2008-03-14 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-window.c: + (remove_hide_timeout): reset opacity when removing the timeout so that + the fadeout is restarted when media keys are pressed while the popup is + already fading out (bug #522499) + +2008-03-13 Jens Granseuer + + * plugins/media-keys/actions/acme.glade: remove unused properties (and, + in particular, an unused translated string) + +2008-03-13 Jens Granseuer + + Patch by: Danny Baumann + + * plugins/media-keys/gsd-media-keys-window.c: + (gsd_media_keys_window_new): set window type hint on the volume popup + (bug #522232) + +2008-03-11 Jens Granseuer + + * plugins/typing-break/gsd-typing-break-manager.c: + (setup_typing_break): pass data to the timeout so shutting down the + typing monitor works instead of segfaulting (bug #521786) + (gsd_typing_break_manager_start): use g_timeout_add_seconds instead of + g_timeout_add + +2008-03-10 Rodrigo Moya + + * configure.ac: Post release version bump + +==== 2.22.0 ==== + +2008-03-10 Rodrigo Moya + + * NEWS: Update for release. + +2008-03-08 Jens Granseuer + + * data/Makefile.am: + * data/apps_gnome_settings_daemon_default_editor.schemas.in: + * data/gnome-settings-daemon.schemas.in: remove obsolete settings for + the removed default editor plugin + +2008-03-01 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (ax_response_callback): don't pass the GError argument if we're + not going to use it. Also remove some unnecessary casting + +2008-02-29 William Jon McCann + + * gnome-settings-daemon/main.c: + Disable debug by default again. + +2008-02-29 Jens Granseuer + + * configure.ac: + * plugins/mouse/Makefile.am: when building with XInput support, + actually link against libXi, or we'll fail to load the plugin due + to unresolved symbols (bug #519488) + +2008-02-29 William Jon McCann + + * configure.ac: Post release version bump + +==== 2.21.92 ==== + +2008-02-29 William Jon McCann + + * NEWS: Update for release. + +2008-02-29 William Jon McCann + + * configure.ac: Remove Werror. + +2008-02-29 Jens Granseuer + + * gnome-settings-daemon/gnome-settings-manager.c: + (register_manager), (gnome_settings_manager_start): minor clean-up + +2008-02-28 William Jon McCann + + * gnome-settings-daemon/gnome-settings-manager.c: + (gnome_settings_manager_error_quark), (_load_file), + (gnome_settings_manager_awake), (gnome_settings_manager_start), + (gnome_settings_manager_start_with_settings_prefix), + (_set_settings_prefix), (gnome_settings_manager_set_property), + (gnome_settings_manager_get_property), + (gnome_settings_manager_class_init), + (gnome_settings_manager_finalize), (gnome_settings_manager_new): + * gnome-settings-daemon/gnome-settings-manager.h: + * gnome-settings-daemon/gnome-settings-manager.xml: + * gnome-settings-daemon/main.c: (main): + When dbus activated only load the plugins when requested + instead of at startup. Add a new method to start and set + plugin settings prefix. This allows gdm to use dbus + activation. It also fixes cases where g-s-d is activated + and plugins are loaded unintentionally. + +2008-02-29 Wouter Bolsterlee + + * plugins/sound/gsd-sound-manager.c (apply_settings): + + Add braces to fix amgiguous else. Avoids compiler + warnings. + +2008-02-28 Bastien Nocera + + * plugins/sound/gsd-sound-manager.c (reset_esd_pid), + (start_gnome_sound), (stop_gnome_sound), (apply_settings), + (gsd_sound_manager_stop): Start the sound server ourselves, + as we need it to cache samples. If esd (or the PulseAudio + esd compat bits) isn't available, just print an error, and + don't try to cache the samples + + If you use PulseAudio instead of esound in your distribution, + build with --disable-esd passed to configure + + (Closes: #518075) + +2008-02-25 William Jon McCann + + * gnome-settings-daemon/main.c: (gsd_log_default_handler), (main): + Add --debug command line option. + Only print DEBUG level messages if --debug is used. + +2008-02-25 William Jon McCann + + * gnome-settings-daemon/gnome-settings-plugin-info.c: + (gnome_settings_plugin_info_fill_from_file): + Don't warn on missing priority since we don't recommend + that it be used. + +2008-02-22 William Jon McCann + + * data/gnome-settings-daemon.schemas.in: + Take a stab at defining the default load priorities. + Fixes #518155 + +2008-02-22 William Jon McCann + + * data/gnome-settings-daemon.schemas.in: + * gnome-settings-daemon/gnome-settings-manager.c: (_load_file): + * gnome-settings-daemon/gnome-settings-plugin-info.c: + (gnome_settings_plugin_info_set_priority): + * gnome-settings-daemon/gnome-settings-plugin-info.h: + Allow gconf to override priorities. Set sound plugin + priority to 1 (highest). + Fixes #515340 + +2008-02-22 William Jon McCann + + * gnome-settings-daemon/Makefile.am: + * gnome-settings-daemon/gnome-settings-manager.c: (_load_info), + (maybe_activate_plugin), (compare_location), (compare_priority), + (on_plugin_activated), (on_plugin_deactivated), (_load_file), + (_load_dir), (_load_all), (_unload_all), + (gnome_settings_manager_start), (gnome_settings_manager_stop), + (gnome_settings_manager_constructor), + (gnome_settings_manager_class_init), + (gnome_settings_manager_finalize): + * gnome-settings-daemon/gnome-settings-manager.h: + * gnome-settings-daemon/gnome-settings-manager.xml: + * gnome-settings-daemon/gnome-settings-plugin-info.c: + (gnome_settings_plugin_info_class_init), + (gnome_settings_plugin_info_set_enabled_key_name), + (_deactivate_plugin), (_activate_plugin): + * gnome-settings-daemon/gnome-settings-plugin-info.h: + * gnome-settings-daemon/gnome-settings-plugins-engine.c: + * gnome-settings-daemon/gnome-settings-plugins-engine.h: + Merge PluginsEngine functionality into Manager. Emit + signals when plugins are activated or deactivated. + Fixes #515341 + +2008-02-22 William Jon McCann + + * gnome-settings-daemon/Makefile.am: + * gnome-settings-daemon/gnome-settings-manager.c: + (gnome_settings_manager_start), (gnome_settings_manager_stop), + (gnome_settings_manager_constructor), + (gnome_settings_manager_finalize): + * gnome-settings-daemon/gnome-settings-plugin-info.c: + (gnome_settings_plugin_info_finalize), + (gnome_settings_plugin_info_class_init), + (gnome_settings_plugin_info_init), + (gnome_settings_plugin_info_fill_from_file), (plugin_enabled_cb), + (gnome_settings_plugin_info_set_enabled_key_name), + (gnome_settings_plugin_info_new_from_file), (_deactivate_plugin), + (gnome_settings_plugin_info_deactivate), (load_plugin_module), + (_activate_plugin), (gnome_settings_plugin_info_activate), + (gnome_settings_plugin_info_is_active), + (gnome_settings_plugin_info_get_enabled), + (gnome_settings_plugin_info_is_available), + (gnome_settings_plugin_info_get_name), + (gnome_settings_plugin_info_get_description), + (gnome_settings_plugin_info_get_authors), + (gnome_settings_plugin_info_get_website), + (gnome_settings_plugin_info_get_copyright), + (gnome_settings_plugin_info_get_location), + (gnome_settings_plugin_info_get_priority): + * gnome-settings-daemon/gnome-settings-plugin-info.h: + * gnome-settings-daemon/gnome-settings-plugins-engine.c: + (gnome_settings_plugins_engine_load), (maybe_activate_plugin), + (compare_location), (compare_priority), + (gnome_settings_plugins_engine_load_file), + (gnome_settings_plugins_engine_load_dir), + (gnome_settings_plugins_engine_load_all), + (gnome_settings_plugins_engine_unload_all), + (gnome_settings_plugins_engine_start), + (gnome_settings_plugins_engine_garbage_collect), + (gnome_settings_plugins_engine_stop), + (gnome_settings_plugins_engine_get_plugins_list), + (_set_gconf_prefix), (gnome_settings_plugins_engine_set_property), + (gnome_settings_plugins_engine_get_property), + (gnome_settings_plugins_engine_class_init), + (gnome_settings_plugins_engine_init), + (gnome_settings_plugins_engine_finalize), + (gnome_settings_plugins_engine_new): + * gnome-settings-daemon/gnome-settings-plugins-engine.h: + Refactor the PluginInfo structure into a class. This + will facilitate fixing bug #515341 + +2008-02-22 Bastien Nocera + + * configure.ac: Only enable ALSA and OSS support if we don't + have GStreamer support, as the media-keys code doesn't + have any fallbacks if GStreamer fails to load (see acme-volume.c's + _new ()) + +2008-02-19 Vincent Untz + + * plugins/keyboard/gsd-keyboard-manager.c: + (gsd_keyboard_get_hostname_key): escape the hostname before using it in + a gconf path since it might contain invalid characters. + Fix bug #517259. + +2008-02-19 Jens Granseuer + + * configure.ac: remove some unused stuff + * plugins/sound/Makefile.am: add missing ESD_CFLAGS/LIBS + +2008-02-19 Jens Granseuer + + * configure.ac: + * plugins/xrandr/Makefile.am: + * plugins/xrandr/gsd-xrandr-manager.c: + (gsd_xrandr_manager_class_init), (gsd_xrandr_manager_init), + (gsd_xrandr_manager_finalize): build with XRandR if available, makes + setting screen geometry at login time work again (bug #517418) + +2008-02-16 Jens Granseuer + + * gnome-settings-daemon/main.c: mark string as translatable + +2008-02-14 Jens Granseuer + + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_start): at startup, don't apply background + prefs twice and don't check for nautilus running since we're usually + started first + +2008-02-12 Kjartan Maraas + + * configure.ac: Fix for 515956. Build with Gio. + +==== 2.21.91 ==== + +2008-02-11 Rodrigo Moya + + * configure.ac: + * NEWS: prepare for 2.21.91. + +2008-02-11 Rodrigo Moya + + Fixes bug #513990 + + * plugins/background/gsd-background-manager.c: use GIO instead of + gnome-vfs. + + * plugins/configure.ac: + * plugins/Makefile.am: + * plugins/default-editor/*: removed useless default editor plugin. + +2008-02-11 Rodrigo Moya + + Patch by Wouter Bolsterlee + + * gnome-settings-daemon/gnome-settings-plugins-engine.c + (gnome_settings_plugins_engine_load_all): assign return value from + g_slist_sort to the plugins list variable. (bug #515340) + +2008-02-10 Jens Granseuer + + * gnome-settings-daemon/main.c: update the default GConf prefix to + match the changes from r112 or bug #514411 + +2008-02-09 Jens Granseuer + + Support for defining plugin start order got lost in the split from + gnome-control-center, but it is essential for some plugins to work + correctly. With this change the "Priority" keyword can be used in the + ".gnome-settings-plugin" file to set plugin priorities. Priority can + take values from 1 upwards, with 1 being maximum priority and 100 + being the default if nothing is specified by the plugin. For multiple + plugins with identical priority start order is undefined. (bug #515340) + + * gnome-settings-daemon/gnome-settings-plugins-engine.c: + (gnome_settings_plugins_engine_load), (activate_plugin), + (compare_location), (compare_priority), + (gnome_settings_plugins_engine_load_file), + (gnome_settings_plugins_engine_load_all), + (gnome_settings_plugins_engine_init), + (gnome_settings_plugins_engine_shutdown), + (gnome_settings_plugins_engine_get_plugins_list), + (gnome_settings_plugins_engine_get_plugin_copyright), + (gnome_settings_plugins_engine_get_plugin_priority): + * gnome-settings-daemon/gnome-settings-plugins-engine.h: add back + support for defining plugin start order + +2008-02-09 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-manager.c: + (gsd_media_keys_manager_stop): declare variables at the beginning of + a block to make older compilers happy + +2008-02-09 Jens Granseuer + + * plugins/clipboard/gsd-clipboard-manager.c: + (gsd_clipboard_error_quark): fix copy'n'paste error (bug #515426) + +2008-02-08 Sebastien Bacher + + * configure.ac: check for xinput (bug #514942) + +2008-02-08 Jens Granseuer + + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_start), (gsd_background_manager_stop): + * plugins/keybindings/gsd-keybindings-manager.c: + (gsd_keybindings_manager_start): + * plugins/media-keys/gsd-media-keys-manager.c: + (gsd_media_keys_manager_stop): fix leaks + + * plugins/default-editor/gsd-default-editor-manager.c: + (gsd_default_editor_manager_start): fix leak and pass the correct data + to the mime type callback + + * plugins/xsettings/gsd-xsettings-manager.c: + (gnome_xsettings_manager_start): unref the GConfClient only after + we're done with it + +2008-02-08 Jens Granseuer + + * plugins/clipboard/gsd-clipboard-manager.c: + (gsd_kbd_a11y_error_quark), (gsd_clipboard_manager_start): make sure + we return a GError if initialization fails + +2008-02-08 Matthias Clasen + + * plugins/keyboard/gsd-keyboard-manager.c + (gsd_keyboard_manager_start): Load the XKB settings initially. + Fixes bug #511771. + +2008-02-07 Jens Granseuer + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + (gsd_kbd_a11y_error_quark), (gsd_a11y_keyboard_manager_start): make + sure we return a GError if initialization fails (bug #514926) + +2008-02-06 Jens Granseuer + + * plugins/media-keys/gsd-media-keys-window.c: + (volume_controls_set_visible), (window_set_icon_name), + (window_set_icon_file), (volume_level_changed), + (gsd_media_keys_window_class_init), (gsd_media_keys_window_init): + release the glade XML file as soon as possible and keep track of the + two widgets we need. This way we can also get rid of the custom + finalize method + +2008-02-06 Jens Granseuer + + * data/gnome-settings-daemon.schemas.in: use gnome_settings_daemon for + the GConf path. This is what the other g-s-d settings use as well, and + there is no good reason to use two separate paths (bug #514411) + +2008-02-06 Jens Granseuer + + * configure.ac: add separate checks for libbackground + * plugins/background/libbackground/*: delete files and use the external + copy from gnome-control-center to avoid duplication + +2008-02-05 Jens Granseuer + + Based on a patch by: Damien Carberry + + * configure.ac: + * data/gnome-settings-daemon-uninstalled.pc.in: add uninstalled.pc + file for building against an uninstalled copy of g-s-d (bug #511820) + +2008-02-05 Jens Granseuer + + Based on a patch by: Damien Carberry + + * Makefile.am: + * autogen.sh: + * configure.ac: + * plugins/a11y-keyboard/Makefile.am: + * plugins/background/Makefile.am: + * plugins/clipboard/Makefile.am: + * plugins/default-editor/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/font/Makefile.am: + * plugins/keybindings/Makefile.am: + * plugins/keyboard/Makefile.am: + * plugins/media-keys/Makefile.am: + * plugins/media-keys/actions/Makefile.am: + * plugins/mouse/Makefile.am: + * plugins/screensaver/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/typing-break/Makefile.am: + * plugins/xrandr/Makefile.am: + * plugins/xrdb/Makefile.am: + * plugins/xsettings/Makefile.am: + * src: rename the src folder to gnome-settings-daemon. This is needed + so we can supply an uninstalled.pc file for g-s-d (see discussion in + bug #511820) + +2008-02-04 Jens Granseuer + + * plugins/screensaver/gsd-screensaver-manager.c: + (gsd_screensaver_manager_start): don't crash when running the + screensaver fails. The plugin relies on the GError it passes always + being filled in if we couldn't start the module, so set it up properly + in those cases (bug #514385) + +2008-02-04 Luca Ferretti + + reviewed by: Jens Granseuer + + * data/apps_gnome_settings_daemon_default_editor.schemas.in: + * data/apps_gnome_settings_daemon_keybindings.schemas.in: + * data/apps_gnome_settings_daemon_screensaver.schemas.in: + * data/desktop_gnome_font_rendering.schemas.in: + * data/gnome-settings-daemon.schemas.in: + + Review short and long descriptions for GConf keys, bug #514047. + +2008-02-02 Jens Granseuer + + * src/Makefile.am: remove duplicate CFLAGS (and NULL) + +2008-02-01 Christian Persch + + * configure.ac: Install the settings plugin to + $(libdir)/gnome-settings-daemon-2.0. Fixes install with libdir == + libexecdir, bug #504203. + +2008-02-01 Christian Persch + + Bug #513246. + + * acinclude.m4: + * configure.ac: + * plugins/a11y-keyboard/Makefile.am: + * plugins/background/Makefile.am: + * plugins/clipboard/Makefile.am: + * plugins/default-editor/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/font/Makefile.am: + * plugins/keybindings/Makefile.am: + * plugins/keyboard/Makefile.am: + * plugins/media-keys/Makefile.am: + * plugins/media-keys/actions/Makefile.am: + * plugins/mouse/Makefile.am: + * plugins/screensaver/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/typing-break/Makefile.am: + * plugins/xrandr/Makefile.am: + * plugins/xrdb/Makefile.am: + * plugins/xsettings/Makefile.am: Use a flat directory instead of a + directory hierarchy to install the plugins into. + Install data files under $(pkgdatadir), not under $(libdir). + + * src/Makefile.am: + * src/gnome-settings-plugins-engine.c: + (gnome_settings_plugin_info_free), + (gnome_settings_plugins_engine_load), + (gnome_settings_plugins_engine_load_file), + (gnome_settings_plugins_engine_load_dir): Don't scan the plugins + directory recursively. Use GSlice for the plugin info struct. + +==== 2.21.90.2 ==== + +2008-01-30 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.21.90.2. + +2008-01-30 Gabor Kelemen + + * data/apps_gnome_settings_daemon_keybindings.schemas.in: Change + E-mail schema's descriptions to be more verbose and sensible. Fix #512766. + +2008-01-30 Christian Persch + + * configure.ac: + * plugins/a11y-keyboard/Makefile.am: + * plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.desktop + .in: + * plugins/background/Makefile.am: + * plugins/background/background.gnome-settings-plugin.desktop.in: + * plugins/clipboard/Makefile.am: + * plugins/clipboard/clipboard.gnome-settings-plugin.desktop.in: + * plugins/default-editor/Makefile.am: + * plugins/default-editor/default-editor.gnome-settings-plugin.deskt + op.in: + * plugins/dummy/Makefile.am: + * plugins/dummy/dummy.gnome-settings-plugin.desktop.in: + * plugins/font/Makefile.am: + * plugins/font/font.gnome-settings-plugin.desktop.in: + * plugins/keybindings/Makefile.am: + * plugins/keybindings/keybindings.gnome-settings-plugin.desktop.in: + * plugins/keyboard/Makefile.am: + * plugins/keyboard/keyboard.gnome-settings-plugin.desktop.in: + * plugins/media-keys/Makefile.am: + * plugins/media-keys/media-keys.gnome-settings-plugin.desktop.in: + * plugins/mouse/Makefile.am: + * plugins/mouse/mouse.gnome-settings-plugin.desktop.in: + * plugins/screensaver/Makefile.am: + * plugins/screensaver/screensaver.gnome-settings-plugin.desktop.in: + * plugins/sound/Makefile.am: + * plugins/sound/libsounds/Makefile.am: + * plugins/sound/sound.gnome-settings-plugin.desktop.in: + * plugins/typing-break/Makefile.am: + * plugins/typing-break/typing-break.gnome-settings-plugin.desktop.in: + * plugins/xrandr/Makefile.am: + * plugins/xrandr/xrandr.gnome-settings-plugin.desktop.in: + * plugins/xrdb/Makefile.am: + * plugins/xrdb/xrdb.gnome-settings-plugin.desktop.in: + * plugins/xsettings/Makefile.am: + * plugins/xsettings/xsettings.gnome-settings-plugin.desktop.in: + * po/POTFILES.in: No need to use weird naming of + .gnome-settings-daemon.in files. Bug #512048. + +2008-01-29 Rodrigo Moya + + * data/org.gnome.SettingsDaemon.service.in: use correct binary + path. + +==== 2.21.90.1 ==== + +2008-01-29 Rodrigo Moya + + * NEWS: + * configure.ac: prepare for 2.21.90.1. + +2008-01-29 Rodrigo Moya + + * src/Makefile.am: use plain $libexecdir for g-s-d binary. + +==== 2.21.90 ==== + +2008-01-28 Rodrigo Moya + + * configure.ac: + * NEWS: prepare for 2.21.90. + +2008-01-28 Wouter Bolsterlee + + * data/Makefile.am: + + Suppress verbose GConf schema installation output. + +2008-01-28 Wouter Bolsterlee + + * src/Makefile.am: + + Don't use weird autofu stuff to install + gnome-settings-daemon into another directory, but define + gsddir and gsd_PROGRAMS instead. Fixes bug #504203. + +2008-01-28 Wouter Bolsterlee + + * data/org.gnome.SettingsDaemon.service.in: + * src/Makefile.am: + + Hopefully allow $(libdir) to be the same directory as + $(libexecdir) by installing the gnome-settings-daemon + binary into a subdirectory of $(libexecdir), i.e. + $(libexecdir)/gnome-settings-daemon/gnome-settings-daemon. + Fixes bug #504203. + +2008-01-28 Wouter Bolsterlee + + * src/main.c: (main): + + Don't leak the GnomeProgram instance. + +2008-01-28 Wouter Bolsterlee + + * configure.ac: + * src/main.c: (main): + + Initialize GnomeProgram to avoid critical warnings from + libgnome. Fixes bug #509770. + +2008-01-26 Jens Granseuer + + * data/gnome-settings-daemon.pc.in: DBus API has been frozen for a + while now. No longer define DBUS_API_SUBJECT_TO_CHANGE + +2008-01-25 Soren Sandmann + + * plugins/background/gsd-background-manager.c + (GNOME_DESKTOP_USE_UNSTABLE_API): Define this macro before + including gnome-bg.h + +2008-01-25 Jens Granseuer + + * plugins/xsettings/gsd-xsettings-manager.c: + (xft_settings_set_xresources): don't try to reference a non-existing + variable (left-over cruft from the patch for bug #505470) + +2008-01-25 Jens Granseuer + + * data/gnome-settings-daemon.schemas.in: fix typo in typing break key. + Bug #510429. + +2008-01-25 Jens Granseuer + + Patch by: + + * configure.ac: readd check for XFT2 that got lost in the g-s-d split. + Bug #510925. + +2008-01-25 Christian Persch + + * plugins/xsettings/gsd-xsettings-manager.c: + (xft_settings_set_xresources): Use g_ascii_dtostr instead of + setlocale. Bug #505470. + +2008-01-25 Christian Persch + + * plugins/media-keys/Makefile.am: Fix build with builddir != srcdir. + BUg #509142. + +2008-01-24 Jens Granseuer + + * configure.ac: quote function names in AC_DEFUN to fix "underquoted + definition" autoconf warning + +2008-01-23 Kjartan Maraas + + * plugins/mouse/gsd-locate-pointer.c: (timeline_frame_cb), + (timeline_finished_cb): Fix a couple typos that broke the build. + +2008-01-22 Carlos Garnacho + + * plugins/mouse/gsd-locate-pointer.c: Reworked, add a more appealing + animation if there's a composite manager present, also use a similar + animation for the non-composite case, so most of the code is shared. + * plugins/mouse/gsd-timeline.[ch]: New files, object to control the + "locate pointer" animation. + * plugins/mouse/Makefile.am: Added these files to build. + +==== 2.21.5.2 ==== + +2008-01-15 Rodrigo Moya + + * configure.ac: + * NEWS: prepare for 2.21.5.2. + +2008-01-15 Rodrigo Moya + + * plugins/sound/Makefile.am: + * plugins/sound/libsounds/Makefile.am: use a libtool library for + x86_64 warnings. + + * configure.ac: automake fixes for allowing long file names in tar.gz. + +==== 2.21.5.1 ==== + +2008-01-15 Rodrigo Moya + + * configure.ac: + * NEWS: prepare for 2.21.5.1. + +==== 2.21.5 ==== + +2008-01-15 Rodrigo Moya + + * NEWS: prepare for 2.21.5. + +2008-01-14 Rodrigo Moya + + * data/gnome-settings-daemon.pc.in: reverted last patch. + +2008-01-14 Rodrigo Moya + + * data/gnome-settings-daemon.pc.in: added dbusapidir variable, for + the gnome-control-center module to access the .xml DBus interfaces file. + +2008-01-14 Denis Washington + + * plugins/xrandr/Makefile.in: This was probably commited by + accident, remove it. + +2008-01-14 Denis Washington + + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c: + Only consider /desktop/gnome/accessibility/keyboard/enable + as option for enabling keyboard a11y features from the keyboard, + not as global switch to turn all a11y features on/off. + +2008-01-14 Denis Washington + + Patch from Gerd Kohlberger (bug #503547) + + * plugins/mouse/gsd-mouse-manager.c: + Mousetweaks support. + +2008-01-14 Rodrigo Moya + + * plugins/media-keys/gsd-media-keys-manager.c: reverted patch from bug + #165343. + +2007-12-24 Christian Persch + + * plugins/xsettings/gsd-xsettings-manager.c: Add Gtk/IMModule XSetting. + Bug #504182, patch by Akira TAGOH. + +2007-12-22 William Jon McCann + + * plugins/xsettings/gsd-xsettings-manager.c: + use new setting from libgnome to make toolbar + icon size setting work (bug #401030) + Merge from gnome-control-center. + +2007-12-22 William Jon McCann + + * plugins/xsettings/Makefile.am: + * plugins/xsettings/gnome-xsettings-manager.c: + * plugins/xsettings/gnome-xsettings-manager.h: + * plugins/xsettings/gnome-xsettings-plugin.c: + * plugins/xsettings/gnome-xsettings-plugin.h: + * plugins/xsettings/gsd-xsettings-manager.c: + * plugins/xsettings/gsd-xsettings-plugin.c: + Rename files to be consistent with other plugins. + +2007-12-21 William Jon McCann + + * plugins/background/Makefile.am: + * plugins/background/background.gnome-settings-plugin.desktop.in: + * plugins/background/gsd-background-manager.c: + (gsd_background_manager_init): + * plugins/background/test-background.c: (idle), (main): + Init gnome-vfs and use the correct name in the desktop file. + +2007-12-21 William Jon McCann + + * configure.ac: + * plugins/background/gsd-background-manager.c: + (nautilus_is_running), (apply_prefs), (queue_apply), + (background_callback), (on_bg_changed), + (gsd_background_manager_start): + Merge g-c-c patch for animated backgrounds. + Require gnome-desktop 2.21.4. + Patch from: Soeren Sandmann + +2007-12-18 William Jon McCann + + * configure.ac: Post release version bump + +==== 2.21.4 ==== + +2007-12-18 William Jon McCann + + * NEWS: Update for release. + +2007-12-18 William Jon McCann + + * configure.ac: Update version number. + +2007-12-18 William Jon McCann + + * src/gnome-settings-manager.c: (gnome_settings_manager_awake): + * src/main.c: + Turn off daemonizing for now since it confused D-Bus service + activation. + +2007-12-18 William Jon McCann + + * src/Makefile.am: + * src/gnome-settings-manager.c: (gnome_settings_manager_awake), + (register_manager), (gnome_settings_manager_class_init), + (gnome_settings_manager_new): + * src/gnome-settings-manager.h: + * src/gnome-settings-manager.xml: + Provide the awake method and install the dbus api header. + +2007-12-17 William Jon McCann + + * plugins/background/Makefile.am: + * plugins/sound/Makefile.am: + Fix distcheck. + +2007-12-17 William Jon McCann + + * plugins/Makefile.am: + * plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.desktop + .in: + * plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h: + * plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c: + (gsd_a11y_keyboard_plugin_init), + (gsd_a11y_keyboard_plugin_finalize), (impl_activate), + (impl_deactivate), (gsd_a11y_keyboard_plugin_class_init): + * plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h: + Add a11y keyboard plugin. + +2007-12-17 William Jon McCann + + * configure.ac: + * plugins/Makefile.am: + * plugins/typing-break/Makefile.am: + * plugins/typing-break/gsd-typing-break-manager.c: + (register_config_callback), (typing_break_timeout), (child_watch), + (setup_typing_break), (typing_break_callback), + (really_setup_typing_break), (gsd_typing_break_manager_start), + (gsd_typing_break_manager_stop), + (gsd_typing_break_manager_set_property), + (gsd_typing_break_manager_get_property), + (gsd_typing_break_manager_constructor), + (gsd_typing_break_manager_dispose), + (gsd_typing_break_manager_class_init), + (gsd_typing_break_manager_init), + (gsd_typing_break_manager_finalize), + (gsd_typing_break_manager_new): + * plugins/typing-break/gsd-typing-break-manager.h: + * plugins/typing-break/gsd-typing-break-plugin.c: + (gsd_typing_break_plugin_init), (gsd_typing_break_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_typing_break_plugin_class_init): + * plugins/typing-break/gsd-typing-break-plugin.h: + * plugins/typing-break/typing-break.gnome-settings-plugin.desktop.in: + Add typing break plugin. + +2007-12-17 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/sound/gsd-sound-manager.c: (start_gnome_sound), + (stop_gnome_sound), (reload_foreach_cb), (apply_settings), + (register_config_callback), (sound_callback), + (gsd_sound_manager_start), (gsd_sound_manager_stop), + (gsd_sound_manager_set_property), (gsd_sound_manager_get_property), + (gsd_sound_manager_constructor), (gsd_sound_manager_dispose), + (gsd_sound_manager_class_init), (gsd_sound_manager_init), + (gsd_sound_manager_finalize), (gsd_sound_manager_new): + * plugins/sound/gsd-sound-manager.h: + * plugins/sound/gsd-sound-plugin.c: (gsd_sound_plugin_init), + (gsd_sound_plugin_finalize), (impl_activate), (impl_deactivate), + (gsd_sound_plugin_class_init): + * plugins/sound/gsd-sound-plugin.h: + * plugins/sound/sound.gnome-settings-plugin.desktop.in: + * plugins/xrandr/Makefile.in: + Add sound plugin + +2007-12-17 William Jon McCann + + * data/gnome-settings-daemon.schemas.in: + Add schemas for media keys. + +2007-12-17 William Jon McCann + + * configure.ac: + * plugins/Makefile.am: + * plugins/dummy/gsd-dummy-manager.c: + * plugins/media-keys/Makefile.am: + * plugins/media-keys/actions/Makefile.am: + * plugins/media-keys/actions/acme-volume-alsa.c: + (acme_volume_alsa_finalize), (acme_volume_alsa_set_mute), + (acme_volume_alsa_get_mute), (acme_volume_alsa_get_volume), + (acme_volume_alsa_set_volume), (acme_volume_alsa_close_real), + (acme_volume_alsa_open), (acme_volume_alsa_close), + (acme_volume_alsa_init), (acme_volume_alsa_class_init): + * plugins/media-keys/actions/acme-volume-alsa.h: + * plugins/media-keys/actions/acme-volume-dummy.c: + (acme_volume_dummy_finalize), (acme_volume_dummy_set_mute), + (acme_volume_dummy_get_mute), (acme_volume_dummy_get_volume), + (acme_volume_dummy_set_volume), (acme_volume_dummy_init), + (acme_volume_dummy_class_init), (acme_volume_dummy_get_type): + * plugins/media-keys/actions/acme-volume-dummy.h: + * plugins/media-keys/actions/acme-volume-gstreamer.c: + (acme_volume_gstreamer_finalize), (acme_volume_gstreamer_set_mute), + (update_state), (acme_volume_gstreamer_get_mute), + (acme_volume_gstreamer_get_volume), + (acme_volume_gstreamer_set_volume), + (acme_volume_gstreamer_close_real), (_acme_set_mixer), + (acme_volume_gstreamer_open), (acme_volume_gstreamer_close), + (acme_volume_gstreamer_init), (acme_volume_gstreamer_class_init): + * plugins/media-keys/actions/acme-volume-gstreamer.h: + * plugins/media-keys/actions/acme-volume-oss.c: + (acme_volume_oss_finalize), (acme_volume_oss_vol_check), + (acme_volume_oss_set_mute), (acme_volume_oss_get_mute), + (acme_volume_oss_get_volume), (acme_volume_oss_set_volume), + (acme_volume_oss_init), (acme_volume_oss_class_init), + (acme_volume_oss_mixer_check): + * plugins/media-keys/actions/acme-volume-oss.h: + * plugins/media-keys/actions/acme-volume.c: + (acme_volume_class_init), (acme_volume_init), + (acme_volume_get_volume), (acme_volume_set_volume), + (acme_volume_get_mute), (acme_volume_set_mute), + (acme_volume_mute_toggle), (acme_volume_new): + * plugins/media-keys/actions/acme-volume.h: + * plugins/media-keys/actions/acme.glade: + * plugins/media-keys/actions/acme.h: + * plugins/media-keys/eggaccelerators.c: (is_alt), (is_ctl), + (is_modx), (is_ctrl), (is_shft), (is_shift), (is_control), + (is_release), (is_meta), (is_super), (is_hyper), (is_keycode), + (egg_accelerator_parse_virtual), (egg_virtual_accelerator_name), + (egg_keymap_resolve_virtual_modifiers), + (egg_keymap_virtualize_modifiers), (reload_modmap), + (egg_keymap_get_modmap): + * plugins/media-keys/eggaccelerators.h: + * plugins/media-keys/gsd-marshal.list: + * plugins/media-keys/gsd-media-keys-manager.c: (init_screens), + (acme_error), (get_term_command), (execute), (do_sleep_action), + (dialog_init), (grab_key_real), (grab_key), (is_valid_shortcut), + (update_kbd_cb), (init_kbd), (dialog_show), (do_unknown_action), + (do_help_action), (do_mail_action), (do_media_action), + (do_www_action), (do_exit_action), (do_eject_action), + (do_sound_action), (find_by_application), (find_by_time), + (gsd_media_keys_manager_grab_media_player_keys), + (gsd_media_keys_manager_release_media_player_keys), + (gsd_media_player_key_pressed), (do_multimedia_player_action), + (do_action), (acme_get_screen_from_event), (acme_filter_events), + (gsd_media_keys_manager_start), (gsd_media_keys_manager_stop), + (gsd_media_keys_manager_set_property), + (gsd_media_keys_manager_get_property), + (gsd_media_keys_manager_constructor), + (gsd_media_keys_manager_dispose), + (gsd_media_keys_manager_class_init), (gsd_media_keys_manager_init), + (gsd_media_keys_manager_finalize), (register_manager), + (gsd_media_keys_manager_new): + * plugins/media-keys/gsd-media-keys-manager.h: + * plugins/media-keys/gsd-media-keys-manager.xml: + * plugins/media-keys/gsd-media-keys-plugin.c: + (gsd_media_keys_plugin_init), (gsd_media_keys_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_media_keys_plugin_class_init): + * plugins/media-keys/gsd-media-keys-plugin.h: + * plugins/media-keys/gsd-media-keys-window.c: (fade_timeout), + (hide_timeout), (remove_hide_timeout), (add_hide_timeout), + (update_window), (volume_controls_set_visible), + (window_set_icon_name), (window_set_icon_file), (action_changed), + (volume_level_changed), (volume_muted_changed), + (gsd_media_keys_window_set_action), + (gsd_media_keys_window_set_volume_muted), + (gsd_media_keys_window_set_volume_level), (curved_rectangle), + (load_pixbuf), (render_eject), (draw_eject), (draw_action_eject), + (draw_waves), (draw_speaker), (render_speaker), + (draw_volume_boxes), (draw_action_volume), (draw_action), + (on_expose_event), (gsd_media_keys_window_real_show), + (gsd_media_keys_window_real_hide), + (gsd_media_keys_window_class_init), + (gsd_media_keys_window_is_valid), (initialize_alpha_mode), + (gsd_media_keys_window_init), (gsd_media_keys_window_finalize), + (gsd_media_keys_window_new): + * plugins/media-keys/gsd-media-keys-window.h: + * plugins/media-keys/media-keys.gnome-settings-plugin.desktop.in: + * plugins/media-keys/test-media-window.c: (update_state), + (test_window), (main): + * plugins/xrandr/Makefile.in: + Add media keys plugin. + +2007-12-17 William Jon McCann + + * configure.ac: + * data/Makefile.am: + * data/apps_gnome_settings_daemon_default_editor.schemas.in: + * data/apps_gnome_settings_daemon_keybindings.schemas.in: + * data/apps_gnome_settings_daemon_screensaver.schemas.in: + * data/desktop_gnome_font_rendering.schemas.in: + * plugins/default-editor/Makefile.am: + * plugins/default-editor/gsd-default-editor-manager.c: + (gsd_default_editor_manager_init): + * plugins/keyboard/Makefile.am: + * plugins/keyboard/gsd-keyboard-manager.c: + * plugins/mouse/gsd-mouse-manager.c: + * plugins/screensaver/gsd-screensaver-manager.c: + (gsd_screensaver_manager_start): + * plugins/xrandr/Makefile.in: + * plugins/xrandr/gsd-xrandr-manager.c: + * plugins/xrdb/Makefile.am: + Add other schemas. Fix some zero length private data. + Fix some install dirs. Add libgnomekbd deps. + +2007-12-17 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/screensaver/Makefile.am: + * plugins/screensaver/gsd-screensaver-manager.c: (key_toggled_cb), + (gsd_screensaver_manager_start), (gsd_screensaver_manager_stop), + (gsd_screensaver_manager_set_property), + (gsd_screensaver_manager_get_property), + (gsd_screensaver_manager_constructor), + (gsd_screensaver_manager_dispose), + (gsd_screensaver_manager_class_init), + (gsd_screensaver_manager_init), (gsd_screensaver_manager_finalize), + (gsd_screensaver_manager_new): + * plugins/screensaver/gsd-screensaver-manager.h: + * plugins/screensaver/gsd-screensaver-plugin.c: + (gsd_screensaver_plugin_init), (gsd_screensaver_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_screensaver_plugin_class_init): + * plugins/screensaver/gsd-screensaver-plugin.h: + * plugins/screensaver/screensaver.gnome-settings-plugin.desktop.in: + Add screensaver plugin. + +2007-12-17 William Jon McCann + + * plugins/background/Makefile.am: + * plugins/clipboard/Makefile.am: + * plugins/default-editor/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/font/Makefile.am: + * plugins/keybindings/Makefile.am: + * plugins/mouse/Makefile.am: + * plugins/xrandr/Makefile.am: + * plugins/xrandr/Makefile.in: + * plugins/xrdb/Makefile.am: + * plugins/xsettings/Makefile.am: + Install in subdirectories + +2007-12-17 William Jon McCann + + * plugins/keyboard/Makefile.am: + * plugins/keyboard/modmap-dialog.glade: + Add missing glade file. + +2007-12-17 William Jon McCann + + * plugins/font/gsd-font-manager.c: + * src/gnome-settings-plugins-engine.c: + (gnome_settings_plugins_engine_load_file), + (gnome_settings_plugins_engine_activate_plugin), + (gnome_settings_plugins_engine_deactivate_plugin): + Fix an extraneous / in gconf path. Add a dummy var + to pad out private data. + +2007-12-16 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/background/Makefile.am: + * plugins/background/background.gnome-settings-plugin.desktop.in: + * plugins/background/gsd-background-manager.c: (applier_idle), + (background_callback), (gsd_background_manager_start), + (gsd_background_manager_stop), + (gsd_background_manager_set_property), + (gsd_background_manager_get_property), + (gsd_background_manager_constructor), + (gsd_background_manager_dispose), + (gsd_background_manager_class_init), (gsd_background_manager_init), + (gsd_background_manager_finalize), (gsd_background_manager_new): + * plugins/background/gsd-background-manager.h: + * plugins/background/gsd-background-plugin.c: + (gsd_background_plugin_init), (gsd_background_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_background_plugin_class_init): + * plugins/background/gsd-background-plugin.h: + Add background plugin. + +2007-12-16 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/default-editor/default-editor.gnome-settings-plugin.deskt + op.in: + * plugins/keybindings/Makefile.am: + * plugins/keybindings/eggaccelerators.c: (is_alt), (is_ctl), + (is_modx), (is_ctrl), (is_shft), (is_shift), (is_control), + (is_release), (is_meta), (is_super), (is_hyper), (is_keycode), + (egg_accelerator_parse_virtual), (egg_virtual_accelerator_name), + (egg_keymap_resolve_virtual_modifiers), + (egg_keymap_virtualize_modifiers), (reload_modmap), + (egg_keymap_get_modmap): + * plugins/keybindings/eggaccelerators.h: + * plugins/keybindings/gsd-keybindings-manager.c: + (get_screens_list), (entry_get_string), (parse_binding), + (compare_bindings), (bindings_get_entry), (key_already_used), + (grab_key), (do_grab), (binding_register_keys), + (screen_exec_display_string), (get_exec_environment), + (keybindings_filter), (bindings_callback), + (register_config_callback), (gsd_keybindings_manager_start), + (gsd_keybindings_manager_stop), + (gsd_keybindings_manager_set_property), + (gsd_keybindings_manager_get_property), + (gsd_keybindings_manager_constructor), + (gsd_keybindings_manager_dispose), + (gsd_keybindings_manager_class_init), + (gsd_keybindings_manager_init), (gsd_keybindings_manager_finalize), + (gsd_keybindings_manager_new): + * plugins/keybindings/gsd-keybindings-manager.h: + * plugins/keybindings/gsd-keybindings-plugin.c: + (gsd_keybindings_plugin_init), (gsd_keybindings_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_keybindings_plugin_class_init): + * plugins/keybindings/gsd-keybindings-plugin.h: + * plugins/keybindings/keybindings.gnome-settings-plugin.desktop.in: + * plugins/keyboard/keyboard.gnome-settings-plugin.desktop.in: + * plugins/mouse/mouse.gnome-settings-plugin.desktop.in: + Add keybindings plugin. + +2007-12-16 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/mouse/Makefile.am: + * plugins/mouse/gsd-locate-pointer.c: (locate_pointer_expose), + (setup_window), (create_window), (locate_pointer_timeout), + (gsd_locate_pointer): + * plugins/mouse/gsd-locate-pointer.h: + * plugins/mouse/gsd-mouse-manager.c: (gsd_mouse_manager_stop), + (gsd_mouse_manager_set_property), (gsd_mouse_manager_get_property), + (gsd_mouse_manager_constructor), (gsd_mouse_manager_dispose), + (gsd_mouse_manager_class_init), (supports_xinput_devices), + (configure_button_layout), (xinput_device_has_buttons), + (set_xinput_devices_left_handed), (set_left_handed), + (set_motion_acceleration), (set_motion_threshold), (filter), + (set_locate_pointer), (mouse_callback), (register_config_callback), + (gsd_mouse_manager_init), (gsd_mouse_manager_start), + (gsd_mouse_manager_finalize), (gsd_mouse_manager_new): + * plugins/mouse/gsd-mouse-manager.h: + * plugins/mouse/gsd-mouse-plugin.c: (gsd_mouse_plugin_init), + (gsd_mouse_plugin_finalize), (impl_activate), (impl_deactivate), + (gsd_mouse_plugin_class_init): + * plugins/mouse/gsd-mouse-plugin.h: + * plugins/mouse/mouse.gnome-settings-plugin.desktop.in: + Add mouse plugin. + +2007-12-16 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/keyboard/Makefile.am: + * plugins/keyboard/delayed-dialog.c: (gsd_delayed_show_dialog), + (delayed_show_timeout), (message_filter): + * plugins/keyboard/delayed-dialog.h: + * plugins/keyboard/gsd-keyboard-manager.c: + (xfree86_set_keyboard_autorepeat_rate), + (xkb_set_keyboard_autorepeat_rate), + (gsd_keyboard_get_hostname_key), (numlock_NumLock_modifier_mask), + (numlock_set_xkb_state), (numlock_gconf_state_key), + (numlock_get_gconf_state), (numlock_set_gconf_state), + (numlock_xkb_callback), (numlock_install_xkb_callback), + (apply_settings), (register_config_callback), + (gsd_keyboard_manager_start), (gsd_keyboard_manager_stop), + (gsd_keyboard_manager_set_property), + (gsd_keyboard_manager_get_property), + (gsd_keyboard_manager_constructor), (gsd_keyboard_manager_dispose), + (gsd_keyboard_manager_class_init), (gsd_keyboard_manager_init), + (gsd_keyboard_manager_finalize), (gsd_keyboard_manager_new): + * plugins/keyboard/gsd-keyboard-manager.h: + * plugins/keyboard/gsd-keyboard-plugin.c: + (gsd_keyboard_plugin_init), (gsd_keyboard_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_keyboard_plugin_class_init): + * plugins/keyboard/gsd-keyboard-plugin.h: + * plugins/keyboard/gsd-keyboard-xkb.c: (gsd_keyboard_log_appender), + (activation_error), (apply_settings), (apply_xkb_settings), + (gsd_keyboard_xkb_analyze_sysconfig), (gsd_chk_file_list), + (gsd_keyboard_xkb_chk_lcl_xmm), + (gsd_keyboard_xkb_set_post_activation_callback), + (gsd_keyboard_xkb_evt_filter), (register_config_callback), + (gsd_keyboard_xkb_init), (gsd_keyboard_xkb_load): + * plugins/keyboard/gsd-keyboard-xkb.h: + * plugins/keyboard/gsd-xmodmap.c: (check_button_callback), + (gsd_load_modmap_files), (response_callback), + (get_selected_files_func), (remove_string_from_list), + (remove_button_clicked_callback), (load_button_clicked_callback), + (gsd_modmap_dialog_call): + * plugins/keyboard/gsd-xmodmap.h: + * plugins/keyboard/keyboard.gnome-settings-plugin.desktop.in: + * plugins/xrandr/Makefile.in: + Add the keyboard plugin. + +2007-12-16 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/default-editor/Makefile.am: + * plugins/default-editor/default-editor.gnome-settings-plugin.deskt + op.in: + * plugins/default-editor/gsd-default-editor-manager.c: + (sync_changes_cb), (register_config_callback), (vfs_change_cb), + (gsd_default_editor_manager_start), + (gsd_default_editor_manager_stop), + (gsd_default_editor_manager_set_property), + (gsd_default_editor_manager_get_property), + (gsd_default_editor_manager_constructor), + (gsd_default_editor_manager_dispose), + (gsd_default_editor_manager_class_init), + (gsd_default_editor_manager_init), + (gsd_default_editor_manager_finalize), + (gsd_default_editor_manager_new): + * plugins/default-editor/gsd-default-editor-manager.h: + * plugins/default-editor/gsd-default-editor-plugin.c: + (gsd_default_editor_plugin_init), + (gsd_default_editor_plugin_finalize), (impl_activate), + (impl_deactivate), (gsd_default_editor_plugin_class_init): + * plugins/default-editor/gsd-default-editor-plugin.h: + * plugins/font/Makefile: + * plugins/font/Makefile.in: + Add default editor plugin + +2007-12-16 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/font/Makefile: + * plugins/font/Makefile.am: + * plugins/font/Makefile.in: + * plugins/font/delayed-dialog.c: + (gnome_settings_delayed_show_dialog), (delayed_show_timeout), + (message_filter): + * plugins/font/delayed-dialog.h: + * plugins/font/font.gnome-settings-plugin.desktop.in: + * plugins/font/gsd-font-manager.c: (write_all), (child_watch_cb), + (spawn_with_input), (load_xcursor_theme), (load_cursor), + (gsd_font_manager_start), (gsd_font_manager_stop), + (gsd_font_manager_set_property), (gsd_font_manager_get_property), + (gsd_font_manager_constructor), (gsd_font_manager_dispose), + (gsd_font_manager_class_init), (gsd_font_manager_init), + (gsd_font_manager_finalize), (gsd_font_manager_new): + * plugins/font/gsd-font-manager.h: + * plugins/font/gsd-font-plugin.c: (gsd_font_plugin_init), + (gsd_font_plugin_finalize), (impl_activate), (impl_deactivate), + (gsd_font_plugin_class_init): + * plugins/font/gsd-font-plugin.h: + Add font plugin + +2007-12-14 William Jon McCann + + * data/gnome-settings-daemon.schemas.in: + Add schemas for clipboard and xrandr. + +2007-12-14 William Jon McCann + + * configure.ac: + * plugins/Makefile.am: + * plugins/clipboard/Makefile.am: + * plugins/clipboard/clipboard.gnome-settings-plugin.desktop.in: + * plugins/clipboard/gsd-clipboard-manager.c: (target_data_ref), + (target_data_unref), (conversion_free), (send_selection_notify), + (finish_selection_request), (clipboard_bytes_per_item), + (save_targets), (find_content_target), (find_content_type), + (find_conversion_requestor), (get_property), + (receive_incrementally), (send_incrementally), + (convert_clipboard_manager), (convert_clipboard_target), + (collect_incremental), (convert_clipboard), + (clipboard_manager_process_event), + (clipboard_manager_event_filter), (clipboard_manager_watch_cb), + (gsd_clipboard_manager_start), (gsd_clipboard_manager_stop), + (gsd_clipboard_manager_set_property), + (gsd_clipboard_manager_get_property), + (gsd_clipboard_manager_constructor), + (gsd_clipboard_manager_dispose), + (gsd_clipboard_manager_class_init), (gsd_clipboard_manager_init), + (gsd_clipboard_manager_finalize), (gsd_clipboard_manager_new): + * plugins/clipboard/gsd-clipboard-manager.h: + * plugins/clipboard/gsd-clipboard-plugin.c: + (gsd_clipboard_plugin_init), (gsd_clipboard_plugin_finalize), + (impl_activate), (impl_deactivate), + (gsd_clipboard_plugin_class_init): + * plugins/clipboard/gsd-clipboard-plugin.h: + * plugins/clipboard/list.c: (list_foreach), (list_prepend), + (list_free), (list_find), (list_remove), (list_length), + (list_copy): + * plugins/clipboard/list.h: + * plugins/clipboard/xutils.c: (init_atoms), (timestamp_predicate), + (get_server_time): + * plugins/clipboard/xutils.h: + Port over the clipboard module. + +2007-12-14 William Jon McCann + + * configure.ac: + * plugins/xrdb/Makefile.am: + * plugins/xrdb/data/Editres.ad: + * plugins/xrdb/data/Emacs.ad: + * plugins/xrdb/data/General.ad: + * plugins/xrdb/data/Makefile.am: + * plugins/xrdb/data/Motif.ad: + * plugins/xrdb/data/Tk.ad: + * plugins/xrdb/data/Xaw.ad: + Add the .ad files. + +2007-12-14 William Jon McCann + + * configure.ac: + * plugins/Makefile.am: + * plugins/xrandr/Makefile.am: + * plugins/xrandr/Makefile.in: + * plugins/xrandr/gsd-xrandr-manager.c: (get_rotation), + (get_resolution), (get_rate), (find_closest_size), + (apply_settings), (gsd_xrandr_manager_start), + (gsd_xrandr_manager_stop), (gsd_xrandr_manager_set_property), + (gsd_xrandr_manager_get_property), + (gsd_xrandr_manager_constructor), (gsd_xrandr_manager_dispose), + (gsd_xrandr_manager_class_init), (gsd_xrandr_manager_init), + (gsd_xrandr_manager_finalize), (gsd_xrandr_manager_new): + * plugins/xrandr/gsd-xrandr-manager.h: + * plugins/xrandr/gsd-xrandr-plugin.c: (gsd_xrandr_plugin_init), + (gsd_xrandr_plugin_finalize), (impl_activate), (impl_deactivate), + (gsd_xrandr_plugin_class_init): + * plugins/xrandr/gsd-xrandr-plugin.h: + * plugins/xrandr/xrandr.gnome-settings-plugin.desktop.in: + Add xrandr plugin. + +2007-12-14 William Jon McCann + + * configure.ac: + * plugins/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/dummy/gsd-dummy-manager.c: (gsd_dummy_manager_start), + (gsd_dummy_manager_stop), (gsd_dummy_manager_set_property), + (gsd_dummy_manager_get_property), (gsd_dummy_manager_constructor), + (gsd_dummy_manager_dispose), (gsd_dummy_manager_class_init), + (gsd_dummy_manager_init), (gsd_dummy_manager_finalize), + (gsd_dummy_manager_new): + * plugins/dummy/gsd-dummy-manager.h: + * plugins/dummy/gsd-dummy-plugin.c: (impl_activate), + (impl_deactivate), (gsd_dummy_plugin_class_init): + * plugins/dummy/gsd-dummy-plugin.h: + Build the dummy. + +2007-12-14 William Jon McCann + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/dummy/Makefile.am: + * plugins/dummy/dummy.gnome-settings-plugin.desktop.in: + * plugins/dummy/gsd-dummy-manager.c: (gsd_xrdb_manager_start), + (gsd_xrdb_manager_stop), (gsd_xrdb_manager_set_property), + (gsd_xrdb_manager_get_property), (gsd_xrdb_manager_constructor), + (gsd_xrdb_manager_dispose), (gsd_xrdb_manager_class_init), + (gsd_xrdb_manager_init), (gsd_xrdb_manager_finalize), + (gsd_xrdb_manager_new): + * plugins/dummy/gsd-dummy-manager.h: + * plugins/dummy/gsd-dummy-plugin.c: (gsd_dummy_plugin_init), + (gsd_dummy_plugin_finalize), (impl_activate), (impl_deactivate), + (gsd_dummy_plugin_class_init): + * plugins/dummy/gsd-dummy-plugin.h: + * plugins/xrdb/Makefile.am: + * plugins/xrdb/gsd-xrdb-manager.c: (append_color_define), + (color_shade), (append_theme_colors), (scan_ad_directory), + (compare_basenames), (scan_for_files), (append_file), + (append_xresource_file), (write_all), (child_watch_cb), + (spawn_with_input), (apply_settings), (theme_changed), + (gsd_xrdb_manager_start), (gsd_xrdb_manager_stop), + (gsd_xrdb_manager_set_property), (gsd_xrdb_manager_get_property), + (gsd_xrdb_manager_constructor), (gsd_xrdb_manager_dispose), + (gsd_xrdb_manager_class_init), (gsd_xrdb_manager_init), + (gsd_xrdb_manager_finalize), (gsd_xrdb_manager_new): + * plugins/xrdb/gsd-xrdb-manager.h: + * plugins/xrdb/gsd-xrdb-plugin.c: (gsd_xrdb_plugin_init), + (gsd_xrdb_plugin_finalize), (impl_activate), (impl_deactivate), + (gsd_xrdb_plugin_class_init): + * plugins/xrdb/gsd-xrdb-plugin.h: + * plugins/xrdb/xrdb.gnome-settings-plugin.desktop.in: + * plugins/xsettings/gnome-xsettings-manager.h: + Port over the xrdb module. Also add a skeleton plugin dir. + +2007-12-14 William Jon McCann + + * MAINTAINERS: + * configure.ac: + * src/main.c: (get_bus_proxy), (acquire_name_on_proxy), + (get_session_bus), (bus_register), (main): + Grab a name on the session bus. + +2007-12-14 William Jon McCann + + * configure.ac, etc: Initial checkin. Previously + lived in gdm module. + diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..6e90e07d --- /dev/null +++ b/INSTALL @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 00000000..f5ebf47d --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,23 @@ +Rodrigo Moya +E-mail: rodrigo at gnome-db.org +Userid: rodrigo + +Sebastien Bacher +Email: seb128 at debian.org +Userid: sbacher + +Thomas Wood +Email: thos at gnome.org +Userid: thos + +Jens Granseuer +Email: jensgr at gmx.net +Userid: jensg + +William Jon McCann +Email: mccann at jhu.edu +Userid: mccann + +Bastien Nocera +Email: hadess at hadess dot net +Userid: hadess diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..6bb3d580 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,24 @@ +NULL = + +SUBDIRS = \ + gnome-settings-daemon \ + plugins \ + data \ + po \ + $(NULL) + +if ENABLE_MAN +SUBDIRS += man +endif + +# Honor aclocal flags +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} + +EXTRA_DIST = \ + MAINTAINERS \ + ChangeLog \ + README \ + $(NULL) + +DISTCLEANFILES = \ + $(NULL) diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..39e0bd58 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,895 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ENABLE_MAN_TRUE@am__append_1 = man +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING COPYING.LIB ChangeLog \ + INSTALL NEWS compile config.guess config.sub install-sh \ + ltmain.sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + cscope distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = gnome-settings-daemon plugins data po man +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.xz +DIST_TARGETS = dist-xz +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +SUBDIRS = gnome-settings-daemon plugins data po $(NULL) \ + $(am__append_1) + +# Honor aclocal flags +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} +EXTRA_DIST = \ + MAINTAINERS \ + ChangeLog \ + README \ + $(NULL) + +DISTCLEANFILES = \ + $(NULL) + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) + +clean-cscope: + -rm -f cscope.files + +cscope.files: clean-cscope cscopelist-recursive cscopelist + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(DISTFILES) + @case `sed 15q $(srcdir)/NEWS` in \ + *"$(VERSION)"*) : ;; \ + *) \ + echo "NEWS not updated; not releasing" 1>&2; \ + exit 1;; \ + esac + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod u+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-cscope \ + clean-generic clean-libtool cscope cscopelist \ + cscopelist-recursive ctags ctags-recursive dist dist-all \ + dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..2009600f --- /dev/null +++ b/NEWS @@ -0,0 +1,2803 @@ +============= +Version 3.6.4 +============= + +- Don't set IBus envvars if keyboard plugin is disabled +- Proxy the org.freedesktop.ScreenSaver D-Bus API to gnome-session as + needed + +Color: +- Fix choosing the correct profile for "legacy" applications +- Use a perceptual intent when creating the auto-EDID profile + +Keyboard: +- Trigger input source switching on key press for Caps Lock +- Don't migrate useless XKB IBus sources from old IBus user settings + +Media keys: +- Add default shortcuts for the magnifier +- Repeat screen and keyboard brightness keys + +Power: +- Fix showing an "About to hibernate" warning when the machine cannot + suspend +- Hide critical battery warning when power is plugged +- Avoid crasher if XRandR calls fail on startup + +Printers: +- Don't show notifications which are not actual errors for the user + +Wacom: +- Avoid infinite recursion in gsettings callback +- Stop capturing mouse buttons when deactivating + +XRandr: +- Fix "next rotation" not working + +============= +Version 3.6.3 +============= + +Mouse: +- Fix horizontal natural scrolling + +Keyboard: +- Add keyboard shortcuts including CapsLock to + switch input sources + +Power: +- Fix a warning on startup + +============= +Version 3.6.2 +============= + +- Make test applications work when libnotify was used + +Keyboard: +- Add default ibus engine for Indic locales +- Prevent 100% CPU usage related to remembering Num-Lock state +- Don't print warning messages when resuming from suspend + +Power: +- Fix screen dimming and power saving even when inhibited +- Don't suspend, dim or blank when running in virtual machines +- Fix warning output in the Brightness & Lock panel +- Fix possible crash when the backlight fails to be turned off for example + +Updates: +- Don't require the user to click OK to clear the message for successful + offline updates + +Sound: +- Fix alert sound changes requiring a log out/login to apply + +Wacom: +- Fix touchstrips and touchrings without a modeswitch + +XSettings: +- Make startup smoother by batching settings updates together + +============= +Version 3.6.1 +============= + +Keyboard: +- Allow grabbing the Menu key +- Apply XKB variants and options for each IBus engine +- Don't setup legacy toolkits if IBus is missing +- Add default setup for some particular languages +- Convert old libgnomekbd and IBus configurations +- Add support for more modifiers only combinations +- Fix input switching eating the modifiers keys in some cases + +Mouse: +- Fix "Locate Pointer" eating the Ctrl key +- Fix "Locate Pointer" animation showing when the Ctrl key has been used + +Updates: +- Never show the user a message about cancelled transactions + +Wacom: +- Fix LEDs switching for some tablet models + +Housekeeping: +- Fix possible crashers on exit + +Color: +- Fix possible crashers on exit + +============= +Version 3.6.0 +============= + +Keyboard: +- Create sources from the X layouts if the configuration is empty +- Always do that in GDM, so system-wide layouts work +- Add modifiers-only shortcuts to switch input sources + +============== +Version 3.5.92 +============== + +Keyboard: +- Don't block getting the IBus global engine +- Don't touch the XKB layout if no input sources were configured +- Fix gtk+ IM module getting set to IBus for XKB sources + +Media keys: +- Make "toggle brightness" work + +Color: +- Don't warn about non-existent DMI file + +Power: +- Fix some instances where an external screen would turn off + +Wacom: +- Require wacom 0.6 to fix bugs with some tablets + +============== +Version 3.5.91 +============== + +Mouse: +- Fix natural-scroll not working until switched off and on again + +Keyboard: +- Don't handle IBus for fallback, it will use the same UI it always did +- Hook IBus support for legacy applications + +Power: +- Do not attempt to change the brightness of an output that was disabled +- Fix idle blank and sleep timeout + +============== +Version 3.5.90 +============== + +Power: +- Fix D-Bus path of the screensaver + +Mouse: +- Add support for natural scroll for touchpads + +Keyboard: +- Apply XKB options + +Wacom: +- Implement the "switch monitor" combination + +And updated translations + +============= +Version 3.5.6 +============= + +Build: +- Add optional man page +- List plugin schemas as children of the main schema + +Updates: +- Remove unused code +- Avoid compilation warnings due to PackageKit API changes + +Mouse: +- If one device was ignored, we would ignore all the devices + +Smartcard: +- Don't try to use smartcard drivers that didn't load + +Keyboard: +- Require ibus 1.4.99 for ibus support + +Wacom: +- Avoid a warning at login + +============= +Version 3.5.5 +============= + +* Add test applications for a number of plugins + +Color: +- Fix notification-related memory leaks + +Keyboard: +- Add support for switching to IBus input methods + +Wacom: +- Fix crasher related to screen tablets +- Do not rotate "pad" devices +- Apply display rotation to device that's mapped to it +- Make shortcuts that require Shift work as expected +- Re-apply calibration and aspect-ratio when the screen changes + but don't apply it to touch devices + +Housekeeping: +- Fix notification-related memory leaks + +Updates: +- Remove unused settings +- Remove a number of unused notifications +- Don't ever live-update packages in the session +- Fix a number of memory leaks +- Prevent crash if a device that requires a firmware is removed before the + firmware search completes + +============= +Version 3.5.4 +============= + +Wacom: +- Fix crasher related to screen matching (Olivier Fourdan) + +Printers: +- Don't block the session with unreachable printers + +============= +Version 3.5.3 +============= + +Keyboard A11y: +- Don't crash when changing large print in fallback mode +- Link to an existing help page + +Housekeeping: +- Support new XDG thumbnail directory locations + +Keyboard: +- Don't crash if LANG is empty + +Media-keys: +- Make keyboard shortcuts work again +- Use systemd to shutdown or suspend if available + +Mouse: +- Only inhibits mouse clicks and scrolls with syndaemon + +Power: +- End the lid-close safety timer when the lid gets opened +- Update fallback status icon on icon state change +- Don't leak notifications +- Avoid duplicate translations +- Use systemd to shutdown or suspend if available +- Don't enable backlight helper if GUdev is not available + +Updates: +- Adapt to new upstream property name +- Add a notification for offline updates + +Wacom: +- Update display mapping on monitor changes +- Flag unknown devices created from fallback +- Add keep aspect ratio option +- Use GnomeRROutput instead of GnomeRROutputInfo +- Match built-in monitor + +XRandr: +- Explicitly set clone state variable when generating monitor configs + +============= +Version 3.5.2 +============= + +- Remove ability to D-Bus activate (Ray Strode) + +Media-keys: +- Get proper gnome-keyring environment (Bastien Nocera) +- Simplify the OSD code (Bastien) +- Add keybindings to switch input sources (Rui Matos) + +Mouse: +- Fix applying settings to newly added touchpads (Owen Taylor) +- Reduce default touchpad deactivation to 1s (Nicolas Dufresne) + +Housekeeping: +- Split out 'ingnore unix mount' code (Bastien) + +Keyboard: +- Always apply xmodmap (Sergey V. Udaltsov) +- Lots of cleanups (Bastien) +- Apply XKB layouts ourselfs and stop relying on libgnomekbd (Rui Matos) + +Power: +- Disconnect from upower signals when needed (Richard Hughes) +- Add org.gnome.settings-daemon.plugins.power.lid-close-suspend-with-extrnal-monitors + key to allow forcing suspend on lid close (Paolo Bonzini) + +Print: +- Fix setting of default media size (Marek Kasik) +- Don't create an unused proxy object (Matthias Clasen) +- Speed up initialization (Matthias) + +Updates: +- Automatically download updates rather than installing them (Richard) + +Wacom: +- Disable wacom support on s390 (Dan Horák) +- Disable wacom support on non-linux (Antoine Jacoutot) +- Don't put touchscreens in relative mode (Timo Aaltonen) +- Make tablet configuration per-machine (Bastien) + +Color: +- Be quiet about unloadable profiles (Richard) + +Translations: +- Catalan +- Crimean Tatar +- Dutch +- Galician +- German +- Hebrew +- Italian +- Kannada +- Norwegian bokmÃ¥l +- Slovenian +- Swedish + +============= +Version 3.4.0 +============= + +Wacom: +- Check if the "last-stylus" property has been set (Olivier Fourdan) + +Translations: +- Simplified Chinese (zh_CN) (YunQiang Su) +- Hindi (Chandan Kumar) +- Belarusian (Ihar Hrachyshka) +- Brazilian Portuguese (Jonh Wendell) +- French (Bruno Brouard) +- Hebrew (Yaron Shahrabani) +- Lithuanian (Žygimantas BeruÄka) +- Portuguese (Duarte Loreto) +- Telugu (Sasi Bhushan) +- Traditional Chinese (Chao-Hsiung Liao) +- Vietnamese (Nguyá»…n Thái Ngá»c Duy) +- Ukranian (Daniel Korostil) + +============== +Version 3.3.92 +============== + +Color: +- Apply the color profile even if the device has an invalid EDID (Richard Hughes) +- Create a color device even if the device has an invalid EDID (Richard Hughes) +- Don't use the username in the profile ID, it's optional and not-required (Richard Hughes) + +Common: +- Add hint on how to set the script path (Bastien Nocera) +- Fix library linkage on Mageia (Jani Välimaa) +- Support explicitly setting G_MESSAGES_DEBUG (Martin Pitt) + +Media Keys: +- Avoid hard-coded shortcuts not working (Bastien Nocera) +- Call Shutdown for the logout action (Bastien Nocera) + +Mouse: +- Stop syndaemon when settings-daemon dies (Martin Pitt) + +Power: +- Do not emit DBus interface change signals when doing the idle dim (Richard Hughes) +- Don't print a message when no backlights are detected (Richard Hughes) +- Failing to clear DPMS timeouts should not be fatal (Alexandre Rostovtsev) +- Fix broken abs_to_percentage() logic (Cosimo Cecchi) +- Lazily connect to gnome-screensaver (Martin Pitt) +- Lock the screensaver if the lid is closed and lock is enabled (Richard Hughes) +- Make the idle dim time 90 seconds to match OSX (Richard Hughes) + +Print Notifications: +- Add test tool (Lars Uebernickel) +- Don't unref floating GVariant (Marek Kasik) + +Wacom: +- Add README about configuration storage (Bastien Nocera) + +XRandR: +- Fix the rotate display button not working (Sjoerd Simons) +- List external display only before internal only (Bastien Nocera) + +XSettings: +- Add README.xsettings about overrides (Ryan Lortie) +- Add test-xsettings program (Ryan Lortie) +- Add xsettings_setting_get() accessor (Ryan Lortie) +- Add XSETTINGS_VARIANT_TYPE_COLOR macro (Ryan Lortie) +- Always call xsettings_setting_set() (Ryan Lortie) +- Don't return XSettingsResult codes (Ryan Lortie) +- Introduce 'tiers' of XSettings (Ryan Lortie) +- Load overrides on startup (Ryan Lortie) +- Remove global 'settings' list (Ryan Lortie) +- Switch manager to GLib memory functions (Ryan Lortie) +- Switch to GVariant for value storage (Ryan Lortie) +- Use GHashTable in the xsettings manager (Ryan Lortie) +- Wire overrides into GSettings (Ryan Lortie) + +Translations: +- Belarusian (Ihar Hrachyshka, Kasia Bondarava) +- British English (Bruce Cowan) +- Bulgarian (Alexander Shopov) +- Catalan (Joan Duran) +- Catalan (Valencian) (Carles Ferrando) +- Czech (Adam MatouÅ¡ek, Marek ÄŒernocký) +- Finnish (Timo Jyrinki) +- Galician (Fran Diéguez) +- Gujarati (Sweta Kothari) +- Hungarian (Gabor Kelemen) +- Korean (Changwoo Ryu) +- Latvian (Anita Reitere) +- Norwegian bokmÃ¥l (Kjartan Maraas) +- Russian (Yuri Myasoedov) +- Serbian (МироÑлав Ðиколић) +- Slovenian (Matej UrbanÄiÄ) +- Traditional Chinese (Cheng-Chia Tseng) +- Vietnamese (Nguyá»…n Thái Ngá»c Duy) +- Punjabi (A S Alam) +- Ukranian (Daniel Korostil) + +============== +Version 3.3.91 +============== + +Color: +- Fix warning with non-present devices +- Make displays without EDID data use the correct device ID +- Create the correct device ID for EDIDs with no text data +- Fix EDID checksum generation + +Power: +- Emit a Changed() signal when the backlight changes +- Don't overflow when pressing the keyboard brightness button + +Media-keys: +- Make Alt+Print appear as Alt+Print not Alt+SysRq + +Wacom: +- Add support for mode switch buttons, touchrings, touchstrips, + and light up the LEDs appropriately +- Add support for current tool ID from Wacom driver +- Fix possible crasher setting pressure curve or display area +- Force touchpads to use relative mode and ignore mode changes +- Fix double-event generation +- Fix installation problems with libexecdir == libdir +- Make monitor == -1 reset the display configuration + +================ +Version 3.3.90.1 +================ + +Build: +- Fix build with --enable-systemd + +============== +Version 3.3.90 +============== + +Build: +- Remove last requirement for dbus-glib +- Remove use of deprecated g_thread_init() +- Fix linking with -Bsymbolic + +Wacom: +- Add tablet button listing and settings +- Add display mapping + +Keyboard: +- Fix blinking num-lock in some circumstances + +Color: +- Set _ICC_PROFILE correctly when there is no primary device specified + +Power: +- Fix possible crasher in backlight helper on error + +============= +Version 3.3.5 +============= + +Build: +- Remove unused date & time mechanism. gnome-control-center + uses a different API, provided by systemd on some systems. + +A11y keyboard: +- Reduce the number of settings updates on startup + +Power: +- Require a newer upower +- Optionally use systemd to shutdown when power is low +- Use GDBusProxy-compatible PropertiesChanged signal +- Fix "
" appearing in notification popups + +Wacom: +- Add a way to get/set the screen associated with a tablet +- Don't crash when using a generic tablet +- Add support for the puck and touch device types +- Add support for enumerating tablet buttons + +Printers: +- Also notify for unknown error reasons +- Unify printer name usage + +Color: +- Set the brightness of the display if it was saved as + metadata in the color profile + +Media keys, XSettings, Updates: +- Fix possible crashes on exit + +Housekeeping, Wacom, XSettings: +- Fix memory leaks + +Media keys: +- Add screenshot keyboard shortcuts + +Keyboard: +- Don't save num-lock state when caps-lock changes + +Automounter: +- Optionally use systemd to check for active seat + +============= +Version 3.3.4 +============= + +Build: +- Fix distribution of a pre-processed desktop file + +Daemon: +- Fix --debug not working +- Remove gnome_settings_session_get_screen() and + gnome_settings_session_get_upower_client(), as + the underlying functions return singletons + +Color: +- Fix some screen setups not being color corrected + +XRandR: +- Better handling of docking stations and plugging of + external monitors (for suspend, and turning off monitors + to work as designed) + +Wacom: +- Fix loading of the plugin +- Fix GSettings read/write for per-tablet/per-styli configs +- Export more tablet and stylus metadata + +=============== +Version 3.3.3.1 +=============== + +Wacom: +- Fix referenced module name (Frederic Peters) + +============= +Version 3.3.3 +============= + +Build: +- Require GTK+ 3.3.4 (for key accel parsing) +- Require XI2 (for wacom support) + +Common: +- Remove unused X key event code (Bastien) + +Wacom: +- Lots of infrastructure buildup that I can't really + summarize here (Bastien Nocera) +- Rename plugin to avoid name clash with libwacom (Bastien) +- Use libwacom to get tablet metadata (Bastien) +- Implement per-device and per-stylus settings (Bastien) + +Power: +- Add the vendor name to the battery recall + warning (Dominique Leuenberger) (#664418) +- Add automatic dimming of keyboard backlight (Alex Murray) +Print: +- Prevent crashes when cups sends malformed + D-Bus signals (Lars Uebernickel) (#665689) + +XSettings: +- Set GtkShellShowsAppMenu xsetting when the shell is running (Colin Walters) + + +Translations: + Hebrew + Norwegian bokmÃ¥l + Romanian + Spanish + +============= +Version 3.3.2 +============= + +Common: +- Remove left-over debug (Bastien Nocera) (#660073) +- Fix handling of (Bastien Nocera) +- Update required gnome-desktop version (Bastien Nocera) +- Return opcode when detecting XInput2 (Bastien Nocera) +- Add helper to get the input device node (Bastien Nocera) +- Use XInput2 to capture and match keys (Bastien Nocera) +- Use GTK+ functions instead of own impl (Bastien Nocera) (#663343) +- Fix small memleak (Bastien Nocera) +- Allow to grab 'Print' without modifiers (Florian Müllner) (#663623) +- Require gsettings-desktop-schemas 3.3.0 (Bastien Nocera) + +A11y keyboard: +- Port to GSettings (Bastien Nocera) (#631502) + +Automount: +- Call bind_textdomain_codeset() (Bastien Nocera) + +Color: +- Do not load all the color devices twice at startup (Richard Hughes) +- Don't assign the same device more than once at startup (Richard Hughes) +- Fix a crash if ~/.local is deleted at runtime (Richard Hughes) (#660664) +- Simplify gcm_profile_store_mkdir_with_parents() (Bastien Nocera) +- Cancel any in-progress directory searching on plugin unload (Richard Hughes) +- Do not check for directory presence sync (Richard Hughes) +- Fix critical warning if the user disables the internal LCD screen (Richard Hughes) +- Reset the gamma tables when the screen configuration changes (Richard Hughes) (#660164) +- Unbreak loading profiles at startup (Cosimo Cecchi) (#660790) +- Do not prefix the EDID profile title with 'Default' (Richard Hughes) +- Set model and vendor to 'unknown' if not specified or unavailable (Richard Hughes) + +Daemon: +- Create a reference to a GnomePnpIds object to speed up loading (Richard Hughes) + +Datetime: +- Fix build requirements (Bastien Nocera) + +Media keys: +- Use a GCancellable for g_bus_get calls so that they can be cancelled (Rodrigo Moya) +- Don't assert if the user sets the 'button-power' action to 'shutdown' (Richard Hughes) +- Don't assert if the user sets the 'button-power' action to 'nothing' (Richard Hughes) +- Only ever send signals to specific apps (Bastien Nocera) +- Document the MediaPlayerKeyPressed signal (Bastien Nocera) +- Add some D-Bus API documentation (Bastien Nocera) +- Fix OSD touchpad icon names (Bastien Nocera) (#661179) +- Fix suspend button not locking the screen (Bastien Nocera) (#660267) +- Fix the suspend key not working (Bastien Nocera) (#660267) +- Remove unused allowed-keys entry (Bastien Nocera) +- Cache the volume change event sound (Bastien Nocera) +- Update for GVC API (Bastien Nocera) +- Print warning for real errors (Bastien Nocera) +- Apply volume on the device the key came from (Bastien Nocera) (#340720) +- Add custom shortcut type (Bastien Nocera) +- Implement GConf keyboard shortcuts (Bastien Nocera) (#625228) +- Redraw volume OSD when not composited (Marien Zwart) (#660990) +- Update for gsd-keygrab API change (Bastien Nocera) (#663343) +- Move some metacity shortcuts into g-s-d (Florian Müllner) (#663623) +- Port custom keybindings to GSettings (Florian Müllner) (#631502) + +Power: +- Use a GCancellable for g_bus_get calls so that they can be cancelled (Rodrigo Moya) +- Do not revert to the pre-idle brightness if idle dimming is disabled (Richard Hughes) (#660434) +- Remove some unused schema for enabling the sleep-inactive actions (Richard Hughes) (#660395) +- Clarify what a value of 0 is for sleep-inactive-x-timeout (Richard Hughes) +- Do not sleep-on-idle by default (Richard Hughes) +- Simplify hiding/showing the status icon (Bastien Nocera) +- Ensure the DPMS state is 'on' at startup (Richard Hughes) (#660482) +- Close low-battery notification when plugged in (Florian Müllner) (#660942) +- Remove the window filter when the plugin is unloaded (Richard Hughes) +- Don't crash when setting the dim timeout when using NX (Richard Hughes) (#661000) +- Call XSyncInitialize() in case GTK+ wasn't compiled with XSync support (Richard Hughes) +- Emit 'Changed' signal to all listeners (Gary Ching-Pang Lin) +- Fix "undefined symbol: WEXITSTATUS" error (Richard Hughes) (#662020) +- Make non-urgent notifications transient (Florian Müllner) (#662711) + +Printers: +- Fix build on systems without LC_PAPER (Bastien Nocera) (#660626) +- Call setlocale() (Bastien Nocera) (#660632) +- Exit gsd-printer when session ends (Marek Kasik) (#660158) +- Correct signature when calling PrinterAddOptionDefault (Marek Kasik) +- Don't show "Not connected?" when not needed (Marek Kasik) +- Unown name on the system bus when session goes idle (Marek Kasik) (#660158) +- Set requesting-user-name when getting job info (Marek Kasik) +- Show printer-state-reasons only when printing my jobs (Marek Kasik) +- Don't allow "/" in printer name (Marek Kasik) (#661774) +- Make notifications resident (Marek Kasik) +- Fix a leak (Marek Kasik) + +Smartcard: +- Remove unnecessary translations (Bastien Nocera) + +Xrandr: +- Use a GCancellable for g_bus_get calls so that they can be cancelled (Rodrigo Moya) + +Xsettings: +- Remove workaround to deal with g-s-d not exiting correctly (Rodrigo Moya) +- Plug mem leaks (Christian Persch) (#663239) + +Wacom: +- Fix possible crasher (Bastien Nocera) (#661170) +- Set cursor devices to be in relative mode by default (Jason Gerecke) (#662977) +- Add classes to manage settings and properties (Bastien Nocera) + +Translations: +- ast (Xandru Armesto) +- de (Mario Blättermann) +- eo (Kristjan SCHMIDT) +- es (Daniel Mustieles, Jorge González) +- gl (Fran Dieguez) +- lt (Algimantas MargeviÄius) +- nb (Kjartan Maraas) +- nl (Redmar, Wouter Bolsterlee) +- or (Manoj Kumar Giri) +- sl (Matej UrbanÄiÄ) +- sv (Daniel Nylander) +- te (krishnababu k) +- uk (Daniel Korostil) +- vi (Nguyá»…n Thái Ngá»c Duy) + +============= +Version 3.2.0 +============= + +Power: +- Correctly put the screen and computer to sleep when idle (Richard Hughes) (#659066) + +Translations: +- ca (Joan Duran, Gil Forcada) +- ca@valencia (Carles Ferrando) +- da (Flemming Christensen) +- eu (Inaki Larranaga Murgoitio) +- hu (Gabor Kelemen) +- ja (OKANO Takayoshi) +- ko (Changwoo Ryu) +- or (Manoj Kumar Giri) +- ru (Alexandre Prokoudine, Yuri Myasoedov) + +============== +Version 3.1.92 +============== + +A11Y keyboard: +- Show the a11y dialogue on right-click (Bastien Nocera) (#564171) + +Color: +- Be less chatty when creating duplicate profiles (Richard Hughes) +- Do not segfault when doing fast-user-switching into a new account (Richard Hughes) (#736846) +- Use a username suffix on the profile ID (Richard Hughes) (#736846) +- Do not show a warning when switching to a new user account (Richard Hughes) +- Use the correct profiles when fast user switching (Richard Hughes) +- Fix linking (Matthias Clasen) (#659086) + +Common: +- Add helper to list disabled devices (Bastien Nocera) +- Clean up X11 library dependencies (Bastien Nocera) (#657178) +- Bump colord dependency (Rodrigo Moya) + +Datetime: +- Allow chrony to be used on Fedora (Tomas Bzatek) (#655119) +- Add NTP support for SUSE variants (Vincent Untz) (#654970) + +GConf: +- Plug some memory leaks (Rodrigo Moya) +- Disconnect callbacks when cleaning up (Rodrigo Moya) + +Keyboard: +- Remember and apply NumLock status (Bastien Nocera) (#631989) + +Media keys: +- Don't show a level when muted (Bastien Nocera) (#644537) +- Fix keyboard brightness (Alex Murray) (#658689) +- Use the same "Music" mime-type as g-c-c (Bastien Nocera) +- There's no Beagle anymore (Bastien Nocera) +- Use gtk_show_uri() to launch nautilus (Bastien Nocera) +- Clean up app launching (Bastien Nocera) (#141379) +- Clean up upower req (Bastien Nocera) +- Remove unused empty LIBS linkage (Bastien Nocera) +- Fix compile-time warning (Bastien Nocera) +- Move keyboard brightness icon here (Bastien Nocera) +- Remove OSD icons (Bastien Nocera) + +Mouse: +- Add more debug for "touchpad disabled" (Bastien Nocera) +- Try harder to re-enable devices (Bastien Nocera) (#656397) + +Power: +- Make ABS_TO_PERCENTAGE warn on invalid input (Bastien Nocera) (#657364) +- Correctly check for helper exit status (Bastien Nocera) +- Avoid warnings without backlights (Bastien Nocera) +- Do not connect to signals if we failed to connect (Richard Hughes) +- Don't crash if we try to calculate the idle state before connected to gnome-session (Richard Hughes) (#657917) +- Be less chatty when optional hardware is not attached (Richard Hughes) (#658613) +- Fix a critical warning when getting the session inhibit state (Richard Hughes) +- Do not handle the idle state transaction when the session is not active (Richard Hughes) (#658568) +- Don't fall through the switch statement when shutting down (Richard Hughes) (#659202) +- Do not leak the icon when getting device status (Richard Hughes) (#659213) +- Protect against a potential SIGFE (Richard Hughes) (#659205) +- Do not emit multiple 'Changed' signals when recalculating (Richard Hughes) (#659204) +- Do not use G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES when we want to read properties (Richard Hughes) (#659066) +- Fix compilation without libcanberra-gtk (Bastien Nocera) + +Printers: +- Use the best PPD for new printer (Marek Kasik) (#658544) +- Style fixes (Bastien Nocera) + +Updates: +- Ignore virtual mountpoints when looking for external media (Richard Hughes) (#658282) +- Use the correct icons in the notifications (Richard Hughes) + +Translations: +- de (Mario Blättermann) +- en_GB (Bruce Cowan) +- es (Jorge González, Daniel Mustieles) +- fi (Timo Jyrinki) +- fr (Bruno Brouard) +- he (Yaron Shahrabani) +- it (Luca Ferretti) +- ja (Jiro Matsuzawa) +- lt (Aurimas ÄŒernius) +- lv (Rudolfs Mazurs) +- pl (Piotr DrÄ…g) +- pt (Duarte Loreto) +- sl (Matej UrbanÄiÄ) +- sr (МироÑлав Ðиколић) + +============== +Version 3.1.91 +============== + +Common: +- Don't list XINPUT_LIBS twice, move X11_LIBS from LDFLAGS to LIBADD (Stefan Sauer) + +Color: +- Ensure the 'Recalibration required' notification has a custom app name (Richard Hughes) +- Fix a critical warning on startup (Richard Hughes) +- Do not notify to recalibrate on every startup (Richard Hughes) + +Daemon: +- Fix possible double-free outside gnome-session (Bastien Nocera) + +Gconf: +- Double check stuff we add to the hash table (Rodrigo Moya) (#658055) + +Housekeeping: +- NULL-terminate the ignore-paths array (Bastien Nocera) (#657849) + +Power: +- Do not exit gnome-settings-daemon if upower fails to load (Richard Hughes) +- Fix impossible to hit error paths (Bastien Nocera) (#657364) +- Fix BRIGHTESS_STEP_AMOUNT calculation macro (Kamal Mostafa) +- Do most of the work in _start () (Bastien Nocera) (#657924) +- Never idle-dim the display to a higher brightness level (Richard Hughes) (#658144) + +Printers: +- Remove redundant code (Marek Kasik) + +Xsettings: +- Handle rgba-order key (Bastien Nocera) (#657525) +- Don't poke at an empty hashtable (Bastien Nocera) (#657464) +- Fix a stray brace (Owen Taylor) + +Translations: +- be (Ihar Hrachyshka) +- cz (Marek ÄŒernocký) +- pt_BR (Og B. Maciel) +- ta (Dr.T.Vasudevan) + +============== +Version 3.1.90 +============== + +A11Y-keyboard: +- Use GIO's DBus API instead of dbus-glib's (Rodrigo Moya) + +Color: +- Don't use uninitialized GErrors (Matthias Clasen) +- Do not set an age for display and printer profiles (Richard Hughes) +- Remove the ability to disable notifications (Richard Hughes) +- Do not search user-icc directories if they do not exist (Richard Hughes) (#657484) + +Daemon: +- Add Unity to OnlyShowIn value for autostart desktop file (Michael Terry) (#654919) + +Media keys: +- Don't go up to 11 (Bastien Nocera) (#649411) + +Mouse: +- Be more careful to avoid segfaults (Matthias Clasen) (#657462) + +Power: +- Ensure the critical battery beep is stopped when the AC is inserted (Richard Hughes) +- Ensure we lock the screen before suspending on lid close (Richard Hughes) (#655924) +- Add mention of bug 652183 (Bastien Nocera) + +Smartcard: +- Use GIO's DBus API instead of dbus-glib's (Rodrigo Moya) + +Updates: +- Do not log a warning if the firmware-missing file does not exist (Richard Hughes) +- Do not log a warning at startup if getting the upgrade list is not supported (Richard Hughes) (#657483) + +Translations: +- bg (Alexander Shopov) +- id (Andika Triwidada) +- pa (A S Alam) +- ta (Dr.T.Vasudevan) +- zh_CN (Aron Xu) + +============= +Version 3.1.5 +============= + +A11y-keyboard: +- Enable plugin by default (Rodrigo Moya) (#656287) + +Automount: +- Link against the private profiler library (Cosimo Cecchi) +- Add some missing includes (Cosimo Cecchi) +- Don't ship the .in file, just the .in.in one (Bastien Nocera) +- Silence two trivial -Wformat-security warnings (Richard Hughes) + +Color: +- Do not show multiple warnings if colord is not available at runtime (Richard Hughes) +- Fix a potential crash when unloading the color plugin (Richard Hughes) +- Fix a potential crash if creating the per-user ICC directory fails (Richard Hughes) +- Make lcms2 a hard dependency (Richard Hughes) + +Housekeeping: +- Use new g_format_size() instead of g_format_size_for_display() (Javier Jardón) + +Media keys: +- Don't preserve the path after filling (Cosimo Cecchi) +- Remove the half pixel offset from the progressbar fill (Cosimo Cecchi) +- Always round the render coordinates for media icons (Cosimo Cecchi) + +Power: +- Add the idle actions (Richard Hughes) +- Show a status icon when in fallback mode (Richard Hughes) +- Respect the idle-dim-ac and idle-dim-battery configuration keys (Richard Hughes) +- Add a backlight helper, as xbacklight isn't always present (Richard Hughes) +- Fall back to the backlight helper if xbacklight is not available (Richard Hughes) +- Fix a potential crash when unloading the power plugin (Richard Hughes) +- Ensure we return the new percentage when changing the brightness (Richard Hughes) + +Updates: +- Do not use deprecated PackageKit #defines (Richard Hughes) + +Wacom: +- Invert TPCButton setting (Peter Hutterer) (#656372) + +Translations: +- es (Daniel Mustieles) +- fa (Arash Mousavi) +- gl (Fran Dieguez) +- he (Yaron Shahrabani) +- ru (Yuri Kozlov) +- sl (Andrej ŽnidarÅ¡iÄ) +- sv (Daniel Nylander) +- zh_HK (Chao-Hsiung Liao) +- zh_TW (Chao-Hsiung Liao) + +============= +Version 3.1.4 +============= + +A11y-keyboard: +- Do proper cleanup when the plugin is stopped (Rodrigo Moya) + +Automount: +- Turn the automount plugin in a separate binary (Cosimo Cecchi) (#653521) +- Fix distcheck of .desktop.in.in file (Rodrigo Moya) + +Common: +- Fix grabbing of multimedia keys (Chris Coulson) + +Daemon: +- Set locale environment on gnome-session as early as possible (Rodrigo Moya) (#654182) +- Plug memory leak (Rodrigo Moya) + +Datetime: +- Use friendlier wording for date & time policykit prompt (Michael Terry) (#645951) + +Media keys: +- Add button handling code from gnome-power-manager (Richard Hughes) + +Power: +- Add power plugin to replace g-p-m (Richard Hughes) + +Translations: +- be (Ihar Hrachyshka) +- cz (Marek ÄŒernocký) +- de (Mario Blättermann) +- es (Daniel Mustieles, Jorge González, Sebi Kul, Francisco Molinero) +- gl (Fran Dieguez) +- he (Yaron Shahrabani) +- lt (Aurimas ÄŒernius) +- lv (Rudolfs Mazurs) +- nb (Kjartan Maraas) +- pa (A S Alam) +- tr (Muhammet Kara) + +============= +Version 3.1.3 +============= + +Common: +- Use defines instead of variables for ranges (Bastien Nocera) +- Fix function keys not being grabbed (Bastien Nocera) (#649222) +- Allow the "Pause" key to be used (Bastien Nocera) (#653524) + +Clipboard: +- Fix incremental sending from the clipboard manager (Cosimo Cecchi) (#652609) + +Color: +- Fix a potential buffer-overflow when converting to wide text (Richard Hughes) + +Keyboard: +- Use the same kbd layout menu labels as Gnome Shell (Jeremy Bicha) (#652836) +- Add missing "Settings" to the string (Bastien Nocera) +- Fix menu items actions (Bastien Nocera) + +Media keys: +- Use constant for icon size in OSD (Bastien Nocera) +- Remove progress bar borders (Bastien Nocera) (#652321) + +Mouse: +- Check device is a touchpad before enabling/disabling it (Rodrigo Moya) + +Translations: +- be (Ihar Hrachyshka) +- es (Jorge González) +- gl (Fran Diéguez) +- he (Yaron Shahrabani) +- nb (Kjartan Maraas) +- sl (Matej UrbanÄiÄ) +- sr (МироÑлав Ðиколић) + +============= +Version 3.1.2 +============= + +Common: +- Don't try to convert show-keyboard-leds-indicator in gnome-settings-daemon.convert + (Chris Coulson) +- Add touchscreen detection (Bastien Nocera) +- Add X property setting helper (Bastien Nocera) +- Add code to detect accelerometers (Bastien Nocera) +- Add better error reporting for egg key parsing (Bastien Nocera) +- Add code to allow disabling input devices (Bastien Nocera) + +Color: +- Add new color plugin (Richard Hughes) + +Cursor: +- Hide cursor on tablets with only a touchscreen (Bastien Nocera) (#650604) +- Show the cursor again on exit (Bastien Nocera) +- Fix XFixes version checking (Bastien Nocera) +- Ignore PS/2 mice as well (Bastien Nocera) +- Fix checking for extension pointer (Bastien Nocera) + +Datetime: +- Fix ntp logic on Debian to include ntpdate as well as ntpd (Michael Terry) (#644821) + +GConf: +- Add missing schema for org.gnome.settings-daemon.plugins.gconf (Rodrigo Moya) (#652200) + +Keybindings: +- Complete update to egg key parsing change (Florian Müllner) + +Media keys: +- Only start D-Bus when _start() is called (Bastien Nocera) +- Simplify touchpad OSD (Bastien Nocera) +- Hardcode the "toggle touchpad" button (Bastien Nocera) +- Remove old-style OSD (Bastien Nocera) +- Always use the primary monitor for display (Bastien Nocera) (#650159) +- Make sound changes quiet with Alt (Bastien Nocera) (#651704) + +Mouse: +- Use new disable/enable device code (Bastien Nocera) + +Orientation: +- Add orientation plugin (Bastien Nocera) + +Updates: +- Fix a string that is hard to translate (Richard Hughes) (#645749) + +Wacom: +- Enable wacom touch key by default (Peter Hutterer) +- Use property settings helper in common/ (Bastien Nocera) +- Typedef the Wacom device types (Bastien Nocera) + +Xrandr: +- Switch touchscreen rotation as wel (Bastien Nocera) +- Fix small memory leak on shutdown (Bastien Nocera) +- Remove the functionality to call gcm-apply when outputs change (Richard Hughes) +- Remove rotation handling for wacom tablets (Bastien Nocera) + +Translations: +- bg (Alexander Shopov) +- ca@valencia (Carles Ferrando) +- cz (Marek ÄŒernocký) +- de (Mario Blättermann) +- es (Jorge González, Daniel Mustieles) +- fa (Arash Mousavi) +- gl (Fran Diéguez) +- he (Yaron Shahrabani) +- nb (Kjartan Maraas) +- pl (Piotr DrÄ…g) +- sl (Matej UrbanÄiÄ) + +============= +Version 3.1.1 +============= + +Common: +- Add input-helper test application (Bastien Nocera) +- Fix syndaemon never getting started (Edward Sheldrake) (#648885) +- Add meaningful app names to notifications from plugins (Matthias Clasen) (#648911) + +Datetime: +- Simplify NTP handling for distros (Bastien Nocera) +- Fix setting NTP on Fedora 15 (Bastien Nocera) + +Media keys: +- Show a popup when no media player is running (Bastien Nocera) +- Use symbolic icon for Eject action (Bastien Nocera) (#649523) + +Mouse: +- Clean up error handling (Bastien Nocera) +- Don't crash if mouse has no FeedbackStates (Bastien Nocera) (#649539) + +Updates: +- Fix the interface name (Richard Hughes) +- Deal with absence of gnome-session gracefully (Matthias Clasen) + +Xrandr: +- Never use a notification for errors (Bastien Nocera) (#648303) + +Translations: +- es (Daniel Mustieles) +- he (Yaron Shahrabani) +- ug (Abduxukur Abdurixit) + +============= +Version 3.0.3 +============= + +Common: +- Use defines instead of variables for ranges (Bastien Nocera) +- Fix function keys not being grabbed (Bastien Nocera) (#649222) +- Allow the "Pause" key to be used (Bastien Nocera) (#653524) +- Fix grabbing of multimedia keys (Rodrigo Moya) + +Wacom: +- Enable wacom touch key by default (Peter Hutterer) (#651020) + +Translations: +- bg (Alexander Shopov) +- ca (Gil Forcada) +- ca@valencia (Carles Ferrando) +- cz (Marek ÄŒernocký) +- de (Mario Blättermann) +- es (Daniel Mustieles) +- gl (Fran Diéguez) +- pl (Piotr DrÄ…g) +- sl (Matej UrbanÄiÄ) +- sr (МироÑлав Ðиколић) +- sv (Daniel Nylander) + +============= +Version 3.0.2 +============= + +Common: +- Fix syndaemon never getting started (Edward Sheldrake) (#648885) +- Fix example input device script (Bastien Nocera) +- Don't try to convert show-keyboard-leds-indicator in gnome-settings-daemon.convert (Chris Coulson) + +Date & Time: +- Fix setting NTP on Fedora 15 (Bastien Nocera) (#648556) + +Media keys: +- Use symbolic icon for Eject action (Bastien Nocera) (#649523) + +Mouse: +- Don't pass NULL to device_is_touchpad (Matthias Clasen) (#649214) +- Clean up error handling (Bastien Nocera) +- Don't crash if mouse has no FeedbackStates (Bastien Nocera) (#649539) + +XRandr: +- Never use a notification for errors (Bastien Nocera) (#648303) + +Translations: +- fa (Arash Mousavi) +- ug (Abduxukur Abdurixit) + +============= +Version 3.0.1 +============= + +Updates: Fix firmware auto-installation +Media-keys: Fix possible crash when sound device is removed + +Updated translations + +=============== +Version 3.0.0.1 +=============== + +Keyboard: Fix crash showing the keyboard layout in fallback mode + +Updated translations + +============= +Version 3.0.0 +============= + +Common: +- Change default inactive sleep on battery to suspend (William Jon McCann) + +Keyboard: +- Clarify actual units used for repeat rate (Bastien Nocera) (#646241) + +Printers: +- Cancel CUPS' subscription policy (Marek Kasik) +- Make CUPS' subscriptions expirable (Marek Kasik) +- Remove old subscriptions (Marek Kasik) + +XSettings: +- Try a few times to start the xsettings manager (Rodrigo Moya) (#634988) + +Translations: +- bn (Jamil Ahmed) +- ca (Jordi Serratosa) +- cz (Marek ÄŒernocký) +- da (Ask H. Larsen) +- de (Christian Kirbach, Wolfgang Stöggl) +- en_GB (Bruce Cowan) +- eu (Iñaki Larrañaga Murgoitio) +- he (Yaron Shahrabani) +- hi (Rajesh Ranjan) +- hu (Gabor Kelemen) +- id (Dirgita) +- ja (Takayuki KUSANO) +- ko (Changwoo Ryu) +- lv (Rudolfs Mazurs) +- ml (Ani Peter) +- nl (Wouter Bolsterlee, Hannie Dumoleyn) +- pl (Piotr DrÄ…g) +- pt_BR (Djavan Fagundes) +- ru (Yuri Myasoedov) +- sr (Miroslav Nikolić) +- sv (Daniel Nylander) +- ta (Dr.T.Vasudevan) +- ug (Abduxukur Abdurixit) +- vi (Nguyá»…n Thái Ngá»c Duy) +- zh_CN (Aron Xu) + +=============== +Version 2.91.93 +=============== + +Power: +- Don't suspend the computer when idle by default +- Add back "interactive" option + +Date & Time: +- Check for the correct PolicyKit action + +Accessibility settings: +- Enable plugin by default, so that screen readers and + on-screen keyboards work out-of-the-box + +And loads of translations + +=============== +Version 2.91.92 +=============== + +Common: +- Update priority of a few plugins (Bastien Nocera) +- gdk_display_get_device_manager() retval handling (Bastien Nocera) (#685020) +- Improve CUPS detection (Saleem Abdulrasool) (#644063) +- Make sure G_LOG_DOMAIN is set to the plugin name for each plugin (Richard Hughes) +- Make sure we mop up stray idle handlers (Bastien Nocera) +- Simplify input helper (Bastien Nocera) +- Launch a custom script on input devices (Peter Hutterer) (#635486) + +Daemon: +- Fix possible crasher on exit (Bastien Nocera) (#639347) + +Media keys: +- Update gvc copy/paste from control-center (Bastien Nocera) +- Make volume go up to 11 (Bastien Nocera) (#631030) +- Simplify volume keys handling (Sjoerd Simons) (#640963) + +Mouse: +- Fix possible memory leak (Bastien Nocera) +- Implement touchpad motion settings (Bastien Nocera) (#642474) +- Fix shape handling in locate-pointer (Gerd Kohlberger) (#645092) +- Handle touchpad handedness changing (Bastien Nocera) +- Don't apply any settings if XInput isn't present (Bastien Nocera) +- Separate device dependent calls (Bastien Nocera) +- Remove duplicated calls on start (Bastien Nocera) +- Remove unused supports_xinput_devices() call (Bastien Nocera) +- Make sure syndaemon is killed when touchpad disappears (Bastien Nocera) +- Hook up input device customisation script (Bastien Nocera) +- Fix double-free when handling one-button touchpad (Bastien Nocera) +- Fix crash in GHashTable usage (Bastien Nocera) + +Power: +- Set the default display off time to be same as session idle time (William Jon McCann) + +Updates: +- g_get_real_time() returns microseconds, not seconds since the epoch (Richard Hughes) +- Ensure te user gets the updates notification if it's never been shown (Richard Hughes) +- Ensure the user gets notified of normal updates at the correct interval (Richard Hughes) + +Translations: +- ar (Khaled Hosny) +- de (Mario Blättermann) +- el (ΓιώÏγος Στεφανάνης) +- et (Mattias Põldaru) +- fr (Cyril Arnaud, Gérard Baylard, Alain Lojewski and Claude Paroz) +- gl (Fran Diéguez) +- he (Yaron Shahrabani) +- hu (Gabor Kelemen) +- lt (Gintautas Miliauskas) +- lv (Rudolfs Mazurs) +- pl (Piotr DrÄ…g) +- ro (Lucian Adrian Grijincu) +- sl (Matej UrbanÄiÄ, Andrej ŽnidarÅ¡iÄ) +- sr (Miroslav Nikolić) +- sv (Daniel Nylander) + +=============== +Version 2.91.91 +=============== + +Automount: +- Fix crash when unlocking the screen saver +- Don't queue volumes when session is inactive + +Housekeeping: +- Use nautilus's D-Bus API to empty the trash + +Media keys: +- Add magnifier in/out keybindings +- Fix larger text/smaller text keybindings + +Mouse: +- Make locate pointer feature work with GTK+ 3 + +Printers: +- Use new CUPS D-Bus API + +Updates: +- Use auto-download updates when possible + +XSettings: +- Also accept .gtk-module for GTK+ modules +- Don't set Xft.lcdfilter, it's broken +- Use "text-scaling-factor" key instead of DPI + +=============== +Version 2.91.90 +=============== + +A11Y Settings: +- Add new plugin (Bastien Nocera) + +Automount: +- Look if the session is active before automounting new volumes (Cosimo Cecchi) +- Disable automounting while screen is locked (Martin Pitt, Cosimo Cecchi) + +Background: +- Stop pending fades if new ones initiated (Ray Strode) + +Date & Time: +- Add Debian support to NTP service activation (Milan Bouchet-Valat) (#641598) +- Fix gsd_datetime_check_tz_name() never working (Bastien Nocera) (#674999) + +Keyboard: +- Update for new libgnomekbd API (Sergey V. Udaltsov) +- Match shell behaviour for visibility (Bastien Nocera) +- Explicitly calling gtk_widget_show_all for kbd layout (Sergey V. Udaltsov) + +Media keys: +- Fix crash when keybindings change (Bastien Nocera) +- Add more Universal Access keybindings (Bastien Nocera) (#641279) + +Mouse: +- Use event driven mode for syndaemon (Pauli Nieminen) (#639623) +- Use syndaemon -K to ignore Ctrl+C and other combos (Peter Hutterer) (#639487) + +Print notification: +- Go back to using name in notifications (William Jon McCann) +- Check that cups is recent enough (Marek Kasik) + +Updates: +- Add an updates plugin to integrate with PackageKit (Richard Hughes) + +XSettings: +- Fix memleak, using wrong unref function (Bastien Nocera) + +Translations: +- ar (Khaled Hosny) +- es (Daniel Mustieles, Jorge González) +- gl (Fran Diéguez) +- he (Yaron Shahrabani) +- it (Luca Ferretti) +- ko (Changwoo Ryu) +- nb (Kjartan Maraas) +- pa (A S Alam) +- zh_HK (Chao-Hsiung Liao) +- zh_TW (Chao-Hsiung Liao) + +============== +Version 2.91.9 +============== + +XSettings: +- Initialize gtk-modules setting (Dan Winship) +- Support GTK/AutoMnemonics setting (Matthias Clasen) + +Date & Time: +- Use a single polkit action for this (Thomas Wood) + +Media keys: +- Prevent volume underflow (Sjoerd Simons, Bastien Nocera) +- Use symbolic icons for OSD (Matthias Clasen, Bastien Nocera) + +Keybindings: +- Rename Accessibility keybindings to 'Universal Access' (William Jon McCann) +- Mark Accessibility keybindings as system (William Jon McCann) + +Keyboard: +- Don't create kbd indicators in the shell (Sergey V. Udaltsov) +- Remove $GDM_KEYBOARD_LAYOUT handling (Bastien Nocera) +- Fix control-center invocation (Yanko Kaneti) + +Housekeeping: +- Fix an untranslatable string (Cosimo Cecchi) + +Print notification: +- New plugin for print notifications (Marek Kasik) +- Appearance and wording tweaks (William Jon McCann) + +- Translations: + Arabic + Estonian + Galician + Hebrew + Italian + Japanese + Norwegian bokmÃ¥l + Simplified Chinese + Spanish + + +============== +Version 2.91.8 +============== + +- Connect to the right GnomeRRScreen signal + +============== +Version 2.91.7 +============== + +- Adapt to new gnome-desktop API (Giovanni Campagna) +- Remove unused macros (Federico Mena Quintero) +- Translations: + - de (Paul Seyfert) + - es (Jorge González) + - et (Ivar Smolin, Mattias Põldaru) + - gl (Fran Diéguez) + - nb (Torstein Adolf Winterseth) + - pa (A S Alam ) + - sv (Daniel Nylander) + - vi (Nguyá»…n Thái, Nguyen Vu Hung) + - zh_HK (Chao-Hsiung Liao) + - zh_TW (Chao-Hsiung Liao) + +================ +Version 2.91.6.2 +================ + +- Fix a crasher with GTK+ 2.91.7 (Cosimo Cecchi) + +================ +Version 2.91.6.1 +================ + +- Suppress warnings due to gdk_error_trap_pop (Cosimo Cecchi) +- Fix build with GTK+ 2.91.7 (Cosimo Cecchi) + +============== +Version 2.91.6 +============== + +- Port to GtkStyleContext (Bastien Nocera) +- Suspend by default on battery power (Colin Walters) +- Timezone and NTP improvements (Bastien Nocera) +- Port to GtkAppChooserButton (Cosimo Cecchi) +- Port background code to GDBus (Dan Williams) +- Support multiple smartcard drivers (Ray Strode) +- Background plugin misc fixes (Tomas Bzatek, Owen W. Taylor) + +================ +Version 2.91.5.1 +================ + +- Handle rename of org.gnome.media-handling (Owen W. Taylor) + +============== +Version 2.91.5 +============== + +- Add automount plugin (Tomas Bzatek) +- Don't pass NULL strings to g_variant_new() (Bastien Nocera) +- Properly handle gnome-session EndSession signals (Cosimo Cecchi) + +============== +Version 2.91.4 +============== + +- Add Wacom configuration plugin (Peter Hutterer) +- Add support for the XF86TouchpadOn/Off keys (Bastien Nocera) +- Move some gnome-power-manager settings, so it can + be used in the control center (Richard Hughes) +- Only ever call g_bus_own_name() once for the main D-Bus name (BN) +- Register with gnome-session to avoid timeouts, and transition + problems on login (BN) +- Fix possible warnings or crashers when _stop() is called without + _start() having been completed (William Jon McCann) + +============== +Version 2.91.3 +============== + +- Remove xrdb plugin (Bastien Nocera) +- Remove outdated GConf schemas (BN) +- Handle a11y toggle shortcut keys in media-keys (BN) +- Make volume down work when muted (BN) +- Export the "cursor-blink-timeout" XSetting +- Add test-system-timezone test program +- Fix possible crasher in media-keys (William Jon McCann) +- Make media-keys not crash when there are no listeners (BN) +- Use a notification for the low space waring in housekeeping (WJMcC) +- Make libnotify a hard-dependency (BN) +- Add a real test application for housekeeping (BN) +- Port daemon and xrandr plugin to GDBus (BN) +- Fix possible warnings in keyboard plugin (BN) +- Fix logout key shortcut not asking for a confirmation (BN) +- Don't warn about low space when over 1GB is free (BN) + +================ +Version 2.91.2.1 +================ + +- Require a newer gnome-desktop with GSettings support for the background plugin + (Tomas Bzatek) + +============== +Version 2.91.2 +============== + +- Migration to GSettings (Bastien Nocera, Rodrigo Moya, Gerd Kohlberger, + Carlos García Campos) +- Use MIME types for URL handlers (Rodrigo Moya) +- Fix the GSD_API_VERSION definition in configure.ac (Matthias Clasen) +- Update PolicyKit minimum requirement (Bastien Nocera) +- Remove typing break plugin (Bastien Nocera) +- Update the required version of gnome-desktop3/GTK3 (Bastien Nocera) +- Require libnotify 0.6.0 (William Jon McCann) +- KEY_SCROLL_METHOD is an enum not an int (Alban Browaeys) (#631963) +- Don't use gdk_drawable_get_screen (Alban Browaeys) (#631931) +- Fix version substitution in pkg-config file (Bastien Nocera) (#631866) +- Remove status icon for monitors (Bastien Nocera) (#631995) +- Make XInput a hard requirement (Bastien Nocera) +- Use canberra-gtk for GTK3 (Bastien Nocera) +- More network filesystems not to monitor (Josselin Mouette) (#606421) +- Fix loading plugins information (Bastien Nocera) (#631933) +- For media key, use the default application for audio/ogg (Rodrigo Moya) +- Set priority for plugins based on settings (Bastien Nocera) +- Never daemonise the "daemon" (Bastien Nocera) +- Use Gdk to get events about input devices being added (Bastien Nocera) +- Cleanup macro magic in plugin.h (Paolo Borelli) (#591798) +- Update gnome-media cut'n'paste code (Bastien Nocera) (#612024) +- Add gnome-settings-daemon man page (Joshua Cummings) (#588716) +- Remove horrible xmodmap fallback code (Bastien Nocera) (#150542) +- Remove outdated plugin (Bastien Nocera) +- Use g_timeout_add_seconds (Bastien Nocera) (#582703) +- Keyboard plugin improvements (Sergey V. Udaltsov) +- Don't choke if there are old plugins laying around (William Jon McCann) +- Check for touchpad before running syndaemon (Hernando Torque) (#632122) +- Add icon to the "Keep settings" dialogue (Bastien Nocera) (#579021) +- Add support for the enable-animation setting (Bastien Nocera) (#630535) +- Export Xft.lcdfilter for OO.o's benefit (Chris Coleman) (#631924) +- Remove XFree86 4.3.0 check (Bastien Nocera) (#632569) +- Make fontconfig a hard dependency (Bastien Nocera) +- Add GConf<->GSettings bridge plugin (Rodrigo Moya) +- Show a touchpad-disabled if no touchpad (Bastien Nocera) +- Make the "log out" key really do that (Bastien Nocera) +- If the stored configuration fails at startup, use the fallback configurations + (Gary Lin) +- Add ability to hard-code media keys (Bastien Nocera) (#623223) +- Use $(sysconfigdir) for .ad files, since they are settings (Rodrigo Moya) +- Enable maintainer mode (Rodrigo Moya) +- Don't display the gnome-settings-daemon autostart in the startup applications + list (Rodrigo Moya) +- Add settings key for disabling boot time configuration (Martin Pitt, Rodrigo + Moya) (#631388) +- Don't access free'd memory if a volume is unmounted whilst the dialog is + running (Rodrigo Moya) +- Port to GDBus (Bastien Nocera) +- Add support for more multimedia keys (Bastien Nocera) +- Handle video out keys in media-keys (Ray Strode) (#623223) +- Use virtual modifier for the Windows key (Ray Strode) +- Simplify the default XRandR behaviour (Bastien Nocera) (#634092) +- Add middle-button-enabled key (Bastien Nocera) (#633863) +- Prepare for the demise of size_request (Matthias Clasen) (#633320) +- Translations: + - ca (Carles Ferrando) + - de (Mario Blättermann) + - es (Jorge González) + - gl (Fran Diéguez) + - he (Yaron Shahrabani) + - ja (Takayuki KUSANO) + - ko (Changwoo Ryu) + - nb (Kjartan Maraas) + - pa (A S Alam ) + +============== +Version 2.91.0 +============== + +- Give a name to the keyboard status icon (Matthias Clasen) (#610319) +- Fix include directory to match API version (Bastien Nocera) +- Add daemon path to pkg-config files (Bastien Nocera) +- Don't switch mouse buttons for XTest devices (Bastien Nocera) (#627084) +- Remove GtkObject usage (Matthias Clasen) (#630678) +- Use gtk3 draw event instead of expose-event (William Jon McCann) (#630975) +- Use gdk-pixbuf header (William Jon McCann) (#630975) +- Don't use GdkColormap (William Jon McCann) +- Use cairo regions to set input shape (William Jon McCann) +- Adapt to GnomeBG API changes (William Jon McCann) +- Use an empty region to ignore events (William Jon McCann) +- Don't destroy the cairo context in draw handler (William Jon McCann) +- Adapt to libgnomekbd API changes (Sergey V. Udaltsov) +- Translations: + - ar (Khaled Hosny) + - bg (Damyan Ivanov) + - ca (Joan Duran) + - cz (Petr Kovar) + - gl (Fran Diéguez) + +=============== +Version 2.90.1 +=============== + +- Apply keyboard a11y settings for newly plugged keyboards +- Loads of compilation fixes for GTK3 +- Fix crasher when certain items are copied to the clipboard +- Silent build by default + +Display: + - Don't try to activate display configurations where all the outputs are off + - Don't cycle through custom display configurations on XF86Display button press + - Add logging infrastructure + +================ +Version 2.31.5.1 +================ + +- Include fixes from 2.31.4.2 +- Translations: + - nb (Kjartan Maraas) + +============== +Version 2.31.5 +============== + +- Depend on gnome-desktop-3.0 (Rodrigo Moya) +- Translations: + - es (Jorge González) + - gl (Fran Diéguez) + - he (Yaron Shahrabani) + - sl (Matej UrbanÄiÄ) + +================ +Version 2.31.4.2 +================ + +- Fix the binary name in the datetime DBus .service file (Thomas Wood) +- Translations: + - gl (Fran Diéguez) + - he (Yaron Shahrabani) + +================ +Version 2.31.4.1 +================ + +- Fix the datetime DBus .service file (Thomas Wood) + +============== +Version 2.31.4 +============== + +- Fix build for --disable-smartcard-support (Ray Strode) (#617748) +- Use gtk+-3.0 (Rodrigo Moya) +- Fix launching the display configuration tool (Matthias Clasen) +- Move clock service from gnome-panel (Rodrigo Moya, Thomas Wood) +- Define plugindir in .pc file (Rodrigo Moya) +- Translations: + - et (Ivar Smolin) + - lv (Rudols Mazurs) + - nb (Kjartan Maraas) + +============== +Version 2.31.3 +============== + +- Fixed icon names, prefixed with kbd- (Sergey Udaltsov) +- Use "show layout" dialog from libgnomekbd (Sergey Udaltsov) +- Translations: + - et (Ivar Smolin) + - he (Yaron Shahrabani) + - sl (Matej UrbanÄiÄ) + +============== +Version 2.31.2 +============== + +- Fix installation of the xrandr helper binary (Jens Granseur) (#617782) +- Always dist smartcard.gnome-settings-plugin (Ray Strode) (#617748) +- Adjust XF86Display timestamps if they are out of order with RANDR + timestamps (Chase Douglas) (#610482) +- Don't install template files into the icon theme (Matthias Clasen) +- Fix loading OSD icons when there's no SVG version (Bastien Nocera) (#618023) +- Only check for baobob if we're about to show a dialog (Ross Burton) +- Translations: + - de (Mario Blättermann) + - en@shaw (Thomas Thurman) + - es (Jorge González) + - gl (Fran Diéguez) + - or (Manoj Kumar Giri) + +============== +Version 2.31.1 +============== + +- Create the directory for the system's RANDR configuration (Federico Mena Quintero) +- Add the logic needed for the "Make Default" button in gnome-display-properties + (Federico Mena Quintero) +- Use $sysconfdir for /etc installation (Rodrigo Moya) +- Replace deprecated GTK_WIDGET_STATE (Andre Klapper) +- Compile with -DGSEAL_ENABLE (Andre Klapper) (#612588) +- Use Layouts instead of Groups (Sergey Udaltsov) (#553108) +- Add smartcard plugin (Ray Strode) +- Software LED indicators (Sergey Udaltsov) (#616380) +- Use LED icons instead of files (Sergey Udaltsov) +- Translations: + - de (Mario Blättermann) + - en_GB (Philip Withnall) + - es (Jorge Gonzalez) + - gl (Francisco Diéguez) + - mr (Sandeep Shedmake) + - sk (Pavol Å imo) + - sl (Matej UrbanÄiÄ) + - te (krishnababu k) + +============== +Version 2.30.1 +============== + +- Fix keyboard indicator displaying (Martin Pitt) (#613666) +- Default to system settings for handling multiple keyboard layouts (Martin Pitt) +- Introduce gconf key that allows hiding the indicator (Sergey Udaltsov) (#612240) + (#613666) +- Translations: + - ca (Jordi Serratosa) + - ca@valencia (Carles Ferrando) + - crh (ReÅŸat SABIQ) + - et (Ivar Smolin) + - kn (Shankar Prasad) + - sl (Pavol Å imo) + - th (Theppitak Karoonboonyanan) + +============== +Version 2.30.0 +============== + +- Protect XInput code by ifdefs if XInput isn't available (Daniel Macks) (#611670) +- Don't play a sound when the volume doesn't change (Bastien Nocera) (#610001) +- Fix linking with pedantic linkers (Bastien Nocera) (#610244) +- Remove unused do_sleep_action function (Bastien Nocera) +- Apply all keyboard settings to new keyboards (Bastien Nocera) (#610245) +- Ensure the window is realized before we invalidate it (Richard Hughes) (#604918) +- Replace "eject" spawn with GIO code (Bastien Nocera) (#580779) +- Don't spawn xrdb (Martin Pitt) (#586276) +- Add translator hint (Jens Granseuer) (#613647) +- Disable font plugin by default (Bastien Nocera) (#613604) +- Translations: + - bn (Jamil Ahmed) + - da (Ask H. Larsen) + - et (Ivar Smolin) + - eu (Inaki Larranaga Murgoitio) + - he (Nikos Bakaoukas) + - hu (Gabor Kelemen) + - ko (Changwoo Ryu) + - lt (Gintautas Miliauskas) + - nl (Hannie Dumoleyn, Reinout van Schouwen) + - nn (Torstein Adolf Winterseth) + - pa (A S Alam) + - pt (Duarte Loreto) + - ro (Adi Roiban) + - sl (Pavol Å imo) + - sr (MiloÅ¡ Popović) + - uk (Maxim V. Dziumanenko) + +=============== +Version 2.29.92 +=============== + +- Translations: + - bg (Alexander Shopov) + - ca (Joan Duran) + - en_GB (Bruce Cowan) + - fi (Timo Jyrinki) + - hu (Gabor Kelemen) + - it (Luca Ferretti) + - nb (Kjartan Maraas) + - pt_BR (Antonio Fernandes C. Neto) + - sv (Daniel Nylander) + +=============== +Version 2.29.91 +=============== + +- Fn-F8 should disable/enable touch points (Peter Hutterer) (#594831) +- Always set the position of outputs, even if they are already turned on + (Federico Mena Quintero) +- Apply keyboard settings to newly plugged in devices (Federico Mena Quintero) + (#610245) +- Translations: + - de (Jochen Skulj, Mario Blättermann) + - es (Jorge González) + - gl (Fran Diéguez) + - ro (Lucian Adrian Grijincu) + - sl (Matej UrbanÄiÄ) + - ta (vasudeven) + - ru (Leonid Kanter) + - zh_CN (Ray Wang) + - zh_HK & zh_TW (Chao-Hsiung Liao) + +=============== +Version 2.29.90 +=============== + +- Add gthread-2.0 to required modules for the daemon (Jens Granseuer) (#608217) +- Centralize the use of gnome_rr_config_apply_with_time (Federico Mena Quintero) +- Translations: + - et (Ivar Smolin) + - sl (Matej UrbanÄiÄ) + +============== +Version 2.29.6 +============== + +- Don't allow left-handed setting for single-button touchpads (Peter Hutterer) +- Don't die on X servers without XKB (Matthias Clasen) (#604651) +- Translations: + - bg (Alexander Shopov) + - bn (Jamil Ahmed) + - es (Jorge González) + - nb (Kjartan Maraas) + - ta (vasudeven) + +============== +Version 2.29.5 +============== + +- Fix variant handling in $GDM_KEYBOARD_LAYOUT (Martin Pitt) (#596897) +- Tighten check for XInput (Jens Granseuer) +- Fix bluriness in level bar, and popup (Bastien Nocera) (#567249) +- Remove unused variable (Bastien Nocera) (#599904) +- Honour libexecdir when spawning gsd-locate-pointer (Jens Granseuer) (#599209) +- Allow left-handed setting for touchpads (Peter Hutterer) +- Use a rounded instead of curved rectangle (William Jon McCann) +- Improve the media keys overlay design (William Jon McCann) (#596136) +- Add brightness to the media-keys popup (Bastien Nocera) (#599677) +- Fix for GSEAL goal (Bastien Nocera) (#599861) +- Avoid volumes going over 100% (Bastien Nocera) (#600770) +- Make OSD display more generic (Bastien Nocera) (#600951) +- Support loading -rtl and -ltr variants of icons (Bastien Nocera) (#600984) +- Relicense gsd-media-keys-window.[ch] to LGPL (Bastien Nocera) (#600986) +- Hide the status icon before unreffing it (Matthias Clasen) (#601696) +- Make eject behave better on OpenBSD (Jasper Lievisse Adriaanse) (#598573) +- Export libexecdir in .pc file (DJ Lucas) (#596388) +- Run gnome-color-manager apply program when the outputs change + (Richard Hughes) +- Factor out function to get keycodes from keysym names (Federico Mena Quintero) +- Handle the XF86RotateWindows hotkey by rotating a laptop's display + (Federico Mena Quintero) +- Respond to monitor configuration changes when in charge (Matthias Clasen) + (#601203) +- Filter invalid layouts before looking for the index of one passed by gdm + (Vincent Untz) (#585868) +- Add linsysfs to list of virtual filesystems (Coleman Kane) (#604396) +- Remove sleep keybindings (Bastien Nocera) (#170175) +- Start an on-screen-display window (OSD) (Federico Mena Quintero) +- Split the composited and non-composited code for the expose-event handler + (Federico Mena Quintero) +- Use a hand-drawn frame instead of a GtkBuilder frame (Federico Mena Quintero) +- Using GkbdStatus for the automatic notification icon (Sergey V. Udaltsov) +- Implement popup menu for the notification icon (Sergey V. Udaltsov) +- Add extra API required by GsdMediaKeysWindow (Federico Mena Quintero) +- Add timed exit option (William Jon McCann) +- Fixes for new libxklavier (Sergey V. Udaltsov) +- Translations: + - ast (Xandru Armesto Fernandez) + - en@shaw (Thomas Thurman) + - es (Jorge González) + - et (Mattias Põldaru, Ivar Smolin) + - ja (Takayuki KUSANO) + - nb (Kjartan Maraas) + - nds (Nils-Christoph Fiedler) + - ru (Leonid Kanter) + - sl (Matej UrbanÄiÄ) + - sv (Daniel Nylander) + - uk (Maxim V. Dziumanenko) + - vi (Nguyá»…n Thái Ngá»c Duy) + - zh_CN (Aron Xu) + +============== +Version 2.28.1 +============== + +- Try harder to use the keyboard layout passed by gdm (Vincent Untz) +- Translations: + - ca (Joan Duran) + - el (Kostas Papadimas) + - or (Manoj Kumar Giri) + - pl (Tomasz Dominikowski) + - ru (Andrey Grigoriev, Alexandre Prokoudine) + - sl (Matej UrbanÄiÄ) + - zh_HK (Chao-Hsiung Liao) + - zh_TW (Chao-Hsiung Liao) + +============== +Version 2.28.0 +============== + +- Fix incomplete function declaration (Vincent Untz) +- Don't install the dummy plugin whilst keeping the Makefile.am + almost intact for copy/paste (Bastien Nocera) (#578538) +- Fix Touchpad left-handed issues (Bastien Nocera) (#594617) +- Add sound effect to volume key handling (Bastien Nocera) (#404683) +- Remove useless custom eject icon (Bastien Nocera) +- Validate xsettings GConf keys read from the configuration (Jens Granseuer) + (#594821) +- Fix compiler warnings (Jens Granseuer) +- Translations: + - as (Amitakhya Phukan) + - cz (Petr Kovar) + - da (Ask H. Larsen) + - de (Mario Blättermann) + - en_GB (Bruce Cowan) + - hi (Rajesh Ranjan) + - hu (Gabor Kelemen) + - it (Luca Ferretti) + - ja (Takayuki KUSANO) + - kn (Shankar Prasad) + - mai (Rajesh Ranjan) + - ml (Ani) + - mr (Sandeep Shedmake) + - or (Manoj Kumar Giri) + - pa (A S Alam ) + - pl (Piotr DrÄ…g) + - ro (Adi Roiban, Dumitru MiÈ™u Moldovan) + - sr (MiloÅ¡ Popović) + - te (krishnababu k) + - uk (Maxim V. Dziumanenko) + +=============== +Version 2.27.92 +=============== + +- Make 'Locate Pointer a separate process (Matthias Clasen) (#524499) +- Skip button mappings only for core devices (Peter Hutterer) +- Translations: + - ar (Khaled Hosny) + - bn (Jamil Ahmed) + - bn_IN (Runa Bhattacharjee) + - ca (Gil Forcada) + - ca@valencia (Carles Ferrando) + - et (Ivar Smolin) + - eu (Inaki Larranaga Murgoitio) + - gu (Sweta Kothari) + - he (Yaron Shahrabani) + - kn (Shankar Prasad) + - lt (Gintautas Miliauskas) + - nb (Kjartan Maraas) + - pt (Duarte Loreto) + - te (krishnababu k) + - tr (Baris Cicek) + +=============== +Version 2.27.91 +=============== + +- Update gnome-volume-control code (Bastien Nocera) +- Update cut'n'paste from gnome-media (Bastien Nocera) +- Update volume control code for new API (Bastien Nocera) +- Translations: + - bg (Alexander Shopov) + - fi (Tommi Vainikainen) + - ga (Seán de Búrca) + - ko (Changwoo Ryu) + - pt_BR (Henrique P. Machado) + +=============== +Version 2.27.90 +=============== + +- Update gnome-volume-control from gnome-media (Bastien Nocera) (#589825) +- Fix crash in gvc_mixer_stream_is_running() (Chris Coulson) (#590073) +- Add '-k' option to syndaemon call for 'Disable touchpad while typing' + (C de-Avillez) (#590588) +- Low disk space warning bug-fixes (Chris Coulson) (#591153) +- Translations: + - br (Denis Arnaud) + - es (Jorge González) + - et (Ivar Smolin, Priit Laes and Mattias Põldaru) + - fr (Nicolas Repentin and Claude Paroz) + - gl (Antón Méixome) + - nb (Kjartan Maraas) + - or (Manoj Kumar Giri) + - sv (Daniel Nylander) + - ta (drtvasudevan) + - zh_CN (Ray Wang) + +============== +Version 2.27.5 +============== + +- Only use applicable configurations for switching with the XF86Display hotkey + (Federico Mena Quintero) +- Only use applicable configurations when auto-configuring outputs during hotplug + (Federico Mena Quintero) +- Really lay out displays from left to right when using the XF86Display hotkey + (Federico Mena Quintero) +- For the XF86Display hotkey, preserve the cycle order when sanitizing the + configurations (Federico Mena Quintero) +- Remove last libglade dependency (Felix Riemann) +- Improved low disk space warning (Chris Coulson) (#573980) +- Fix compiler warnings (Jens Granseuer) +- Translations: + - es (Jorge González) + - et (Ivar Smolin) + - fr (Claude Paroz) + - he (Yaron Sharabani) + - sv (Daniel Nylander) + - ta (drtvasudevan) + - zh_HK (Chao-Hsiung Liao) + - zh_TW (Chao-Hsiung Liao) + +============== +Version 2.27.4 +============== +- Remove screensaver plugin, it's autostarted now (Matthias Clasen) +- Don't take too long in RANDR D-Bus method implementation (Federico Mena + Quintero) +- Add support for Synaptics touchpads (Matthias Clasen) +- Don't spawn more than one syncdaemon (Matthias Clasen) +- Depend on gnome-desktop >= 2.26.3 (Rodrigo Moya) +- Update gnome-volume-control code from master (Bastien Nocera) +- Fix order of arguments to strstr (Federico Mena Quintero) +- Depend on libxklavier 4.0 (Sergey V. Udaltsov) +- Remove libglade dependency from media-keys and keyboard plugins (Felix Riemann) +- Translations: + - he (Yaron Shahrabani) + - hu (Gabor Kelemen) + - in_BN (Runa Bhattacharjee) + - uk (Maxim V. Dziumanenko) + +============== +Version 2.27.3 +============== +- Make the RANDR tray icon's per-monitor labels explicitly black (Federico Mena + Quintero) (#556050) +- Include config.h so that the notifications code in housekeeping plugin can + actually be built (Jens Granseuer) (#584217) +- Use "screen reader" instead of "screenreader" in schema (Gabor Kelemen) (#572911) +- Lots of RANDR fixes and improvements (Federico Mena Quintero) +- Nicer handling of broken XKB configuration in gconf (Sergey Udaltsov) (#585259) +- Make 'locate pointer' deal with wm/cm changes (Matthias Clasen) (#585209) +- Be more careful when comparing two key structs (Matthias Clasen) (#580616) +- Translations: + - da (Ask H. Larsen) + - es (Jorge Gonzalez) + - et (Ivar Smolin) + - nb (Kjartan Maraas) + - sv (Daniel Nylander) + - ta (drtvasudevan) + +============== +Version 2.27.1 +============== +- Use ngettext for the reset dialog (Jens Granseuer) (#575409) +- Replace deprecated gtk_status_icon_set_tooltip (Thomas H.P. Andersen) (#578480) +- Updated translations: + - ca (Jordi Mas i Hernandez) + - es (Jorge Gonzalez) + - nb (Kjartan Maraas) + - sl (Matej Urban) + - zh_CN (Deng Xiyue) + +============== +Version 2.26.1 +============== +- Fix crash when closing the lid on some laptops (Jens Granseuer) (#576875) +- Fix crash when closing a11y notification bubble (Jens Granseuer) (#576535) + (use of libnotify >= 0.4.5 highly recommended) +- Fix problems with saving/restoring screen setup (Federico Mena Quintero) +- Make the screen resolution confirmation dialog always appear in front of + the settings window (Federico Mena Quintero) (#576006) +- Increase confirmation timeout to 30 seconds to give slower devices (like + projectors) time to adjust +- Avoid some GConf roundtrips (Jens Granseuer) (#578539, #578542) +- Build fixes (Jens Granseuer, yselkowitz@users.sourceforge.net) +- Updated translations: + - ar (Khaled Hosny) + - as (Amitakhya Phukan) + - kn (Shankar Prasad) + - nb (Kjartan Maraas) + - sr (MiloÅ¡ Popović) + - sr@latin (MiloÅ¡ Popović) + +============== +Version 2.26.0 +============== +- Make build work with -Wl,-z,defs (Christopher Taylor) (#574452) +- Updated translations: + - as (Amitakhya Phukan) + - ca (Gil Forcada) + - cs (Petr Kovar) + - da (Kenneth Nielsen) + - de (Mario Blättermann) + - el (Kostas Papadimas) + - eu (Inaki Larranaga Murgoitio) + - gl (Ignacio Casal Quinteiro) + - gu (Ankitkumar Patel) + - he (Yair Hershkovitz) + - hi (Rajesh Ranjan) + - it (Luca Ferretti) + - ja (Takeshi AIHANA) + - lt (Gintautas Miliauskas) + - ml (Ani Peter) + - mr (Sandeep Shedmake) + - or (Manoj Kumar Giri) + - ro (MiÈ™u Moldovan) + - ru (Nickolay V. Shmyrev) + - ta (I. Felix) + - te (Krishnababu K) + +=============== +Version 2.25.92 +=============== +- don't print warnings for disabled custom shortcuts (Jens Granseuer) +- revert screen resolution change if the user closes the confirmation window + using the close icon or by pressing escape (Jens Granseuer) (#571492) +- add missing keys for a11y shortcut keys to GConf schemas (Jens Granseuer) + (#572807) +- install gnome-settings-daemon-plugin.h for custom plugin developement + (Jens Granseuer) (#573610) +- Updated translations: + - bg (Alexander Shopov) + - en_GB (Philip Withnall) + - es (Jorge Gonzalez) + - fi (Ilkka Tuohela) + - fr (Claude Paroz) + - gu (Sweta Kothari) + - hu (Gabor Kelemen) + - ko (Changwoo Ryu) + - nl (Wouter Bolsterlee) + - pl (Tomasz Dominikowski) + - pt (Duarte Loreto) + - pt_BR (Krix Apolinário, Vladimir Melo) + - sv (Daniel Nylander) + - th (Theppitak Karoonboonyanan) + - zh_HK (Chao-Hsiung Liao) + - zh_TW (Chao-Hsiung Liao) + +=============== +Version 2.25.91 +=============== +- Have gnome-session restart g-s-d if it crashes (Matthias Clasen) +- Add --without-libnotify to disable notifications (Nirbheek Chauchan) +- Avoid warnings due to notifications on nonexisting status icons + (Matthias Clasen) +- Fix crash with invalid keyboard shortcuts (Jens Granseuer) +- fix label for "Don't show this message again" checkbox (Luca Ferretti) (#517821) +- HIG fix for button labels (Luca Ferretti) (#571819) +- Don't use legacy icons for keyboard and mouse (Luca Ferretti) (#571823) +- Fix alignment of the composited media window (Leo Iannacone) (#567249) +- Updated translations: + - ast (Mikel González) + - ca (Gil Forcada) + - da (Kenneth Nielsen) + - es (Jorge Gonzalez) + - eu (Iñaki Larrañaga Murgoitio) + - ja (Takeshi AIHANA) + - nl (Wouter Bolsterlee) + - pl (Tomasz Dominikowski) + - ro (Jani Monoses) + - sv (Daniel Nylander) + - vi (Clytie Siddall) + +=============== +Version 2.25.90 +=============== +- Initialize thread system (Frederic Peters) (#565515) +- Better support for Eject and Sleep actions on BSD (Jasper Lievisse Adriaanse) + (#565472) +- Spawn screensaver after a 30 second timeout instead of when idle so that it + doesn't compete with other processes when the session starts (Jens Granseuer) + (#564059) +- Add low diskspace notification (Vincent Untz) (#557647) +- Support hotkeys for a11y tools (Matthias Clasen) (#565310) +- Quiet xrdb when there are duplicate rules in the .ad files (Bastien Nocera) + (#566610) +- Add debugging output when de/registering media players (Jens Granseuer) + (#564433) +- Add a new sound plugin that tells PulseAudio to drop its sample cache when + the sound theme changes (Lennart Poettering) (#545386) +- Don't pop up an error message when there's no randr configuration file + (Federico Mena Quintero) +- Ungrab keys when key-related plugins are disabled (Jens Granseuer) (#567867) +- Use PulseAudio directly to change the volume (Bastien Nocera) (#567177) +- Don't draw_background immediately when nautilus is disabled, GnomeBG will + send a signal (Ray Strode) +- Add crossfade transition when switching backgrounds (Ray Strode) (#552857) +- Use XF86Explorer to launch the file manager (Bastien Nocera) +- Fix possible crash when pressing Fn-F7 (Andres Freund) (#568713) +- Delay drawing the background until SessionRunning (Ray Stode) +- Ask for confirmation with a timeout after changing the randr configuration + (Federico Mena Quintero) (#545115) +- Require gnome-desktop 2.25.6 (Jen Granseuer) +- Plug leaks +- Build fixes +- Updated translations: + - es (Jorge González) + - et (Mattias Põldaru) + - he (Yuval Tanny) + - hu (Gabor Kelemen) + - it (Luca Ferretti) + - ko (Changwoo Ryu) + - nb (Kjartan Maraas) + - pt_BR (Krix Apolinário) + - sv (Daniel Nylander) + - zh_CN (甘露(Gan Lu)) + +============== +Version 2.25.3 +============== +- Add support for fn-f7 type keys (Søren Sandmann) +- Use D-Bus instead of an X client mesage in the xrandr plugin, so + the front-end can get error messages as well (Federico Mena Quintero) +- Fix crash when the X server doesn't have the XInput extension (Jens Granseuer) (#562977) +- Don't call umask (Behdad Esfahbod) (#563543) +- Shut the daemon down properly when the SIGTERM signal is received or the + D-Bus bus goes away (Ray Strode) +- Restore AccessX bits to original values on exit, fixes sticky keys + coming on when gnome-settings-daemon has exited (Ray Strode) +- Use only top-level glib and gtk+ headers (Pedro Fragoso) (#563796) + +============== +Version 2.25.2 +============== +- No need to trap XkbQueryExtension and friends errors (Jens Granseuer) (#559346) +- Add some performance annotations around libxklavier calls (Behdad Esfahbod) +- Start managers in idle callbacks (Behdad Esfahbod) (#559482, #559564) +- Only initialize fontconfig when starting up (Behdad Esfahbod) (#559550) +- Remove unnecessary X error traps (Jens Granseuer) (#559562) +- Init a11y status icon only when needed (Behdad Esfahbod) (#559558) +- Reshufle plugin priorities a bit (Behdad Esfhabod) +- Delay constructing the GnomeBg object until we need it (Behdad Esfahbod) + (#559639) +- Listen for DeviceEnabled instead of DeviceAdded to be sure the mouse has + been initialized (William Grant) (#559827) +- Add debugging output for volume_step (Jens Granseuer) +- Fork before gtk_init (Behdad Esfahbod) (#559695) +- Lockdown in the keybinding plugin (Matthias Clasen) (#553434) +- Trap X errors so we don't crash on X servers that don't support DevicePresence + (Jens Granseuer) (#560618) +- Fix handling of time = GDK_CURRENT_TIME (Jens Granseuer) (#559797) +- Add bundle_loader linker flag to fix compilation on MacOS X (dmack@netspace.org) + (#522673) +- Grab all keycodes that match the respective keysim (Mario Limonciello) (#561275) +- Fix --no-daemon (Behdad Esfahbod) +- Depend on libxklavier 3.8 (Sergey Udaltsov) +- Fix checks for various X libraries (Jens Granseuer) +- Fix check for xklavier device discovery (Jens Granseuer) + +============== +Version 2.25.1 +============== +- Ignore the 'activate' signal for deselected items so that the rotation + setting doesn't reset when the systray menu is opened (Eric Piel) + (#554951) +- Don't make togglekeys_enable depend on global AccessX state (Jens + Granseuer) (#555009) +- Fix picking up of the GDM layout (Matthias Clasen) (#554525 and + #555873) +- Use printf safely (Christian Persch) (#555553) +- Show the shutdown dialog when the power button is pressed (Matthias + Clasen) (#556307) +- Support the Gtk/ButtonImages XSetting (Matthias Clasen) (#556797) +- Clean-up volume initialization (Jens Granseuer) (#552383) +- Make the composited volume images more clear (Bogdan Butnaru) + (#557307) +- Spawn screensaver process in idle callback (Rodrigo Moya) +- Remove sound plugin (Jens Granseuer) (#557806) +- Replace gnome_help_display_desktop with gtk_show_uri (Jens Granseuer) + (#557808) +- Listen for X device changes and reconfigure the mouse if necessary + (William Grant) (#549267) +- Remove AM_MAINTAINER_MODE (Jens Granseuer) (#558503) +- Disable xrdb plugin by default (Behdad Esfahbod) (#557807) +- Improve performance logging annotations (Behdad Esfahbod) (#559162) +- Cleanup font module (Behdad Esfahbod) (#559163) +- Don't trap errors around grab_key (Behdad Esfahbod) (#559164) +- Don't run 'mousetweaks -s' at startup (Behdad Esfahbod) (#559165) +- Start fontconfig monitors, mouse and clipboard managers in idle + callbacks (Behdad Esfahbod) (#559166) +- Preload gconf dirs when feasible (Behdad Esfahbod) (#559167) +- Wait for initialization processes to be done before spawning other + processes (Behdad Esfahbod) (#559168) +- Don't close stderr to not lose warnings (Behdad Esfahbod) +- Use a pipe to communicate between children and parent process instead + of a signal (Behdad Esfahbod) +- Updated translations: + - et (Priit Laes) + - mk (Jovan Naumovski) + - pt_BR (Leonardo Ferreira Fontenelle) + - sk (Marcel Telka) + +============== +Version 2.24.0 +============== +- Fix the fix for read-only home directories (Simon Zheng) (#530975) +- Make the volume popup not crash when invoking it on any screen but + the first when using a compositing manager (Jens Granseuer) + (#551677) +- Add GPLv2 copyright notice explicitly so that newer versions of + autotools don't declare us GPLv3 (Jens Granseuer) (#551956) +- Specify GTK modules to load in a GConf directory instead of the + single /desktop/gnome/gtk-modules key (Jens Granseuer) (#539840) +- Also allow linking the module state to other boolean keys by using + a string value that is the name of the key to use (Jens Granseuer) +- Made the housekeeping plugin less aggressive by default (Michael J. + Chudobiak) (#552680) +- Updated translations: + - af (Friedel Wolff) + - ar (Khaled Hosny) + - bn_IN (Runa Bhattacharjee) + - ca (Gil Forcada) + - da (Kenneth Nielsen) + - el (Kostas Papadimas) + - et (Priit Laes) + - he (Yair Hershkovitz) + - hu (Gabor Kelemen) + - it (Luca Ferretti) + - kn (Shankar Prasad) + - lt (Gintautas Miliauskas) + - ml (Praveen Arimbrathodiyil) + - mr (Sandeep Shedmake) + - pl (Wadim Dziedzic) + - pt_BR (Leonardo Ferreira Fontenelle) + - ro (MiÅŸu Moldovan) + - ta (Tirumurthi Vasudevan) + - zh_CN (Funda Wang) + +=============== +Version 2.23.92 +=============== +- Try harder to use the keyboard layout passed by GDM (Matthias Clasen) + (#551062) +- Updated translations: + - bg (Alexander Shopov) + - de (Hendrik Richter) + - en_GB (Philip Withnall) + - ga (Seán de Búrca) + - ko (Changwoo Ryu) + - nl (Reinout van Schouwen) + - pt (Duarte Loreto) + - sv (Daniel Nylander) + +=============== +Version 2.23.91 +=============== +- Removed translatable property on stock gtk-close (Claude Paroz) +- Fix a constness warning (Jens Granseuer) +- Fix a crash due to an incorrect signal handler definition (William Jon + McCann) +- Use a scale factor instead of a fixed DPI (William Jon McCann) +- Use g_warning instead of g_error when setup fails so we don't abort + (Jens Granseuer) (#549483) +- Updated translations: + - cs (Petr Kovar) + - eu (Inaki Larranaga Murgoitio) + - fi (Ilkka Tuohela) + - fr (Claude Paroz) + - ja (Takeshi AIHANA) + - nb (Kjartan Maraas) + - pt_BR (Leonardo Ferreira Fontenelle) + - th (Theppitak Karoonboonyanan) + - vi (Nguyá»…n Thái Ngá»c Duy) + - zh_HK (Chao-Hsiung Liao) + - zh_TW (Chao-Hsiung Liao) + +=============== +Version 2.23.90 +=============== +- PulseAudio check to not ouput "no" twice (Jens Granseuer) +- Add status icon when a11y hotkeys are enabled, and display Universal + Access preferences when it is clicked (William Jon McCann) (#526070) +- Simplify libnotify check, fix fontconfig result output (Jens Granseuer) +- Put the Glade file where all the others are (jens Granseuer) +- Remove some unnecessary boilerplate (Jens Granseuer) +- Use g_file_monitor instead of g_file_monitor_file/_directory (Jens + Granseuer) (#546372) +- Remove warning that isn't (Jens Granseuer) +- Fixed crash in randr startup (Jens Granseuer) +- Fail xrandr initialization if we couldn't start xrandr (Matthias Clasen) + (#546446) +- Try harder to clean up xrandr in _stop so we can enable/disable the plugin + on the fly (Jens Granseuer) +- For LIBSOUNDS, check for libgnomeui, not just libgnome (Federico Mena Quintero) +- Add sexy labels when setting up dual monitors (Federico Mena Quintero) +- Add a separator to the menu before "Configure display settings" (Federico Mena + Quintero) +- Use GDK to get DPI (William Jon McCann) +- Updated translations: + - ar (Djihed Afifi) + - es (Jorge Gonzalez) + - et (Priit Laes) + - fi (Ilkka Tuohela) + - gl (Ignacio Casal Quinteiro) + - ja (Takeshi AIHANA) + - he (Yair Hershkovitz) + - ml (Praveen Arimbrathodiyil) + - nb (Kjartan Maraas) + - pt (Duarte Loreto) + - pt_BR (Leonardo Ferreira Fontenelle) + - th (Theppitak Karoonboonyanan) + +============== +Version 2.23.6 +============== +- Remove libgnomeui dependency (James Sharpe) (#544347) +- Bump glib dependency to 2.15 (Wouter Bolsterlee) (#544737) +- Use standard icon names for the OSD (Matthias Clasen) (#544733) +- Make the display notification icon configurable (Søren Sandmann) +- Resolve NumLock dynamically (Jens Granseuer) (#165343) +- Updated translations: + - ar (Djihed Afifi) + - es (Jorge Gonzalez) + - gl (Ignacio Casal Quinteiro) + - nb (Kjartan Maraas) + - pt_BR (Leonardo Ferreira Fontenelle) + +============== +Version 2.23.5 +============== +- New settings for event sounds (Lennart Poettering) (#539786) +- Fix include path for building against uninstalled package. + (Damien Carbery) (#543289) +- Remove 'daemon' from the warning message (Gerd Kohlberger) (#543095) +- Make more shortcuts with shift work (Jens Granseuer) (#542275) +- Update RandR code to use new gnome-desktop API (Soren Sandmann) +- Fix accelerator check (Jens Granseuer) (#538699) +- Detect and enable PulseAudio (Colin Walters) (#533198) + +============== +Version 2.23.4 +============== +- Check for fontconfig instead of xft2 (Behdad Esfahbod) +- Send a Fontconfig/Timestamp xsettings notification whenever fontconfig + configurations change (Behdad Esfahbod) (#490374) +- Properly match keybindings that need Shift for resolving the keysym + (Jens Granseuer, Bastien Nocera) (#536581) +- If available use the esd_serverdir variable to locate the esd daemon + so it can be started even if it's not in the PATH (Jens Granseuer, Brian + Cameron) (#531868) +- Updated translations: + - ar (Djihed Afifi) + - th (Theppitak Karoonboonyanan) + +============== +Version 2.23.3 +============== +- Execute the correct action when there are multiple keyboard shortcuts with + the same keycode but different keysyms (Bastien Nocera) (#530356) +- Fix wallpaper handling for people running a session without nautilus + (Matthias Clasen) (#531487) +- Try to keep the keyboard layout from gdm (Matthias Clasen) (#531589) +- Don't die when the user's home directory is read-only (Brian Cameron) + (#530975) +- Fix artifacts from the locate pointer animation in non-composited mode + (Carlos Garnacho) (#531861) +- Pass clicks to the media popup window through to the underlying window + (Carlos Garnacho) (#531862) +- Use new gnome-desktop background API and get rid of libbackground (William + Jon McCann) +- Don't eat keypresses for multimedia key events in the mouse plugin (Bastien + Nocera) +- Shutdown when receiving the "SessionOver" signal from gnome-session (Lucas + Rocha, Jens Granseuer) (#522017) +- Fix memory leaks in the font plugin (Jens Granseuer) +- Move the locate pointer animation with the mouse cursor (Gerd Kohlberger) + (#531665) +- Fix build without GStreamer (Jens Granseuer) (#536177) +- Updated translation: + - ar (Djihed Afifi) + - bg (Yavor Doganov) + - es (Jorge Gonzalez) + - gl (Ignacio Casal Quinteiro) + - nb (Kjartan Maraas) + - th (Theppitak Karoonboonyanan) + - vi (Clytie Siddall) + +================ +Version 2.23.1.1 +================ +- Install .desktop for gnome-settings-daemon in a standard autostart directory + (Lucas Rocha) +- Updated translations: + - nb (Kjartan Maraas) + +============== +Version 2.23.1 +============== +- Sound server startup based on GConf setting, even when esd is disabled + (Alexey Shabalin) (#523743) +- Added a new "housekeeping" plugin to set limits on the size and age of the + thumbnail cache (Michael J. Chudobiak) (#523159) +- Fix mismatched modifier maping between egg and GTK (Jens Granseuer) +- Replace some custom functionality with stock GTK (Jens Granseuer) +- Mark string for translation (Jens Granseuer) +- Use G_DEFINE_TYPE instead of open-coding (Jens Granseuer) +- Change data types to match glib, avoid using time_t (Jens Granseuer) +- Add mapping for Gtk/Modules xsetting using GConf (Jens Granseuer) (#507386) +- Set GConf keys back to false if mousetweaks is not installed (Gerd Kohlberger) + (#525042) +- Don't try to add grabas with invalid modifiers (Jens Granseuer) +- Remove trailing newlines from messages since g_warning already takes care + of those (Jens Granseuer) +- Fix various leaks (Jens Granseuer) +- Fix TYPE macro and remove unimplemented prototype (Lorne Applebaum) +- Add a special volume subclass for better support of IBM Thinkpad hardware + volume buttons (Lorne Applebaum) (#524425) +- Initialize inited_ok or behaviour is undefined when xkb setup fails (Jens + Granseuer) +- Continued attempt at making XKB setup and error handling a bit less arcane + and crufty (Jens Granseuer) +- Only use the built-in default for volume_step if we get an error from GConf, + not just when the value is 0 which might be what the user wants (Jens + Granseuer) +- Adds a "threshold" property to the AcmeVolume class that denotes the minimum + percentage required to actually affect the volume (Jens Granseuer) +- Don't install any listeners or callbacks when XKB is not available (Jens + Granseuer) +- Remove excessive key grab logging (Jens Granseuer) +- Make plugins deactivation work (Jens Granseuer) +- Properly null-terminate g_build_filename (Jens Granseuer) +- Turn into a daemon by default and make --no-daemon work (Jens Granseuer) +- DBus API has been stable for a while; don't define DBUS_API_SUBJECT_TO_CHANGE + anymore (Jens Granseuer) +- Drop GConf backup for xkb (Sergey Udaltsov) +- Extract some functionality used by several plugins into a separate shared + helper library (Jens Granseuer) (#525426) +- Reset GConf keys when we can't launch the daemon (Jens Granseuer) +- Updated translations: + - bn_IN (Runa Bhattacharjee) + - es (Jorge Gonzalez) + - et (Priit Laes) + - nn (Eskild Hustvedt) + - sk (Marcel Telka) + - te (Sunil Mohan Adapa) + +============== +Version 2.22.1 +============== +- Fix segfault when shutting down the typing break monitor (Jens Granseuer) + (#521786) +- Set window type hint on the volume popup (Jens Granseuer) (#522232) +- Remove unused properties from actions GUI (Jens Granseuer) +- Reset opacity when removing the timeout (Jens Granseuer) (#522499) +- Fix handling of child process (William Jon McCann) +- Add a tool to test media keys (William Jon McCann) +- Add some profiling code (William Jon McCann) +- Fix compiler warnings (William Jon McCann) +- Fix leaks (William Jon McCann) (#524183) +- Add more stuff to the configuration summary (William Jon McCann) +- Don't eat key events (Jens Granseuer) (#523676) +- Apply keyboard settings on startup (Jens Granseuer) (#525440) +- Make "Home" keybinding work again (Jens Granseuer) +- Updated translations: + - bn_IN (Runa Bhattacharjee) + - et (Priit Laes) + - nn (Eskild Hustvedt) + - sk (Marcel Telka) + - te (Sunil Mohan Adapa) + - vi (Nguyá»…n Thái Ngá»c Duy) + +============== +Version 2.22.0 +============== + +- Actually link against libXi when building with XInput support (Jens Granseuer) + (#519488) +- Disable debug by default (William Jon McCann) +- Don't pass GError's if we're not going to use them (Jens Graseuer) +- Remove obsolete settings for the removed default editor plugin (Jens Granseuer) +- Updated translations: + - da (Kenneth Nielsen) + - el (Kostas Papadimas) + - en_GB (Philip Withnall) + - es (Jorge Gonzalez) + - et (Priit Laes) + - hu (Gabor Kelemen) + - it (Luca Ferretti) + - lt (Gintautas Miliauskas) + - mk (Arangel Angov) + - nb (Kjartan Maraas) + - nl (Vincent van Adrighem) + - ru (Leonid Kanter) + - uk (Maxim Dziumanenko) + - zh_HK (Chao-Hsiung Liao) + - zh_TW (Chao-Hsiung Liao) + +=============== +Version 2.21.92 +=============== + +- Only print debug messages if --debug is used +- Only load plugins when requested not at every start +- Fixed #515340, Add a way to prioritise plugin load (William Jon McCann) +- Fixed #515341, Signal when plugins finish loading (William Jon McCann) +- Fixed #517259, Escape hostname for use in gconf key (Vincent Untz) +- Fixed #517418, gnome-display-properties resolution change will not be used after logout or reboot (Jens Granseuer) +- Fixed #518075, Sound plugin should start pulseaudio itself (Bastien Nocera) + +Translations: +- Updated fr: Claude Paroz +- Updated de: Hendrik Brandt +- Updated nl: Vincent van Adrighem +- Updated be@latin: Ihar Hrachyshka +- Updated pt_BR: Jonh Wendell +- Updated pt: Duarte Loreto +- Updated ca: Gil Forcada +- Updated *: Matthias Clasen +- Updated oc: Yannig Marchegay +- Updated sv: Daniel Nylander +- Updated ja: Takeshi AIHANA +- Updated cs: Petr Kovar +- Updated ar: Djihed Afifi +- Updated it: Luca Ferretti +- Updated es: Jorge Gonzalez +- Updated th: Theppitak Karoonboonyanan +- Updated eu: Inaki Larranaga Murgoitio +- Updated fi: bug #518255, Ilkka Tuohela +- Updated gl: Ignacio Casal Quinteiro +- Updated nb: Kjartan Maraas +- Updated pl: Artur Flinta + +=============== +Version 2.21.91 +=============== + +- Use a flat directory instead of a hierarchy to install plugins + into (Christian Persch) (#513246) +- Don't scan the plugins directory recursively (Christian Persch) + (#513246) +- Install the settings plugin to a versioned directory to fix install + with libdir == libexecdir (Christan Persch) (#504203) +- Review short and long descriptions for GConf keys (Luca Ferretti) + (#514047) +- Don't crash when running the screensaver fails (Jens Granseuer) + (#514385) +- Rename src folder to gnome-settings-daemon (Damien Carberry, Jens + Granseuer) (#511820) +- Add uninstalled.pc file for building against an uninstalled copy of + g-s-d (Damien Carberry, Jens Granseuer) (#511820) +- Add separate checks for libbackground and use external copy (Jens + Granseuer) +- Use gnome_settings_daemon for the GConf path (Jens Granseuer) (#514411) +- Release the Glade XML ASAP and keep track of the 2 widgets we need + (Jens Granseuer) +- Make sure we return a GError if initialization fails (Jens Granseuer) + (#514926) +- Load the XKB settings initially (Matthias Clasen) (#511771) +- Fix leaks (Jens Granseuer) +- Unref the GConfClient only after done with it (Jens Granseuer) +- Check for xinput (Sebastien Bacher) (#514942) +- Fix copy'n'paste error (Jens Granseuer) (#515426) +- Declare variables at the beginning of a block to make older compilers + happy (Jens Granseuer) +- Add back support for defining plugin start order (Jens Granseuer) +- Assign return value from g_slist_sort to the plugins list variable + (Wouter Bolsterlee) (#515340) +- Replace gnome_vfs usage with GIO (Rodrigo Moya) (#513990) + +================= +Version 2.21.90.2 +================= + +- Use correct binary path in DBus service file (Rodrigo Moya) +- Updated translations: + - sv (Daniel Nylander) + +================= +Version 2.21.90.1 +================= + +- Use plain $libexecdir for g-s-d binary (Rodrigo Moya) + +=============== +Version 2.21.90 +=============== + +- Add a more appealing animation for locate pointer feature if composite + is available (Carlos Garnacho) +- Quote function names in AC_DEFUN to fix autoconf warnings (Jens Granseuer) +- Fix build with builddir != srcdir (Christian Persch) (#509142) +- Use g_ascii_dtostr instead of setlocale (Christian Persch) (#505470) +- Read check for XFT2 that got loast in the g-s-d split (Jens Granseuer) + (#510925) +- Fix typo in typing break key (Jens Granseuer) (#510429) +- Define GNOME_DESKTOP_USE_UNSTABLE_API before including gnome-bg.h (Jens + Granseuer) +- No longer define DBUS_API_SUBJECT_TO_CHANGE (Jens Granseuer) +- Initialize GnomeProgram to avoid critical warnings from libgnome (Wouter + Bolsterlee) (#509770) +- Hopefully allow $(libdir) to be the same directory as $(libexecdir) by + installing the gnome-settings-daemon binary into a subdirectory of + $(libexecdir) (Wouter Bolsterlee) (#504203) +- Don't use weird autofoo stuff to install gnome-settings-daemon into another + directory (Wouter Bolsterlee) (#504203) +- Suppress verbose GConf schema installation output (Wouter Bolsterlee) + +================ +Version 2.21.5.2 +================ + +- Use libtool for building static libs also (Rodrigo Moya) +- Automake fixes for allowing long file names (Rodrigo Moya) +- Updated translations: + - nb (Kjartan Maraas) + +================ +Version 2.21.5.1 +================ + +- Added translations from gnome-control-center module (Rodrigo Moya) + (#509651) + +=============== +Version 2.21.5 +=============== + +- Support animated backgrounds (Soren Sandmann) +- Init gnome-vfs and use correct name in desktop file (William Jon McCann) +- Use new setting from libgnome to make toolbar icon size setting work + (William Jon McCann) +- Add Gtk/IMModule XSetting (Akira TAGOH) (#504182) +- Reverted patch for SUPER key modifier (Rodrigo Moya) +- Support mousetweaks (Gerd Kohlberger) (#503547) +- Only consider /desktop/gnome/accessibility/keyboard/enable as option + for enabling keyboard a11y features from the keyboard, not as global + switch to turn all a11y features on/off (Denis Washington) + +=============== +Version 2.21.4 +=============== + +Initial development release of new gnome-settings-daemon design. diff --git a/README b/README new file mode 100644 index 00000000..e69de29b diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..d834aa44 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,137 @@ +dnl EXTRA_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([EXTRA_COMPILE_WARNINGS],[ + dnl ****************************** + dnl More compiler warnings + dnl ****************************** + + AC_ARG_ENABLE(compile-warnings, + AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@], + [Turn on compiler warnings]),, + [enable_compile_warnings="m4_default([$1],[yes])"]) + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall" + ;; + yes) + warning_flags="-Wall -Wmissing-prototypes" + ;; + maximum|error) + warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_RESULT($has_option) + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) + ;; + esac + CFLAGS="$realsave_CFLAGS" + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + AC_MSG_RESULT($warning_flags) + + AC_ARG_ENABLE(iso-c, + AC_HELP_STRING([--enable-iso-c], + [Try to warn if code is not ISO C ]),, + [enable_iso_c=no]) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + + WARN_CFLAGS="$warning_flags $complCFLAGS" + AC_SUBST(WARN_CFLAGS) +]) + +dnl as-ac-expand.m4 0.2.0 -*- autoconf -*- +dnl autostars m4 macro for expanding directories using configure's prefix + +dnl (C) 2003, 2004, 2005 Thomas Vander Stichele + +dnl Copying and distribution of this file, with or without modification, +dnl are permitted in any medium without royalty provided the copyright +dnl notice and this notice are preserved. + +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) + +dnl example: +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local + +AC_DEFUN([AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix="$ac_default_prefix" + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var" = "x$full_var"; then break; fi + full_var=$new_full_var + done + + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..0fb21a76 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,10689 @@ +# generated automatically by aclocal 1.12.2 -*- Autoconf -*- + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# Copyright (C) 1995-2002 Free Software Foundation, Inc. +# Copyright (C) 2001-2003,2004 Red Hat, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995, 1996 +# +# Modified to never use included libintl. +# Owen Taylor , 12/15/1998 +# +# Major rework to remove unused code +# Owen Taylor , 12/11/2002 +# +# Added better handling of ALL_LINGUAS from GNU gettext version +# written by Bruno Haible, Owen Taylor 5/30/3002 +# +# Modified to require ngettext +# Matthias Clasen 08/06/2004 +# +# We need this here as well, since someone might use autoconf-2.5x +# to configure GLib then an older version to configure a package +# using AM_GLIB_GNU_GETTEXT +AC_PREREQ(2.53) + +dnl +dnl We go to great lengths to make sure that aclocal won't +dnl try to pull in the installed version of these macros +dnl when running aclocal in the glib directory. +dnl +m4_copy([AC_DEFUN],[glib_DEFUN]) +m4_copy([AC_REQUIRE],[glib_REQUIRE]) +dnl +dnl At the end, if we're not within glib, we'll define the public +dnl definitions in terms of our private definitions. +dnl + +# GLIB_LC_MESSAGES +#-------------------- +glib_DEFUN([GLIB_LC_MESSAGES], + [AC_CHECK_HEADERS([locale.h]) + if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi + fi]) + +# GLIB_PATH_PROG_WITH_TEST +#---------------------------- +dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +glib_DEFUN([GLIB_PATH_PROG_WITH_TEST], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# GLIB_WITH_NLS +#----------------- +glib_DEFUN([GLIB_WITH_NLS], + dnl NLS is obligatory + [USE_NLS=yes + AC_SUBST(USE_NLS) + + gt_cv_have_gettext=no + + CATOBJEXT=NONE + XGETTEXT=: + INTLLIBS= + + AC_CHECK_HEADER(libintl.h, + [gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" + + # + # First check in libc + # + AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, + [AC_TRY_LINK([ +#include +], + [return !ngettext ("","", 1)], + gt_cv_func_ngettext_libc=yes, + gt_cv_func_ngettext_libc=no) + ]) + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, + [AC_TRY_LINK([ +#include +], + [return !dgettext ("","")], + gt_cv_func_dgettext_libc=yes, + gt_cv_func_dgettext_libc=no) + ]) + fi + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + AC_CHECK_FUNCS(bind_textdomain_codeset) + fi + + # + # If we don't have everything we want, check in libintl + # + if test "$gt_cv_func_dgettext_libc" != "yes" \ + || test "$gt_cv_func_ngettext_libc" != "yes" \ + || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then + + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CHECK_LIB(intl, ngettext, + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes)])]) + + if test "$gt_cv_func_dgettext_libintl" != "yes" ; then + AC_MSG_CHECKING([if -liconv is needed to use gettext]) + AC_MSG_RESULT([]) + AC_CHECK_LIB(intl, ngettext, + [AC_CHECK_LIB(intl, dcgettext, + [gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv], + :,-liconv)], + :,-liconv) + fi + + # + # If we found libintl, then check in it for bind_textdomain_codeset(); + # we'll prefer libc if neither have bind_textdomain_codeset(), + # and both have dgettext and ngettext + # + if test "$gt_cv_func_dgettext_libintl" = "yes" ; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $libintl_extra_libs" + unset ac_cv_func_bind_textdomain_codeset + AC_CHECK_FUNCS(bind_textdomain_codeset) + LIBS="$glib_save_LIBS" + + if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then + gt_cv_func_dgettext_libc=no + else + if test "$gt_cv_func_dgettext_libc" = "yes" \ + && test "$gt_cv_func_ngettext_libc" = "yes"; then + gt_cv_func_dgettext_libintl=no + fi + fi + fi + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + gt_cv_have_gettext=yes + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS="-lintl $libintl_extra_libs" + fi + + if test "$gt_cv_have_gettext" = "yes"; then + AC_DEFINE(HAVE_GETTEXT,1, + [Define if the GNU gettext() function is already present or preinstalled.]) + GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + AC_CHECK_FUNCS(dcgettext) + MSGFMT_OPTS= + AC_MSG_CHECKING([if msgfmt accepts -c]) + GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: test 1.0\n" +"PO-Revision-Date: 2007-02-15 12:01+0100\n" +"Last-Translator: test \n" +"Language-Team: C \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + AC_SUBST(MSGFMT_OPTS) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share and + dnl and CATOBJEXT=.gmo in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + ;; + *-*-openbsd*) + CATOBJEXT=.mo + DATADIRNAME=share + ;; + *) + CATOBJEXT=.mo + DATADIRNAME=lib + ;; + esac]) + LIBS="$glib_save_LIBS" + INSTOBJEXT=.mo + else + gt_cv_have_gettext=no + fi + fi + ]) + + if test "$gt_cv_have_gettext" = "yes" ; then + AC_DEFINE(ENABLE_NLS, 1, + [always defined to indicate that i18n is enabled]) + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is not GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.ac. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLLIBS) + AC_SUBST(PO_IN_DATADIR_TRUE) + AC_SUBST(PO_IN_DATADIR_FALSE) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +# AM_GLIB_GNU_GETTEXT +# ------------------- +# Do checks necessary for use of gettext. If a suitable implementation +# of gettext is found in either in libintl or in the C library, +# it will set INTLLIBS to the libraries needed for use of gettext +# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable +# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST() +# on various variables needed by the Makefile.in.in installed by +# glib-gettextize. +dnl +glib_DEFUN([GLIB_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + + GLIB_LC_MESSAGES + GLIB_WITH_NLS + + if test "$gt_cv_have_gettext" = "yes"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + +# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE) +# ------------------------------- +# Define VARIABLE to the location where catalog files will +# be installed by po/Makefile. +glib_DEFUN([GLIB_DEFINE_LOCALEDIR], +[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl +glib_save_prefix="$prefix" +glib_save_exec_prefix="$exec_prefix" +glib_save_datarootdir="$datarootdir" +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +datarootdir=`eval echo "${datarootdir}"` +if test "x$CATOBJEXT" = "x.mo" ; then + localedir=`eval echo "${libdir}/locale"` +else + localedir=`eval echo "${datadir}/locale"` +fi +prefix="$glib_save_prefix" +exec_prefix="$glib_save_exec_prefix" +datarootdir="$glib_save_datarootdir" +AC_DEFINE_UNQUOTED($1, "$localedir", + [Define the location where the catalogs will be installed]) +]) + +dnl +dnl Now the definitions that aclocal will find +dnl +ifdef(glib_configure_ac,[],[ +AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)]) +AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) +])dnl + +# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL]) +# +# Create a temporary file with TEST-FILE as its contents and pass the +# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with +# 0 and perform ACTION-IF-FAIL for any other exit status. +AC_DEFUN([GLIB_RUN_PROG], +[cat >conftest.foo <<_ACEOF +$2 +_ACEOF +if AC_RUN_LOG([$1 conftest.foo]); then + m4_ifval([$3], [$3], [:]) +m4_ifvaln([$4], [else $4])dnl +echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD +sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD +fi]) + + +dnl GLIB_GSETTINGS +dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether +dnl the schema should be compiled +dnl + +AC_DEFUN([GLIB_GSETTINGS], +[ + m4_pattern_allow([AM_V_GEN]) + AC_ARG_ENABLE(schemas-compile, + AS_HELP_STRING([--disable-schemas-compile], + [Disable regeneration of gschemas.compiled on install]), + [case ${enableval} in + yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;; + no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;; + esac]) + AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE]) + PKG_PROG_PKG_CONFIG([0.16]) + AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas]) + if test x$cross_compiling != xyes; then + GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0` + else + AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas) + fi + AC_SUBST(GLIB_COMPILE_SCHEMAS) + if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then + ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2]) + else + ifelse([$1],,[:],[$1]) + fi + + GSETTINGS_RULES=' +.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas + +mostlyclean-am: clean-gsettings-schemas + +gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE)) + +%.gschema.valid: %.gschema.xml $(gsettings__enum_file) + $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@ + +all-am: $(gsettings_SCHEMAS:.xml=.valid) +uninstall-am: uninstall-gsettings-schemas +install-data-am: install-gsettings-schemas + +.SECONDARY: $(gsettings_SCHEMAS) + +install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file) + @$(NORMAL_INSTALL) + if test -n "$^"; then \ + test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \ + $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \ + test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \ + fi + +uninstall-gsettings-schemas: + @$(NORMAL_UNINSTALL) + @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files + test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir) + +clean-gsettings-schemas: + rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file) + +ifdef gsettings_ENUM_NAMESPACE +$(gsettings__enum_file): $(gsettings_ENUM_FILES) + $(AM_V_GEN) glib-mkenums --comments '\'''\'' --fhead "" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " " --vtail " " --ftail "" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@ +endif +' + _GSETTINGS_SUBST(GSETTINGS_RULES) +]) + +dnl _GSETTINGS_SUBST(VARIABLE) +dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST +AC_DEFUN([_GSETTINGS_SUBST], +[ +AC_SUBST([$1]) +m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) +] +) + + +dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) +# serial 42 IT_PROG_INTLTOOL +AC_DEFUN([IT_PROG_INTLTOOL], [ +AC_PREREQ([2.50])dnl +AC_REQUIRE([AM_NLS])dnl + +case "$am__api_version" in + 1.[01234]) + AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) + ;; + *) + ;; +esac + +INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` +INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +if test -n "$1"; then + AC_MSG_CHECKING([for intltool >= $1]) + AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) +fi + +AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) +AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) +AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) +if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then + AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) +fi + +if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 +fi +AC_SUBST([AM_DEFAULT_VERBOSITY]) + +INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' +INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' +INTLTOOL__v_MERGE_0='@echo " ITMRG " [$]@;' +AC_SUBST(INTLTOOL_V_MERGE) +AC_SUBST(INTLTOOL__v_MERGE_) +AC_SUBST(INTLTOOL__v_MERGE_0) + +INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))' +intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))' +intltool__v_merge_options_0='-q' +AC_SUBST(INTLTOOL_V_MERGE_OPTIONS) +AC_SUBST(intltool__v_merge_options_) +AC_SUBST(intltool__v_merge_options_0) + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< [$]@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< [$]@' +else + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.[$][$]RANDOM && mkdir [$][$]_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u [$][$]_it_tmp_dir $< [$]@ && rmdir [$][$]_it_tmp_dir' +fi + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + +_IT_SUBST(INTLTOOL_DESKTOP_RULE) +_IT_SUBST(INTLTOOL_DIRECTORY_RULE) +_IT_SUBST(INTLTOOL_KEYS_RULE) +_IT_SUBST(INTLTOOL_PROP_RULE) +_IT_SUBST(INTLTOOL_OAF_RULE) +_IT_SUBST(INTLTOOL_PONG_RULE) +_IT_SUBST(INTLTOOL_SERVER_RULE) +_IT_SUBST(INTLTOOL_SHEET_RULE) +_IT_SUBST(INTLTOOL_SOUNDLIST_RULE) +_IT_SUBST(INTLTOOL_UI_RULE) +_IT_SUBST(INTLTOOL_XAM_RULE) +_IT_SUBST(INTLTOOL_KBD_RULE) +_IT_SUBST(INTLTOOL_XML_RULE) +_IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) +_IT_SUBST(INTLTOOL_CAVES_RULE) +_IT_SUBST(INTLTOOL_SCHEMAS_RULE) +_IT_SUBST(INTLTOOL_THEME_RULE) +_IT_SUBST(INTLTOOL_SERVICE_RULE) +_IT_SUBST(INTLTOOL_POLICY_RULE) + +# Check the gettext tools to make sure they are GNU +AC_PATH_PROG(XGETTEXT, xgettext) +AC_PATH_PROG(MSGMERGE, msgmerge) +AC_PATH_PROG(MSGFMT, msgfmt) +AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) +if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) +fi +xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" +mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" +mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" +if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) +fi + +AC_PATH_PROG(INTLTOOL_PERL, perl) +if test -z "$INTLTOOL_PERL"; then + AC_MSG_ERROR([perl not found]) +fi +AC_MSG_CHECKING([for perl >= 5.8.1]) +$INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 +if test $? -ne 0; then + AC_MSG_ERROR([perl 5.8.1 is required for intltool]) +else + IT_PERL_VERSION=`$INTLTOOL_PERL -e "printf '%vd', $^V"` + AC_MSG_RESULT([$IT_PERL_VERSION]) +fi +if test "x$2" != "xno-xml"; then + AC_MSG_CHECKING([for XML::Parser]) + if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([XML::Parser perl module is required for intltool]) + fi +fi + +# Substitute ALL_LINGUAS so we can use it in po/Makefile +AC_SUBST(ALL_LINGUAS) + +# Set DATADIRNAME correctly if it is not set yet +# (copied from glib-gettext.m4) +if test -z "$DATADIRNAME"; then + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]], + [[extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr]])], + [DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share + dnl in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [DATADIRNAME=share], [DATADIRNAME=lib]) + ;; + *) + [DATADIRNAME=lib] + ;; + esac]) +fi +AC_SUBST(DATADIRNAME) + +IT_PO_SUBDIR([po]) + +]) + + +# IT_PO_SUBDIR(DIRNAME) +# --------------------- +# All po subdirs have to be declared with this macro; the subdir "po" is +# declared by IT_PROG_INTLTOOL. +# +AC_DEFUN([IT_PO_SUBDIR], +[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. +dnl +dnl The following CONFIG_COMMANDS should be executed at the very end +dnl of config.status. +AC_CONFIG_COMMANDS_PRE([ + AC_CONFIG_COMMANDS([$1/stamp-it], [ + if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then + AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) + fi + rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" + >"$1/stamp-it.tmp" + [sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" + ] + [sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r $1/POTFILES + } + ' "$1/Makefile.in" >"$1/Makefile"] + rm -f "$1/Makefile.tmp" + mv "$1/stamp-it.tmp" "$1/stamp-it" + ]) +])dnl +]) + +# _IT_SUBST(VARIABLE) +# ------------------- +# Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST +# +AC_DEFUN([_IT_SUBST], +[ +AC_SUBST([$1]) +m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) +] +) + +# deprecated macros +AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) +# A hint is needed for aclocal from Automake <= 1.9.4: +# AC_DEFUN([AC_PROG_INTLTOOL], ...) + + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS + +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) + +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) + +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 3337 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.2' +macro_revision='1.3337' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) + +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) + +# nls.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.50]) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE([nls], + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + +# Copyright (C) 2002-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.12' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.12.2], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.12.2])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 17 + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each '.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 19 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], +[$0: two- and three-arguments forms are deprecated. For more info, see: +http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +dnl Support for Objective C++ was only introduced in Autoconf 2.65, +dnl but we still cater to Autoconf 2.62. +m4_ifdef([AC_PROG_OBJCXX], +[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Copyright (C) 1999-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of '-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/compile b/compile new file mode 100755 index 00000000..7b4a9a7e --- /dev/null +++ b/compile @@ -0,0 +1,342 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-03-05.13; # UTC + +# Copyright (C) 1999-2012 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# 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, 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/config.guess b/config.guess new file mode 100755 index 00000000..c0adba94 --- /dev/null +++ b/config.guess @@ -0,0 +1,1530 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-06-10' + +# This file 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, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 00000000..7f146afd --- /dev/null +++ b/config.h.in @@ -0,0 +1,116 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* always defined to indicate that i18n is enabled */ +#undef ENABLE_NLS + +/* enable profiling */ +#undef ENABLE_PROFILING + +/* Name of default gettext domain */ +#undef GETTEXT_PACKAGE + +/* Define to 1 if you have the `bind_textdomain_codeset' function. */ +#undef HAVE_BIND_TEXTDOMAIN_CODESET + +/* Define to 1 if you have the header file. */ +#undef HAVE_CUPS_CUPS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CUPS_HTTP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CUPS_IPP_H + +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* define if GUdev is available */ +#undef HAVE_GUDEV + +/* Defined if IBus support is enabled */ +#undef HAVE_IBUS + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if your file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Got new lcms2 */ +#undef HAVE_NEW_LCMS + +/* Define if PackageKit should be used */ +#undef HAVE_PACKAGEKIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if systemd is used for session tracking */ +#undef HAVE_SYSTEMD + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define if smartcard support should be enabled */ +#undef SMARTCARD_SUPPORT + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/config.sub b/config.sub new file mode 100755 index 00000000..6205f842 --- /dev/null +++ b/config.sub @@ -0,0 +1,1782 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-04-18' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ + | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i386-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 00000000..06075534 --- /dev/null +++ b/configure @@ -0,0 +1,23304 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for gnome-settings-daemon 3.6.4. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='gnome-settings-daemon' +PACKAGE_TARNAME='gnome-settings-daemon' +PACKAGE_VERSION='3.6.4' +PACKAGE_STRING='gnome-settings-daemon 3.6.4' +PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon' +PACKAGE_URL='' + +ac_unique_file="gnome-settings-daemon/gnome-settings-manager.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +DEBUG_CFLAGS +ENABLE_MAN_FALSE +ENABLE_MAN_TRUE +XSLTPROC +PLUGIN_CFLAGS +plugindir +BUILD_PRINT_NOTIFICATIONS_FALSE +BUILD_PRINT_NOTIFICATIONS_TRUE +CUPS_LIBS +CUPS_CFLAGS +CUPS_CONFIG +WITH_SYSTEMD_FALSE +WITH_SYSTEMD_TRUE +SYSTEMD_LIBS +SYSTEMD_CFLAGS +NSS_DATABASE +SMARTCARD_SUPPORT_FALSE +SMARTCARD_SUPPORT_TRUE +NSS_LIBS +NSS_CFLAGS +HAVE_PACKAGEKIT_FALSE +HAVE_PACKAGEKIT_TRUE +PACKAGEKIT_LIBS +PACKAGEKIT_CFLAGS +HAVE_WACOM_FALSE +HAVE_WACOM_TRUE +WACOM_LIBS +WACOM_CFLAGS +COLOR_LIBS +COLOR_CFLAGS +BACKLIGHT_HELPER_LIBS +BACKLIGHT_HELPER_CFLAGS +POWER_LIBS +POWER_CFLAGS +SOUND_LIBS +SOUND_CFLAGS +ORIENTATION_LIBS +ORIENTATION_CFLAGS +XRANDR_LIBS +XRANDR_CFLAGS +MEDIA_KEYS_LIBS +MEDIA_KEYS_CFLAGS +GIOUNIX_LIBS +GIOUNIX_CFLAGS +KEYBOARD_LIBS +KEYBOARD_CFLAGS +HAVE_IBUS_FALSE +HAVE_IBUS_TRUE +XSETTINGS_LIBS +XSETTINGS_CFLAGS +CURSOR_LIBS +CURSOR_CFLAGS +MOUSE_LIBS +MOUSE_CFLAGS +BACKGROUND_LIBS +BACKGROUND_CFLAGS +AUTOMOUNT_LIBS +AUTOMOUNT_CFLAGS +COMMON_LIBS +COMMON_CFLAGS +HAVE_GUDEV_FALSE +HAVE_GUDEV_TRUE +GUDEV_LIBS +GUDEV_CFLAGS +LIBNOTIFY_LIBS +LIBNOTIFY_CFLAGS +LCMS_LIBS +LCMS_CFLAGS +GNOME_DESKTOP_LIBS +GNOME_DESKTOP_CFLAGS +GSETTINGS_RULES +GLIB_COMPILE_SCHEMAS +gsettingsschemadir +GSETTINGS_DISABLE_SCHEMAS_COMPILE +GLIB_GENMARSHAL +GSD_PLUGIN_LDFLAGS +SETTINGS_PLUGIN_LIBS +SETTINGS_PLUGIN_CFLAGS +SETTINGS_DAEMON_LIBS +SETTINGS_DAEMON_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +WARN_CFLAGS +GSD_INTLTOOL_PLUGIN_RULE +MKINSTALLDIRS +POSUB +POFILES +PO_IN_DATADIR_FALSE +PO_IN_DATADIR_TRUE +INTLLIBS +INSTOBJEXT +GMOFILES +CATOBJEXT +CATALOGS +MSGFMT_OPTS +GETTEXT_PACKAGE +DATADIRNAME +ALL_LINGUAS +INTLTOOL_PERL +GMSGFMT +MSGFMT +MSGMERGE +XGETTEXT +INTLTOOL_POLICY_RULE +INTLTOOL_SERVICE_RULE +INTLTOOL_THEME_RULE +INTLTOOL_SCHEMAS_RULE +INTLTOOL_CAVES_RULE +INTLTOOL_XML_NOMERGE_RULE +INTLTOOL_XML_RULE +INTLTOOL_KBD_RULE +INTLTOOL_XAM_RULE +INTLTOOL_UI_RULE +INTLTOOL_SOUNDLIST_RULE +INTLTOOL_SHEET_RULE +INTLTOOL_SERVER_RULE +INTLTOOL_PONG_RULE +INTLTOOL_OAF_RULE +INTLTOOL_PROP_RULE +INTLTOOL_KEYS_RULE +INTLTOOL_DIRECTORY_RULE +INTLTOOL_DESKTOP_RULE +intltool__v_merge_options_0 +intltool__v_merge_options_ +INTLTOOL_V_MERGE_OPTIONS +INTLTOOL__v_MERGE_0 +INTLTOOL__v_MERGE_ +INTLTOOL_V_MERGE +INTLTOOL_EXTRACT +INTLTOOL_MERGE +INTLTOOL_UPDATE +USE_NLS +CXXCPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +GSD_API_VERSION +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_silent_rules +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_nls +enable_compile_warnings +enable_iso_c +enable_schemas_compile +enable_gudev +enable_ibus +enable_packagekit +enable_smartcard_support +with_nssdb +enable_systemd +enable_cups +enable_profiling +enable_man +enable_more_warnings +enable_debug +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +CXXCPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +SETTINGS_DAEMON_CFLAGS +SETTINGS_DAEMON_LIBS +SETTINGS_PLUGIN_CFLAGS +SETTINGS_PLUGIN_LIBS +GNOME_DESKTOP_CFLAGS +GNOME_DESKTOP_LIBS +LCMS_CFLAGS +LCMS_LIBS +LIBNOTIFY_CFLAGS +LIBNOTIFY_LIBS +GUDEV_CFLAGS +GUDEV_LIBS +COMMON_CFLAGS +COMMON_LIBS +AUTOMOUNT_CFLAGS +AUTOMOUNT_LIBS +BACKGROUND_CFLAGS +BACKGROUND_LIBS +MOUSE_CFLAGS +MOUSE_LIBS +CURSOR_CFLAGS +CURSOR_LIBS +XSETTINGS_CFLAGS +XSETTINGS_LIBS +KEYBOARD_CFLAGS +KEYBOARD_LIBS +GIOUNIX_CFLAGS +GIOUNIX_LIBS +MEDIA_KEYS_CFLAGS +MEDIA_KEYS_LIBS +XRANDR_CFLAGS +XRANDR_LIBS +ORIENTATION_CFLAGS +ORIENTATION_LIBS +SOUND_CFLAGS +SOUND_LIBS +POWER_CFLAGS +POWER_LIBS +BACKLIGHT_HELPER_CFLAGS +BACKLIGHT_HELPER_LIBS +COLOR_CFLAGS +COLOR_LIBS +WACOM_CFLAGS +WACOM_LIBS +PACKAGEKIT_CFLAGS +PACKAGEKIT_LIBS +NSS_CFLAGS +NSS_LIBS +SYSTEMD_CFLAGS +SYSTEMD_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures gnome-settings-daemon 3.6.4 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root + [DATAROOTDIR/doc/gnome-settings-daemon] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of gnome-settings-daemon 3.6.4:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-maintainer-mode + disable make rules and dependencies not useful (and + sometimes confusing) to the casual installer + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-nls do not use Native Language Support + --enable-compile-warnings=[no/minimum/yes/maximum/error] + Turn on compiler warnings + --enable-iso-c Try to warn if code is not ISO C + --disable-schemas-compile + Disable regeneration of gschemas.compiled on install + --disable-gudev Disable GUdev support (not optional on Linux + platforms) + --disable-ibus Disable IBus support + --disable-packagekit turn off PackageKit support + --disable-smartcard-support + turn off smartcard support + --enable-systemd Use systemd for session tracking + --disable-cups disable CUPS support (default: enabled) + --enable-profiling turn on profiling + --enable-man generate man pages [default=yes] + --enable-more-warnings Maximum compiler warnings + --enable-debug turn on debugging + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-nssdb where system NSS database is + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + SETTINGS_DAEMON_CFLAGS + C compiler flags for SETTINGS_DAEMON, overriding pkg-config + SETTINGS_DAEMON_LIBS + linker flags for SETTINGS_DAEMON, overriding pkg-config + SETTINGS_PLUGIN_CFLAGS + C compiler flags for SETTINGS_PLUGIN, overriding pkg-config + SETTINGS_PLUGIN_LIBS + linker flags for SETTINGS_PLUGIN, overriding pkg-config + GNOME_DESKTOP_CFLAGS + C compiler flags for GNOME_DESKTOP, overriding pkg-config + GNOME_DESKTOP_LIBS + linker flags for GNOME_DESKTOP, overriding pkg-config + LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config + LCMS_LIBS linker flags for LCMS, overriding pkg-config + LIBNOTIFY_CFLAGS + C compiler flags for LIBNOTIFY, overriding pkg-config + LIBNOTIFY_LIBS + linker flags for LIBNOTIFY, overriding pkg-config + GUDEV_CFLAGS + C compiler flags for GUDEV, overriding pkg-config + GUDEV_LIBS linker flags for GUDEV, overriding pkg-config + COMMON_CFLAGS + C compiler flags for COMMON, overriding pkg-config + COMMON_LIBS linker flags for COMMON, overriding pkg-config + AUTOMOUNT_CFLAGS + C compiler flags for AUTOMOUNT, overriding pkg-config + AUTOMOUNT_LIBS + linker flags for AUTOMOUNT, overriding pkg-config + BACKGROUND_CFLAGS + C compiler flags for BACKGROUND, overriding pkg-config + BACKGROUND_LIBS + linker flags for BACKGROUND, overriding pkg-config + MOUSE_CFLAGS + C compiler flags for MOUSE, overriding pkg-config + MOUSE_LIBS linker flags for MOUSE, overriding pkg-config + CURSOR_CFLAGS + C compiler flags for CURSOR, overriding pkg-config + CURSOR_LIBS linker flags for CURSOR, overriding pkg-config + XSETTINGS_CFLAGS + C compiler flags for XSETTINGS, overriding pkg-config + XSETTINGS_LIBS + linker flags for XSETTINGS, overriding pkg-config + KEYBOARD_CFLAGS + C compiler flags for KEYBOARD, overriding pkg-config + KEYBOARD_LIBS + linker flags for KEYBOARD, overriding pkg-config + GIOUNIX_CFLAGS + C compiler flags for GIOUNIX, overriding pkg-config + GIOUNIX_LIBS + linker flags for GIOUNIX, overriding pkg-config + MEDIA_KEYS_CFLAGS + C compiler flags for MEDIA_KEYS, overriding pkg-config + MEDIA_KEYS_LIBS + linker flags for MEDIA_KEYS, overriding pkg-config + XRANDR_CFLAGS + C compiler flags for XRANDR, overriding pkg-config + XRANDR_LIBS linker flags for XRANDR, overriding pkg-config + ORIENTATION_CFLAGS + C compiler flags for ORIENTATION, overriding pkg-config + ORIENTATION_LIBS + linker flags for ORIENTATION, overriding pkg-config + SOUND_CFLAGS + C compiler flags for SOUND, overriding pkg-config + SOUND_LIBS linker flags for SOUND, overriding pkg-config + POWER_CFLAGS + C compiler flags for POWER, overriding pkg-config + POWER_LIBS linker flags for POWER, overriding pkg-config + BACKLIGHT_HELPER_CFLAGS + C compiler flags for BACKLIGHT_HELPER, overriding pkg-config + BACKLIGHT_HELPER_LIBS + linker flags for BACKLIGHT_HELPER, overriding pkg-config + COLOR_CFLAGS + C compiler flags for COLOR, overriding pkg-config + COLOR_LIBS linker flags for COLOR, overriding pkg-config + WACOM_CFLAGS + C compiler flags for WACOM, overriding pkg-config + WACOM_LIBS linker flags for WACOM, overriding pkg-config + PACKAGEKIT_CFLAGS + C compiler flags for PACKAGEKIT, overriding pkg-config + PACKAGEKIT_LIBS + linker flags for PACKAGEKIT, overriding pkg-config + NSS_CFLAGS C compiler flags for NSS, overriding pkg-config + NSS_LIBS linker flags for NSS, overriding pkg-config + SYSTEMD_CFLAGS + C compiler flags for SYSTEMD, overriding pkg-config + SYSTEMD_LIBS + linker flags for SYSTEMD, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +gnome-settings-daemon configure 3.6.4 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------------------------------------------------------ ## +## Report this to http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon ## +## ------------------------------------------------------------------------------------ ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by gnome-settings-daemon $as_me 3.6.4, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +am__api_version='1.12' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='gnome-settings-daemon' + VERSION='3.6.4' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 +$as_echo_n "checking how to create a ustar tar archive... " >&6; } +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar plaintar pax cpio none' +_am_tools=${am_cv_prog_tar_ustar-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of '-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x ustar -w "$$tardir"' + am__tar_='pax -L -x ustar -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H ustar -L' + am__tar_='find "$tardir" -print | cpio -o -H ustar -L' + am__untar='cpio -i -H ustar -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_ustar}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +if ${am_cv_prog_tar_ustar+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_prog_tar_ustar=$_am_tool +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 +$as_echo "$am_cv_prog_tar_ustar" >&6; } + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + + + + +GSD_API_VERSION="3.0" + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec_CXX='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + gnu*) + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } + test "$ld_shlibs_CXX" = no && can_build_shared=no + + GCC_CXX="$GXX" + LD_CXX="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +$as_echo "$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink || + test "$inherit_rpath_CXX" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + +ac_config_headers="$ac_config_headers config.h" + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + +case "$am__api_version" in + 1.01234) + as_fn_error $? "Automake 1.5 or newer is required to use intltool" "$LINENO" 5 + ;; + *) + ;; +esac + +INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.37.1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` +INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +if test -n "0.37.1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= 0.37.1" >&5 +$as_echo_n "checking for intltool >= 0.37.1... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5 +$as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; } + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + as_fn_error $? "Your intltool is too old. You need intltool 0.37.1 or later." "$LINENO" 5 +fi + +# Extract the first word of "intltool-update", so it can be a program name with args. +set dummy intltool-update; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_INTLTOOL_UPDATE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $INTLTOOL_UPDATE in + [\\/]* | ?:[\\/]*) + ac_cv_path_INTLTOOL_UPDATE="$INTLTOOL_UPDATE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_INTLTOOL_UPDATE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +INTLTOOL_UPDATE=$ac_cv_path_INTLTOOL_UPDATE +if test -n "$INTLTOOL_UPDATE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_UPDATE" >&5 +$as_echo "$INTLTOOL_UPDATE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "intltool-merge", so it can be a program name with args. +set dummy intltool-merge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_INTLTOOL_MERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $INTLTOOL_MERGE in + [\\/]* | ?:[\\/]*) + ac_cv_path_INTLTOOL_MERGE="$INTLTOOL_MERGE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_INTLTOOL_MERGE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +INTLTOOL_MERGE=$ac_cv_path_INTLTOOL_MERGE +if test -n "$INTLTOOL_MERGE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_MERGE" >&5 +$as_echo "$INTLTOOL_MERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "intltool-extract", so it can be a program name with args. +set dummy intltool-extract; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_INTLTOOL_EXTRACT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $INTLTOOL_EXTRACT in + [\\/]* | ?:[\\/]*) + ac_cv_path_INTLTOOL_EXTRACT="$INTLTOOL_EXTRACT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_INTLTOOL_EXTRACT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +INTLTOOL_EXTRACT=$ac_cv_path_INTLTOOL_EXTRACT +if test -n "$INTLTOOL_EXTRACT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_EXTRACT" >&5 +$as_echo "$INTLTOOL_EXTRACT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then + as_fn_error $? "The intltool scripts were not found. Please install intltool." "$LINENO" 5 +fi + +if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 +fi + + +INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' +INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' +INTLTOOL__v_MERGE_0='@echo " ITMRG " $@;' + + + + +INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))' +intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))' +intltool__v_merge_options_0='-q' + + + + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< $@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< $@' +else + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.$$RANDOM && mkdir $$_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u $$_it_tmp_dir $< $@ && rmdir $$_it_tmp_dir' +fi + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Check the gettext tools to make sure they are GNU +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $XGETTEXT in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +XGETTEXT=$ac_cv_path_XGETTEXT +if test -n "$XGETTEXT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGMERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MSGMERGE in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +MSGMERGE=$ac_cv_path_MSGMERGE +if test -n "$MSGMERGE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +MSGFMT=$ac_cv_path_MSGFMT +if test -n "$MSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then + as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5 +fi +xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" +mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" +mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" +if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then + as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5 +fi + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_INTLTOOL_PERL+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $INTLTOOL_PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_INTLTOOL_PERL="$INTLTOOL_PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_INTLTOOL_PERL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +INTLTOOL_PERL=$ac_cv_path_INTLTOOL_PERL +if test -n "$INTLTOOL_PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_PERL" >&5 +$as_echo "$INTLTOOL_PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test -z "$INTLTOOL_PERL"; then + as_fn_error $? "perl not found" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl >= 5.8.1" >&5 +$as_echo_n "checking for perl >= 5.8.1... " >&6; } +$INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 +if test $? -ne 0; then + as_fn_error $? "perl 5.8.1 is required for intltool" "$LINENO" 5 +else + IT_PERL_VERSION=`$INTLTOOL_PERL -e "printf '%vd', $^V"` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IT_PERL_VERSION" >&5 +$as_echo "$IT_PERL_VERSION" >&6; } +fi +if test "x" != "xno-xml"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML::Parser" >&5 +$as_echo_n "checking for XML::Parser... " >&6; } + if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } + else + as_fn_error $? "XML::Parser perl module is required for intltool" "$LINENO" 5 + fi +fi + +# Substitute ALL_LINGUAS so we can use it in po/Makefile + + +# Set DATADIRNAME correctly if it is not set yet +# (copied from glib-gettext.m4) +if test -z "$DATADIRNAME"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + DATADIRNAME=share +else + case $host in + *-*-solaris*) + ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" +if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : + DATADIRNAME=share +else + DATADIRNAME=lib +fi + + ;; + *) + DATADIRNAME=lib + ;; + esac +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + + + + +GETTEXT_PACKAGE=gnome-settings-daemon + + +cat >>confdefs.h <<_ACEOF +#define GETTEXT_PACKAGE "$GETTEXT_PACKAGE" +_ACEOF + + + + for ac_header in locale.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" +if test "x$ac_cv_header_locale_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LOCALE_H 1 +_ACEOF + +fi + +done + + if test $ac_cv_header_locale_h = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5 +$as_echo_n "checking for LC_MESSAGES... " >&6; } +if ${am_cv_val_LC_MESSAGES+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_val_LC_MESSAGES=yes +else + am_cv_val_LC_MESSAGES=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_val_LC_MESSAGES" >&5 +$as_echo "$am_cv_val_LC_MESSAGES" >&6; } + if test $am_cv_val_LC_MESSAGES = yes; then + +$as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h + + fi + fi + USE_NLS=yes + + + gt_cv_have_gettext=no + + CATOBJEXT=NONE + XGETTEXT=: + INTLLIBS= + + ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" +if test "x$ac_cv_header_libintl_h" = xyes; then : + gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" + + # + # First check in libc + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in libc" >&5 +$as_echo_n "checking for ngettext in libc... " >&6; } +if ${gt_cv_func_ngettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ +return !ngettext ("","", 1) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_ngettext_libc=yes +else + gt_cv_func_ngettext_libc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_ngettext_libc" >&5 +$as_echo "$gt_cv_func_ngettext_libc" >&6; } + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in libc" >&5 +$as_echo_n "checking for dgettext in libc... " >&6; } +if ${gt_cv_func_dgettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ +return !dgettext ("","") + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_dgettext_libc=yes +else + gt_cv_func_dgettext_libc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_dgettext_libc" >&5 +$as_echo "$gt_cv_func_dgettext_libc" >&6; } + fi + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + for ac_func in bind_textdomain_codeset +do : + ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" +if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_BIND_TEXTDOMAIN_CODESET 1 +_ACEOF + +fi +done + + fi + + # + # If we don't have everything we want, check in libintl + # + if test "$gt_cv_func_dgettext_libc" != "yes" \ + || test "$gt_cv_func_ngettext_libc" != "yes" \ + || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bindtextdomain in -lintl" >&5 +$as_echo_n "checking for bindtextdomain in -lintl... " >&6; } +if ${ac_cv_lib_intl_bindtextdomain+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char bindtextdomain (); +int +main () +{ +return bindtextdomain (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_bindtextdomain=yes +else + ac_cv_lib_intl_bindtextdomain=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_bindtextdomain" >&5 +$as_echo "$ac_cv_lib_intl_bindtextdomain" >&6; } +if test "x$ac_cv_lib_intl_bindtextdomain" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5 +$as_echo_n "checking for ngettext in -lintl... " >&6; } +if ${ac_cv_lib_intl_ngettext+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ngettext (); +int +main () +{ +return ngettext (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_ngettext=yes +else + ac_cv_lib_intl_ngettext=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_ngettext" >&5 +$as_echo "$ac_cv_lib_intl_ngettext" >&6; } +if test "x$ac_cv_lib_intl_ngettext" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5 +$as_echo_n "checking for dgettext in -lintl... " >&6; } +if ${ac_cv_lib_intl_dgettext+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dgettext (); +int +main () +{ +return dgettext (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_dgettext=yes +else + ac_cv_lib_intl_dgettext=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dgettext" >&5 +$as_echo "$ac_cv_lib_intl_dgettext" >&6; } +if test "x$ac_cv_lib_intl_dgettext" = xyes; then : + gt_cv_func_dgettext_libintl=yes +fi + +fi + +fi + + + if test "$gt_cv_func_dgettext_libintl" != "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -liconv is needed to use gettext" >&5 +$as_echo_n "checking if -liconv is needed to use gettext... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5 +$as_echo_n "checking for ngettext in -lintl... " >&6; } +if ${ac_cv_lib_intl_ngettext+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl -liconv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ngettext (); +int +main () +{ +return ngettext (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_ngettext=yes +else + ac_cv_lib_intl_ngettext=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_ngettext" >&5 +$as_echo "$ac_cv_lib_intl_ngettext" >&6; } +if test "x$ac_cv_lib_intl_ngettext" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dcgettext in -lintl" >&5 +$as_echo_n "checking for dcgettext in -lintl... " >&6; } +if ${ac_cv_lib_intl_dcgettext+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl -liconv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dcgettext (); +int +main () +{ +return dcgettext (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_dcgettext=yes +else + ac_cv_lib_intl_dcgettext=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dcgettext" >&5 +$as_echo "$ac_cv_lib_intl_dcgettext" >&6; } +if test "x$ac_cv_lib_intl_dcgettext" = xyes; then : + gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv +else + : +fi + +else + : +fi + + fi + + # + # If we found libintl, then check in it for bind_textdomain_codeset(); + # we'll prefer libc if neither have bind_textdomain_codeset(), + # and both have dgettext and ngettext + # + if test "$gt_cv_func_dgettext_libintl" = "yes" ; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $libintl_extra_libs" + unset ac_cv_func_bind_textdomain_codeset + for ac_func in bind_textdomain_codeset +do : + ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" +if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_BIND_TEXTDOMAIN_CODESET 1 +_ACEOF + +fi +done + + LIBS="$glib_save_LIBS" + + if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then + gt_cv_func_dgettext_libc=no + else + if test "$gt_cv_func_dgettext_libc" = "yes" \ + && test "$gt_cv_func_ngettext_libc" = "yes"; then + gt_cv_func_dgettext_libintl=no + fi + fi + fi + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + gt_cv_have_gettext=yes + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS="-lintl $libintl_extra_libs" + fi + + if test "$gt_cv_have_gettext" = "yes"; then + +$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + if test "$MSGFMT" != "no"; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + for ac_func in dcgettext +do : + ac_fn_c_check_func "$LINENO" "dcgettext" "ac_cv_func_dcgettext" +if test "x$ac_cv_func_dcgettext" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DCGETTEXT 1 +_ACEOF + +fi +done + + MSGFMT_OPTS= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if msgfmt accepts -c" >&5 +$as_echo_n "checking if msgfmt accepts -c... " >&6; } + cat >conftest.foo <<_ACEOF + +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: test 1.0\n" +"PO-Revision-Date: 2007-02-15 12:01+0100\n" +"Last-Translator: test \n" +"Language-Team: C \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" + +_ACEOF +if { { $as_echo "$as_me:${as_lineno-$LINENO}: \$MSGFMT -c -o /dev/null conftest.foo"; } >&5 + ($MSGFMT -c -o /dev/null conftest.foo) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + MSGFMT_OPTS=-c; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +echo "$as_me: failed input was:" >&5 +sed 's/^/| /' conftest.foo >&5 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + CATOBJEXT=.gmo + DATADIRNAME=share +else + case $host in + *-*-solaris*) + ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" +if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : + CATOBJEXT=.gmo + DATADIRNAME=share +else + CATOBJEXT=.mo + DATADIRNAME=lib +fi + + ;; + *-*-openbsd*) + CATOBJEXT=.mo + DATADIRNAME=share + ;; + *) + CATOBJEXT=.mo + DATADIRNAME=lib + ;; + esac +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$glib_save_LIBS" + INSTOBJEXT=.mo + else + gt_cv_have_gettext=no + fi + fi + +fi + + + + if test "$gt_cv_have_gettext" = "yes" ; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5 +$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; } + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + ac_config_commands="$ac_config_commands default-1" + + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + + + + + + + + + + + + + if test "$gt_cv_have_gettext" = "yes"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5 +$as_echo_n "checking for catalogs to be installed... " >&6; } + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5 +$as_echo "$LINGUAS" >&6; } + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + + +GSD_INTLTOOL_PLUGIN_RULE='%.gnome-settings-plugin: %.gnome-settings-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + + + +GLIB_REQUIRED_VERSION=2.31.0 +GTK_REQUIRED_VERSION=3.3.18 +GCONF_REQUIRED_VERSION=2.6.1 +GIO_REQUIRED_VERSION=2.26.0 +GNOME_DESKTOP_REQUIRED_VERSION=3.5.3 +LIBNOTIFY_REQUIRED_VERSION=0.7.3 +UPOWER_GLIB_REQUIRED_VERSION=0.9.1 +PA_REQUIRED_VERSION=0.9.16 +LIBWACOM_REQUIRED_VERSION=0.6 +UPOWER_REQUIRED_VERSION=0.9.11 +IBUS_REQUIRED_VERSION=1.4.99 + + + + # Check whether --enable-compile-warnings was given. +if test "${enable_compile_warnings+set}" = set; then : + enableval=$enable_compile_warnings; +else + enable_compile_warnings="yes" +fi + + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall" + ;; + yes) + warning_flags="-Wall -Wmissing-prototypes" + ;; + maximum|error) + warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands $option" >&5 +$as_echo_n "checking whether gcc understands $option... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + has_option=yes +else + has_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5 +$as_echo "$has_option" >&6; } + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + as_fn_error $? "Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" "$LINENO" 5 + ;; + esac + CFLAGS="$realsave_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what warning flags to pass to the C compiler" >&5 +$as_echo_n "checking what warning flags to pass to the C compiler... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $warning_flags" >&5 +$as_echo "$warning_flags" >&6; } + + # Check whether --enable-iso-c was given. +if test "${enable_iso_c+set}" = set; then : + enableval=$enable_iso_c; +else + enable_iso_c=no +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what language compliance flags to pass to the C compiler" >&5 +$as_echo_n "checking what language compliance flags to pass to the C compiler... " >&6; } + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *\ \ -ansi\ \ *) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *\ \ -pedantic\ \ *) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $complCFLAGS" >&5 +$as_echo "$complCFLAGS" >&6; } + + WARN_CFLAGS="$warning_flags $complCFLAGS" + + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SETTINGS_DAEMON" >&5 +$as_echo_n "checking for SETTINGS_DAEMON... " >&6; } + +if test -n "$SETTINGS_DAEMON_CFLAGS"; then + pkg_cv_SETTINGS_DAEMON_CFLAGS="$SETTINGS_DAEMON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED_VERSION + gtk+-3.0 >= \$GTK_REQUIRED_VERSION + gio-2.0 >= \$GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SETTINGS_DAEMON_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SETTINGS_DAEMON_LIBS"; then + pkg_cv_SETTINGS_DAEMON_LIBS="$SETTINGS_DAEMON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED_VERSION + gtk+-3.0 >= \$GTK_REQUIRED_VERSION + gio-2.0 >= \$GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SETTINGS_DAEMON_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SETTINGS_DAEMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +" 2>&1` + else + SETTINGS_DAEMON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SETTINGS_DAEMON_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +) were not met: + +$SETTINGS_DAEMON_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables SETTINGS_DAEMON_CFLAGS +and SETTINGS_DAEMON_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables SETTINGS_DAEMON_CFLAGS +and SETTINGS_DAEMON_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + SETTINGS_DAEMON_CFLAGS=$pkg_cv_SETTINGS_DAEMON_CFLAGS + SETTINGS_DAEMON_LIBS=$pkg_cv_SETTINGS_DAEMON_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SETTINGS_PLUGIN" >&5 +$as_echo_n "checking for SETTINGS_PLUGIN... " >&6; } + +if test -n "$SETTINGS_PLUGIN_CFLAGS"; then + pkg_cv_SETTINGS_PLUGIN_CFLAGS="$SETTINGS_PLUGIN_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-3.0 >= \$GTK_REQUIRED_VERSION + gio-2.0 >= \$GIO_REQUIRED_VERSION + libnotify >= \$LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SETTINGS_PLUGIN_CFLAGS=`$PKG_CONFIG --cflags "gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SETTINGS_PLUGIN_LIBS"; then + pkg_cv_SETTINGS_PLUGIN_LIBS="$SETTINGS_PLUGIN_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-3.0 >= \$GTK_REQUIRED_VERSION + gio-2.0 >= \$GIO_REQUIRED_VERSION + libnotify >= \$LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SETTINGS_PLUGIN_LIBS=`$PKG_CONFIG --libs "gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SETTINGS_PLUGIN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +" 2>&1` + else + SETTINGS_PLUGIN_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SETTINGS_PLUGIN_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +) were not met: + +$SETTINGS_PLUGIN_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables SETTINGS_PLUGIN_CFLAGS +and SETTINGS_PLUGIN_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables SETTINGS_PLUGIN_CFLAGS +and SETTINGS_PLUGIN_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + SETTINGS_PLUGIN_CFLAGS=$pkg_cv_SETTINGS_PLUGIN_CFLAGS + SETTINGS_PLUGIN_LIBS=$pkg_cv_SETTINGS_PLUGIN_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +GSD_PLUGIN_LDFLAGS="-export_dynamic -module -avoid-version -no-undefined" +case $host_os in + darwin*) + GSD_PLUGIN_LDFLAGS="${GSD_PLUGIN_LDFLAGS} -Wl,-bundle_loader,\$(top_builddir)/gnome-settings-daemon/gnome-settings-daemon" + ;; +esac + + +# Extract the first word of "glib-genmarshal", so it can be a program name with args. +set dummy glib-genmarshal; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GLIB_GENMARSHAL+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GLIB_GENMARSHAL in + [\\/]* | ?:[\\/]*) + ac_cv_path_GLIB_GENMARSHAL="$GLIB_GENMARSHAL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GLIB_GENMARSHAL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GLIB_GENMARSHAL=$ac_cv_path_GLIB_GENMARSHAL +if test -n "$GLIB_GENMARSHAL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GLIB_GENMARSHAL" >&5 +$as_echo "$GLIB_GENMARSHAL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + + + # Check whether --enable-schemas-compile was given. +if test "${enable_schemas_compile+set}" = set; then : + enableval=$enable_schemas_compile; case ${enableval} in + yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;; + no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;; + *) as_fn_error $? "bad value ${enableval} for --enable-schemas-compile" "$LINENO" 5 ;; + esac +fi + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.16 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + gsettingsschemadir=${datadir}/glib-2.0/schemas + + if test x$cross_compiling != xyes; then + GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0` + else + # Extract the first word of "glib-compile-schemas", so it can be a program name with args. +set dummy glib-compile-schemas; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GLIB_COMPILE_SCHEMAS+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GLIB_COMPILE_SCHEMAS in + [\\/]* | ?:[\\/]*) + ac_cv_path_GLIB_COMPILE_SCHEMAS="$GLIB_COMPILE_SCHEMAS" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GLIB_COMPILE_SCHEMAS="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GLIB_COMPILE_SCHEMAS=$ac_cv_path_GLIB_COMPILE_SCHEMAS +if test -n "$GLIB_COMPILE_SCHEMAS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GLIB_COMPILE_SCHEMAS" >&5 +$as_echo "$GLIB_COMPILE_SCHEMAS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then + as_fn_error $? "glib-compile-schemas not found." "$LINENO" 5 + else + : + fi + + GSETTINGS_RULES=' +.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas + +mostlyclean-am: clean-gsettings-schemas + +gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE)) + +%.gschema.valid: %.gschema.xml $(gsettings__enum_file) + $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch $@ + +all-am: $(gsettings_SCHEMAS:.xml=.valid) +uninstall-am: uninstall-gsettings-schemas +install-data-am: install-gsettings-schemas + +.SECONDARY: $(gsettings_SCHEMAS) + +install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file) + @$(NORMAL_INSTALL) + if test -n "$^"; then \ + test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \ + $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \ + test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \ + fi + +uninstall-gsettings-schemas: + @$(NORMAL_UNINSTALL) + @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files + test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir) + +clean-gsettings-schemas: + rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file) + +ifdef gsettings_ENUM_NAMESPACE +$(gsettings__enum_file): $(gsettings_ENUM_FILES) + $(AM_V_GEN) glib-mkenums --comments '\'''\'' --fhead "" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " " --vtail " " --ftail "" $^ > $@.tmp && mv $@.tmp $@ +endif +' + + + + + + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNOME_DESKTOP" >&5 +$as_echo_n "checking for GNOME_DESKTOP... " >&6; } + +if test -n "$GNOME_DESKTOP_CFLAGS"; then + pkg_cv_GNOME_DESKTOP_CFLAGS="$GNOME_DESKTOP_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GNOME_DESKTOP_CFLAGS=`$PKG_CONFIG --cflags "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GNOME_DESKTOP_LIBS"; then + pkg_cv_GNOME_DESKTOP_LIBS="$GNOME_DESKTOP_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GNOME_DESKTOP_LIBS=`$PKG_CONFIG --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GNOME_DESKTOP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>&1` + else + GNOME_DESKTOP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GNOME_DESKTOP_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) were not met: + +$GNOME_DESKTOP_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GNOME_DESKTOP_CFLAGS +and GNOME_DESKTOP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GNOME_DESKTOP_CFLAGS +and GNOME_DESKTOP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + GNOME_DESKTOP_CFLAGS=$pkg_cv_GNOME_DESKTOP_CFLAGS + GNOME_DESKTOP_LIBS=$pkg_cv_GNOME_DESKTOP_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5 +$as_echo_n "checking for LCMS... " >&6; } + +if test -n "$LCMS_CFLAGS"; then + pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2 >= 2.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lcms2 >= 2.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms2 >= 2.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LCMS_LIBS"; then + pkg_cv_LCMS_LIBS="$LCMS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2 >= 2.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lcms2 >= 2.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms2 >= 2.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lcms2 >= 2.2" 2>&1` + else + LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lcms2 >= 2.2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LCMS_PKG_ERRORS" >&5 + + have_new_lcms=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_new_lcms=no +else + LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS + LCMS_LIBS=$pkg_cv_LCMS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_new_lcms=yes +fi +if test x$have_new_lcms = xyes; then + +$as_echo "#define HAVE_NEW_LCMS 1" >>confdefs.h + +else + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5 +$as_echo_n "checking for LCMS... " >&6; } + +if test -n "$LCMS_CFLAGS"; then + pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LCMS_LIBS"; then + pkg_cv_LCMS_LIBS="$LCMS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lcms2" 2>&1` + else + LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lcms2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LCMS_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (lcms2) were not met: + +$LCMS_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LCMS_CFLAGS +and LCMS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LCMS_CFLAGS +and LCMS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS + LCMS_LIBS=$pkg_cv_LCMS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5 +$as_echo_n "checking for LIBNOTIFY... " >&6; } + +if test -n "$LIBNOTIFY_CFLAGS"; then + pkg_cv_LIBNOTIFY_CFLAGS="$LIBNOTIFY_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= \$LIBNOTIFY_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libnotify >= $LIBNOTIFY_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNOTIFY_CFLAGS=`$PKG_CONFIG --cflags "libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNOTIFY_LIBS"; then + pkg_cv_LIBNOTIFY_LIBS="$LIBNOTIFY_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= \$LIBNOTIFY_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libnotify >= $LIBNOTIFY_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNOTIFY_LIBS=`$PKG_CONFIG --libs "libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>&1` + else + LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNOTIFY_PKG_ERRORS" >&5 + + have_libnotify=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_libnotify=no +else + LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS + LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_libnotify=yes +fi +if test "x$have_libnotify" = xno ; then + as_fn_error $? "libnotify is required to build gnome-settings-daemon" "$LINENO" 5 +fi + + + +GUDEV_PKG="" +# Check whether --enable-gudev was given. +if test "${enable_gudev+set}" = set; then : + enableval=$enable_gudev; enable_gudev=$enableval +fi + +if test x$enable_gudev != xno; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GUDEV" >&5 +$as_echo_n "checking for GUDEV... " >&6; } + +if test -n "$GUDEV_CFLAGS"; then + pkg_cv_GUDEV_CFLAGS="$GUDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gudev-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gudev-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GUDEV_CFLAGS=`$PKG_CONFIG --cflags "gudev-1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GUDEV_LIBS"; then + pkg_cv_GUDEV_LIBS="$GUDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gudev-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gudev-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GUDEV_LIBS=`$PKG_CONFIG --libs "gudev-1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GUDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gudev-1.0" 2>&1` + else + GUDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gudev-1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GUDEV_PKG_ERRORS" >&5 + + have_gudev="no" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_gudev="no" +else + GUDEV_CFLAGS=$pkg_cv_GUDEV_CFLAGS + GUDEV_LIBS=$pkg_cv_GUDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_gudev="yes" +fi + if test "x$have_gudev" = "xyes"; then + +$as_echo "#define HAVE_GUDEV 1" >>confdefs.h + + GUDEV_PKG="gudev-1.0" + else + if test x$enable_gudev = xyes; then + as_fn_error $? "GUdev enabled but not found" "$LINENO" 5 + fi + fi +else + have_gudev=no +fi + if test x$have_gudev = xyes; then + HAVE_GUDEV_TRUE= + HAVE_GUDEV_FALSE='#' +else + HAVE_GUDEV_TRUE='#' + HAVE_GUDEV_FALSE= +fi + + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for COMMON" >&5 +$as_echo_n "checking for COMMON... " >&6; } + +if test -n "$COMMON_CFLAGS"; then + pkg_cv_COMMON_CFLAGS="$COMMON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 kbproto xi\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 kbproto xi") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COMMON_CFLAGS=`$PKG_CONFIG --cflags "x11 kbproto xi" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COMMON_LIBS"; then + pkg_cv_COMMON_LIBS="$COMMON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 kbproto xi\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 kbproto xi") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COMMON_LIBS=`$PKG_CONFIG --libs "x11 kbproto xi" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COMMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11 kbproto xi" 2>&1` + else + COMMON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11 kbproto xi" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COMMON_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (x11 kbproto xi) were not met: + +$COMMON_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables COMMON_CFLAGS +and COMMON_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables COMMON_CFLAGS +and COMMON_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + COMMON_CFLAGS=$pkg_cv_COMMON_CFLAGS + COMMON_LIBS=$pkg_cv_COMMON_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AUTOMOUNT" >&5 +$as_echo_n "checking for AUTOMOUNT... " >&6; } + +if test -n "$AUTOMOUNT_CFLAGS"; then + pkg_cv_AUTOMOUNT_CFLAGS="$AUTOMOUNT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 kbproto\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 kbproto") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_AUTOMOUNT_CFLAGS=`$PKG_CONFIG --cflags "x11 kbproto" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$AUTOMOUNT_LIBS"; then + pkg_cv_AUTOMOUNT_LIBS="$AUTOMOUNT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 kbproto\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 kbproto") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_AUTOMOUNT_LIBS=`$PKG_CONFIG --libs "x11 kbproto" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + AUTOMOUNT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11 kbproto" 2>&1` + else + AUTOMOUNT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11 kbproto" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$AUTOMOUNT_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (x11 kbproto) were not met: + +$AUTOMOUNT_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables AUTOMOUNT_CFLAGS +and AUTOMOUNT_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables AUTOMOUNT_CFLAGS +and AUTOMOUNT_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + AUTOMOUNT_CFLAGS=$pkg_cv_AUTOMOUNT_CFLAGS + AUTOMOUNT_LIBS=$pkg_cv_AUTOMOUNT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BACKGROUND" >&5 +$as_echo_n "checking for BACKGROUND... " >&6; } + +if test -n "$BACKGROUND_CFLAGS"; then + pkg_cv_BACKGROUND_CFLAGS="$BACKGROUND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_BACKGROUND_CFLAGS=`$PKG_CONFIG --cflags "x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$BACKGROUND_LIBS"; then + pkg_cv_BACKGROUND_LIBS="$BACKGROUND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_BACKGROUND_LIBS=`$PKG_CONFIG --libs "x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + BACKGROUND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>&1` + else + BACKGROUND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$BACKGROUND_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) were not met: + +$BACKGROUND_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables BACKGROUND_CFLAGS +and BACKGROUND_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables BACKGROUND_CFLAGS +and BACKGROUND_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + BACKGROUND_CFLAGS=$pkg_cv_BACKGROUND_CFLAGS + BACKGROUND_LIBS=$pkg_cv_BACKGROUND_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MOUSE" >&5 +$as_echo_n "checking for MOUSE... " >&6; } + +if test -n "$MOUSE_CFLAGS"; then + pkg_cv_MOUSE_CFLAGS="$MOUSE_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xi\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xi") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MOUSE_CFLAGS=`$PKG_CONFIG --cflags "x11 xi" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$MOUSE_LIBS"; then + pkg_cv_MOUSE_LIBS="$MOUSE_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xi\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xi") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MOUSE_LIBS=`$PKG_CONFIG --libs "x11 xi" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MOUSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11 xi" 2>&1` + else + MOUSE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11 xi" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$MOUSE_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (x11 xi) were not met: + +$MOUSE_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables MOUSE_CFLAGS +and MOUSE_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables MOUSE_CFLAGS +and MOUSE_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + MOUSE_CFLAGS=$pkg_cv_MOUSE_CFLAGS + MOUSE_LIBS=$pkg_cv_MOUSE_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CURSOR" >&5 +$as_echo_n "checking for CURSOR... " >&6; } + +if test -n "$CURSOR_CFLAGS"; then + pkg_cv_CURSOR_CFLAGS="$CURSOR_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xfixes\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xfixes") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURSOR_CFLAGS=`$PKG_CONFIG --cflags "xfixes" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CURSOR_LIBS"; then + pkg_cv_CURSOR_LIBS="$CURSOR_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xfixes\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xfixes") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURSOR_LIBS=`$PKG_CONFIG --libs "xfixes" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CURSOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xfixes" 2>&1` + else + CURSOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xfixes" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CURSOR_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (xfixes) were not met: + +$CURSOR_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables CURSOR_CFLAGS +and CURSOR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables CURSOR_CFLAGS +and CURSOR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + CURSOR_CFLAGS=$pkg_cv_CURSOR_CFLAGS + CURSOR_LIBS=$pkg_cv_CURSOR_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSETTINGS" >&5 +$as_echo_n "checking for XSETTINGS... " >&6; } + +if test -n "$XSETTINGS_CFLAGS"; then + pkg_cv_XSETTINGS_CFLAGS="$XSETTINGS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XSETTINGS_CFLAGS=`$PKG_CONFIG --cflags "fontconfig" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$XSETTINGS_LIBS"; then + pkg_cv_XSETTINGS_LIBS="$XSETTINGS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontconfig\""; } >&5 + ($PKG_CONFIG --exists --print-errors "fontconfig") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XSETTINGS_LIBS=`$PKG_CONFIG --libs "fontconfig" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XSETTINGS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fontconfig" 2>&1` + else + XSETTINGS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fontconfig" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$XSETTINGS_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (fontconfig) were not met: + +$XSETTINGS_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XSETTINGS_CFLAGS +and XSETTINGS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XSETTINGS_CFLAGS +and XSETTINGS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + XSETTINGS_CFLAGS=$pkg_cv_XSETTINGS_CFLAGS + XSETTINGS_LIBS=$pkg_cv_XSETTINGS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +# Check whether --enable-ibus was given. +if test "${enable_ibus+set}" = set; then : + enableval=$enable_ibus; enable_ibus=$enableval +else + enable_ibus=yes +fi + + +if test "x$enable_ibus" = "xyes" ; then + IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" + +$as_echo "#define HAVE_IBUS 1" >>confdefs.h + +else + IBUS_MODULE= +fi + if test "x$enable_ibus" == "xyes"; then + HAVE_IBUS_TRUE= + HAVE_IBUS_FALSE='#' +else + HAVE_IBUS_TRUE='#' + HAVE_IBUS_FALSE= +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for KEYBOARD" >&5 +$as_echo_n "checking for KEYBOARD... " >&6; } + +if test -n "$KEYBOARD_CFLAGS"; then + pkg_cv_KEYBOARD_CFLAGS="$KEYBOARD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xkbfile \$IBUS_MODULE gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_KEYBOARD_CFLAGS=`$PKG_CONFIG --cflags "xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$KEYBOARD_LIBS"; then + pkg_cv_KEYBOARD_LIBS="$KEYBOARD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xkbfile \$IBUS_MODULE gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_KEYBOARD_LIBS=`$PKG_CONFIG --libs "xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + KEYBOARD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>&1` + else + KEYBOARD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$KEYBOARD_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) were not met: + +$KEYBOARD_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables KEYBOARD_CFLAGS +and KEYBOARD_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables KEYBOARD_CFLAGS +and KEYBOARD_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + KEYBOARD_CFLAGS=$pkg_cv_KEYBOARD_CFLAGS + KEYBOARD_LIBS=$pkg_cv_KEYBOARD_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GIOUNIX" >&5 +$as_echo_n "checking for GIOUNIX... " >&6; } + +if test -n "$GIOUNIX_CFLAGS"; then + pkg_cv_GIOUNIX_CFLAGS="$GIOUNIX_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-unix-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gio-unix-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GIOUNIX_CFLAGS=`$PKG_CONFIG --cflags "gio-unix-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GIOUNIX_LIBS"; then + pkg_cv_GIOUNIX_LIBS="$GIOUNIX_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-unix-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gio-unix-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GIOUNIX_LIBS=`$PKG_CONFIG --libs "gio-unix-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GIOUNIX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-unix-2.0" 2>&1` + else + GIOUNIX_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-unix-2.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GIOUNIX_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gio-unix-2.0) were not met: + +$GIOUNIX_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GIOUNIX_CFLAGS +and GIOUNIX_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GIOUNIX_CFLAGS +and GIOUNIX_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + GIOUNIX_CFLAGS=$pkg_cv_GIOUNIX_CFLAGS + GIOUNIX_LIBS=$pkg_cv_GIOUNIX_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MEDIA_KEYS" >&5 +$as_echo_n "checking for MEDIA_KEYS... " >&6; } + +if test -n "$MEDIA_KEYS_CFLAGS"; then + pkg_cv_MEDIA_KEYS_CFLAGS="$MEDIA_KEYS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-unix-2.0 libpulse >= \$PA_REQUIRED_VERSION \$GUDEV_PKG libpulse-mainloop-glib >= \$PA_REQUIRED_VERSION libcanberra\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MEDIA_KEYS_CFLAGS=`$PKG_CONFIG --cflags "gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$MEDIA_KEYS_LIBS"; then + pkg_cv_MEDIA_KEYS_LIBS="$MEDIA_KEYS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-unix-2.0 libpulse >= \$PA_REQUIRED_VERSION \$GUDEV_PKG libpulse-mainloop-glib >= \$PA_REQUIRED_VERSION libcanberra\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MEDIA_KEYS_LIBS=`$PKG_CONFIG --libs "gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MEDIA_KEYS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra" 2>&1` + else + MEDIA_KEYS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$MEDIA_KEYS_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra) were not met: + +$MEDIA_KEYS_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables MEDIA_KEYS_CFLAGS +and MEDIA_KEYS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables MEDIA_KEYS_CFLAGS +and MEDIA_KEYS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + MEDIA_KEYS_CFLAGS=$pkg_cv_MEDIA_KEYS_CFLAGS + MEDIA_KEYS_LIBS=$pkg_cv_MEDIA_KEYS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRANDR" >&5 +$as_echo_n "checking for XRANDR... " >&6; } + +if test -n "$XRANDR_CFLAGS"; then + pkg_cv_XRANDR_CFLAGS="$XRANDR_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= \$UPOWER_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XRANDR_CFLAGS=`$PKG_CONFIG --cflags "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$XRANDR_LIBS"; then + pkg_cv_XRANDR_LIBS="$XRANDR_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= \$UPOWER_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XRANDR_LIBS=`$PKG_CONFIG --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XRANDR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION" 2>&1` + else + XRANDR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$XRANDR_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION) were not met: + +$XRANDR_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XRANDR_CFLAGS +and XRANDR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XRANDR_CFLAGS +and XRANDR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + XRANDR_CFLAGS=$pkg_cv_XRANDR_CFLAGS + XRANDR_LIBS=$pkg_cv_XRANDR_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +if test x$have_gudev != xno; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ORIENTATION" >&5 +$as_echo_n "checking for ORIENTATION... " >&6; } + +if test -n "$ORIENTATION_CFLAGS"; then + pkg_cv_ORIENTATION_CFLAGS="$ORIENTATION_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ORIENTATION_CFLAGS=`$PKG_CONFIG --cflags "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$ORIENTATION_LIBS"; then + pkg_cv_ORIENTATION_LIBS="$ORIENTATION_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ORIENTATION_LIBS=`$PKG_CONFIG --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + ORIENTATION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0" 2>&1` + else + ORIENTATION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$ORIENTATION_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0) were not met: + +$ORIENTATION_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables ORIENTATION_CFLAGS +and ORIENTATION_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables ORIENTATION_CFLAGS +and ORIENTATION_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + ORIENTATION_CFLAGS=$pkg_cv_ORIENTATION_CFLAGS + ORIENTATION_LIBS=$pkg_cv_ORIENTATION_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOUND" >&5 +$as_echo_n "checking for SOUND... " >&6; } + +if test -n "$SOUND_CFLAGS"; then + pkg_cv_SOUND_CFLAGS="$SOUND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse >= \$PA_REQUIRED_VERSION \$GUDEV_PKG libpulse-mainloop-glib >= \$PA_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SOUND_CFLAGS=`$PKG_CONFIG --cflags "libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SOUND_LIBS"; then + pkg_cv_SOUND_LIBS="$SOUND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse >= \$PA_REQUIRED_VERSION \$GUDEV_PKG libpulse-mainloop-glib >= \$PA_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SOUND_LIBS=`$PKG_CONFIG --libs "libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SOUND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION" 2>&1` + else + SOUND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SOUND_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION) were not met: + +$SOUND_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables SOUND_CFLAGS +and SOUND_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables SOUND_CFLAGS +and SOUND_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + SOUND_CFLAGS=$pkg_cv_SOUND_CFLAGS + SOUND_LIBS=$pkg_cv_SOUND_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +# --------------------------------------------------------------------------- +# Power +# --------------------------------------------------------------------------- + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POWER" >&5 +$as_echo_n "checking for POWER... " >&6; } + +if test -n "$POWER_CFLAGS"; then + pkg_cv_POWER_CFLAGS="$POWER_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"upower-glib >= \$UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext\""; } >&5 + ($PKG_CONFIG --exists --print-errors "upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_POWER_CFLAGS=`$PKG_CONFIG --cflags "upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$POWER_LIBS"; then + pkg_cv_POWER_LIBS="$POWER_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"upower-glib >= \$UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext\""; } >&5 + ($PKG_CONFIG --exists --print-errors "upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_POWER_LIBS=`$PKG_CONFIG --libs "upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + POWER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext" 2>&1` + else + POWER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$POWER_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext) were not met: + +$POWER_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables POWER_CFLAGS +and POWER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables POWER_CFLAGS +and POWER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + POWER_CFLAGS=$pkg_cv_POWER_CFLAGS + POWER_LIBS=$pkg_cv_POWER_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +if test x$have_gudev != xno; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BACKLIGHT_HELPER" >&5 +$as_echo_n "checking for BACKLIGHT_HELPER... " >&6; } + +if test -n "$BACKLIGHT_HELPER_CFLAGS"; then + pkg_cv_BACKLIGHT_HELPER_CFLAGS="$BACKLIGHT_HELPER_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED_VERSION + gudev-1.0 + \""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_BACKLIGHT_HELPER_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$BACKLIGHT_HELPER_LIBS"; then + pkg_cv_BACKLIGHT_HELPER_LIBS="$BACKLIGHT_HELPER_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED_VERSION + gudev-1.0 + \""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_BACKLIGHT_HELPER_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + BACKLIGHT_HELPER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + " 2>&1` + else + BACKLIGHT_HELPER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + " 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$BACKLIGHT_HELPER_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ) were not met: + +$BACKLIGHT_HELPER_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables BACKLIGHT_HELPER_CFLAGS +and BACKLIGHT_HELPER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables BACKLIGHT_HELPER_CFLAGS +and BACKLIGHT_HELPER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + BACKLIGHT_HELPER_CFLAGS=$pkg_cv_BACKLIGHT_HELPER_CFLAGS + BACKLIGHT_HELPER_LIBS=$pkg_cv_BACKLIGHT_HELPER_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for COLOR" >&5 +$as_echo_n "checking for COLOR... " >&6; } + +if test -n "$COLOR_CFLAGS"; then + pkg_cv_COLOR_CFLAGS="$COLOR_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"colord >= 0.1.9 gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COLOR_CFLAGS=`$PKG_CONFIG --cflags "colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COLOR_LIBS"; then + pkg_cv_COLOR_LIBS="$COLOR_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"colord >= 0.1.9 gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COLOR_LIBS=`$PKG_CONFIG --libs "colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COLOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3" 2>&1` + else + COLOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COLOR_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3) were not met: + +$COLOR_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables COLOR_CFLAGS +and COLOR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables COLOR_CFLAGS +and COLOR_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + COLOR_CFLAGS=$pkg_cv_COLOR_CFLAGS + COLOR_LIBS=$pkg_cv_COLOR_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +case $host_os in + linux*) + if test "$host_cpu" = s390 -o "$host_cpu" = s390x; then + have_wacom=no + else + if test x$enable_gudev != xno; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WACOM" >&5 +$as_echo_n "checking for WACOM... " >&6; } + +if test -n "$WACOM_CFLAGS"; then + pkg_cv_WACOM_CFLAGS="$WACOM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libwacom >= \$LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WACOM_CFLAGS=`$PKG_CONFIG --cflags "libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$WACOM_LIBS"; then + pkg_cv_WACOM_LIBS="$WACOM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libwacom >= \$LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WACOM_LIBS=`$PKG_CONFIG --libs "libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + WACOM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom" 2>&1` + else + WACOM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$WACOM_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom) were not met: + +$WACOM_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables WACOM_CFLAGS +and WACOM_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables WACOM_CFLAGS +and WACOM_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + WACOM_CFLAGS=$pkg_cv_WACOM_CFLAGS + WACOM_LIBS=$pkg_cv_WACOM_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + else + as_fn_error $? "GUdev is necessary to compile Wacom support" "$LINENO" 5 + fi + have_wacom=yes + fi + ;; + *) + have_wacom=no + ;; +esac + if test x$have_wacom = xyes; then + HAVE_WACOM_TRUE= + HAVE_WACOM_FALSE='#' +else + HAVE_WACOM_TRUE='#' + HAVE_WACOM_FALSE= +fi + + + +have_packagekit=false +# Check whether --enable-packagekit was given. +if test "${enable_packagekit+set}" = set; then : + enableval=$enable_packagekit; case "${enableval}" in + yes) WANT_PACKAGEKIT=yes ;; + no) WANT_PACKAGEKIT=no ;; + *) as_fn_error $? "bad value ${enableval} for --disable-packagekit" "$LINENO" 5 ;; + esac +else + WANT_PACKAGEKIT=yes +fi + +if test x$WANT_PACKAGEKIT = xyes ; then + PK_REQUIRED_VERSION=0.7.4 + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PACKAGEKIT" >&5 +$as_echo_n "checking for PACKAGEKIT... " >&6; } + +if test -n "$PACKAGEKIT_CFLAGS"; then + pkg_cv_PACKAGEKIT_CFLAGS="$PACKAGEKIT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 packagekit-glib2 >= \$PK_REQUIRED_VERSION upower-glib >= \$UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= \$LIBNOTIFY_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PACKAGEKIT_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PACKAGEKIT_LIBS"; then + pkg_cv_PACKAGEKIT_LIBS="$PACKAGEKIT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 packagekit-glib2 >= \$PK_REQUIRED_VERSION upower-glib >= \$UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= \$LIBNOTIFY_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PACKAGEKIT_LIBS=`$PKG_CONFIG --libs "glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PACKAGEKIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>&1` + else + PACKAGEKIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PACKAGEKIT_PKG_ERRORS" >&5 + + have_packagekit=false +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_packagekit=false +else + PACKAGEKIT_CFLAGS=$pkg_cv_PACKAGEKIT_CFLAGS + PACKAGEKIT_LIBS=$pkg_cv_PACKAGEKIT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_packagekit=true + +$as_echo "#define HAVE_PACKAGEKIT 1" >>confdefs.h + +fi +fi + if test "x$have_packagekit" = "xtrue"; then + HAVE_PACKAGEKIT_TRUE= + HAVE_PACKAGEKIT_FALSE='#' +else + HAVE_PACKAGEKIT_TRUE='#' + HAVE_PACKAGEKIT_FALSE= +fi + + + + + +have_smartcard_support=false +# Check whether --enable-smartcard-support was given. +if test "${enable_smartcard_support+set}" = set; then : + enableval=$enable_smartcard_support; case "${enableval}" in + yes) WANT_SMARTCARD_SUPPORT=yes ;; + no) WANT_SMARTCARD_SUPPORT=no ;; + *) as_fn_error $? "bad value ${enableval} for --disable-smartcard-support" "$LINENO" 5 ;; + esac +else + WANT_SMARTCARD_SUPPORT=yes +fi + + +if test x$WANT_SMARTCARD_SUPPORT = xyes ; then + NSS_REQUIRED_VERSION=3.11.2 + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS" >&5 +$as_echo_n "checking for NSS... " >&6; } + +if test -n "$NSS_CFLAGS"; then + pkg_cv_NSS_CFLAGS="$NSS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss >= \$NSS_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "nss >= $NSS_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_NSS_CFLAGS=`$PKG_CONFIG --cflags "nss >= $NSS_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$NSS_LIBS"; then + pkg_cv_NSS_LIBS="$NSS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss >= \$NSS_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "nss >= $NSS_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_NSS_LIBS=`$PKG_CONFIG --libs "nss >= $NSS_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + NSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "nss >= $NSS_REQUIRED_VERSION" 2>&1` + else + NSS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "nss >= $NSS_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$NSS_PKG_ERRORS" >&5 + + have_smartcard_support=false +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_smartcard_support=false +else + NSS_CFLAGS=$pkg_cv_NSS_CFLAGS + NSS_LIBS=$pkg_cv_NSS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_smartcard_support=true + +$as_echo "#define SMARTCARD_SUPPORT 1" >>confdefs.h + +fi +fi + if test "x$have_smartcard_support" = "xtrue"; then + SMARTCARD_SUPPORT_TRUE= + SMARTCARD_SUPPORT_FALSE='#' +else + SMARTCARD_SUPPORT_TRUE='#' + SMARTCARD_SUPPORT_FALSE= +fi + + + + + + +# Check whether --with-nssdb was given. +if test "${with_nssdb+set}" = set; then : + withval=$with_nssdb; +fi + + +NSS_DATABASE="" +if test "x$have_smartcard_support" = "xtrue"; then + if ! test -z "$with_nssdb" ; then + NSS_DATABASE="$with_nssdb" + else + NSS_DATABASE="${sysconfdir}/pki/nssdb" + fi +else + if ! test -z "$with_nssdb" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: nssdb specified when smartcard support is disabled" >&5 +$as_echo "$as_me: WARNING: nssdb specified when smartcard support is disabled" >&2;} + fi +fi + + + + + +# Check whether --enable-systemd was given. +if test "${enable_systemd+set}" = set; then : + enableval=$enable_systemd; with_systemd=$enableval +else + with_systemd=no +fi + +if test "$with_systemd" = "yes" ; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5 +$as_echo_n "checking for SYSTEMD... " >&6; } + +if test -n "$SYSTEMD_CFLAGS"; then + pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-login\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd-login") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "libsystemd-login" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SYSTEMD_LIBS"; then + pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-login\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd-login") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "libsystemd-login" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd-login" 2>&1` + else + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd-login" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SYSTEMD_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libsystemd-login) were not met: + +$SYSTEMD_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables SYSTEMD_CFLAGS +and SYSTEMD_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables SYSTEMD_CFLAGS +and SYSTEMD_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS + SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +$as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h + + SESSION_TRACKING=systemd +else + SESSION_TRACKING=ConsoleKit +fi + + + + + if test "$with_systemd" = "yes"; then + WITH_SYSTEMD_TRUE= + WITH_SYSTEMD_FALSE='#' +else + WITH_SYSTEMD_TRUE='#' + WITH_SYSTEMD_FALSE= +fi + + +# --------------------------------------------------------------------------- +# CUPS +# --------------------------------------------------------------------------- + +# Check whether --enable-cups was given. +if test "${enable_cups+set}" = set; then : + enableval=$enable_cups; +else + enable_cups=yes +fi + + +if test x"$enable_cups" != x"no" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + # Extract the first word of "cups-config", so it can be a program name with args. +set dummy cups-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_CUPS_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $CUPS_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_CUPS_CONFIG="$CUPS_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CUPS_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +CUPS_CONFIG=$ac_cv_path_CUPS_CONFIG +if test -n "$CUPS_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUPS_CONFIG" >&5 +$as_echo "$CUPS_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test x$CUPS_CONFIG = x; then + as_fn_error $? "cups-config not found but CUPS support requested" "$LINENO" 5 + fi + + CUPS_API_VERSION=`$CUPS_CONFIG --api-version` + CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 1` + CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 2` + + for ac_header in cups/cups.h cups/http.h cups/ipp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "CUPS headers not found but CUPS support requested" "$LINENO" 5 +fi + +done + + + if ! test $CUPS_API_MAJOR -gt 1 -o \ + $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4 ; then + as_fn_error $? "CUPS 1.4 or newer not found, but CUPS support requested" "$LINENO" 5 + fi + + CUPS_CFLAGS=`$CUPS_CONFIG --cflags | $SED -e 's/-O\w*//g' -e 's/-m\w*//g'` + CUPS_LIBS=`$CUPS_CONFIG --libs` + + +fi + + if test x"$enable_cups" = x"yes"; then + BUILD_PRINT_NOTIFICATIONS_TRUE= + BUILD_PRINT_NOTIFICATIONS_FALSE='#' +else + BUILD_PRINT_NOTIFICATIONS_TRUE='#' + BUILD_PRINT_NOTIFICATIONS_FALSE= +fi + + +# --------------------------------------------------------------------------- +# Enable Profiling +# --------------------------------------------------------------------------- +# Check whether --enable-profiling was given. +if test "${enable_profiling+set}" = set; then : + enableval=$enable_profiling; +else + enable_profiling=no +fi + +if test "x$enable_profiling" = "xyes"; then + +$as_echo "#define ENABLE_PROFILING 1" >>confdefs.h + +fi + + +# --------------------------------------------------------------------------- +# Plugins +# --------------------------------------------------------------------------- + +plugindir='$(libdir)/gnome-settings-daemon-3.0' + + +PLUGIN_CFLAGS="-DG_LOG_DOMAIN=\"\\\"\$(plugin_name)-plugin\\\"\" -DPLUGIN_NAME=\"\\\"\$(plugin_name)\\\"\" " + + +# Check whether --enable-man was given. +if test "${enable_man+set}" = set; then : + enableval=$enable_man; +else + enable_man=yes +fi + +if test "$enable_man" != no; then + # Extract the first word of "xsltproc", so it can be a program name with args. +set dummy xsltproc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XSLTPROC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $XSLTPROC in + [\\/]* | ?:[\\/]*) + ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +XSLTPROC=$ac_cv_path_XSLTPROC +if test -n "$XSLTPROC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 +$as_echo "$XSLTPROC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$XSLTPROC"; then + as_fn_error $? "xsltproc is required for --enable-man" "$LINENO" 5 + fi +fi + if test "$enable_man" != no; then + ENABLE_MAN_TRUE= + ENABLE_MAN_FALSE='#' +else + ENABLE_MAN_TRUE='#' + ENABLE_MAN_FALSE= +fi + + + + +# Turn on the additional warnings last, so warnings don't affect other tests. + +# Check whether --enable-more-warnings was given. +if test "${enable_more_warnings+set}" = set; then : + enableval=$enable_more_warnings; set_more_warnings="$enableval" +else + + if test -d $srcdir/.git; then + set_more_warnings=yes + else + set_more_warnings=no + fi + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for more warnings" >&5 +$as_echo_n "checking for more warnings... " >&6; } +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="\ + -Wall \ + -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ + -Wnested-externs -Wpointer-arith \ + -Wcast-align -Wsign-compare \ + $CFLAGS" + + for option in -Wno-strict-aliasing -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands $option" >&5 +$as_echo_n "checking whether gcc understands $option... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + has_option=yes +else + has_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5 +$as_echo "$has_option" >&6; } + unset has_option + unset SAVE_CFLAGS + done + unset option +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +# +# Enable Debug +# +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; +else + enable_debug=yes +fi + +if test "$enable_debug" = "yes"; then + DEBUG_CFLAGS="-DG_ENABLE_DEBUG" +else + if test "x$enable_debug" = "xno"; then + DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" + else + DEBUG_CFLAGS="" + fi +fi + + +ac_config_files="$ac_config_files Makefile gnome-settings-daemon/Makefile plugins/Makefile plugins/a11y-keyboard/Makefile plugins/a11y-settings/Makefile plugins/automount/Makefile plugins/background/Makefile plugins/clipboard/Makefile plugins/color/Makefile plugins/common/Makefile plugins/cursor/Makefile plugins/dummy/Makefile plugins/power/Makefile plugins/housekeeping/Makefile plugins/keyboard/Makefile plugins/media-keys/Makefile plugins/media-keys/cut-n-paste/Makefile plugins/mouse/Makefile plugins/orientation/Makefile plugins/print-notifications/Makefile plugins/screensaver-proxy/Makefile plugins/smartcard/Makefile plugins/sound/Makefile plugins/updates/Makefile plugins/wacom/Makefile plugins/xrandr/Makefile plugins/xsettings/Makefile data/Makefile data/gnome-settings-daemon.pc data/gnome-settings-daemon-uninstalled.pc data/org.gnome.settings-daemon.plugins.gschema.xml.in data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in data/org.gnome.settings-daemon.plugins.power.gschema.xml.in data/org.gnome.settings-daemon.plugins.color.gschema.xml.in data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in data/org.gnome.settings-daemon.peripherals.gschema.xml.in data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in po/Makefile.in man/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + + ac_config_commands="$ac_config_commands po/stamp-it" + + +if test -z "${HAVE_GUDEV_TRUE}" && test -z "${HAVE_GUDEV_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GUDEV\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_IBUS_TRUE}" && test -z "${HAVE_IBUS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_IBUS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_WACOM_TRUE}" && test -z "${HAVE_WACOM_FALSE}"; then + as_fn_error $? "conditional \"HAVE_WACOM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_PACKAGEKIT_TRUE}" && test -z "${HAVE_PACKAGEKIT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PACKAGEKIT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SMARTCARD_SUPPORT_TRUE}" && test -z "${SMARTCARD_SUPPORT_FALSE}"; then + as_fn_error $? "conditional \"SMARTCARD_SUPPORT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WITH_SYSTEMD_TRUE}" && test -z "${WITH_SYSTEMD_FALSE}"; then + as_fn_error $? "conditional \"WITH_SYSTEMD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_PRINT_NOTIFICATIONS_TRUE}" && test -z "${BUILD_PRINT_NOTIFICATIONS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_PRINT_NOTIFICATIONS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_MAN_TRUE}" && test -z "${ENABLE_MAN_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_MAN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by gnome-settings-daemon $as_me 3.6.4, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +gnome-settings-daemon config.status 3.6.4 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "gnome-settings-daemon/Makefile") CONFIG_FILES="$CONFIG_FILES gnome-settings-daemon/Makefile" ;; + "plugins/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/Makefile" ;; + "plugins/a11y-keyboard/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/a11y-keyboard/Makefile" ;; + "plugins/a11y-settings/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/a11y-settings/Makefile" ;; + "plugins/automount/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/automount/Makefile" ;; + "plugins/background/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/background/Makefile" ;; + "plugins/clipboard/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/clipboard/Makefile" ;; + "plugins/color/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/color/Makefile" ;; + "plugins/common/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/common/Makefile" ;; + "plugins/cursor/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/cursor/Makefile" ;; + "plugins/dummy/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/dummy/Makefile" ;; + "plugins/power/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/power/Makefile" ;; + "plugins/housekeeping/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/housekeeping/Makefile" ;; + "plugins/keyboard/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/keyboard/Makefile" ;; + "plugins/media-keys/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/media-keys/Makefile" ;; + "plugins/media-keys/cut-n-paste/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/media-keys/cut-n-paste/Makefile" ;; + "plugins/mouse/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/mouse/Makefile" ;; + "plugins/orientation/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/orientation/Makefile" ;; + "plugins/print-notifications/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/print-notifications/Makefile" ;; + "plugins/screensaver-proxy/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/screensaver-proxy/Makefile" ;; + "plugins/smartcard/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/smartcard/Makefile" ;; + "plugins/sound/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/sound/Makefile" ;; + "plugins/updates/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/updates/Makefile" ;; + "plugins/wacom/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/wacom/Makefile" ;; + "plugins/xrandr/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/xrandr/Makefile" ;; + "plugins/xsettings/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/xsettings/Makefile" ;; + "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; + "data/gnome-settings-daemon.pc") CONFIG_FILES="$CONFIG_FILES data/gnome-settings-daemon.pc" ;; + "data/gnome-settings-daemon-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES data/gnome-settings-daemon-uninstalled.pc" ;; + "data/org.gnome.settings-daemon.plugins.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.power.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.power.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.color.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.color.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.peripherals.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.peripherals.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in" ;; + "data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in") CONFIG_FILES="$CONFIG_FILES data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="CXX " + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + "default-1":C) case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac ;; + "po/stamp-it":C) + if ! grep "^# INTLTOOL_MAKEFILE$" "po/Makefile.in" > /dev/null ; then + as_fn_error $? "po/Makefile.in.in was not created by intltoolize." "$LINENO" 5 + fi + rm -f "po/stamp-it" "po/stamp-it.tmp" "po/POTFILES" "po/Makefile.tmp" + >"po/stamp-it.tmp" + sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/po/POTFILES.in" | sed '$!s/$/ \\/' >"po/POTFILES" + + sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r po/POTFILES + } + ' "po/Makefile.in" >"po/Makefile" + rm -f "po/Makefile.tmp" + mv "po/stamp-it.tmp" "po/stamp-it" + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + +echo " + gnome-settings-daemon $VERSION + ============================= + + prefix: ${prefix} + exec_prefix: ${exec_prefix} + libdir: ${libdir} + bindir: ${bindir} + sbindir: ${sbindir} + sysconfdir: ${sysconfdir} + sysconfsubdir: ${sysconfsubdir} + localstatedir: ${localstatedir} + plugindir: ${plugindir} + datadir: ${datadir} + source code location: ${srcdir} + compiler: ${CC} + cflags: ${CFLAGS} + Maintainer mode: ${USE_MAINTAINER_MODE} + + Session tracking: ${SESSION_TRACKING} + LCMS DICT support: ${have_new_lcms} + IBus support: ${enable_ibus} + Libnotify support: ${have_libnotify} + PackageKit support: ${have_packagekit} + Smartcard support: ${have_smartcard_support} + Cups support: ${enable_cups} + Wacom support: ${have_wacom} +${NSS_DATABASE:+\ + System nssdb: ${NSS_DATABASE} +}\ + Profiling support: ${enable_profiling} +" diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..6ef462b1 --- /dev/null +++ b/configure.ac @@ -0,0 +1,594 @@ +AC_PREREQ([2.60]) + +AC_INIT([gnome-settings-daemon], + [3.6.4], + [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon]) + +AC_CONFIG_SRCDIR([gnome-settings-daemon/gnome-settings-manager.c]) + +AM_INIT_AUTOMAKE([1.9 tar-ustar dist-xz no-dist-gzip check-news]) +AM_MAINTAINER_MODE([enable]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +m4_define([gsd_api_version_major],[3]) +m4_define([gsd_api_version_minor],[0]) +m4_define([gsd_api_version],[gsd_api_version_major.gsd_api_version_minor]) +GSD_API_VERSION="gsd_api_version" +AC_SUBST(GSD_API_VERSION) + +AC_STDC_HEADERS +AC_PROG_CXX +AM_PROG_CC_C_O +AC_PROG_LIBTOOL + +AC_HEADER_STDC + +AC_SUBST(VERSION) + +AC_CONFIG_HEADERS([config.h]) + +IT_PROG_INTLTOOL([0.37.1]) + +GETTEXT_PACKAGE=gnome-settings-daemon +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain]) + +AM_GLIB_GNU_GETTEXT + +GSD_INTLTOOL_PLUGIN_RULE='%.gnome-settings-plugin: %.gnome-settings-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +AC_SUBST([GSD_INTLTOOL_PLUGIN_RULE]) + +dnl --------------------------------------------------------------------------- +dnl - Dependencies +dnl --------------------------------------------------------------------------- + +GLIB_REQUIRED_VERSION=2.31.0 +GTK_REQUIRED_VERSION=3.3.18 +GCONF_REQUIRED_VERSION=2.6.1 +GIO_REQUIRED_VERSION=2.26.0 +GNOME_DESKTOP_REQUIRED_VERSION=3.5.3 +LIBNOTIFY_REQUIRED_VERSION=0.7.3 +UPOWER_GLIB_REQUIRED_VERSION=0.9.1 +PA_REQUIRED_VERSION=0.9.16 +LIBWACOM_REQUIRED_VERSION=0.6 +UPOWER_REQUIRED_VERSION=0.9.11 +APPINDICATOR_REQUIRED_VERSION=0.3.0 + +EXTRA_COMPILE_WARNINGS(yes) + +PKG_CHECK_MODULES(SETTINGS_DAEMON, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + gmodule-2.0 + gthread-2.0 + gsettings-desktop-schemas >= 3.5.90 +) + +PKG_CHECK_MODULES(SETTINGS_PLUGIN, + gtk+-3.0 >= $GTK_REQUIRED_VERSION + gio-2.0 >= $GIO_REQUIRED_VERSION + libnotify >= $LIBNOTIFY_REQUIRED_VERSION + gsettings-desktop-schemas + x11 +) + +GSD_PLUGIN_LDFLAGS="-export_dynamic -module -avoid-version -no-undefined" +case $host_os in + darwin*) + GSD_PLUGIN_LDFLAGS="${GSD_PLUGIN_LDFLAGS} -Wl,-bundle_loader,\$(top_builddir)/gnome-settings-daemon/gnome-settings-daemon" + ;; +esac +AC_SUBST([GSD_PLUGIN_LDFLAGS]) + +AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + +dnl ================================================================ +dnl GSettings stuff +dnl ================================================================ + +GLIB_GSETTINGS + +dnl --------------------------------------------------------------------------- +dnl - Check for gnome-desktop +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - Check for LCMS2 +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2, have_new_lcms=yes, have_new_lcms=no) +if test x$have_new_lcms = xyes; then + AC_DEFINE(HAVE_NEW_LCMS,1,[Got new lcms2]) +else + PKG_CHECK_MODULES(LCMS, lcms2) +fi + +dnl --------------------------------------------------------------------------- +dnl - Check for libnotify +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_libnotify=yes], have_libnotify=no) +if test "x$have_libnotify" = xno ; then + AC_MSG_ERROR([libnotify is required to build gnome-settings-daemon]) +fi +AC_SUBST(LIBNOTIFY_CFLAGS) +AC_SUBST(LIBNOTIFY_LIBS) + +dnl --------------------------------------------------------------------------- +dnl - GUdev integration (default enabled) +dnl --------------------------------------------------------------------------- +GUDEV_PKG="" +AC_ARG_ENABLE(gudev, AS_HELP_STRING([--disable-gudev],[Disable GUdev support (not optional on Linux platforms)]), enable_gudev=$enableval) +if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(GUDEV, gudev-1.0, have_gudev="yes", have_gudev="no") + if test "x$have_gudev" = "xyes"; then + AC_DEFINE(HAVE_GUDEV, 1, [define if GUdev is available]) + GUDEV_PKG="gudev-1.0" + else + if test x$enable_gudev = xyes; then + AC_MSG_ERROR([GUdev enabled but not found]) + fi + fi +else + have_gudev=no +fi +AM_CONDITIONAL(HAVE_GUDEV, test x$have_gudev = xyes) + +dnl --------------------------------------------------------------------------- +dnl - common +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COMMON, x11 kbproto xi) + +dnl --------------------------------------------------------------------------- +dnl - automount +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(AUTOMOUNT, x11 kbproto) + +dnl --------------------------------- +dnl - Application indicator +dnl --------------------------------- + +AC_ARG_ENABLE([appindicator], + AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators]), + [enable_appindicator=$enableval], + [enable_appindicator="auto"]) + + +if test x$enable_appindicator = xauto ; then + PKG_CHECK_EXISTS(appindicator3-0.1 >= $APPINDICATOR_REQUIRED_VERSION, + [enable_appindicator="yes"], + [enable_appindicator="no"]) +fi + +if test x$enable_appindicator = xyes ; then + PKG_CHECK_MODULES(APPINDICATOR, + [appindicator3-0.1 >= $APPINDICATOR_REQUIRED_VERSION], + [AC_DEFINE(HAVE_APPINDICATOR, 1, [Have AppIndicator])]) +fi + +AM_CONDITIONAL(HAVE_APPINDICATOR, test x$enable_appindicator = xyes) +AC_SUBST(APPINDICATOR_CFLAGS) +AC_SUBST(APPINDICATOR_LIBS) + +dnl --------------------------------------------------------------------------- +dnl - background +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(BACKGROUND, x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) + +dnl --------------------------------------------------------------------------- +dnl - mouse +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MOUSE, x11 xi) + +dnl --------------------------------------------------------------------------- +dnl - cursor +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(CURSOR, xfixes) + +dnl --------------------------------------------------------------------------- +dnl - xsettings +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XSETTINGS, fontconfig) + +dnl --------------------------------------------------------------------------- +dnl - Keyboard plugin stuff +dnl --------------------------------------------------------------------------- + +LIBGNOMEKBD_REQUIRED=2.91.1 +PKG_CHECK_MODULES(KEYBOARD, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0 kbproto]) + +dnl --------------------------------------------------------------------------- +dnl - Housekeeping plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(GIOUNIX, [gio-unix-2.0]) + +dnl --------------------------------------------------------------------------- +dnl - media-keys plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra libnotify]) + +dnl --------------------------------------------------------------------------- +dnl - xrandr plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(XRANDR, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION]) + +dnl --------------------------------------------------------------------------- +dnl - orientation plugin stuff +dnl --------------------------------------------------------------------------- + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(ORIENTATION, [gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gudev-1.0]) +fi + +dnl --------------------------------------------------------------------------- +dnl - sound plugin stuff +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(SOUND, [libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION]) + +# --------------------------------------------------------------------------- +# Power +# --------------------------------------------------------------------------- +PKG_CHECK_MODULES(POWER, upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext) + +if test x$have_gudev != xno; then + PKG_CHECK_MODULES(BACKLIGHT_HELPER, + glib-2.0 >= $GLIB_REQUIRED_VERSION + gudev-1.0 + ) +fi + +dnl --------------------------------------------------------------------------- +dnl - color +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES(COLOR, [colord >= 0.1.9 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3]) + +dnl --------------------------------------------------------------------------- +dnl - wacom (disabled for s390/s390x and non Linux platforms) +dnl --------------------------------------------------------------------------- + +case $host_os in + linux*) + if test "$host_cpu" = s390 -o "$host_cpu" = s390x; then + have_wacom=no + else + if test x$enable_gudev != xno; then + PKG_CHECK_MODULES(WACOM, [libwacom >= $LIBWACOM_REQUIRED_VERSION x11 xi xtst gudev-1.0 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION xorg-wacom]) + else + AC_MSG_ERROR([GUdev is necessary to compile Wacom support]) + fi + have_wacom=yes + fi + ;; + *) + have_wacom=no + ;; +esac +AM_CONDITIONAL(HAVE_WACOM, test x$have_wacom = xyes) + +dnl ============================================== +dnl PackageKit section +dnl ============================================== + +have_packagekit=false +AC_ARG_ENABLE(packagekit, + AC_HELP_STRING([--disable-packagekit], + [turn off PackageKit support]), + [case "${enableval}" in + yes) WANT_PACKAGEKIT=yes ;; + no) WANT_PACKAGEKIT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-packagekit) ;; + esac], + [WANT_PACKAGEKIT=yes]) dnl Default value + +if test x$WANT_PACKAGEKIT = xyes ; then + PK_REQUIRED_VERSION=0.7.4 + PKG_CHECK_MODULES(PACKAGEKIT, glib-2.0 packagekit-glib2 >= $PK_REQUIRED_VERSION upower-glib >= $UPOWER_REQUIRED_VERSION gudev-1.0 libnotify >= $LIBNOTIFY_REQUIRED_VERSION, + [have_packagekit=true + AC_DEFINE(HAVE_PACKAGEKIT, 1, [Define if PackageKit should be used])], + [have_packagekit=false]) +fi +AM_CONDITIONAL(HAVE_PACKAGEKIT, test "x$have_packagekit" = "xtrue") + +AC_SUBST(PACKAGEKIT_CFLAGS) +AC_SUBST(PACKAGEKIT_LIBS) + +dnl ============================================== +dnl smartcard section +dnl ============================================== +have_smartcard_support=false +AC_ARG_ENABLE(smartcard-support, + AC_HELP_STRING([--disable-smartcard-support], + [turn off smartcard support]), + [case "${enableval}" in + yes) WANT_SMARTCARD_SUPPORT=yes ;; + no) WANT_SMARTCARD_SUPPORT=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-smartcard-support) ;; + esac], + [WANT_SMARTCARD_SUPPORT=yes]) + +if test x$WANT_SMARTCARD_SUPPORT = xyes ; then + NSS_REQUIRED_VERSION=3.11.2 + PKG_CHECK_MODULES(NSS, nss >= $NSS_REQUIRED_VERSION, + [have_smartcard_support=true + AC_DEFINE(SMARTCARD_SUPPORT, 1, [Define if smartcard support should be enabled])], + [have_smartcard_support=false]) +fi +AM_CONDITIONAL(SMARTCARD_SUPPORT, test "x$have_smartcard_support" = "xtrue") + +AC_SUBST(NSS_CFLAGS) +AC_SUBST(NSS_LIBS) + +AC_ARG_WITH(nssdb, + AC_HELP_STRING([--with-nssdb], + [where system NSS database is])) + +NSS_DATABASE="" +if test "x$have_smartcard_support" = "xtrue"; then + if ! test -z "$with_nssdb" ; then + NSS_DATABASE="$with_nssdb" + else + NSS_DATABASE="${sysconfdir}/pki/nssdb" + fi +else + if ! test -z "$with_nssdb" ; then + AC_MSG_WARN([nssdb specified when smartcard support is disabled]) + fi +fi + +AC_SUBST(NSS_DATABASE) + + +dnl ============================================== +dnl systemd check +dnl ============================================== + +AC_ARG_ENABLE([systemd], + AS_HELP_STRING([--enable-systemd], [Use systemd for session tracking]), + [with_systemd=$enableval], + [with_systemd=no]) +if test "$with_systemd" = "yes" ; then + PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login]) + AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking]) + SESSION_TRACKING=systemd +else + SESSION_TRACKING=ConsoleKit +fi + +AC_SUBST(SYSTEMD_CFLAGS) +AC_SUBST(SYSTEMD_LIBS) + +AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = "yes"], [Using systemd]) + +# --------------------------------------------------------------------------- +# CUPS +# --------------------------------------------------------------------------- + +AC_ARG_ENABLE(cups, + AS_HELP_STRING([--disable-cups], [disable CUPS support (default: enabled)]),, + enable_cups=yes) + +if test x"$enable_cups" != x"no" ; then + AC_PROG_SED + + AC_PATH_PROG(CUPS_CONFIG, cups-config) + + if test x$CUPS_CONFIG = x; then + AC_MSG_ERROR([cups-config not found but CUPS support requested]) + fi + + CUPS_API_VERSION=`$CUPS_CONFIG --api-version` + CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 1` + CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | cut -d . -f 2` + + AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h],, + AC_MSG_ERROR([CUPS headers not found but CUPS support requested])) + + if ! test $CUPS_API_MAJOR -gt 1 -o \ + $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4 ; then + AC_MSG_ERROR([CUPS 1.4 or newer not found, but CUPS support requested]) + fi + + CUPS_CFLAGS=`$CUPS_CONFIG --cflags | $SED -e 's/-O\w*//g' -e 's/-m\w*//g'` + CUPS_LIBS=`$CUPS_CONFIG --libs` + AC_SUBST(CUPS_CFLAGS) + AC_SUBST(CUPS_LIBS) +fi + +AM_CONDITIONAL(BUILD_PRINT_NOTIFICATIONS, [test x"$enable_cups" = x"yes"]) + +# --------------------------------------------------------------------------- +# Enable Profiling +# --------------------------------------------------------------------------- +AC_ARG_ENABLE(profiling, + [AC_HELP_STRING([--enable-profiling], + [turn on profiling])], + , enable_profiling=no) +if test "x$enable_profiling" = "xyes"; then + AC_DEFINE(ENABLE_PROFILING,1,[enable profiling]) +fi + + +# --------------------------------------------------------------------------- +# Plugins +# --------------------------------------------------------------------------- + +plugindir='$(libdir)/gnome-settings-daemon-gsd_api_version' +AC_SUBST([plugindir]) + +PLUGIN_CFLAGS="-DG_LOG_DOMAIN=\"\\\"\$(plugin_name)-plugin\\\"\" -DPLUGIN_NAME=\"\\\"\$(plugin_name)\\\"\" " +AC_SUBST(PLUGIN_CFLAGS) + +AC_ARG_ENABLE(man, + [AS_HELP_STRING([--enable-man], + [generate man pages [default=yes]])],, + enable_man=yes) +if test "$enable_man" != no; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test -z "$XSLTPROC"; then + AC_MSG_ERROR([xsltproc is required for --enable-man]) + fi +fi +AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) + +dnl --------------------------------------------------------------------------- +dnl - Finish +dnl --------------------------------------------------------------------------- + + +# Turn on the additional warnings last, so warnings don't affect other tests. + +AC_ARG_ENABLE(more-warnings, + [AC_HELP_STRING([--enable-more-warnings], + [Maximum compiler warnings])], + set_more_warnings="$enableval",[ + if test -d $srcdir/.git; then + set_more_warnings=yes + else + set_more_warnings=no + fi + ]) +AC_MSG_CHECKING(for more warnings) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + CFLAGS="\ + -Wall \ + -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ + -Wnested-externs -Wpointer-arith \ + -Wcast-align -Wsign-compare \ + $CFLAGS" + + for option in -Wno-strict-aliasing -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + AC_MSG_RESULT($has_option) + unset has_option + unset SAVE_CFLAGS + done + unset option +else + AC_MSG_RESULT(no) +fi + +# +# Enable Debug +# +AC_ARG_ENABLE(debug, + [AC_HELP_STRING([--enable-debug], + [turn on debugging])], + , enable_debug=yes) +if test "$enable_debug" = "yes"; then + DEBUG_CFLAGS="-DG_ENABLE_DEBUG" +else + if test "x$enable_debug" = "xno"; then + DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" + else + DEBUG_CFLAGS="" + fi +fi +AC_SUBST(DEBUG_CFLAGS) + +AC_OUTPUT([ +Makefile +gnome-settings-daemon/Makefile +plugins/Makefile +plugins/a11y-keyboard/Makefile +plugins/a11y-settings/Makefile +plugins/automount/Makefile +plugins/background/Makefile +plugins/clipboard/Makefile +plugins/color/Makefile +plugins/common/Makefile +plugins/cursor/Makefile +plugins/dummy/Makefile +plugins/power/Makefile +plugins/housekeeping/Makefile +plugins/keyboard/Makefile +plugins/media-keys/Makefile +plugins/media-keys/cut-n-paste/Makefile +plugins/mouse/Makefile +plugins/orientation/Makefile +plugins/print-notifications/Makefile +plugins/screensaver-proxy/Makefile +plugins/smartcard/Makefile +plugins/sound/Makefile +plugins/updates/Makefile +plugins/wacom/Makefile +plugins/xrandr/Makefile +plugins/xsettings/Makefile +data/Makefile +data/gnome-settings-daemon.pc +data/gnome-settings-daemon-uninstalled.pc +data/org.gnome.settings-daemon.plugins.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in +data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in +data/org.gnome.settings-daemon.plugins.power.gschema.xml.in +data/org.gnome.settings-daemon.plugins.color.gschema.xml.in +data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.gschema.xml.in +data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in +data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in +data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in +data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in +data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in +data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in +po/Makefile.in +man/Makefile +]) + +dnl --------------------------------------------------------------------------- +dnl - Show summary +dnl --------------------------------------------------------------------------- + +echo " + gnome-settings-daemon $VERSION + ============================= + + prefix: ${prefix} + exec_prefix: ${exec_prefix} + libdir: ${libdir} + bindir: ${bindir} + sbindir: ${sbindir} + sysconfdir: ${sysconfdir} + sysconfsubdir: ${sysconfsubdir} + localstatedir: ${localstatedir} + plugindir: ${plugindir} + datadir: ${datadir} + source code location: ${srcdir} + compiler: ${CC} + cflags: ${CFLAGS} + Maintainer mode: ${USE_MAINTAINER_MODE} + + Session tracking: ${SESSION_TRACKING} + LCMS DICT support: ${have_new_lcms} + Libnotify support: ${have_libnotify} + App indicator support: ${enable_appindicator} + PackageKit support: ${have_packagekit} + Smartcard support: ${have_smartcard_support} + Cups support: ${enable_cups} + Wacom support: ${have_wacom} +${NSS_DATABASE:+\ + System nssdb: ${NSS_DATABASE} +}\ + Profiling support: ${enable_profiling} +" diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 00000000..7ab096bb --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,69 @@ +NULL = + +apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon +api_DATA = gsd-enums.h + +gsettings_ENUM_NAMESPACE = org.gnome.settings-daemon +gsettings_ENUM_FILES = $(top_srcdir)/data/$(api_DATA) + +gsettings_SCHEMAS = \ + org.gnome.settings-daemon.peripherals.gschema.xml \ + org.gnome.settings-daemon.plugins.gschema.xml \ + org.gnome.settings-daemon.plugins.keyboard.gschema.xml \ + org.gnome.settings-daemon.plugins.power.gschema.xml \ + org.gnome.settings-daemon.plugins.color.gschema.xml \ + org.gnome.settings-daemon.plugins.media-keys.gschema.xml \ + org.gnome.settings-daemon.plugins.xsettings.gschema.xml \ + org.gnome.settings-daemon.plugins.housekeeping.gschema.xml \ + org.gnome.settings-daemon.plugins.print-notifications.gschema.xml \ + org.gnome.settings-daemon.plugins.xrandr.gschema.xml \ + org.gnome.settings-daemon.plugins.updates.gschema.xml \ + org.gnome.settings-daemon.plugins.orientation.gschema.xml \ + org.gnome.settings-daemon.peripherals.wacom.gschema.xml + +@INTLTOOL_XML_NOMERGE_RULE@ + +@GSETTINGS_RULES@ + +convertdir = $(datadir)/GConf/gsettings +convert_DATA = gnome-settings-daemon.convert + +@INTLTOOL_DESKTOP_RULE@ +desktopdir = $(sysconfdir)/xdg/autostart +desktop_in_files = gnome-settings-daemon.desktop.in.in +desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop) + +gnome-settings-daemon.desktop.in: gnome-settings-daemon.desktop.in.in + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@.tmp && mv $@.tmp $@ + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gnome-settings-daemon.pc + +@INTLTOOL_XML_NOMERGE_RULE@ + +man_MANS = gnome-settings-daemon.1 + +dbusservice_in_files = org.freedesktop.IBus.service.in + +EXTRA_DIST = \ + $(man_MANS) \ + $(convert_DATA) \ + $(gsettings_SCHEMAS:.xml=.xml.in.in) \ + $(desktop_in_files) \ + $(gsettings_ENUM_FILES) \ + gnome-settings-daemon.pc.in \ + $(api_DATA) \ + $(dbusservice_in_files) \ + $(NULL) + +DISTCLEANFILES = \ + $(gsettings_SCHEMAS) \ + $(desktop_DATA) \ + gnome-settings-daemon.desktop.in \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in \ + $(gsettings_SCHEMAS:.xml=.valid) + diff --git a/data/Makefile.in b/data/Makefile.in new file mode 100644 index 00000000..05d97678 --- /dev/null +++ b/data/Makefile.in @@ -0,0 +1,837 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = data +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/gnome-settings-daemon-uninstalled.pc.in \ + $(srcdir)/gnome-settings-daemon.pc.in \ + $(srcdir)/org.gnome.settings-daemon.peripherals.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in \ + $(srcdir)/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in \ + $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = gnome-settings-daemon.pc \ + gnome-settings-daemon-uninstalled.pc \ + org.gnome.settings-daemon.plugins.gschema.xml.in \ + org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in \ + org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in \ + org.gnome.settings-daemon.plugins.power.gschema.xml.in \ + org.gnome.settings-daemon.plugins.color.gschema.xml.in \ + org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in \ + org.gnome.settings-daemon.peripherals.gschema.xml.in \ + org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in \ + org.gnome.settings-daemon.plugins.orientation.gschema.xml.in \ + org.gnome.settings-daemon.plugins.updates.gschema.xml.in \ + org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in \ + org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in \ + org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(apidir)" \ + "$(DESTDIR)$(convertdir)" "$(DESTDIR)$(dbusservicedir)" \ + "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgconfigdir)" +NROFF = nroff +MANS = $(man_MANS) +DATA = $(api_DATA) $(convert_DATA) $(dbusservice_DATA) $(desktop_DATA) \ + $(pkgconfig_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon +api_DATA = gsd-enums.h +gsettings_ENUM_NAMESPACE = org.gnome.settings-daemon +gsettings_ENUM_FILES = $(top_srcdir)/data/$(api_DATA) +gsettings_SCHEMAS = \ + org.gnome.settings-daemon.peripherals.gschema.xml \ + org.gnome.settings-daemon.plugins.gschema.xml \ + org.gnome.settings-daemon.plugins.keyboard.gschema.xml \ + org.gnome.settings-daemon.plugins.power.gschema.xml \ + org.gnome.settings-daemon.plugins.color.gschema.xml \ + org.gnome.settings-daemon.plugins.media-keys.gschema.xml \ + org.gnome.settings-daemon.plugins.xsettings.gschema.xml \ + org.gnome.settings-daemon.plugins.housekeeping.gschema.xml \ + org.gnome.settings-daemon.plugins.print-notifications.gschema.xml \ + org.gnome.settings-daemon.plugins.xrandr.gschema.xml \ + org.gnome.settings-daemon.plugins.updates.gschema.xml \ + org.gnome.settings-daemon.plugins.orientation.gschema.xml \ + org.gnome.settings-daemon.peripherals.wacom.gschema.xml + +convertdir = $(datadir)/GConf/gsettings +convert_DATA = gnome-settings-daemon.convert +desktopdir = $(sysconfdir)/xdg/autostart +desktop_in_files = gnome-settings-daemon.desktop.in.in +desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop) +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gnome-settings-daemon.pc +man_MANS = gnome-settings-daemon.1 +dbusservice_in_files = org.freedesktop.IBus.service.in +EXTRA_DIST = \ + $(man_MANS) \ + $(convert_DATA) \ + $(gsettings_SCHEMAS:.xml=.xml.in.in) \ + $(desktop_in_files) \ + $(gsettings_ENUM_FILES) \ + gnome-settings-daemon.pc.in \ + $(api_DATA) \ + $(dbusservice_in_files) \ + $(NULL) + +DISTCLEANFILES = \ + $(gsettings_SCHEMAS) \ + $(desktop_DATA) \ + gnome-settings-daemon.desktop.in \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in \ + $(gsettings_SCHEMAS:.xml=.valid) + +@HAVE_IBUS_TRUE@dbusservicedir = ${datadir}/dbus-1/services +@HAVE_IBUS_TRUE@dbusservice_DATA = $(dbusservice_in_files:.service.in=.service) +@HAVE_IBUS_TRUE@CLEANFILES = $(dbusservice_DATA) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu data/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +gnome-settings-daemon.pc: $(top_builddir)/config.status $(srcdir)/gnome-settings-daemon.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +gnome-settings-daemon-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/gnome-settings-daemon-uninstalled.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.power.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.color.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.peripherals.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.peripherals.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.orientation.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.updates.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in: $(top_builddir)/config.status $(srcdir)/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +install-apiDATA: $(api_DATA) + @$(NORMAL_INSTALL) + @list='$(api_DATA)'; test -n "$(apidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(apidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(apidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(apidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(apidir)" || exit $$?; \ + done + +uninstall-apiDATA: + @$(NORMAL_UNINSTALL) + @list='$(api_DATA)'; test -n "$(apidir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(apidir)'; $(am__uninstall_files_from_dir) +install-convertDATA: $(convert_DATA) + @$(NORMAL_INSTALL) + @list='$(convert_DATA)'; test -n "$(convertdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(convertdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(convertdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(convertdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(convertdir)" || exit $$?; \ + done + +uninstall-convertDATA: + @$(NORMAL_UNINSTALL) + @list='$(convert_DATA)'; test -n "$(convertdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(convertdir)'; $(am__uninstall_files_from_dir) +install-dbusserviceDATA: $(dbusservice_DATA) + @$(NORMAL_INSTALL) + @list='$(dbusservice_DATA)'; test -n "$(dbusservicedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dbusservicedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dbusservicedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusservicedir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusservicedir)" || exit $$?; \ + done + +uninstall-dbusserviceDATA: + @$(NORMAL_UNINSTALL) + @list='$(dbusservice_DATA)'; test -n "$(dbusservicedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(dbusservicedir)'; $(am__uninstall_files_from_dir) +install-desktopDATA: $(desktop_DATA) + @$(NORMAL_INSTALL) + @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(desktopdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(desktopdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(desktopdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ + done + +uninstall-desktopDATA: + @$(NORMAL_UNINSTALL) + @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir) +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically 'make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(apidir)" "$(DESTDIR)$(convertdir)" "$(DESTDIR)$(dbusservicedir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-apiDATA install-convertDATA \ + install-dbusserviceDATA install-desktopDATA install-man \ + install-pkgconfigDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-apiDATA uninstall-convertDATA \ + uninstall-dbusserviceDATA uninstall-desktopDATA uninstall-man \ + uninstall-pkgconfigDATA + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-apiDATA install-convertDATA install-data \ + install-data-am install-dbusserviceDATA install-desktopDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-apiDATA uninstall-convertDATA \ + uninstall-dbusserviceDATA uninstall-desktopDATA uninstall-man \ + uninstall-man1 uninstall-pkgconfigDATA + + +@INTLTOOL_XML_NOMERGE_RULE@ + +@GSETTINGS_RULES@ + +@INTLTOOL_DESKTOP_RULE@ + +gnome-settings-daemon.desktop.in: gnome-settings-daemon.desktop.in.in + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@.tmp && mv $@.tmp $@ + +@INTLTOOL_XML_NOMERGE_RULE@ + +@HAVE_IBUS_TRUE@org.freedesktop.IBus.service: org.freedesktop.IBus.service.in +@HAVE_IBUS_TRUE@ $(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@.tmp && mv $@.tmp $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/data/gnome-settings-daemon-uninstalled.pc.in b/data/gnome-settings-daemon-uninstalled.pc.in new file mode 100644 index 00000000..36f0c15a --- /dev/null +++ b/data/gnome-settings-daemon-uninstalled.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +binary=${pc_top_builddir}/gnome-settings-daemon/gnome-settings-daemon + +Name: gnome-settings-daemon +Description: Utility library for accessing gnome-settings-daemon over DBUS +Requires: glib-2.0 +Version: @VERSION@ +Libs: ${pc_top_builddir}/${pcfiledir}/../gnome-settings-daemon/libgsd.la +Cflags: -I${pc_top_builddir}/${pcfiledir}/.. diff --git a/data/gnome-settings-daemon.1 b/data/gnome-settings-daemon.1 new file mode 100644 index 00000000..79f998e0 --- /dev/null +++ b/data/gnome-settings-daemon.1 @@ -0,0 +1,33 @@ +.\" +.\" gnomeâ‚‹settings-daemon manual page +.\" Copyright (c) 2009 Joshua Cummings +.\" +.TH GNOME-SETTINGS-DAEMON 1 "June 25 2009" "" +.SH NAME +gnome-settings-daemon \- Handles the GNOME session settings +.SH SYNOPSIS +\fBgnome-settings-daemon\fR [\fB\-\-debug\fR] [\fB\-\-no-daemon\fR] +[\fB\-\-display\fR=\fIDISPLAY\fR] +.SH DESCRIPTION +\fIgnome-settings-daemon\fR is responsible for setting the various preference +parameters of a GNOME session and the applications that run under it. +.SH OPTIONS +.PP +Help options +.TP +\-?, \fB\-\-help\fR +Show this help message +.PP +Application options +.TP +\fB\-\^\-debug\fR +Enable debugging code +.TP +\fB\-\^\-display\fR=\fIDISPLAY\fR +X display to use +.PP +.SH AUTHOR +\fBgnome-settings-daemon\fR was written by Jonathan Blandford +and William Jon McCann . +.PP +This manual page was originally written by Joshua Cummings . diff --git a/data/gnome-settings-daemon.convert b/data/gnome-settings-daemon.convert new file mode 100644 index 00000000..001a147c --- /dev/null +++ b/data/gnome-settings-daemon.convert @@ -0,0 +1,98 @@ +[org.gnome.settings-daemon.peripherals.smartcard] +removal-action = /desktop/gnome/peripherals/smartcard/removal_action + +[org.gnome.settings-daemon.peripherals.touchpad] +disable-while-typing = /desktop/gnome/peripherals/touchpad/disable_while_typing +horiz-scroll-enabled = /desktop/gnome/peripherals/touchpad/horiz_scroll_enabled +scroll-method = /desktop/gnome/peripherals/touchpad/scroll_method +tap-to-click = /desktop/gnome/peripherals/touchpad/tap_to_click +touchpad-enabled = /desktop/gnome/peripherals/touchpad/touchpad_enabled +motion-acceleration = /desktop/gnome/peripherals/mouse/motion_acceleration +motion-threshold = /desktop/gnome/peripherals/mouse/motion_threshold + +[org.gnome.settings-daemon.plugins.a11y-keyboard] +active = /apps/gnome_settings_daemon/plugins/a11y-keyboard/active +priority = /apps/gnome_settings_daemon/plugins/a11y-keyboard/priority + +[org.gnome.settings-daemon.plugins.background] +active = /apps/gnome_settings_daemon/plugins/background/active +priority = /apps/gnome_settings_daemon/plugins/background/priority + +[org.gnome.settings-daemon.plugins.clipboard] +active = /apps/gnome_settings_daemon/plugins/clipboard/active +priority = /apps/gnome_settings_daemon/plugins/clipboard/priority + +[org.gnome.settings-daemon.plugins.font] +active = /apps/gnome_settings_daemon/plugins/font/active +priority = /apps/gnome_settings_daemon/plugins/font/priority + +[org.gnome.settings-daemon.plugins.housekeeping] +active = /apps/gnome_settings_daemon/plugins/housekeeping/active +free-percent-notify = /apps/gnome_settings_daemon/plugins/housekeeping/free_percent_notify +free-percent-notify-again = /apps/gnome_settings_daemon/plugins/housekeeping/free_percent_notify_again +free-size-gb-no-notify = /apps/gnome_settings_daemon/plugins/housekeeping/free_size_gb_no_notify +ignore-paths = /apps/gnome_settings_daemon/plugins/housekeeping/ignore_paths +min-notify-period = /apps/gnome_settings_daemon/plugins/housekeeping/min_notify_period +priority = /apps/gnome_settings_daemon/plugins/housekeeping/priority + +[org.gnome.settings-daemon.plugins.keyboard] +active = /apps/gnome_settings_daemon/plugins/keyboard/active +priority = /apps/gnome_settings_daemon/plugins/keyboard/priority + +[org.gnome.settings-daemon.plugins.media-keys] +active = /apps/gnome_settings_daemon/plugins/keybindings/active +calculator = /apps/gnome_settings_daemon/keybindings/calculator +email = /apps/gnome_settings_daemon/keybindings/email +eject = /apps/gnome_settings_daemon/keybindings/eject +help = /apps/gnome_settings_daemon/keybindings/help +home = /apps/gnome_settings_daemon/keybindings/home +logout = /apps/gnome_settings_daemon/keybindings/power +media = /apps/gnome_settings_daemon/keybindings/media +next = /apps/gnome_settings_daemon/keybindings/next +pause = /apps/gnome_settings_daemon/keybindings/pause +play = /apps/gnome_settings_daemon/keybindings/play +previous = /apps/gnome_settings_daemon/keybindings/previous +priority = /apps/gnome_settings_daemon/plugins/keybindings/priority +screensaver = /apps/gnome_settings_daemon/keybindings/screensaver +search = /apps/gnome_settings_daemon/keybindings/search +stop = /apps/gnome_settings_daemon/keybindings/stop +touchpad = /apps/gnome_settings_daemon/keybindings/touchpad +volume-down = /apps/gnome_settings_daemon/keybindings/volume_down +volume-mute = /apps/gnome_settings_daemon/keybindings/volume_mute +volume-up = /apps/gnome_settings_daemon/keybindings/volume_up +www = /apps/gnome_settings_daemon/keybindings/www +screenshot = /apps/metacity/global_keybindings/run_command_screenshot +window-screenshot = /apps/metacity/global_keybindings/run_command_window_screenshot +terminal = /apps/metacity/global_keybindings/run_command_terminal + +[org.gnome.settings-daemon.plugins.mouse] +active = /apps/gnome_settings_daemon/plugins/mouse/active +priority = /apps/gnome_settings_daemon/plugins/mouse/priority + +[org.gnome.settings-daemon.peripherals.mouse] +locate-pointer = /desktop/gnome/peripherals/mouse/locate_pointer +double-click = /desktop/gnome/peripherals/mouse/double_click +drag-threshold = /desktop/gnome/peripherals/mouse/drag_threshold +left-handed = /desktop/gnome/peripherals/mouse/left_handed +motion-acceleration = /desktop/gnome/peripherals/mouse/motion_acceleration +motion-threshold = /desktop/gnome/peripherals/mouse/motion_threshold + +[org.gnome.settings-daemon.plugins.smartcard] +active = /apps/gnome_settings_daemon/plugins/smartcard/active +priority = /apps/gnome_settings_daemon/plugins/smartcard/priority + +[org.gnome.settings-daemon.plugins.sound] +active = /apps/gnome_settings_daemon/plugins/sound/active +priority = /apps/gnome_settings_daemon/plugins/sound/priority + +[org.gnome.settings-daemon.plugins.xrandr] +active = /apps/gnome_settings_daemon/plugins/xrandr/active +default-configuration-file = /apps/gnome_settings_daemon/xrandr/default_configuration_file +priority = /apps/gnome_settings_daemon/plugins/xrandr/priority + +[org.gnome.settings-daemon.plugins.xsettings] +active = /apps/gnome_settings_daemon/plugins/xsettings/active +antialiasing = /desktop/gnome/font_rendering/antialiasing +hinting = /desktop/gnome/font_rendering/hinting +priority = /apps/gnome_settings_daemon/plugins/xsettings/priority +rgba-order = /desktop/gnome/font_rendering/rgba_order diff --git a/data/gnome-settings-daemon.desktop.in.in b/data/gnome-settings-daemon.desktop.in.in new file mode 100644 index 00000000..5307d400 --- /dev/null +++ b/data/gnome-settings-daemon.desktop.in.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +_Name=GNOME Settings Daemon +Exec=@libexecdir@/gnome-settings-daemon +OnlyShowIn=GNOME;Unity; +NoDisplay=true +X-GNOME-Autostart-Phase=Initialization +X-GNOME-Autostart-Notify=true +X-GNOME-AutoRestart=true diff --git a/data/gnome-settings-daemon.pc.in b/data/gnome-settings-daemon.pc.in new file mode 100644 index 00000000..e3de494c --- /dev/null +++ b/data/gnome-settings-daemon.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +libexecdir=@libexecdir@ +plugindir=${libdir}/gnome-settings-daemon-@GSD_API_VERSION@ +binary=${libexecdir}/gnome-settings-daemon + +Name: gnome-settings-daemon +Description: Utility library for accessing gnome-settings-daemon over DBUS +Requires: glib-2.0 +Version: @VERSION@ +Libs: -L${libdir} +Cflags: -I${includedir}/gnome-settings-daemon-@GSD_API_VERSION@ diff --git a/data/gsd-enums.h b/data/gsd-enums.h new file mode 100644 index 00000000..99d9fbad --- /dev/null +++ b/data/gsd-enums.h @@ -0,0 +1,149 @@ +/* + * Copyright © 2010 Bastien Nocera + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * Authors: + * Bastien Nocera + */ + +#ifndef __gsd_enums_h__ +#define __gsd_enums_h__ + +typedef enum +{ + GSD_FONT_ANTIALIASING_MODE_NONE, + GSD_FONT_ANTIALIASING_MODE_GRAYSCALE, + GSD_FONT_ANTIALIASING_MODE_RGBA +} GsdFontAntialiasingMode; + +typedef enum +{ + GSD_FONT_HINTING_NONE, + GSD_FONT_HINTING_SLIGHT, + GSD_FONT_HINTING_MEDIUM, + GSD_FONT_HINTING_FULL +} GsdFontHinting; + +typedef enum +{ + GSD_FONT_RGBA_ORDER_RGBA, + GSD_FONT_RGBA_ORDER_RGB, + GSD_FONT_RGBA_ORDER_BGR, + GSD_FONT_RGBA_ORDER_VRGB, + GSD_FONT_RGBA_ORDER_VBGR +} GsdFontRgbaOrder; + +typedef enum +{ + GSD_SMARTCARD_REMOVAL_ACTION_NONE, + GSD_SMARTCARD_REMOVAL_ACTION_LOCK_SCREEN, + GSD_SMARTCARD_REMOVAL_ACTION_FORCE_LOGOUT +} GsdSmartcardRemovalAction; + +typedef enum +{ + GSD_TOUCHPAD_SCROLL_METHOD_DISABLED, + GSD_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING, + GSD_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING +} GsdTouchpadScrollMethod; + +typedef enum +{ + GSD_BELL_MODE_ON, + GSD_BELL_MODE_OFF, + GSD_BELL_MODE_CUSTOM +} GsdBellMode; + +typedef enum +{ + GSD_TOUCHPAD_HANDEDNESS_RIGHT, + GSD_TOUCHPAD_HANDEDNESS_LEFT, + GSD_TOUCHPAD_HANDEDNESS_MOUSE +} GsdTouchpadHandedness; + +typedef enum +{ + GSD_XRANDR_BOOT_BEHAVIOUR_DO_NOTHING, + GSD_XRANDR_BOOT_BEHAVIOUR_CLONE, + GSD_XRANDR_BOOT_BEHAVIOUR_DOCK +} GsdXrandrBootBehaviour; + +typedef enum +{ + GSD_WACOM_ROTATION_NONE, + GSD_WACOM_ROTATION_CW, + GSD_WACOM_ROTATION_CCW, + GSD_WACOM_ROTATION_HALF +} GsdWacomRotation; + +typedef enum +{ + GSD_WACOM_ACTION_TYPE_NONE, + GSD_WACOM_ACTION_TYPE_CUSTOM, + GSD_WACOM_ACTION_TYPE_SWITCH_MONITOR +} GsdWacomActionType; + +typedef enum +{ + GSD_POWER_ACTION_BLANK, + GSD_POWER_ACTION_SUSPEND, + GSD_POWER_ACTION_SHUTDOWN, + GSD_POWER_ACTION_HIBERNATE, + GSD_POWER_ACTION_INTERACTIVE, + GSD_POWER_ACTION_NOTHING +} GsdPowerActionType; + +typedef enum +{ + GSD_UPDATE_TYPE_ALL, + GSD_UPDATE_TYPE_SECURITY, + GSD_UPDATE_TYPE_NONE +} GsdUpdateType; + +typedef enum +{ + GSD_NUM_LOCK_STATE_UNKNOWN, + GSD_NUM_LOCK_STATE_ON, + GSD_NUM_LOCK_STATE_OFF +} GsdNumLockState; + +typedef enum +{ + GSD_INPUT_SOURCES_SWITCHER_OFF, + GSD_INPUT_SOURCES_SWITCHER_SHIFT_L, + GSD_INPUT_SOURCES_SWITCHER_ALT_L, + GSD_INPUT_SOURCES_SWITCHER_CTRL_L, + GSD_INPUT_SOURCES_SWITCHER_SHIFT_R, + GSD_INPUT_SOURCES_SWITCHER_ALT_R, + GSD_INPUT_SOURCES_SWITCHER_CTRL_R, + GSD_INPUT_SOURCES_SWITCHER_ALT_SHIFT_L, + GSD_INPUT_SOURCES_SWITCHER_ALT_SHIFT_R, + GSD_INPUT_SOURCES_SWITCHER_CTRL_SHIFT_L, + GSD_INPUT_SOURCES_SWITCHER_CTRL_SHIFT_R, + GSD_INPUT_SOURCES_SWITCHER_SHIFT_L_SHIFT_R, + GSD_INPUT_SOURCES_SWITCHER_ALT_L_ALT_R, + GSD_INPUT_SOURCES_SWITCHER_CTRL_L_CTRL_R, + GSD_INPUT_SOURCES_SWITCHER_ALT_SHIFT, + GSD_INPUT_SOURCES_SWITCHER_CTRL_SHIFT, + GSD_INPUT_SOURCES_SWITCHER_ALT_CTRL, + GSD_INPUT_SOURCES_SWITCHER_CAPS, + GSD_INPUT_SOURCES_SWITCHER_SHIFT_CAPS, + GSD_INPUT_SOURCES_SWITCHER_ALT_CAPS, + GSD_INPUT_SOURCES_SWITCHER_CTRL_CAPS, +} GsdInputSourcesSwitcher; + +#endif /* __gsd_enums_h__ */ diff --git a/data/org.freedesktop.IBus.service.in b/data/org.freedesktop.IBus.service.in new file mode 100644 index 00000000..cc888342 --- /dev/null +++ b/data/org.freedesktop.IBus.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.freedesktop.IBus +Exec=@bindir@/ibus-daemon --replace --xim --panel disable diff --git a/data/org.gnome.settings-daemon.peripherals.gschema.xml.in.in b/data/org.gnome.settings-daemon.peripherals.gschema.xml.in.in new file mode 100644 index 00000000..c2c2f0c8 --- /dev/null +++ b/data/org.gnome.settings-daemon.peripherals.gschema.xml.in.in @@ -0,0 +1,163 @@ + + + + + + + + + + + + 'none' + <_summary>Smartcard removal action + <_description>Set this to one of "none", "lock-screen", or "force-logout". The action will get performed when the smartcard used for log in is removed. + + + + + false + <_summary>Disable touchpad while typing + <_description>Set this to TRUE if you have problems with accidentally hitting the touchpad while typing. + + + false + <_summary>Enable horizontal scrolling + <_description>Set this to TRUE to allow horizontal scrolling by the same method selected with the scroll_method key. + + + 'edge-scrolling' + <_summary>Select the touchpad scroll method + <_description>Select the touchpad scroll method. Supported values are: "disabled", "edge-scrolling", "two-finger-scrolling". + + + false + <_summary>Enable mouse clicks with touchpad + <_description>Set this to TRUE to be able to send mouse clicks by tapping on the touchpad. + + + true + <_summary>Enable touchpad + <_description>Set this to TRUE to enable all touchpads. + + + 'mouse' + Touchpad button orientation + Swap left and right mouse buttons for left-handed mice with 'left', 'right' for right-handed, 'mouse' to follow the mouse setting. + + + -1 + Single Click + Acceleration multiplier for mouse motion. A value of -1 is the system default. + + + -1 + Motion Threshold + Distance in pixels the pointer must move before accelerated mouse motion is activated. A value of -1 is the system default. + + + false + Natural scrolling + Set this to TRUE to enable natural (reverse) scrolling for touchpads. + + + + + true + + + true + + + 30 + Key Repeat Interval + Delay between repeats in milliseconds. + + + 500 + Initial Key Repeat Delay + Initial key repeat delay in milliseconds. + + + 0 + + + 'on' + Possible values are "on", "off", and "custom". + + + 400 + + + 100 + + + '' + Keyboard Bell Custom Filename + File name of the bell sound to be played. + + + true + Remember NumLock state + When set to true, GNOME will remember the state of the NumLock LED between sessions. + + + 'unknown' + NumLock state + The remembered state of the NumLock LED. + + + 'off' + Modifiers-only input sources switcher shortcut + + + + + false + <_summary>Highlights the current location of the pointer when the Control key is pressed and released. + + + false + Mouse button orientation + Swap left and right mouse buttons for left-handed mice. + + + -1 + Single Click + Acceleration multiplier for mouse motion. A value of -1 is the system default. + + + -1 + Motion Threshold + Distance in pixels the pointer must move before accelerated mouse motion is activated. A value of -1 is the system default. + + + 400 + <_summary>Double click time + <_description> Length of a double click in milliseconds. + + + 8 + <_summary>Drag threshold + <_description>Distance before a drag is started. + + + false + <_summary>Middle button emulation + <_description>Enables middle mouse button emulation through simultaneous left and right button click. + + + + + false + <_summary>Whether the tablet's orientation is locked, or rotated automatically. + + + + + '' + <_summary>Device hotplug custom command + <_description>Command to be run when a device is added or removed. + + + diff --git a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in new file mode 100644 index 00000000..68dd80aa --- /dev/null +++ b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in @@ -0,0 +1,106 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 6 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + + + + + true + <_summary>Wacom stylus absolute mode + <_description>Enable this to set the tablet to absolute mode. + + + [-1, -1, -1, -1] + <_summary>Wacom tablet area + <_description>Set this to x1, y1 and x2, y2 of the area usable by the tools. + + + false + <_summary>Wacom tablet aspect ratio + <_description>Enable this to restrict the Wacom tablet area to match the aspect ratio of the output. + + + 'none' + <_summary>Wacom tablet rotation + <_description>Set this to 'none', 'cw' for 90 degree clockwise, 'half' for 180 degree, and 'ccw' for 90 degree counterclockwise. + + + true + <_summary>Wacom touch feature + <_description>Enable this to move the cursor when the user touches the tablet. + + + false + <_summary>Wacom tablet PC feature + <_description>Enable this to only report stylus events when the tip is pressed. + + + ["", "", ""] + <_summary>Wacom display mapping + <_description>EDID information of monitor to map tablet to. Must be in the format [vendor, product, serial]. ["","",""] disables mapping. + + + + + [0, 0, 100, 100] + <_summary>Wacom stylus pressure curve + <_description>Set this to x1, y1 and x2, y2 of the pressure curve applied to the stylus. + + + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + <_summary>Wacom stylus button mapping + <_description>Set this to the logical button mapping. + + + -1 + <_summary>Wacom stylus pressure threshold + <_description>Set this to the pressure value at which a stylus click event is generated. + + + + + [0, 0, 100, 100] + <_summary>Wacom eraser pressure curve + <_description>Set this to x1, y1 and x2, y2 of the pressure curve applied to the eraser. + + + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + <_summary>Wacom eraser button mapping + <_description>Set this to the logical button mapping. + + + -1 + <_summary>Wacom eraser pressure threshold + <_description>Set this to the pressure value at which an eraser click event is generated. + + + + + 'none' + <_summary>Wacom button action type + <_description>The type of action triggered by the button being pressed. + + + '' + <_summary>Key combination for the custom action + <_description>The keyboard shortcut generated when the button is pressed for custom actions. + + + ['', ''] + <_summary>Key combinations for an elevator custom action + <_description>The keyboard shortcuts generated when a touchring or touchstrip is used for custom actions (up followed by down). + + + diff --git a/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in new file mode 100644 index 00000000..d19863ee --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in @@ -0,0 +1,24 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 1 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + 0 + <_summary>The duration a display profile is valid + <_description>This is the number of days after which the display color profile is considered invalid. + + + 0 + <_summary>The duration a printer profile is valid + <_description>This is the number of days after which the printer color profile is considered invalid. + + + diff --git a/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in new file mode 100644 index 00000000..0594331e --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 7 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 7 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 97 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 99 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 99 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 4 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 7 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 8 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 8 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 5 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + diff --git a/data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in.in new file mode 100644 index 00000000..594c0455 --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in.in @@ -0,0 +1,39 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + [] + <_summary>Mount paths to ignore + <_description>Specify a list of mount paths to ignore when they run low on space. + + + 0.05 + <_summary>Free percentage notify threshold + <_description>Percentage free space threshold for initial warning of low disk space. If the percentage free space drops below this, a warning will be shown. + + + 0.01 + <_summary>Subsequent free space percentage notify threshold + <_description>Specify the percentage that the free disk space should reduce by before issuing a subsequent warning. + + + 1 + <_summary>Free space notify threshold + <_description>Specify an amount in GB. If the amount of free space is more than this, no warning will be shown. + + + 10 + <_summary>Minimum notify period for repeated warnings + <_description>Specify a time in minutes. Subsequent warnings for a volume will not appear more often than this period. + + + 300 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + diff --git a/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in new file mode 100644 index 00000000..4d2a7282 --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.keyboard.gschema.xml.in.in @@ -0,0 +1,14 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 6 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + diff --git a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in new file mode 100644 index 00000000..1fd4d054 --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in @@ -0,0 +1,202 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + [] + <_summary>Custom keybindings + <_description>List of custom keybindings + + + 'XF86Calculator' + <_summary>Launch calculator + <_description>Binding to launch the calculator. + + + 'XF86Mail' + <_summary>Launch email client + <_description>Binding to launch the email client. + + + 'XF86Eject' + <_summary>Eject + <_description>Binding to eject an optical disc. + + + '' + <_summary>Launch help browser + <_description>Binding to launch the help browser. + + + 'XF86Explorer' + <_summary>Home folder + <_description>Binding to open the Home folder. + + + 'XF86AudioMedia' + <_summary>Launch media player + <_description>Binding to launch the media player. + + + 'XF86AudioNext' + <_summary>Next track + <_description>Binding to skip to next track. + + + 'XF86AudioPause' + <_summary>Pause playback + <_description>Binding to pause playback. + + + 'XF86AudioPlay' + <_summary>Play (or play/pause) + <_description>Binding to start playback (or toggle play/pause). + + + '<Control><Alt>Delete' + <_summary>Log out + <_description>Binding to log out. + + + 'XF86AudioPrev' + <_summary>Previous track + <_description>Binding to skip to previous track. + + + 98 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + '<Control><Alt>l' + <_summary>Lock screen + <_description>Binding to lock the screen. + + + 'XF86Search' + <_summary>Search + <_description>Binding to launch the search tool. + + + 'XF86AudioStop' + <_summary>Stop playback + <_description>Binding to stop playback. + + + 'XF86AudioLowerVolume' + <_summary>Volume down + <_description>Binding to lower the system volume. + + + 'XF86AudioMute' + <_summary>Volume mute + <_description>Binding to mute the system volume. + + + 'XF86AudioRaiseVolume' + <_summary>Volume up + <_description>Binding to raise the system volume. + + + 'Print' + <_summary>Take a screenshot + <_description>Binding to take a screenshot. + + + '<Alt>Print' + <_summary>Take a screenshot of a window + <_description>Binding to take a screenshot of a window. + + + '<Shift>Print' + <_summary>Take a screenshot of an area + <_description>Binding to take a screenshot of an area. + + + '<Ctrl>Print' + <_summary>Copy a screenshot to clipboard + <_description>Binding to copy a screenshot to clipboard. + + + '<Ctrl><Alt>Print' + <_summary>Copy a screenshot of a window to clipboard + <_description>Binding to copy a screenshot of a window to clipboard. + + + '<Ctrl><Shift>Print' + <_summary>Copy a screenshot of an area to clipboard + <_description>Binding to copy a screenshot of an area to clipboard. + + + '<Primary><Alt>t' + <_summary>Launch terminal + <_description>Binding to launch the terminal. + + + 'XF86WWW' + <_summary>Launch web browser + <_description>Binding to launch the web browser. + + + '<Alt><Super>8' + <_summary>Toggle magnifier + <_description>Binding to show the screen magnifier + + + '' + <_summary>Toggle screen reader + <_description>Binding to start the screen reader + + + '' + <_summary>Toggle on-screen keyboard + <_description>Binding to show the on-screen keyboard + + + '' + <_summary>Increase text size + <_description>Binding to increase the text size + + + '' + <_summary>Decrease text size + <_description>Binding to decrease the text size + + + '' + <_summary>Toggle contrast + <_description>Binding to toggle the interface contrast + + + '<Alt><Super>equal' + <_summary>Magnifier zoom in + <_description>Binding for the magnifier to zoom in + + + '<Alt><Super>minus' + <_summary>Magnifier zoom out + <_description>Binding for the magnifier to zoom out + + + + + + '' + <_summary>Name + <_description>Name of the custom binding + + + '' + <_summary>Binding + <_description>Binding for the custom binding + + + '' + <_summary>Command + <_description>Command to run when the binding is invoked + + + diff --git a/data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in.in new file mode 100644 index 00000000..9e2504e1 --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.orientation.gschema.xml.in.in @@ -0,0 +1,14 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 1 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in new file mode 100644 index 00000000..fddfb120 --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in @@ -0,0 +1,152 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 1 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + 30 + The brightness of the screen when idle + This is the laptop panel screen brightness used when the session is idle. + + + false + Dim the screen after a period of inactivity when on AC power + If the screen should be dimmed to save power when the computer is idle when on AC power. + + + true + Dim the screen after a period of inactivity when on battery power + If the screen should be dimmed to save power when the computer is idle when on battery power. + + + 90 + The default amount of time to dim the screen after idle + The default amount of time to dim the screen after idle. + + + 600 + Sleep timeout display when on AC + The amount of time in seconds before the display turns off when the computer is on AC power. + + + 600 + Sleep timeout display when on battery + The amount of time in seconds before the display turns off when the computer is on battery power. + + + 0 + Sleep timeout computer when on AC + The amount of time in seconds the computer on AC power needs to be inactive before it goes to sleep. A value of 0 means never. + + + 'suspend' + Whether to hibernate, suspend or do nothing when inactive + The type of sleeping that should be performed when the computer is inactive. + + + 0 + Sleep timeout computer when on battery + The amount of time in seconds the computer on battery power needs to be inactive before it goes to sleep. A value of 0 means never. + + + 'suspend' + Whether to hibernate, suspend or do nothing when inactive + The type of sleeping that should be performed when the computer is inactive. + + + 'suspend' + Suspend button action + The action to take when the system suspend button is pressed. + + + 'hibernate' + Hibernate button action + The action to take when the system hibernate button is pressed. + + + 'hibernate' + Sleep button action + The action to take when the system sleep (non-specific type) button is pressed. + + + + 'suspend' + Power button action + The action to take when the system power button is pressed. + + + + 'suspend' + Laptop lid close action on battery + The action to take when the laptop lid is closed and the laptop is on battery power. + + + 'suspend' + Laptop lid close action when on AC + The action to take when the laptop lid is closed and the laptop is on AC power. + + + false + Laptop lid, when closed, will suspend even if there is an external monitor plugged in + With no external monitors plugged in, closing a laptop's lid + will suspend the machine (as set by the lid-close-battery-action and + lid-close-ac-action keys). By default, however, closing the lid when + an external monitor is present will not suspend the machine, so that one can keep + working on that monitor (e.g. for docking stations or media viewers). Set this + key to False to keep the default behavior, or to True to suspend the laptop whenever the + lid is closed and regardless of external monitors. + + + 'hibernate' + Battery critical low action + The action to take when the battery is critically low. + + + 10 + <_summary>Percentage considered low + <_description>The percentage of the battery when it is considered low. Only valid when use-time-for-policy is false. + + + 3 + <_summary>Percentage considered critical + <_description>The percentage of the battery when it is considered critical. Only valid when use-time-for-policy is false. + + + 2 + <_summary>Percentage action is taken + <_description>The percentage of the battery when the critical action is performed. Only valid when use-time-for-policy is false. + + + 1200 + <_summary>The time remaining when low + <_description>The time remaining in seconds of the battery when it is considered low. Only valid when use-time-for-policy is true. + + + 300 + <_summary>The time remaining when critical + <_description>The time remaining in seconds of the battery when it is considered critical. Only valid when use-time-for-policy is true. + + + 120 + <_summary>The time remaining when action is taken + <_description>The time remaining in seconds of the battery when critical action is taken. Only valid when use-time-for-policy is true. + + + true + <_summary>Whether to use time-based notifications + <_description>If time based notifications should be used. If set to false, then the percentage change is used instead, which may fix a broken ACPI BIOS. + + + true + <_summary>If we should show the recalled battery warning for a broken battery + <_description>If we should show the recalled battery warning for a broken battery. Set this to false only if you know your battery is okay. + + + diff --git a/data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in.in new file mode 100644 index 00000000..a1c74eeb --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.print-notifications.gschema.xml.in.in @@ -0,0 +1,14 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 99 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + diff --git a/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in new file mode 100644 index 00000000..9af2718f --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in @@ -0,0 +1,79 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 300 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + false + <_summary>Use mobile broadband connections + <_description>Use mobile broadband connections such as GSM and CDMA to check for updates. + + + true + <_summary>Automatically download updates in the background without confirmation + <_description>Automatically download updates in the background without confirmation. Updates will be auto-downloaded when using wired network connnections, and mobile broadband if 'connection-use-mobile' is enabled. + + + 86400 + <_summary>How often to check for updates + <_description>How often to check for updates. Value is in seconds. This is a maximum amount of time that can pass between a security update being published, and the update being automatically installed or the user notified. + + + 604800 + <_summary>How often to notify the user that non-critical updates are available + <_description>How often to tell the user there are non-critical updates. Value is in seconds. Security update notifications are always shown after the check for updates, but non-critical notifications should be shown a lot less frequently. + + + 0 + <_summary>The last time we told the user about non-critical notifications + <_description>The last time we notified the user about non-critical updates. Value is in seconds since the epoch, or zero for never. + + + 604800 + <_summary>How often to check for distribution upgrades + <_description>How often to check for distribution upgrades. Value is in seconds. + + + 86400 + <_summary>How often to refresh the package cache + <_description>How often to refresh the package cache. Value is in seconds. + + + false + <_summary>Check for updates when running on battery power + <_description>Check for updates when running on battery power. + + + false + <_summary>Notify the user when distribution upgrades are available + <_description>Notify the user when distribution upgrades are available. + + + true + <_summary>Ask the user if additional firmware should be installed + <_description>Ask the user if additional firmware should be installed if it is available. + + + '*/intel-ucode/*' + <_summary>Firmware files that should not be searched for + <_description>Firmware files that should not be searched for, separated by commas. These can include '*' and '?' characters. + + + '' + <_summary>Devices that should be ignored + <_description>Devices that should be ignored, separated by commas. These can include '*' and '?' characters. + + + 'media.repo,.discinfo' + <_summary>The filenames on removable media that designate it a software source. + <_description>When removable media is inserted, it is checked to see if it contains any important filenames in the root directory. If the filename matches, then an updates check is performed. This allows post-install disks to be used to update running systems. + + + diff --git a/data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in new file mode 100644 index 00000000..51f87bbf --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in @@ -0,0 +1,24 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + '/etc/gnome-settings-daemon/xrandr/monitors.xml' + <_summary>File for default configuration for RandR + <_description>The XRandR plugin will look for a default configuration in the file specified by this key. This is similar to the ~/.config/monitors.xml that normally gets stored in users' home directories. If a user does not have such a file, or has one that does not match the user's setup of monitors, then the file specified by this key will be used instead. + + + 2 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + 'do-nothing' + <_summary>Whether to turn off specific monitors after boot + <_description>'clone' will display the same thing on all monitors, 'dock' will switch off the internal monitor, 'do-nothing' will use the default Xorg behaviour (extend the desktop in recent versions) + + + diff --git a/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in new file mode 100644 index 00000000..ff780244 --- /dev/null +++ b/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in @@ -0,0 +1,44 @@ + + + + true + <_summary>Activation of this plugin + <_description>Whether this plugin would be activated by gnome-settings-daemon or not + + + 'grayscale' + <_summary>Antialiasing + <_description>The type of antialiasing to use when rendering fonts. Possible values are: "none" for no antialiasing, "grayscale" for standard grayscale antialiasing, and "rgba" for subpixel antialiasing (LCD screens only). + + + 'medium' + <_summary>Hinting + <_description>The type of hinting to use when rendering fonts. Possible values are: "none" for no hinting, "slight" for basic, "medium" for moderate, and "full" for maximum hinting (may cause distortion of letter forms). + + + 2 + <_summary>Priority to use for this plugin + <_description>Priority to use for this plugin in gnome-settings-daemon startup queue + + + 'rgb' + <_summary>RGBA order + <_description>The order of subpixel elements on an LCD screen; only used when antialiasing is set to "rgba". Possible values are: "rgb" for red on left (most common), "bgr" for blue on left, "vrgb" for red on top, "vbgr" for red on bottom. + + + [] + <_summary>List of explicitly disabled GTK+ modules + <_description>A list of strings representing the GTK+ modules that will not be loaded, even if enabled by default in their configuration. + + + [] + <_summary>List of explicitly enabled GTK+ modules + <_description>A list of strings representing the GTK+ modules that will be loaded, usually in addition to conditional and forcibly disabled ones. + + + {} + A dictionary of XSETTINGS to override + This dictionary maps XSETTINGS names to overrides values. The values must be either strings, signed int32s or (in the case of colors), 4-tuples of uint16 (red, green, blue, alpha; 65535 is fully opaque). + + + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..12081d7b --- /dev/null +++ b/debian/changelog @@ -0,0 +1,1619 @@ +gnome-settings-daemon (3.6.4-0ubuntu8) raring; urgency=low + + * debian/control.in: + - Breaks on g-c-c and indicator-datetime versions using the old interface + - recommends systemd-service (lp: #1153567) + * debian/gnome-settings-daemon.install: + - updated for the patch being dropped + * debian/gnome-settings-daemon.main: + - clean org.gnome.SettingsDaemon.DateTimeMechanism.conf conffile + * debian/patches/revert_git_datetime_dropping.patch: + - drop the upstream's revert + + -- Sebastien Bacher Tue, 26 Mar 2013 21:20:26 +0100 + +gnome-settings-daemon (3.6.4-0ubuntu7) raring; urgency=low + + * Add upstart user session job for gnome-settings-daemon. + + -- Stéphane Graber Tue, 12 Mar 2013 15:06:05 -0400 + +gnome-settings-daemon (3.6.4-0ubuntu6) raring; urgency=low + + * debian/patches/nexus_orientation.patch: Fix memory leak when building + pathnames, thanks Jean-Baptiste Lallement! (LP: #1123930) + + -- Jani Monoses Wed, 13 Feb 2013 13:25:19 +0200 + +gnome-settings-daemon (3.6.4-0ubuntu5) raring; urgency=low + + * debian/patches/nexus_orientation.patch: Wait until a DBus connection to + the xrandr module is in place before trying to change orientation. + + -- Jani Monoses Tue, 12 Feb 2013 00:07:12 +0200 + +gnome-settings-daemon (3.6.4-0ubuntu4) raring; urgency=low + + * debian/patches/nexus_orientation.patch: Correctly set up portrait + orientation on first run. Disable the timer that polls the accelerometer + on the Nexus 7 if the orientation-lock gsetting is set. + + -- Jani Monoses Mon, 11 Feb 2013 13:14:46 +0200 + +gnome-settings-daemon (3.6.4-0ubuntu3) raring; urgency=low + + * debian/patches/nexus_orientation.patch: Set up a timer to poll + sysfs attributes when an MPU6050 sensor is detected and calculate + screen orientation based on these raw accelerometer readings. + The kernel driver for this sensor used on the Nexus 7 does not currently + provide the interface expected by the current code in g-s-d, hence + this approach until the final one is decided upon. + + -- Jani Monoses Wed, 30 Jan 2013 14:13:45 +0200 + +gnome-settings-daemon (3.6.4-0ubuntu2) raring; urgency=low + + * debian/patches/touchscreen_rotation.patch: On touchscreens + rotate input coordinates by changing the Coordinate Transform Matrix + property instead of evdev axis properties. + + -- Jani Monoses Tue, 29 Jan 2013 16:28:12 +0200 + +gnome-settings-daemon (3.6.4-0ubuntu1) raring; urgency=low + + * New upstream version + * debian/patches/53_update_schemas_warning.patch: + - dropped, the issue is fixed in the new version + * debian/patches/bugzilla_segfault_dpms.patch: + - dropped the part of the patch which is included in the new tarball + * debian/patches/revert_new_ibus_use.patch: refreshed + + -- Sebastien Bacher Wed, 23 Jan 2013 15:12:37 +0100 + +gnome-settings-daemon (3.6.3-0ubuntu4) raring; urgency=low + + * debian/patches/migrate_metacity_keys.patch: + - Migrate screenshot/terminal keys from metacity gconf as well + (LP: #1058004) + + -- Timo Jyrinki Thu, 13 Dec 2012 08:49:24 +0200 + +gnome-settings-daemon (3.6.3-0ubuntu3) raring; urgency=low + + * debian/control.in: + - Pre-Depends: ${misc:Pre-Depends} + * debian/compat, debian/control.in: + - updated debhelper version + * debian/gnome-settings-daemon.maintscript: + * debian/gnome-settings-daemon.postinst: + - clean old "/etc/gnome/config" xrdb conffiles + + -- Sebastien Bacher Thu, 06 Dec 2012 19:31:20 +0100 + +gnome-settings-daemon (3.6.3-0ubuntu2) raring; urgency=low + + * debian/patches/16_use_synchronous_notifications.patch: + - don't segfault when using the screen hotkey (lp: #1082856) + * debian/patches/53_update_schemas_warning.patch: + - don't list the updates schemas it's not used in ubuntu (lp: #1082986) + + -- Sebastien Bacher Mon, 26 Nov 2012 16:28:45 +0100 + +gnome-settings-daemon (3.6.3-0ubuntu1) raring; urgency=low + + [ Sebastien Bacher ] + * New upstream version (lp: #1008840) + * debian/patches/git*, + debian/patches/power-ignore-bad-dbus-requests.patch, + debian/patches/power-ignore-bad-dbus-requests.patch, + debian/patches/10_smaller_syndaemon_timeout.patch: + - dropped, those fixes are in the new version + * debian/control.in: + - restore build-depends on libgnomekbd-dev, libxklavier-dev, + drop the build-depends on libxkbfile-dev + * debian/patches/20_migrate_background_uri.patch: + - dropped, it was only needed until the LTS + * debian/patches/40_xres_lcddefault.patch: + - dropped, that was a workaround for libreoffice that shouldn't be + needed and we should better fix libreoffice + * debian/patches/61_unity_use_application_indicator.patch: + - drop the keyboard indicator code, that will need to be turned + into a proper indicator refactored to handle the new ibus config + * debian/patches/90_set_gmenus_xsettings.patch: + - refreshed for the new version + * debian/patches/revert_new_ibus_use.patch: + - revert keyboard code to our 3.4 version + * debian/patches/sync_keyboard_layout_to_accountsservice.patch: + - dropped, the changes are included in the previous patch + + [ Robert Ancell ] + * New upstream release + * debian/control: + - Bump build-depends on libgnome-desktop-3-dev, libwacom-dev + - Drop build-depends on libgnomekbd-dev, libxklavier-dev + - Add build-depends on libxkbfile-dev + + [ Rico Tzschichholz ] + * debian/control.in: + - Build-depend on gtk-doc-tools + + [ Iain Lane ] + * New upstream release + * Refresh patches and remove those applied upstream. + * Remove gstreamer BDs which are now obsolete. + + -- Sebastien Bacher Wed, 21 Nov 2012 17:16:23 +0100 + +gnome-settings-daemon (3.4.2-0ubuntu14) quantal; urgency=low + + * debian/patches/git_power_dbus_path.patch: + - Fix screen not locking when lid is closed while running + GNOME Shell on GDM (LP: #1048420) + + -- Jeremy Bicha Fri, 28 Sep 2012 21:04:37 -0400 + +gnome-settings-daemon (3.4.2-0ubuntu13) quantal; urgency=low + + * debian/gnome-settings-daemon.gsettings-override: + - Dropped, override moved to ubuntu-default-settings and + ubuntu-gnome-default-settings + + -- Jeremy Bicha Tue, 11 Sep 2012 21:14:56 -0400 + +gnome-settings-daemon (3.4.2-0ubuntu12) quantal-proposed; urgency=low + + * debian/patches/bugzilla_segfault_dpms.patch: + - Update to cover another way to get the same segfault. (LP: #971353) + + -- Michael Terry Wed, 05 Sep 2012 15:42:01 -0400 + +gnome-settings-daemon (3.4.2-0ubuntu11) quantal-proposed; urgency=low + + * debian/patches/90_set_gmenus_xsettings.patch: + - restore ShellShowsAppMenu xsettings to true under unity, that's the + correct thing to do since it supports appmenus and we don't need to + workaroud issues with the new nautils since we reverted to the old one + + -- Sebastien Bacher Wed, 05 Sep 2012 21:16:26 +0200 + +gnome-settings-daemon (3.4.2-0ubuntu10) quantal; urgency=low + + * 64_restore_terminal_keyboard_shortcut_schema.patch: + - The "Launch Terminal" schema was dropped in the gconf>gsettings + switch. Bring it back. (LP: #1010558, LP: #1040081) + + -- Jeremy Bicha Sun, 26 Aug 2012 12:44:27 -0400 + +gnome-settings-daemon (3.4.2-0ubuntu9) quantal-proposed; urgency=low + + [ Sebastien Bacher ] + * debian/control.in: + - don't build-depends on gconf + - updated gnome-control-center breaks version for gsettings + * debian/patches/revert_git_a11y_gsettings.patch, + debian/patches/revert_git_stop_using_gconf.patch, + debian/patches/revert_git_use_gsetting_keybindings.patch: + - drop the gconf to gsettings migration reverts (LP: #1035261) + + [ Keng-Yu Lin ] + * debian/patches/git-mask-out-virtual-modifiers.patch + - patch from upstream git, fix the grabbing issue of the + keyboard shortcut with virtual (Super, Hyper, Meta) modifier. + (lp: #950160) + + [ Edward Donovan ] + * debian/source_gnome-settings-daemon.py: Fix for Python 3. (LP: #1013171) + + [ Hsin-Yi, Chen (hychen) ] + * debian/patches/git_xrandr_explicitly_set_clone_state.patch: + - "xrandr; explicitly set clone state variable when generating monitor + configs" (LP: #1014533) + + [ Michael Terry ] + * debian/patches/git-smartcard-crash.patch: + - Don't crash on login with a smartcard (LP: #1031034) + + -- Sebastien Bacher Thu, 23 Aug 2012 17:04:16 +0200 + +gnome-settings-daemon (3.4.2-0ubuntu8) quantal; urgency=low + + * debian/gnome-settings-daemon.gsettings-override: + - don't enable the deprecated gconf bridge + * debian/patches/revert_git_dropping_gconf_wrapper.patch: + - drop the hackish gsettings to gconf copy mechanism, it shouldn't be + required after the lts, the code is also make gsd sensible to .convert + issues as showed recently by a file-roller update (lp: #1037646) + * debian/rules: + - don't use deprecated --enable-gconf-bridge + + -- Sebastien Bacher Mon, 20 Aug 2012 17:53:45 +0200 + +gnome-settings-daemon (3.4.2-0ubuntu7) quantal; urgency=low + + * debian/patches/git_better_xi_handling.patch: + - should fix multimedia keys (lp: #1034090) + * debian/patches/git_new_cups_build.patch: + - build with cups 1.6 + + -- Sebastien Bacher Wed, 08 Aug 2012 15:38:57 +0200 + +gnome-settings-daemon (3.4.2-0ubuntu6) quantal; urgency=low + + * debian/patches/90_set_gmenus_xsettings.patch: + - set ShellShowsAppMenu xsettings to false under unity so applications go + back to use normal menus, should give nautilus its preferences menu + entry back for example + + -- Sebastien Bacher Wed, 11 Jul 2012 18:21:49 +0200 + +gnome-settings-daemon (3.4.2-0ubuntu5) quantal; urgency=low + + * debian/patches/10_smaller_syndaemon_timeout.patch: Update to increase + the size of the stack allocated array for the extra argument passed to + syndaemon. This fixes a crash in the PLT due to a corrupt %ebx register + (which holds the GOT base address on i386), which was caused in an earlier + function by writing zero in to the location on the stack where the value of + %ebx is saved. Thanks to Sebastien Bacher for spotting the buggy patch! + (fixes LP: #1007588) + + -- Chris Coulson Mon, 18 Jun 2012 10:27:29 +0100 + +gnome-settings-daemon (3.4.2-0ubuntu4) quantal; urgency=low + + * debian/patches/62_unity_disable_gsd_printer.patch: gracefully exit the + print-notifications plugin when running unity + + -- Lars Uebernickel Mon, 11 Jun 2012 16:17:55 -0400 + +gnome-settings-daemon (3.4.2-0ubuntu3) quantal; urgency=low + + * Rebuild for the libgnome-desktop SOVER bump. + + -- Adam Conrad Thu, 07 Jun 2012 15:59:11 -0600 + +gnome-settings-daemon (3.4.2-0ubuntu2) quantal; urgency=low + + * debian/patches/xsettings_signal_handling.patch: + - upstream bugzilla patch, fix segfaults in the xsettings code which + seem to happen at logout + (lp: #946295, #948347, #963704) + + -- Sebastien Bacher Wed, 23 May 2012 21:50:41 +0200 + +gnome-settings-daemon (3.4.2-0ubuntu1) quantal; urgency=low + + * New upstream version: + Media-keys: + - Fix applications launching through keyboard shortcuts not using + the session's ssh agent, or keyrings + Mouse: + - Fix arguments passed to the custom command + And a number of memory leak fixes and translation updates. + * debian/patches/git_keyring_environment.patch: + - dropped, the fix is in the new version + + -- Sebastien Bacher Tue, 22 May 2012 21:09:19 +0200 + +gnome-settings-daemon (3.4.1-0ubuntu2) quantal; urgency=low + + * debian/patches/power-check-null-devices.patch: + - NULL-guard the return value of up_client_get_devices. + LP: #868928 + * debian/patches/power-ignore-bad-dbus-requests.patch: + - If we get a DBus request while the manager isn't active, ignore it. + LP: #969535 + + -- Michael Terry Tue, 01 May 2012 09:30:20 -0700 + +gnome-settings-daemon (3.4.1-0ubuntu1) precise-proposed; urgency=low + + * New upstream release: + - Fix applying settings to touchpads + - Fix possible crashes when exiting + - Don't put touchscreens in relative mode, just touch tablets + (such as the Bamboo Touch) + - Use PrinterAddOption method to set media size + - Updated translations + * Drop patches which are upstream now: + - disconnect_from_up_client.patch + - git_device_setting.patch + - wacom-keep-touchscreen-absolute.patch + + -- Martin Pitt Mon, 16 Apr 2012 15:55:26 +0200 + +gnome-settings-daemon (3.4.0-0ubuntu7) precise; urgency=low + + * Fix LP: #917598 - Battery critical notification using fallback alert + - add debian/patches/power-no-fallback-notifications.patch + + -- Chris Coulson Thu, 12 Apr 2012 11:43:36 +0100 + +gnome-settings-daemon (3.4.0-0ubuntu6) precise; urgency=low + + * debian/patches/wacom-keep-touchscreen-absolute.patch: + - Don't set touchscreens to relative mode (LP: #949097) + + -- Timo Aaltonen Wed, 11 Apr 2012 17:05:04 +0300 + +gnome-settings-daemon (3.4.0-0ubuntu5) precise; urgency=low + + * debian/patches/git_device_setting.patch: + - "fix applying settings to newly added touchpads" (lp: #973784) + + -- Sebastien Bacher Tue, 10 Apr 2012 22:47:06 +0200 + +gnome-settings-daemon (3.4.0-0ubuntu4) precise; urgency=low + + * debian/patches/disconnect_from_up_client.patch: + - Disconnect any signals from a UpClient object before we unref it. + UpClients are ref-counted singletons and may stay around after + unref, so we have to be explicit. LP: #965487 + + -- Michael Terry Mon, 09 Apr 2012 12:45:13 -0400 + +gnome-settings-daemon (3.4.0-0ubuntu3) precise; urgency=low + + * debian/patches/correct_logout_action.patch: + - display the logout action on ctrl-alt-del (lp: #961501) + * debian/patches/60_unity_hide_status_icon.patch: + - don't show the power status icon under classic either (lp: #965279) + * debian/patches/git_keyring_environment.patch: + - "Get the environment from gnome-keyring When launching + custom applications." (lp: #839444) + + -- Sebastien Bacher Tue, 03 Apr 2012 17:28:40 +0200 + +gnome-settings-daemon (3.4.0-0ubuntu2) precise; urgency=low + + * debian/patches/10_smaller_syndaemon_timeout.patch: + - don't change delay, use -t option to block the clicks (lp: #962958) + * debian/patches/61_unity_use_application_indicator.patch: + - small tweaks to be consistant with other indicators, + change the order and label from the two bottom items (lp: #964178) + * debian/patches/bugzilla_segfault_dpms.patch: + - upstream fix for a segfault (lp: #956824) + + [ Iain Lane ] + * debian/patches/16_use_synchronous_notifications.patch: Fix invalid cast + causing segfault when using keyboard backlight keys. (LP: #959874) + + -- Sebastien Bacher Thu, 29 Mar 2012 21:43:49 +0200 + +gnome-settings-daemon (3.4.0-0ubuntu1) precise-proposed; urgency=low + + * New upstream release: + - Wacom: + Check if the "last-stylus" property has been set + - updated translations + + -- Didier Roche Tue, 27 Mar 2012 10:50:10 +0200 + +gnome-settings-daemon (3.3.92-0ubuntu2) precise; urgency=low + + * 51_lock_screen_on_suspend.patch: when closing the lid, only lock the + screen at this step if we're not going to suspend or hibernate. + + -- Marc Deslauriers Tue, 20 Mar 2012 08:39:38 -0400 + +gnome-settings-daemon (3.3.92-0ubuntu1) precise; urgency=low + + [ Sebastien Bacher ] + * New upstream version, should fix + - "Option to "Lock screen afer screen turns off" is ignored" + (lp: #959184) + - "color-plugin-WARNING **: failed to get edid: unable to get + EDID for output" (lp: #863359) + * Dropped patches included in the new version + * Refreshed the other patches + + [ Marc Deslauriers ] + - 51_lock_screen_on_suspend.patch: refreshed for 3.3.92. + + -- Sebastien Bacher Mon, 19 Mar 2012 18:57:50 +0100 + +gnome-settings-daemon (3.3.91-0ubuntu6) precise; urgency=low + + * debian/patches/61_unity_use_application_indicator.patch: + - update to fix issues where the keyboard indicator would not update + or reflect the correct layout when changing layout with the keyboard, + thanks Charles Kerr (lp: #885730) + + -- Sebastien Bacher Fri, 16 Mar 2012 11:10:43 +0100 + +gnome-settings-daemon (3.3.91-0ubuntu5) precise; urgency=low + + * debian/patches/52_sync_background_to_accountsservice.patch: + - don't trigger a warning when using a solid color (lp: #954590) + * debian/patches/90_set_gmenus_xsettings.patch: + - update from Ryan Lortie to handle correctly new shell sessions + + [ Gunnar Hjalmarsson ] + * debian/patches/43_disable_locale_settings.patch: + Description updated. + + -- Sebastien Bacher Thu, 15 Mar 2012 19:15:43 +0100 + +gnome-settings-daemon (3.3.91-0ubuntu4) precise; urgency=low + + * Add 01_fix_multiple_syndaemons.patch: Ensure that a spawned syndaemon gets + killed when settings-daemon exists due to a crash, a keyboard interrupt, + etc. This avoids having multiple syndaemons run at the same time, which + can lead to the trackpad malfunctioning. (LP: #868400) + + -- Martin Pitt Wed, 14 Mar 2012 11:22:21 +0100 + +gnome-settings-daemon (3.3.91-0ubuntu3) precise; urgency=low + + * debian/control.in: + - updated gsettings-desktop-schemas requirement for the lock key + * debian/patches/61_unity_use_application_indicator.patch: + - updated indicators ids, combined with the libappindicator new version + that should give the correct wm_class to the fallback gtkstatusicon + which should fix some gnome-shell issues (lp: #878951) + - use set_icon_full() with "Keyboard" as a11y description (lp: #740726) + + [ Marc Deslauriers ] + * Add a new preference to lock the screen when the system suspends. + (LP: #938076) + - 51_lock_screen_on_suspend.patch: use lock-on-suspend gsettings to + determine if screen should be locked. + - 51_always_lock_screen_on_suspend.patch: removed. + - 54_lazily_connect_to_screensaver.patch: refreshed. + - 60_unity_hide_status_icon.patch: refreshed. + + -- Sebastien Bacher Fri, 09 Mar 2012 18:25:40 +0100 + +gnome-settings-daemon (3.3.91-0ubuntu2) precise; urgency=low + + * debian/patches/git_power_logic.patch: fix logic error, should restore + the screen controls (lp: #947748) + + -- Sebastien Bacher Wed, 07 Mar 2012 11:46:50 +0100 + +gnome-settings-daemon (3.3.91-0ubuntu1) precise; urgency=low + + * New upstream version: + - fix segfault with some wacom devices (lp: #945477) + * debian/patches/git_wacom_fix.patch: + - dropped, the fix is in the new version + * debian/rules: disable pkgkit support explicitly + + -- Sebastien Bacher Mon, 05 Mar 2012 21:17:42 +0100 + +gnome-settings-daemon (3.3.90-0ubuntu4) precise; urgency=low + + * Renamed unity patches to start with _unity and be in the same range, + it makes easier to see what patches we have + * debian/control.in: + - updated libappindicator version requirement for set_title() + * debian/patches/60_unity_hide_status_icon.patch: + - updated to fix a case not handled before (lp: #934582) + * debian/patches/61_unity_use_application_indicator.patch: + - set an indicator title for the unity hud benefit (lp: #943319) + + -- Sebastien Bacher Wed, 29 Feb 2012 18:28:11 +0100 + +gnome-settings-daemon (3.3.90-0ubuntu3) precise; urgency=low + + * debian/patches/git_wacom_fix.patch: + - deal better with some wacom devices to avoiding segfaults (lp: #934445) + * debian/source_gnome-settings-daemon.py: + - correctly separate tags with spaces so they don't get concatenated + + -- Sebastien Bacher Fri, 24 Feb 2012 12:39:29 +0100 + +gnome-settings-daemon (3.3.90-0ubuntu2) precise; urgency=low + + * debian/gnome-settings-daemon.install: + - install the hook + + -- Sebastien Bacher Tue, 21 Feb 2012 22:28:16 +0100 + +gnome-settings-daemon (3.3.90-0ubuntu1) precise; urgency=low + + * New upstream version + * debian/control.in: + - build-depends on libxtst-dev and xserver-xorg-input-wacom + - updated glib requirement + * debian/patches/buggy_error_handling_segfault.patch: + - dropped, the patch is in the new version + * debian/patches/git_numlock_status.patch: + - dropped, the patch is in the new version + * debian/rules: + - drop -Bsymbolic-functions workaround, upstream fixed the issue + * debian/source_gnome-settings-daemon.py: + - set title and tag with the component which had issues for segfaults + + -- Sebastien Bacher Tue, 21 Feb 2012 12:37:47 +0100 + +gnome-settings-daemon (3.3.5-0ubuntu3) precise; urgency=low + + * debian/patches/buggy_error_handling_segfault.patch: + - don't try to print an unset error variable (lp: #932953) + + -- Sebastien Bacher Thu, 16 Feb 2012 17:03:26 +0100 + +gnome-settings-daemon (3.3.5-0ubuntu2) precise; urgency=low + + * debian/patches/git_numlock_status.patch: + - correctly update the numlock status (lp: #933405) + + -- Sebastien Bacher Thu, 16 Feb 2012 15:47:19 +0100 + +gnome-settings-daemon (3.3.5-0ubuntu1) precise; urgency=low + + * New upstream version (lp: #931656), refreshed patches, + thanks Jeremy Bicha for starting the work on the new version: + - change the sound level by device (lp: #340720) + - correctly unassign keybindings (lp: #515670) + - define keybinding to take a screenshot of a selection (lp: #625518) + - resolve some segfaults (lp: #865286) + * debian/control.in: + - build-depends on libgudev-1.0-dev + - breaks unity-greeter (<< 0.2.1-0ubuntu1) due to the wacom schema rename + - build-depends on libwacom + - updated gtk, gnome-desktop3, g-d-s, upower requirements + * debian/gnome-settings-daemon.gsettings-override: + - don't set deprecated "sleep-inactive-battery" key + * debian/patches/90_set_gmenus_xsettings.patch: + - refreshed, we don't handle gnome-shell xsettings yet because we still + ship 3.2, that patch will need an update if we go for the new version + * debian/patches/git_gsettings_write_only_when_required.patch; + debian/patches/50_add_dell_backlight.patch: + - dropped the fix is in the new version + * debian/patches/47_delay_pa_connect_to_idle.patch: + - commented, will need to be updated if still needed + * debian/patches/revert_git_datetime_dropping.patch: + - revert the datetime service dropping, ubuntu-system-service doesn't + implement the timedated interfaces + * debian/patches/revert_git_dropping_gconf_wrapper.patch: + - revert the gconf code dropping, we might still need the settings + gateway for the lts (though it's a bit hackish) + * debian/patches/revert_git_use_gsetting_keybindings.patch: + - revert the keybindings switch to gsettings, compiz is not ready, + it's likely possible to update the patch to do either according to + the session in use at runtime if somebody wants to work on that + * debian/patches/revert_git_a11y_gsettings.patch: + - similar to the previous one + * debian/patches/revert_git_stop_using_gconf.patch: + - don't stop using gconf, the other patches listed before need it + * debian/rules: + - don't use -Bsymbolic-functions to workaround upstream issues + - drop deprecated --enable-pulse option + - use --disable-systemd + * debian/watch: + - watch for .xz + + -- Sebastien Bacher Wed, 15 Feb 2012 11:41:52 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu17) precise; urgency=low + + * debian/patches/disable_three_touch_tap.patch + - Disable three-touch tap so three-touch gestures work + + -- Chase Douglas Mon, 13 Feb 2012 21:45:07 -0800 + +gnome-settings-daemon (3.2.2-0ubuntu16) precise; urgency=low + + * debian/patches/06_use_application_indicator.patch: + - Check for gtk3 version of libappindicator, not gtk2 + * debian/patches/sync_keyboard_layout_to_accountsservice.patch: + - Sync user's list of layouts to accountsservice so it can in turn + inform LightDM. LP: #915468 + + -- Michael Terry Mon, 13 Feb 2012 10:40:21 -0500 + +gnome-settings-daemon (3.2.2-0ubuntu15) precise; urgency=low + + * debian/patches/46_share_rr_screen.patch: + - dropped that optimization, upstream fixed it in gnome-desktop instead + + -- Sebastien Bacher Mon, 06 Feb 2012 11:09:47 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu14) precise; urgency=low + + * debian/patches/51_always_lock_screen_on_suspend.patch: added missing + brackets that was preventing screen locking from working at all. + (LP: #924336) + + -- Marc Deslauriers Tue, 31 Jan 2012 10:10:41 -0500 + +gnome-settings-daemon (3.2.2-0ubuntu13) precise; urgency=low + + * debian/patches/51_always_lock_screen_on_suspend.patch: updated to + lock the screen on suspend and hibernate, but only if the user hasn't + configured autologin. + + -- Marc Deslauriers Sat, 28 Jan 2012 16:15:17 -0500 + +gnome-settings-daemon (3.2.2-0ubuntu12) precise; urgency=low + + * Updated some patches with bug references + * debian/patches/02_missing_libs.patch: + - dropped, that patch is a leftover and not required nowadays + * debian/patches/16_use_synchronous_notifications.patch: + - use the correct widget so the media key sounds work (lp: #909407) + + [ Martin Pitt ] + * debian/gnome-settings-daemon.gsettings-override: Set default idle dim time + to 30 seconds. 10 seconds is a bit unnerving when you want to read + something or show photos. (LP: #918928) + + -- Sebastien Bacher Thu, 26 Jan 2012 22:36:41 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu11) precise; urgency=low + + * debian/patches/git_gsettings_write_only_when_required.patch: + - git patch, don't write to gsettings when not required (i.e on login) + + -- Sebastien Bacher Thu, 19 Jan 2012 19:46:01 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu10) precise; urgency=low + + * Rebuild with the newest pkgbinarymangler (lp: #913085) + * debian/control.in: build-depends on libnss3-dev for smartcard support + + -- Sebastien Bacher Fri, 13 Jan 2012 17:32:40 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu9) precise; urgency=low + + * Rebuild with fixed pkgbinarymangler (lp: #913085), + that should fix broke permissions errors (lp: #915600) + + -- Sebastien Bacher Fri, 13 Jan 2012 11:44:32 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu8) precise; urgency=low + + * debian/patches/90_set_gmenus_xsettings.patch: + - set the ShellShowsMenubar and ShellShowsAppMenu xsettings under unity + + -- Sebastien Bacher Thu, 12 Jan 2012 11:34:38 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu7) precise; urgency=low + + * Add 54_lazily_connect_to_screensaver.patch: Do not D-BUS activate + gnome-screensaver right at startup, this unnecessarily slows down boot + speed. Instead, D-BUS activate it the first time we actually need it. + (LP: #912186) + + -- Martin Pitt Thu, 05 Jan 2012 12:42:24 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu6) precise; urgency=low + + * Add 53_disable_gsd_printer_on_unity.patch: Disable gsd-printer plugin + under Unity. We are still using system-config-printer for this, so no need + to start another service for this. + + -- Martin Pitt Wed, 04 Jan 2012 16:15:47 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu5) precise; urgency=low + + * debian/patches/52_sync_background_to_accountsservice.patch: + - Watch background gsettings value and synchronize it to the + accountsservice daemon for the benefit of unity-greeter + + -- Michael Terry Fri, 09 Dec 2011 15:35:40 -0500 + +gnome-settings-daemon (3.2.2-0ubuntu4) precise; urgency=low + + * 42_onlyshowin_unity.patch: the gnome-shell session is called "gnome", use + the correct name so nautilus doesn't open in shell sessions (lp: #892989) + + -- Sebastien Bacher Fri, 02 Dec 2011 12:12:29 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu3) precise; urgency=low + + * Upload for Precise + + -- Rodrigo Moya Wed, 16 Nov 2011 12:59:33 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu2) oneiric-proposed; urgency=low + + * debian/patches/07_hide_status_icon_on_unity.patch: + - Never show the power status icon when running Unity (LP: #833397) + + -- Rodrigo Moya Tue, 15 Nov 2011 11:12:54 +0100 + +gnome-settings-daemon (3.2.2-0ubuntu1) oneiric-proposed; urgency=low + + * New upstream release (LP: #888526) + * debian/patches/00git_remove_assertions.patch: + * debian/patches/git_correct_suspend_bus.patch: + - Remove upstreamed patches + * debian/patches/16_use_synchronous_notifications.patch: + * debian/patches/45_suppress-printer-may-not-be-connected-notification.patch: + - Rebased + + -- Rodrigo Moya Thu, 10 Nov 2011 12:15:05 +0100 + +gnome-settings-daemon (3.2.1-0ubuntu3) oneiric-proposed; urgency=low + + * debian/patches/00git_remove_assertions.patch: + - git patch to remove assertions that shouldn't be there (LP: #878486) + + -- Rodrigo Moya Tue, 25 Oct 2011 12:52:39 +0200 + +gnome-settings-daemon (3.2.1-0ubuntu2) oneiric-proposed; urgency=low + + [ Didier Roche ] + * debian/patches/16_use_synchronous_notifications.patch: + - make our patch using the new icon name (LP: #877058) + + [ Sebastien Bacher ] + * debian/patches/git_correct_suspend_bus.patch: + - git patch to fix a suspend regression in the new version (lp: #878076) + + -- Didier Roche Wed, 19 Oct 2011 17:25:16 +0200 + +gnome-settings-daemon (3.2.1-0ubuntu1) oneiric-proposed; urgency=low + + * New upstream release (LP: #877326) + * debian/patches/00git_dont_restore_brightness.patch: + * debian/patches/00git_fix_reference_leaks.patch: + * debian/patches/00git_fix_async_dbus_crash.patch: + * debian/patches/00git_dont_sleep_on_idle_by_default.patch: + * debian/patches/00git_dont_revert_pre_idle_brigthness.patch: + * debian/patches/00git_avoid_undesired_sleeps.patch: + * debian/patches/49_fix_suspend_media_key.patch: + - Remove upstreamed patches + * debian/patches/16_use_synchronous_notifications.patch: + - Rebased + + -- Rodrigo Moya Tue, 18 Oct 2011 11:29:23 +0200 + +gnome-settings-daemon (3.2.0-0ubuntu5) oneiric; urgency=low + + [ Rodrigo Moya ] + * debian/patches/00git_avoid_undesired_sleeps.patch: + - Avoid sleeping the computer when disabled (LP: #864479) and ditto for + the display (LP: #863038) + + [ Marc Deslauriers ] + * debian/patches/51_always_lock_screen_on_suspend.patch: + - always lock the screen when suspending or hibernating, even if + automatic screen lock is disabled. (LP: #847814) + + -- Marc Deslauriers Mon, 03 Oct 2011 17:23:23 -0400 + +gnome-settings-daemon (3.2.0-0ubuntu4) oneiric; urgency=low + + * debian/patches/00git_dont_sleep_on_idle_by_default.patch: + - Don't sleep on idle by default (LP: #860485) + * debian/patches/00git_dont_revert_pre_idle_brigthness.patch: + - Do not revert to the pre-idle brightness if idle dimming is disabled + * debian/patches/50_add_dell_backlight.patch: + - Add 'dell_backlight' module to gsd-backlight-helper (LP: #862474) + + -- Rodrigo Moya Thu, 29 Sep 2011 16:47:57 +0200 + +gnome-settings-daemon (3.2.0-0ubuntu3) oneiric; urgency=low + + * debian/patches/00git_fix_async_dbus_crash.patch: + - Fix async DBus calls crashes (LP: #832603) + * debian/patches/49_fix_suspend_media_key.patch: + - Rebased + + -- Rodrigo Moya Wed, 28 Sep 2011 17:14:53 +0200 + +gnome-settings-daemon (3.2.0-0ubuntu2) oneiric; urgency=low + + * debian/patches/49_fix_suspend_media_key.patch: Fix screen locking when + suspending via a media key. (LP: #859498) + + -- Marc Deslauriers Tue, 27 Sep 2011 11:34:03 -0400 + +gnome-settings-daemon (3.2.0-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/patches/00git_dont_restore_brightness.patch: + - Don't restore brightness if it's never been set + * debian/patches/00git_fix_reference_leaks.patch: + - Fix 2 small reference leaks + + -- Rodrigo Moya Mon, 26 Sep 2011 17:57:20 +0200 + +gnome-settings-daemon (3.1.92-0ubuntu3) oneiric; urgency=low + + * Fix LP: #854101 - various startup time improvements: + * debian/patches/46_share_rr_screen.patch: + - Share a single GnomeRRScreen across plugins, rather than having the + xrandr, color and power plugins each create their own, which results + in 3 reprobes before running the main loop. Thanks to Rodrigo Moya for + tidying this up a bit. + * debian/patches/47_delay_pa_connect_to_idle.patch: + - Don't connect to pulseaudio until we are running the main loop. Starting + pulseaudio seems to block for around a second here on my machine + * debian/patches/48_register_client_before_idle_callbacks.patch: + - Create the GDBusProxy for gnome-session synchronously, and then schedule + the RegisterClient call with a higher priority. This ensures that we + register with the session manager as soon as we start the main loop, and + before running any other idle callbacks + + * debian/patches/16_use_synchronous_notifications.patch: + - Make the volume notifications work correctly again + + -- Chris Coulson Thu, 22 Sep 2011 15:44:40 +0100 + +gnome-settings-daemon (3.1.92-0ubuntu2) oneiric; urgency=low + + * debian/patches/45_suppress-printer-may-not-be-connected-notification.patch: + Do not show notifications if the printer state reason "connecting-to-device" + is reported by CUPS. The text of this state reason notificatioon is the + misleading "Printer XXX may not be connected" and the reason is set in + every print job (usually only for a short time but enough to trigger the + notifier). As we are after UI freeze we simply suppress this notification + with this patch (do not forward upstream). The real fix would be improving + the text, like really saying "Connecting to printer XXX ..." (LP: #842768). + + -- Till Kamppeter Thu, 15 Sep 2011 18:34:24 +0200 + +gnome-settings-daemon (3.1.92-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/control: + - Bump libcolord-dev build dependency + * debian/patches/00git_guard_against_division_by_0.patch: + * debian/patches/00git_dont_crash_if_session_not_ready.patch: + * debian/patches/00git_numlock_status.patch: + * debian/patches/00git_disconnect_callbacks.patch: + - Remove upstream patches + * debian/patches/06_use_application_indicator.patch: + * debian/patches/16_use_synchronous_notifications.patch: + - Rebased + + -- Rodrigo Moya Mon, 19 Sep 2011 17:05:48 +0200 + +gnome-settings-daemon (3.1.91-0ubuntu5) oneiric; urgency=low + + * debian/patches/00git_disconnect_callbacks.patch: + - Disconnect callbacks when cleaning up (LP: #837373) + + -- Rodrigo Moya Tue, 13 Sep 2011 11:00:41 +0200 + +gnome-settings-daemon (3.1.91-0ubuntu4) oneiric; urgency=low + + * debian/patches/00git_numlock_status.patch: + - git backport, store the numlock status and apply it (lp: #841748) + + -- Sebastien Bacher Fri, 09 Sep 2011 15:16:09 +0200 + +gnome-settings-daemon (3.1.91-0ubuntu3) oneiric; urgency=low + + * debian/control: + - Build depend on libgnome-desktop3-dev >= 3.1.5, which is what upstream + asks for + * debian/patches/00git_guard_against_division_by_0.patch: + - Guard against dividing by 0 in ABS_TO_PERCENTAGE macro (LP: #833595) + * debian/patches/00git_dont_crash_if_session_not_ready.patch: + - Don't crash if we try to calculate the idle state before connected to + the session (LP: #836014) + + -- Rodrigo Moya Wed, 07 Sep 2011 12:07:45 +0200 + +gnome-settings-daemon (3.1.91-0ubuntu2) oneiric; urgency=low + + * Fix the volume OSD patch so that the volume level is displayed correctly + again + - update debian/patches/16_use_synchronous_notifications.patch + + -- Chris Coulson Mon, 05 Sep 2011 17:40:06 +0100 + +gnome-settings-daemon (3.1.91-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/patches/01_git_do_power_init_in_start.patch: + * debian/patches/01_git_double_check_hash_table.patch: + * debian/patches/01_git_fix_brightness_step_amount.patch: + - Remove upstreamed patches + + -- Rodrigo Moya Mon, 05 Sep 2011 16:48:28 +0200 + +gnome-settings-daemon (3.1.90-0ubuntu3) oneiric; urgency=low + + * debian/patches/01_git_double_check_hash_table.patch: + - Double check stuff we add to the hash table to avoid crashes when cleaning up + (LP: #839322) + + -- Rodrigo Moya Fri, 02 Sep 2011 16:17:24 +0200 + +gnome-settings-daemon (3.1.90-0ubuntu2) oneiric; urgency=low + + * debian/patches/01_git_fix_brightness_step_amount.patch: + - Fix BRIGHTESS_STEP_AMOUNT calculation macro (LP: #827517) + * debian/patches/01_git_do_power_init_in_start.patch: + - Do power plugin initialization in _start, not _init, to avoid multiple + crashes (LP: #836014) + + -- Rodrigo Moya Thu, 01 Sep 2011 10:33:58 +0200 + +gnome-settings-daemon (3.1.90-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/patches/16_use_synchronous_notifications.patch: + * debian/patches/42_onlyshowin_unity.patch: + - Rebased patches + * debian/patches/44_lock_before_suspend.patch: + - Remove upstream patch + + -- Rodrigo Moya Mon, 29 Aug 2011 16:04:57 +0200 + +gnome-settings-daemon (3.1.5-0ubuntu6) oneiric; urgency=low + + * debian/patches/44_lock_before_suspend.patch: ensure the screen is + locked before suspending. (LP: #824188) + + -- Marc Deslauriers Thu, 25 Aug 2011 23:44:36 -0400 + +gnome-settings-daemon (3.1.5-0ubuntu5) oneiric; urgency=low + + * Make the keyboard backlight notification use notify-osd too + - update debian/patches/16_use_synchronous_notifications.patch + + -- Chris Coulson Tue, 23 Aug 2011 15:26:34 +0100 + +gnome-settings-daemon (3.1.5-0ubuntu4) oneiric; urgency=low + + * Make the brightness osd use synchronous notify-osd notifications + - update debian/patches/16_use_synchronous_notifications.patch + * Add missing liblcms2-dev build-dep + - update debian/control{.in} + + -- Chris Coulson Mon, 22 Aug 2011 22:00:23 +0100 + +gnome-settings-daemon (3.1.5-0ubuntu3) oneiric; urgency=low + + * debian/gnome-settings-daemon.gsettings-override: + - Enable GConf bridge plugin by default + * debian/patches/10_smaller_syndaemon_timeout.patch: + - Use a smaller timeout for syndaemon (LP: #801763) + + -- Rodrigo Moya Mon, 22 Aug 2011 10:46:19 +0200 + +gnome-settings-daemon (3.1.5-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/patches/06_use_application_indicator.patch: + - Rebased + + -- Rodrigo Moya Tue, 16 Aug 2011 10:31:48 +0200 + +gnome-settings-daemon (3.1.4-0ubuntu5) oneiric; urgency=low + + * debian/patches/43_disable_locale_settings.patch: + - Don't set locales since they are set in Oneiric by sourcing + ~/.profile. + + -- Gunnar Hjalmarsson Mon, 15 Aug 2011 10:14:05 +0200 + +gnome-settings-daemon (3.1.4-0ubuntu4) oneiric; urgency=low + + * debian/control: + * debian/patches/series: + * debian/patches/03_disable_colord.patch: + - Enable building with colord (LP: #788108) + + -- Rodrigo Moya Thu, 11 Aug 2011 13:57:00 +0200 + +gnome-settings-daemon (3.1.4-0ubuntu3) oneiric; urgency=low + + * debian/patches/42_onlyshowin_unity.patch: + - tweak the new automount .desktop as well to run under unity (lp: #816774) + + -- Sebastien Bacher Mon, 01 Aug 2011 18:09:29 +0200 + +gnome-settings-daemon (3.1.4-0ubuntu2) oneiric; urgency=low + + * debian/control: + - Add missing build dependency on libupower-glib-dev + + -- Rodrigo Moya Tue, 26 Jul 2011 15:34:10 +0200 + +gnome-settings-daemon (3.1.4-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/control: + - bumo libgnome-desktop dependency + * debian/patches/01_git_a11y_keyboard_cleanup.patch: + * debian/patches/41_fix_key_grab.patch: + - Remove upstreamed patches + * debian/patches/06_use_application_indicator.patch: + * debian/patches/16_use_synchronous_notifications.patch: + - Rebased + + -- Rodrigo Moya Mon, 25 Jul 2011 12:00:12 +0200 + +gnome-settings-daemon (3.1.3-0ubuntu7) oneiric; urgency=low + + * debian/patches/42_onlyshowin_unity.patch: + - Add Unity to OnlyShowIn value (LP: #803519) + * debian/control.in: + - Remove Debian's Vcs fields + + -- Michael Terry Tue, 19 Jul 2011 15:02:18 -0400 + +gnome-settings-daemon (3.1.3-0ubuntu6) oneiric; urgency=low + + * debian/gnome-settings-daemon.gsettings-override: + - Turn on autosleep on battery for Energy Star 5.0 compliance (LP: #604635) + - Suspend by default when system sleep button is pressed + - Suspend by default for low battery as hibernate can be slow & unreliable + + -- Jeremy Bicha Mon, 18 Jul 2011 08:03:30 +0200 + +gnome-settings-daemon (3.1.3-0ubuntu5) oneiric; urgency=low + + * debian/patches/01_git_shorter_syndaemon_delay.patch: + - Remove this patch, it fixes the annoyance for some users and breaks it + for others + * debian/patches/17_react_when_streams_removed.patch: + - Remove patch not being applied and already upstream + * debian/patches/01_git_a11y_keyboard_cleanup.patch: + - Do proper cleanup when the plugin is stopped (LP: #804946) + * debian/patches/06_use_application_indicator.patch: + - Rebased + + -- Rodrigo Moya Tue, 12 Jul 2011 13:04:51 +0200 + +gnome-settings-daemon (3.1.3-0ubuntu4) oneiric; urgency=low + + [ Marco Trevisan (Treviño) ] + * debian/patches/06_use_application_indicator.patch + - Updated to support libappindicator scroll event to change + the keyboard layout via mouse-wheel + + [ Chris Coulson ] + * Fix the volume OSD notifications to work properly again (when the + media keys work properly) + - update debian/patches/16_use_synchronous_notifications.patch + * Fix the logic in grab_key_unsafe to not reject keys which are useful + to grab without a modifier. Fixes the media-keys plugin + - add debian/patches/41_fix_key_grab.patch + + -- Chris Coulson Wed, 13 Jul 2011 00:13:36 +0100 + +gnome-settings-daemon (3.1.3-0ubuntu3) oneiric; urgency=low + + * debian/gnome-settings-daemon.gsettings-override: Set default action for + power button back to 'interactive'. (LP: #806855) + + -- Martin Pitt Mon, 11 Jul 2011 12:19:38 +0200 + +gnome-settings-daemon (3.1.3-0ubuntu2) oneiric; urgency=low + + * debian/patches/06_use_application_indicator.patch: + - Fix typo in keyboard indicator icon name (LP: #805743) + + -- Robert Ancell Tue, 05 Jul 2011 11:35:37 +1000 + +gnome-settings-daemon (3.1.3-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/patches/01_git_check_touchpad.patch: + - Remove upstreamed patch + * debian/patches/06_use_application_indicator.patch: + - Rebased + + -- Rodrigo Moya Mon, 04 Jul 2011 22:21:28 +0200 + +gnome-settings-daemon (3.1.2-0ubuntu2) oneiric; urgency=low + + * debian/patches/01_git_shorter_syndaemon_delay.patch: + - Make syndaemon delay shorter (LP: #801763) + + -- Rodrigo Moya Wed, 29 Jun 2011 11:31:41 +0200 + +gnome-settings-daemon (3.1.2-0ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/control: + - Bump dependency on libgnome-desktop-3-dev + - Conflict with gnome-color-manager < 3.0 + - Build-Depend on hwdata + * debian/watch: + - Watch .bz2 tarball and unstable series + * debian/patches/06_use_application_indicator.patch: + * debian/patches/16_use_synchronous_notifications.patch: + - Rebased + * debian/patches/03_disable_colord.patch: + - Disable color plugin if colord is not found + * debian/patches/01git_add_missing_schema_for_gconf.patch: + - Remove upstreamed patch + * debian/patches/01_git_check_touchpad.patch: + - Add GIT patch to only disable touchpad, not all input devices + + -- Rodrigo Moya Fri, 24 Jun 2011 12:33:25 +0200 + +gnome-settings-daemon (3.0.2-1ubuntu4) oneiric; urgency=low + + * debian/control.in: stop depending on libgnome2-common + + -- Sebastien Bacher Fri, 10 Jun 2011 18:48:41 +0200 + +gnome-settings-daemon (3.0.2-1ubuntu3) oneiric; urgency=low + + * debian/patches/01git_add_missing_schema_for_gconf.patch: + - Add upstream patch to add missing GSettings schema for GConf conversion + plugin + + -- Rodrigo Moya Fri, 10 Jun 2011 16:29:26 +0200 + +gnome-settings-daemon (3.0.2-1ubuntu2) oneiric; urgency=low + + * debian/patches/20_migrate_background_uri.patch: + - Convert old filenames to an URI, to have migration of GConf background + to GSettings work correctly + + -- Rodrigo Moya Tue, 07 Jun 2011 16:33:00 +0200 + +gnome-settings-daemon (3.0.2-1ubuntu1) oneiric; urgency=low + + * New upstream release + * debian/patches/16_use_synchronous_notifications.patch: + - Rebased + * debian/patches/41_dont_convert_nonexistant_key.patch: + - Removed upstreamed patch + + -- Rodrigo Moya Tue, 24 May 2011 11:27:08 +0200 + +gnome-settings-daemon (3.0.1-1ubuntu4) oneiric; urgency=low + + * debian/gnome-settings-daemon.gconf-defaults: + * debian/gnome-settings-daemon.gsettings-override: + - Move default GConf settings to GSettings + + -- Rodrigo Moya Mon, 23 May 2011 16:06:19 +0200 + +gnome-settings-daemon (3.0.1-1ubuntu3) oneiric; urgency=low + + * Don't try to convert show-keyboard-leds-indicator in + gnome-settings-daemon.convert. It has no schema, and makes + gsettings-data-convert crash + - add debian/patches/41_dont_convert_nonexistant_key.patch + - update debian/patches/series + + -- Chris Coulson Fri, 20 May 2011 11:45:37 +0100 + +gnome-settings-daemon (3.0.1-1ubuntu2) oneiric; urgency=low + + * debian/patches/06_use_application_indicator.patch: + - GkbKeyboardConfig's layouts_variants is now an array of strings, not + a list. Fixes crash + + -- Rodrigo Moya Wed, 18 May 2011 10:40:17 +0200 + +gnome-settings-daemon (3.0.1-1ubuntu1) oneiric; urgency=low + + * New upstream release + + -- Rodrigo Moya Tue, 17 May 2011 16:37:27 +0200 + +gnome-settings-daemon (3.0.0.1-1ubuntu4) oneiric; urgency=low + + * debian/control: + - Rename build dependency from libnotify4-dev to libnotify-dev + + -- Rodrigo Moya Tue, 17 May 2011 12:17:12 +0200 + +gnome-settings-daemon (3.0.0.1-1ubuntu3) oneiric; urgency=low + + * debian/patches/06_use_application_indicator.patch: + - Fix call to xkl_engine_get_instance to pass a Display, not a GdkDisplay + + -- Rodrigo Moya Wed, 11 May 2011 09:25:54 +0200 + +gnome-settings-daemon (3.0.0.1-1ubuntu2) oneiric; urgency=low + + * debian/patches/06_use_application_indicator.patch: + - Fix call to non existing API + + -- Rodrigo Moya Mon, 09 May 2011 11:24:49 +0200 + +gnome-settings-daemon (3.0.0.1-1ubuntu1) oneiric; urgency=low + + [ Guido Günther ] + * Bump build-dependency on libgnome-desktop-3-dev (Closes: #622689) + + [ Rodrigo Moya ] + * Rebase from Debian, remaining Ubuntu changes: + * debian/control: + - Build-depend on libnotify4-dev, not libnotify-dev + - Add Buil-depend on libappindicator3-dev + - Add Vcs-Bzr URL + * debian/gnome-settings-daemon.install: + * debian/gnome-settings-daemon.postinst: + - Keep autostart files in standard directories + * debian/gnome-update-wallpaper-cache.c: + * debian/rules: + - Add wallpaper cache updater program + * debian/patches/02_missing_libs.patch: + - Add missing X11 libraries to build dependencies + * debian/patches/05_disable_corner_tapping.patch: + - Disable corner tapping when disabling tap to click + * debian/patches/06_use_application_indicator.patch: + - Use application indicators + * debian/patches/16_use_synchronous_notifications.patch: + - Use synchronous notifications when they are supported + * debian/patches/17_react_when_streams_removed.patch: + - React to stream-removed signal from GvcMixerControl + * debian/patches/40_xres_lcddefault.patch: + - OpenOffice.org subpixel font rendering broken with new cairo + * debian/gnome-settings-daemon.gconf-defaults: + - Needs to be moved to GSettings + + -- Rodrigo Moya Wed, 04 May 2011 13:07:16 +0200 + +gnome-settings-daemon (3.0.0.1-1) experimental; urgency=low + + * New upstream release. + + -- Frederic Peters Mon, 28 Mar 2011 11:37:24 +0530 + +gnome-settings-daemon (2.91.93-1) experimental; urgency=low + + * New upstream release. + + -- Frederic Peters Sun, 27 Mar 2011 19:15:59 +0530 + +gnome-settings-daemon (2.91.92-1) experimental; urgency=low + + * New upstream release. + + -- Frederic Peters Wed, 23 Mar 2011 19:24:48 +0100 + +gnome-settings-daemon (2.91.91-1) experimental; urgency=low + + [Frederic Peters] + * New upstream release. + + [Emilio Pozuelo Monfort] + * debian/control.in: + + Re-add build dependency on libxklavier-dev, since configure.ac + actually requires it. + + -- Frederic Peters Tue, 08 Mar 2011 19:17:09 +0100 + +gnome-settings-daemon (2.91.90-2) experimental; urgency=low + + * debian/control.in: + * Add build-dep on recent libgnomekbd-dev + * Remove direct build-depend on libxklavier-dev, libgnomekbd-dev will pull + in the right version + + -- Sjoerd Simons Sat, 26 Feb 2011 21:26:07 +0000 + +gnome-settings-daemon (2.91.90-1) experimental; urgency=low + + * New upstream release. + - gnome-settings-daemon.install: keybindings for accessibility tools + have been moved to the gnome-control-center module. + + -- Frederic Peters Tue, 22 Feb 2011 22:49:26 +0100 + +gnome-settings-daemon (2.91.9-1) experimental; urgency=low + + [ Sebastien Bacher ] + * debian/gnome-settings-daemon.install: + - install the polkit files there + * debian/control.in: + - build-depends on libpolkit-gobject-1-dev + - drop the build-depends on libxrandr-dev and libxrender-dev, the + configure doesn't use those in the new version + - recommends pulseaudio since it's used for the multimedia keys + (Close: #611198) + + [ Emilio Pozuelo Monfort ] + * debian/patches/02_missing_libs.patch: + + Removed. This was fixed upstream in a different way a long time + ago. The patch was also disabled on 2.91.5.1-1 without any bad + consequences. + * New upstream release. + + d/patches/0001-Ensure-the-volume-doesn-t-underflow-and-wrap-around.patch, + d/patches/13_monitor_kfreebsd.patch: + - Removed, fixed upstream. + + debian/control.in: + - Updated build dependencies. + - Update the gtk+ 3 build dependency for the new package name. + + -- Emilio Pozuelo Monfort Sat, 19 Feb 2011 14:28:40 +0000 + +gnome-settings-daemon (2.91.8-1) experimental; urgency=low + + [ Sjoerd Simons ] + * Enable pulseaudio support + * Enable the settings d-conf <-> gconf bridge + * d/p/0001-Ensure-the-volume-doesn-t-underflow-and-wrap-around.patch + + Added. Fix a bug where it was possible to lower the volume below zero, + causing it to wrap-around to MAXUINT. + + [ Emilio Pozuelo Monfort ] + * New upstream release. + + debian/control.in: + - Update build dependencies. + * debian/rules: + - Remove duplicated list-missing target and utils.mk include. + - Include autoreconf.mk before debhelper.mk to not leave cruft when + running clean. + * debian/control.in: + - Standards-Version is 3.9.1, no changes needed. + - Drop old Replaces. + + -- Emilio Pozuelo Monfort Wed, 12 Jan 2011 22:48:04 +0000 + +gnome-settings-daemon (2.91.5.1-2) experimental; urgency=low + + * Make the nautilus-data depend versioned + + -- Sjoerd Simons Sun, 12 Dec 2010 14:32:07 +0000 + +gnome-settings-daemon (2.91.5.1-1) experimental; urgency=low + + * New upstream release + * debian/control.in: Update build-depends to gnome 3.0 versions + * debian/patches/01_xrdb.patch + - Removed. g-s-d no longer manages xrdb + * debian/patches/03_maintainer_mode.patch + - Removed. Fixed upstream + * debian/patches/10_clipboard_crash.patch + - Removed. Fixed upstream. + * debian/patches/12_monitor_network_fs.patch + - Removed. Fixed upstream + * debian/patches/13_monitor_kfreebsd.patch + - Updated + * debian/patches/20_gstreamer.patch + - Removed. Time to move to pulseaudio by default... + * debian/patches/30_pkgconfig-path.patch: + - Removed. Fixed upstream + * debian/patches/70_relibtoolize.patch + - Removed, moving to dh_autoreconf + * debian/patches/99_ltmain_as-needed.patch + - Removed, moving to dh_autoreconf + * debian/gnome-settings-daemon.install + - Updated + * Switch to dh_autoreconf and trigger list-missing + * Make gnome-settings-daemon depends on gsettings-desktop-schemas and + nautilus-data to pull in the necessary schema files. + + -- Sjoerd Simons Sat, 11 Dec 2010 16:20:56 +0000 + +gnome-settings-daemon (2.30.2-2) unstable; urgency=low + + * 13_monitor_kfreebsd.patch: new patch. Don’t monitor fdescfs. + Closes: #594891. + * 10_clipboard_crash.patch: stolen from upstream git. Fixes a crash in + the clipboard manager. Closes: #588308. + + -- Josselin Mouette Wed, 20 Oct 2010 01:29:10 +0200 + +gnome-settings-daemon (2.30.2-1) unstable; urgency=low + + * New upstream stable release. + * Switch to source format 3.0 (quilt). + - Add debian/source/format. + - Drop Build-Depends on quilt. + - Remove /usr/share/cdbs/1/rules/patchsys-quilt.mk from debian/rules. + * Refresh patches for new upstream release. + * debian/control.in + - Drop Build-Depends on dpkg-dev (>= 1.13.19) as even oldstable has a more + recent version. + - Add Vcs-Browser and Vcs-Svn fields. + - Bump Standards-Version to 3.9.0. + - Use Breaks as recommended by the new policy. + + -- Michael Biebl Fri, 23 Jul 2010 01:34:51 +0200 + +gnome-settings-daemon (2.30.1-1) unstable; urgency=low + + * New upstream release. + * Bump build-dependencies. + * 11_sleepkey.patch, 40_xklavier_5.0.patch: dropped, obsolete. + * 20_gstreamer.patch, 30_pkgconfig-path.patch, 70_relibtoolize.patch: + updated for the new version. + + -- Josselin Mouette Tue, 27 Apr 2010 20:00:27 +0200 + +gnome-settings-daemon (2.28.1-3) unstable; urgency=low + + * Depend on libgnome2-common for the GConf schemas. + * 40_xklavier_5.0.patch: new patch. Get 2.28 version to work with + libxklavier 5.0. + * Require said version to build. + + -- Josselin Mouette Fri, 09 Apr 2010 00:17:00 +0200 + +gnome-settings-daemon (2.28.1-2) unstable; urgency=low + + * Drop libxxf86misc-dev build-dependency. This extension is only used + as a fallback to XKB. Closes: #559690. + * 12_monitor_network_fs.patch: new patch. Don’t monitor remote + filesystems for their free size. Closes: #563592. + + -- Josselin Mouette Sat, 09 Jan 2010 10:59:14 +0100 + +gnome-settings-daemon (2.28.1-1) unstable; urgency=low + + * New upstream release. + - debian/patches/70_relibtoolize.patch: + + Updated. + * debian/rules: remove check-dist.mk to upload to unstable. + + -- Emilio Pozuelo Monfort Thu, 22 Oct 2009 06:08:36 +0200 + +gnome-settings-daemon (2.28.0-1) experimental; urgency=low + + * Add a watch file. + * Add a manpage for gnome-settings-daemon, thanks Joshua Cummings! + Closes: #494370. + * debian/control.in: remove trailing whitespaces. + * Standards-Version is 3.8.2, no changes needed. + * New upstream release. + - debian/control.in: + + Bump libgtk2.0-dev and libgnome-desktop-dev build dependencies. + + Remove libglade2-dev build dependency, no longer needed. + + Build depend on libxklavier-dev >= 4.0 instead of libxklavier12-dev. + + Break gnome-screensaver << 2.28 since g-s-d doesn't start it anymore, + relaying on the autostart file in g-s 2.28. + - debian/patches/20_gstreamer.patch, + debian/patches/70_relibtoolize.patch: + + Updated to apply again. + - debian/gnome-settings-daemon.install: + + Install *.ui rather than *.glade. + + Don't install *.png, the icon is not shipped anymore. + * Standards-Version is 3.8.3, no changes needed. + * debian/rules: + - Don't touch every file anymore, it was done because of a broken tarball. + - Include check-dist.mk to avoid uploads to unstable. + + -- Emilio Pozuelo Monfort Fri, 09 Oct 2009 17:26:43 +0200 + +gnome-settings-daemon (2.26.1-2) unstable; urgency=low + + * 03_maintainer_mode.patch: new patch, add AM_MAINTAINER_MODE. Fixes + FTBFS. + * Regenerate 70_relibtoolize.patch. + + -- Josselin Mouette Fri, 29 May 2009 16:19:52 +0200 + +gnome-settings-daemon (2.26.1-1) unstable; urgency=low + + * New upstream release. + + 20_gstreamer.patch: install the plugin although pulse is disabled. + + Refresh 70_relibtoolize.patch. + * Move the autostart file to /usr/share/gnome/autostart. + * gnome-settings-daemon.postinst: + + Remove the old autostart file if needed. + + Only remove the xrdb stuff upon upgrades from pre-2.24.1. + + -- Josselin Mouette Fri, 29 May 2009 11:25:35 +0200 + +gnome-settings-daemon (2.26.0-2) experimental; urgency=low + + * 20_gstreamer.patch: Initialize Gerror * variables to NULL before + usage. Fixes a crasher when using media keys (Closes: #524165) + + -- Sjoerd Simons Sat, 18 Apr 2009 11:00:25 +0100 + +gnome-settings-daemon (2.26.0-1) experimental; urgency=low + + * New upstream release. + * Update build-dependencies. + * Install the autostart file and the keybindings XML file. + + Break gnome-session < 2.24 which would attempt to start it twice + with the autostart file. + * 11_sleepkey.patch: updated for the new version. + * 20_gstreamer.patch: new patch from Romain Périer, adds back support + for GStreamer with a selection at compile time. + * 70_relibtoolize.patch: regenerated. + * Refresh other patches. + * Pass --disable-pulse to configure, to use the GStreamer code + instead. + + -- Josselin Mouette Sat, 11 Apr 2009 11:31:52 +0200 + +gnome-settings-daemon (2.24.1-2) unstable; urgency=low + + [ Josselin Mouette ] + * Improve package descriptions. Mention XSETTINGS. Closes: #511905. + * Upload to unstable. + + [ Loic Minier ] + * Suggest x11-xserver-utils as gnome-settings-daemon attempts to run xrdb by + default and logs a warning when that fails. + * Suggest gnome-screensaver as gnome-settings-daemon attempts to start it by + default and logs a warning when that fails. + * Suggest metacity | x-window-manager as gnome-settings-daemon attemts to + start a window manager and logs a warning when that fails. + + -- Josselin Mouette Tue, 07 Apr 2009 08:48:36 +0200 + +gnome-settings-daemon (2.24.1-1) experimental; urgency=low + + * New upstream release. + + Cleans up thumbnail cache automatically. Closes: #235067. + * Update build-dependencies and -dev dependencies. + * Standards version is 3.8.0. + * Switch to quilt for patch management; build-depend on quilt. + * 02_missing_libs.patch: explicitly add X11 libraries to + SETTINGS_PLUGINS since plugins are actually relying on them being + available. + * 70_relibtoolize.patch: new patch, relibtoolize the source. + * 99_ltmain_as-needed.patch: new patch, make --as-needed work. + * Pass -O1 -z defs --as-needed to the linker. + + Only warn on undefined symbols as plugins need a symbol from the + daemon. + * Add some comments in the patches. + * Pass --no-act to dh_makeshlibs. + * gnome-settings-daemon.postinst: remove /etc/gnome/config/xrdb. + * Install .ad files in /etc/gnome/config to replace the ones from + capplets-data which are still used. + * Do not install the autostart file since we still use gnome-session + 2.22 which will start g-s-d by hand. + + -- Josselin Mouette Sat, 27 Dec 2008 11:29:41 +0100 + +gnome-settings-daemon (2.22.2.1-2) unstable; urgency=low + + * 08_extra_touchpad_options.patch: removed broken patch from Ubuntu. + Closes: #481191. + * 11_sleepkey.patch: use gnome-power-cmd to suspend the computer + instead of the nonexistent gdm-signal. + + -- Josselin Mouette Tue, 11 Nov 2008 16:08:08 +0100 + +gnome-settings-daemon (2.22.2.1-1) unstable; urgency=low + + [ Josselin Mouette ] + * Fix priority. + + [ Sebastian Dröge ] + * New upstream bugfix release: + + debian/rules: + - Run touch on every file to fix up timestamps. + + -- Sebastian Dröge Thu, 29 May 2008 10:31:39 +0200 + +gnome-settings-daemon (2.22.1-2) unstable; urgency=high + + * Conflict against gnome-control-center < 2.21.5. Closes: #476802. + + -- Josselin Mouette Sat, 19 Apr 2008 22:17:49 +0200 + +gnome-settings-daemon (2.22.1-1) unstable; urgency=low + + * New upstream bugfix release: + + debian/patches/09_locate_pointer.patch: + - Dropped, fixed upstream. + + -- Sebastian Dröge Mon, 07 Apr 2008 14:44:12 +0200 + +gnome-settings-daemon (2.22.0-4) unstable; urgency=low + + * debian/control.in: + + Also conflict with totem (<< 2.22.0) for the same reason. + * debian/gnome-settings-daemon.install: + + Install xrdb files into /etc/gnome/config again. + + -- Sebastian Dröge Sat, 22 Mar 2008 14:56:12 +0100 + +gnome-settings-daemon (2.22.0-3) unstable; urgency=low + + * Upload to unstable. + * debian/control.in: + + Add conflicts with rhythmbox (<< 0.11.5) and banshee (<< 0.13.2+dfsg-7) + as the multimedia keys DBus interface changed. + + -- Sebastian Dröge Wed, 19 Mar 2008 01:47:15 +0100 + +gnome-settings-daemon (2.22.0-2) experimental; urgency=low + + * debian/rules: + + Don't install the dbus service file. This is not meant to be autostarted + but should be started by gnome-session. + + -- Sebastian Dröge Sun, 16 Mar 2008 17:39:52 +0100 + +gnome-settings-daemon (2.22.0-1) experimental; urgency=low + + * New package, based on the Ubuntu packaging. + + -- Sebastian Dröge Wed, 12 Mar 2008 15:17:19 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..84261868 --- /dev/null +++ b/debian/control @@ -0,0 +1,93 @@ +# This file is autogenerated. DO NOT EDIT! +# +# Modifications should be made to debian/control.in instead. +# This file is regenerated automatically in the clean target. +Source: gnome-settings-daemon +Section: gnome +Priority: optional +Maintainer: Ubuntu Desktop Team +XSBC-Original-Maintainer: Debian GNOME Maintainers +Uploaders: Debian GNOME Maintainers +Build-Depends: cdbs, + debhelper (>= 9), + gnome-pkg-tools, + gtk-doc-tools, + dh-autoreconf, + autotools-dev, + intltool (>= 0.37.1), + libdbus-glib-1-dev (>= 0.74), + libglib2.0-dev (>= 2.31.0), + libgtk-3-dev (>= 3.3.4), + libnotify-dev (>= 0.7.0), + libxt-dev, + libxi-dev, + libfontconfig1-dev, + libxext-dev, + libx11-dev, + libxtst-dev, + gsettings-desktop-schemas-dev (>= 3.5.90), + libgnome-desktop-3-dev (>= 3.5.3), + libpulse-dev (>= 0.9.16), + libcanberra-gtk3-dev, + libcups2-dev, + libpolkit-gobject-1-dev, + libappindicator3-dev (>= 0.4.90), + hwdata, + libupower-glib-dev (>= 0.9.11), + libcolord-dev (>= 0.1.12), + liblcms2-dev, + libnss3-dev, + libgudev-1.0-dev, + libwacom-dev (>= 0.6), + xserver-xorg-input-wacom, + libgnomekbd-dev (>= 3.5.1), + libxklavier-dev +Standards-Version: 3.9.3 +Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/gnome-settings-daemon/ubuntu + +Package: gnome-settings-daemon +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + gsettings-desktop-schemas (>= 3.3.90-0ubuntu2), + nautilus-data (>= 2.91.3-1) +Recommends: pulseaudio, + systemd-services, +Pre-Depends: ${misc:Pre-Depends} +Breaks: rhythmbox (<< 0.11.5), + banshee (<< 0.13.2+dfsg-7), + totem (<< 2.22.0), + gnome-control-center (<< 1:3.6.3-0ubuntu18), + gnome-session (<< 2.24), + gnome-screensaver (<< 2.28.0), + gnome-color-manager (<< 3.0), + unity-greeter (<< 0.2.1-0ubuntu1), + indicator-datetime (<< 12.10.3daily13.03.26), +Suggests: x11-xserver-utils, + gnome-screensaver, + metacity | x-window-manager +Description: daemon handling the GNOME session settings + This package contains the daemon which is responsible for setting the + various parameters of a GNOME session and the applications that run + under it. It handles the following kinds of settings: + . + * Keyboard: layout, accessibility options, shortcuts, media keys + * Clipboard management + * Theming: background, icons, GTK+ applications + * Cleanup of unused files + * Mouse: cursors, speed, accessibility options + * Startup of other daemons: screensaver, sound daemon + * Typing break + . + It also sets various application settings through X resources and + freedesktop.org XSETTINGS. + +Package: gnome-settings-daemon-dev +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libdbus-glib-1-dev (>= 0.74), + libglib2.0-dev (>= 2.26.0) +Description: Headers for building applications communicating with gnome-settings-daemon + This package contains header files required to build applications that + communicate with the GNOME settings daemon over D-Bus. diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 00000000..a482e59e --- /dev/null +++ b/debian/control.in @@ -0,0 +1,89 @@ +Source: gnome-settings-daemon +Section: gnome +Priority: optional +Maintainer: Ubuntu Desktop Team +XSBC-Original-Maintainer: Debian GNOME Maintainers +Uploaders: @GNOME_TEAM@ +Build-Depends: cdbs, + debhelper (>= 9), + gnome-pkg-tools, + gtk-doc-tools, + dh-autoreconf, + autotools-dev, + intltool (>= 0.37.1), + libdbus-glib-1-dev (>= 0.74), + libglib2.0-dev (>= 2.31.0), + libgtk-3-dev (>= 3.3.4), + libnotify-dev (>= 0.7.0), + libxt-dev, + libxi-dev, + libfontconfig1-dev, + libxext-dev, + libx11-dev, + libxtst-dev, + gsettings-desktop-schemas-dev (>= 3.5.90), + libgnome-desktop-3-dev (>= 3.5.3), + libpulse-dev (>= 0.9.16), + libcanberra-gtk3-dev, + libcups2-dev, + libpolkit-gobject-1-dev, + libappindicator3-dev (>= 0.4.90), + hwdata, + libupower-glib-dev (>= 0.9.11), + libcolord-dev (>= 0.1.12), + liblcms2-dev, + libnss3-dev, + libgudev-1.0-dev, + libwacom-dev (>= 0.6), + xserver-xorg-input-wacom, + libgnomekbd-dev (>= 3.5.1), + libxklavier-dev +Standards-Version: 3.9.3 +Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/gnome-settings-daemon/ubuntu + +Package: gnome-settings-daemon +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + gsettings-desktop-schemas (>= 3.3.90-0ubuntu2), + nautilus-data (>= 2.91.3-1) +Recommends: pulseaudio, + systemd-services, +Pre-Depends: ${misc:Pre-Depends} +Breaks: rhythmbox (<< 0.11.5), + banshee (<< 0.13.2+dfsg-7), + totem (<< 2.22.0), + gnome-control-center (<< 1:3.6.3-0ubuntu18), + gnome-session (<< 2.24), + gnome-screensaver (<< 2.28.0), + gnome-color-manager (<< 3.0), + unity-greeter (<< 0.2.1-0ubuntu1), + indicator-datetime (<< 12.10.3daily13.03.26), +Suggests: x11-xserver-utils, + gnome-screensaver, + metacity | x-window-manager +Description: daemon handling the GNOME session settings + This package contains the daemon which is responsible for setting the + various parameters of a GNOME session and the applications that run + under it. It handles the following kinds of settings: + . + * Keyboard: layout, accessibility options, shortcuts, media keys + * Clipboard management + * Theming: background, icons, GTK+ applications + * Cleanup of unused files + * Mouse: cursors, speed, accessibility options + * Startup of other daemons: screensaver, sound daemon + * Typing break + . + It also sets various application settings through X resources and + freedesktop.org XSETTINGS. + +Package: gnome-settings-daemon-dev +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libdbus-glib-1-dev (>= 0.74), + libglib2.0-dev (>= 2.26.0) +Description: Headers for building applications communicating with gnome-settings-daemon + This package contains header files required to build applications that + communicate with the GNOME settings daemon over D-Bus. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..6e2b25fb --- /dev/null +++ b/debian/copyright @@ -0,0 +1,72 @@ +This package was debianized by Sebastien Bacher on +Wed, 16 Jan 2008 11:12:19 +0100. + +It was downloaded from http://ftp.acc.umu.se/pub/GNOME/sources/gnome-settings-daemon + +Upstream Authors: + + Jonathan Blandford + William Jon McCann + +Copyright: + + Copyright © 2001 Ximian, Inc. + Copyright (C) 2007 William Jon McCann + Copyright (C) 2000 Helix Code, Inc + Copyright © 2007 Matthias Clasen + Copyright (C) 2007 Rodrigo Moya + Copyright (C) 2007 Anders Carlsson + Copyright © 2004 Red Hat, Inc. + Copyright 2002 Sun Microsystems, Inc. + Copyright © 2005,2006 Novell, Inc. + Copyright © 2007 The GNOME Foundation + Copyright (C) 2002-2005 - Paolo Maggi + Copyright (C) 2002 Red Hat, Inc. + Copyright 1998, 2001 Tim Janik + Copyright � 2001 Udaltsoft + Copyright (C) 2001, 2002, 2003 Bastien Nocera + Copyright (C) 2003 Ross Burton + Copyright © 2001 Jonathan Blandford + +License: + + This package 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 package 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 package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +eggaccelerators.h, eggaccelerators.c + +License: + + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This package 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 Lesser General Public + License along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU Lesser General +Public License can be found in `/usr/share/common-licenses/LGPL'. + +The Debian packaging is (C) 2008, Sebastien Bacher and +is licensed under the GPL, see above. diff --git a/debian/gnome-settings-daemon-dev.install b/debian/gnome-settings-daemon-dev.install new file mode 100644 index 00000000..2aae22ae --- /dev/null +++ b/debian/gnome-settings-daemon-dev.install @@ -0,0 +1,2 @@ +debian/tmp/usr/include +debian/tmp/usr/lib/pkgconfig diff --git a/debian/gnome-settings-daemon.1 b/debian/gnome-settings-daemon.1 new file mode 100644 index 00000000..27e2664b --- /dev/null +++ b/debian/gnome-settings-daemon.1 @@ -0,0 +1,39 @@ +.\" +.\" gnomeâ‚‹settings-daemon manual page +.\" Copyright (c) 2009 Joshua Cummings +.\" +.TH GNOME-SETTINGS-DAEMON 1 "June 25 2009" "" +.SH NAME +gnome-settings-daemon \- Handles the GNOME session settings +.SH SYNOPSIS +\fBgnome-settings-daemon\fR [\fB\-\-debug\fR] [\fB\-\-no-daemon\fR] +[\fB\-\-gconf-prefix\fR] [\fB\-\-display\fR=\fIDISPLAY\fR] +.SH DESCRIPTION +\fIgnome-settings-daemon\fR is responsible for setting the various preference +parameters of a GNOME session and the applications that run under it. +.SH OPTIONS +.PP +Help options +.TP +\-?, \fB\-\-help\fR +Show this help message +.PP +Application options +.TP +\fB\-\^\-debug\fR +Enable debugging code +.TP +\fB\-\^\-no-daemon\fR +Do not detach the daemon process from its controlling terminal +.TP +\fB\-\^\-gconf-prefix\fR +Specify a custom GConf settings prefix for settings manager plugins +.TP +\fB\-\^\-display\fR=\fIDISPLAY\fR +X display to use +.PP +.SH AUTHOR +\fBgnome-settings-daemon\fR was written by Jonathan Blandford +and William Jon McCann . +.PP +This manual page was originally written by Joshua Cummings . diff --git a/debian/gnome-settings-daemon.install b/debian/gnome-settings-daemon.install new file mode 100644 index 00000000..d373792d --- /dev/null +++ b/debian/gnome-settings-daemon.install @@ -0,0 +1,10 @@ +debian/tmp/etc +debian/tmp/usr/lib/gnome-settings-daemon* +debian/tmp/usr/share/icons +debian/tmp/usr/share/locale +debian/tmp/usr/share/gnome-settings-daemon +debian/tmp/usr/share/GConf +debian/tmp/usr/share/glib-2.0 +debian/tmp/usr/share/polkit-1 +debian/source_gnome-settings-daemon.py /usr/share/apport/package-hooks + diff --git a/debian/gnome-settings-daemon.links b/debian/gnome-settings-daemon.links new file mode 100644 index 00000000..7865e629 --- /dev/null +++ b/debian/gnome-settings-daemon.links @@ -0,0 +1 @@ +usr/lib/gnome-settings-daemon/gnome-settings-daemon usr/bin/gnome-settings-daemon diff --git a/debian/gnome-settings-daemon.maintscript b/debian/gnome-settings-daemon.maintscript new file mode 100644 index 00000000..2cacbbca --- /dev/null +++ b/debian/gnome-settings-daemon.maintscript @@ -0,0 +1,8 @@ +rm_conffile /etc/gnome/config/Editres.ad 3.6.3-0ubuntu3~ +rm_conffile /etc/gnome/config/Emacs.ad 3.6.3-0ubuntu3~ +rm_conffile /etc/gnome/config/General.ad 3.6.3-0ubuntu3~ +rm_conffile /etc/gnome/config/Motif.ad 3.6.3-0ubuntu3~ +rm_conffile /etc/gnome/config/Tk.ad 3.6.3-0ubuntu3~ +rm_conffile /etc/gnome/config/Xaw.ad 3.6.3-0ubuntu3~ +rm_conffile /etc/dbus-1/system.d/org.gnome.SettingsDaemon.DateTimeMechanism.conf 3.6.4-0ubuntu7~ + diff --git a/debian/gnome-settings-daemon.manpages b/debian/gnome-settings-daemon.manpages new file mode 100644 index 00000000..fb2071b7 --- /dev/null +++ b/debian/gnome-settings-daemon.manpages @@ -0,0 +1 @@ +debian/gnome-settings-daemon.1 diff --git a/debian/gnome-settings-daemon.postinst b/debian/gnome-settings-daemon.postinst new file mode 100644 index 00000000..0f28bc5e --- /dev/null +++ b/debian/gnome-settings-daemon.postinst @@ -0,0 +1,21 @@ +#! /bin/sh +set -e + +#DEBHELPER# + +# Remove obsolete conffiles + +case "$1" in +configure) + if dpkg --compare-versions "$2" lt-nl "2.24.1"; then + rm -rf /etc/gnome/config/xrdb + fi + if dpkg --compare-versions "$2" lt-nl "2.26.1"; then + rm -f /etc/xdg/autostart/gnome-settings-daemon.desktop + fi + if dpkg --compare-versions "$2" lt-nl "3.6.3-0ubuntu3"; then + if [ -d /etc/gnome/config ]; then + rmdir --ignore-fail-on-non-empty /etc/gnome/config + fi + fi +esac diff --git a/debian/gnome-settings-daemon.user-session.desktop b/debian/gnome-settings-daemon.user-session.desktop new file mode 100644 index 00000000..1162bfed --- /dev/null +++ b/debian/gnome-settings-daemon.user-session.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Name=GNOME Settings Daemon +Exec=/usr/lib/gnome-settings-daemon/gnome-settings-daemon +Hidden=true diff --git a/debian/gnome-settings-daemon.user-session.upstart b/debian/gnome-settings-daemon.user-session.upstart new file mode 100644 index 00000000..3f8062a9 --- /dev/null +++ b/debian/gnome-settings-daemon.user-session.upstart @@ -0,0 +1,8 @@ +description "The Gnome Settings Daemon" +author "Stéphane Graber " + +start on started dbus and starting gnome-session +stop on stopping gnome-session + +respawn +exec /usr/lib/gnome-settings-daemon/gnome-settings-daemon diff --git a/debian/gnome-update-wallpaper-cache.c b/debian/gnome-update-wallpaper-cache.c new file mode 100644 index 00000000..1d9a5638 --- /dev/null +++ b/debian/gnome-update-wallpaper-cache.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Canonical, Ltd. + * + * 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 3 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 version 3.0 for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authored by Didier Roche + * + * Bug: https://bugs.launchpad.net/bugs/530024 + */ + +#include +#include +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +static GOptionEntry entries[] = +{ + { NULL } +}; + +main (int argc, char *argv[]) +{ + GOptionContext *context = NULL; + GError *error = NULL; + + GdkScreen *screen; + GdkRectangle rect; + GnomeBG *bg; + GSettings *settings; + GdkPixbuf *pixbuf; + + gdk_init (&argc, &argv); + + context = g_option_context_new ("- refresh wallpaper cache"); + g_option_context_add_main_entries (context, entries, NULL); + if (!g_option_context_parse (context, &argc, &argv, &error)) { + g_printerr ("option parsing failed: %s\n", error->message); + g_option_context_free(context); + g_error_free (error); + return (1); + } + if (context) + g_option_context_free (context); + + /* cache only the first monitor */ + screen = gdk_screen_get_default (); + gdk_screen_get_monitor_geometry (screen, 0, &rect); + + bg = gnome_bg_new (); + settings = g_settings_new ("org.gnome.desktop.background"); + gnome_bg_load_from_preferences (bg, settings); + + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, rect.width, rect.height); + gnome_bg_draw (bg, pixbuf, screen, FALSE); + + g_object_unref (settings); + + return (0); +} diff --git a/debian/patches/05_disable_corner_tapping.patch b/debian/patches/05_disable_corner_tapping.patch new file mode 100644 index 00000000..47ee36c4 --- /dev/null +++ b/debian/patches/05_disable_corner_tapping.patch @@ -0,0 +1,19 @@ +Description: Disable corner tapping when disabling tap to click +Bug: https://bugzilla.gnome.org/show_bug.cgi?id=607474 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/509724 + +Index: gnome-settings-daemon-3.6.1/plugins/mouse/gsd-mouse-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/mouse/gsd-mouse-manager.c 2012-10-05 13:56:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/mouse/gsd-mouse-manager.c 2012-10-26 10:20:07.735005058 +0200 +@@ -650,6 +650,10 @@ + &bytes_after, &data); + + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7) { ++ /* Set MR mapping for corner tapping on the right side*/ ++ data[0] = (state) ? 2 : 0; ++ data[1] = (state) ? 3 : 0; ++ + /* Set RLM mapping for 1/2/3 fingers*/ + data[4] = (state) ? ((left_handed) ? 3 : 1) : 0; + data[5] = (state) ? ((left_handed) ? 1 : 3) : 0; diff --git a/debian/patches/16_use_synchronous_notifications.patch b/debian/patches/16_use_synchronous_notifications.patch new file mode 100644 index 00000000..e9707b02 --- /dev/null +++ b/debian/patches/16_use_synchronous_notifications.patch @@ -0,0 +1,469 @@ +Description: Use synchronous notifications when they are supported +Author: ? +Upstream: that's Ubuntu specific (notify-osd) +Index: gnome-settings-daemon-3.6.3/plugins/media-keys/gsd-media-keys-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.3.orig/plugins/media-keys/gsd-media-keys-manager.c 2012-11-14 13:19:28.000000000 +0100 ++++ gnome-settings-daemon-3.6.3/plugins/media-keys/gsd-media-keys-manager.c 2012-11-26 16:06:37.308449155 +0100 +@@ -58,6 +58,8 @@ + #include + #include "gvc-mixer-control.h" + ++#include ++ + #define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" + #define GSD_DBUS_NAME "org.gnome.SettingsDaemon" + #define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +@@ -166,6 +168,11 @@ + GCancellable *cancellable; + + guint start_idle_id; ++ ++ /* Ubuntu notifications */ ++ NotifyNotification *volume_notification; ++ NotifyNotification *brightness_notification; ++ NotifyNotification *kb_backlight_notification; + }; + + static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +@@ -179,6 +186,132 @@ + + static gpointer manager_object = NULL; + ++#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous" ++#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only" ++#define NOTIFY_HINT_TRUE "true" ++ ++typedef struct { ++ GsdMediaKeysManager *manager; ++ MediaKeyType type; ++ guint old_percentage; ++ ++} GsdBrightnessActionData; ++ ++static const char *volume_icons[] = { ++ "notification-audio-volume-muted", ++ "notification-audio-volume-low", ++ "notification-audio-volume-medium", ++ "notification-audio-volume-high", ++ NULL ++}; ++ ++static const char *brightness_icons[] = { ++ "notification-display-brightness-off", ++ "notification-display-brightness-low", ++ "notification-display-brightness-medium", ++ "notification-display-brightness-high", ++ "notification-display-brightness-full", ++ NULL ++}; ++ ++static const char *kb_backlight_icons[] = { ++ "notification-keyboard-brightness-off", ++ "notification-keyboard-brightness-low", ++ "notification-keyboard-brightness-medium", ++ "notification-keyboard-brightness-high", ++ "notification-keyboard-brightness-full", ++ NULL ++}; ++ ++static const char * ++calculate_icon_name (gint value, const char **icon_names) ++{ ++ value = CLAMP (value, 0, 100); ++ gint length = g_strv_length (icon_names); ++ gint s = (length - 1) * value / 100 + 1; ++ s = CLAMP (s, 1, length - 1); ++ ++ return icon_names[s]; ++} ++ ++static gboolean ++ubuntu_osd_notification_is_supported (void) ++{ ++ GList *caps; ++ gboolean has_cap; ++ ++ caps = notify_get_server_caps (); ++ has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL); ++ g_list_foreach (caps, (GFunc) g_free, NULL); ++ g_list_free (caps); ++ ++ return has_cap; ++} ++ ++static gboolean ++ubuntu_osd_notification_show_icon (const char *icon, ++ const char *hint) ++{ ++ if (!ubuntu_osd_notification_is_supported ()) ++ return FALSE; ++ ++ NotifyNotification *notification = notify_notification_new (" ", "", icon); ++ notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); ++ notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE); ++ ++ gboolean res = notify_notification_show (notification, NULL); ++ g_object_unref (notification); ++ ++ return res; ++} ++ ++static gboolean ++ubuntu_osd_do_notification (NotifyNotification **notification, ++ const char *hint, ++ gint value, ++ gboolean muted, ++ const char **icon_names) ++{ ++ if (!ubuntu_osd_notification_is_supported ()) ++ return FALSE; ++ ++ if (!*notification) { ++ *notification = notify_notification_new (" ", "", NULL); ++ notify_notification_set_hint_string (*notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); ++ } ++ ++ value = CLAMP (value, -1, 101); ++ const char *icon = muted ? icon_names[0] : calculate_icon_name (value, icon_names); ++ notify_notification_set_hint_int32 (*notification, "value", value); ++ notify_notification_update (*notification, " ", "", icon); ++ ++ return notify_notification_show (*notification, NULL); ++} ++ ++static gboolean ++ubuntu_osd_notification_show_volume (GsdMediaKeysManager *manager, ++ gint value, ++ gboolean muted) ++{ ++ return ubuntu_osd_do_notification (&manager->priv->volume_notification, ++ "volume", value, muted, volume_icons); ++} ++ ++static gboolean ++ubuntu_osd_notification_show_brightness (GsdMediaKeysManager *manager, ++ gint value) ++{ ++ return ubuntu_osd_do_notification (&manager->priv->brightness_notification, ++ "brightness", value, value <= 0, brightness_icons); ++} ++ ++static gboolean ++ubuntu_osd_notification_show_kb_backlight (GsdMediaKeysManager *manager, ++ gint value) ++{ ++ return ubuntu_osd_do_notification (&manager->priv->kb_backlight_notification, ++ "keyboard", value, value <= 0, kb_backlight_icons); ++} + + static void + init_screens (GsdMediaKeysManager *manager) +@@ -835,11 +968,13 @@ + } + + /* Show the dialogue */ +- dialog_init (manager); +- gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), +- "media-eject-symbolic", +- FALSE); +- dialog_show (manager); ++ if (!ubuntu_osd_notification_show_icon ("notification-device-eject", "Eject")) { ++ dialog_init (manager); ++ gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), ++ "media-eject-symbolic", ++ FALSE); ++ dialog_show (manager); ++ } + + /* Clean up the drive selection and exit if no suitable + * drives are found */ +@@ -897,11 +1032,13 @@ + static void + do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) + { +- dialog_init (manager); +- gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), +- state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", +- FALSE); +- dialog_show (manager); ++ if (!ubuntu_osd_notification_show_icon ((!state) ? "touchpad-disabled-symbolic" : "input-touchpad-symbolic", "Touchpad")) { ++ dialog_init (manager); ++ gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), ++ state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", ++ FALSE); ++ dialog_show (manager); ++ } + } + + static void +@@ -932,12 +1069,10 @@ + gboolean sound_changed, + gboolean quiet) + { +- if (!muted) { +- vol = (int) (100 * (double) vol / PA_VOLUME_NORM); +- vol = CLAMP (vol, 0, 100); +- } else { +- vol = 0.0; +- } ++ if (ubuntu_osd_notification_show_volume (manager, vol, muted)) ++ goto done; ++ ++ vol = CLAMP (vol, 0, 100); + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), +@@ -947,6 +1082,7 @@ + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + ++done: + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); +@@ -1069,7 +1205,7 @@ + { + GvcMixerStream *stream; + gboolean old_muted, new_muted; +- guint old_vol, new_vol, norm_vol_step; ++ guint old_vol, new_vol, norm_vol_step, osd_vol; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +@@ -1120,7 +1256,16 @@ + } + } + +- update_dialog (manager, stream, new_vol, new_muted, sound_changed, quiet); ++ if (type == VOLUME_DOWN_KEY && old_vol == 0 && old_muted) ++ osd_vol = -1; ++ else if (type == VOLUME_UP_KEY && old_vol == PA_VOLUME_NORM && !old_muted) ++ osd_vol = 101; ++ else if (!new_muted) ++ osd_vol = (int) (100 * (double) new_vol / PA_VOLUME_NORM); ++ else ++ osd_vol = 0; ++ ++ update_dialog (manager, stream, osd_vol, new_muted, sound_changed, quiet); + } + + static void +@@ -1426,8 +1571,11 @@ + + static gboolean + do_multimedia_player_action (GsdMediaKeysManager *manager, ++ const char *icon, + const char *key) + { ++ if (icon != NULL) ++ ubuntu_osd_notification_show_icon (icon, key); + return gsd_media_player_key_pressed (manager, key); + } + +@@ -1652,7 +1800,8 @@ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; +- GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); ++ GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; ++ GsdMediaKeysManager *manager = data->manager; + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); +@@ -1660,22 +1809,68 @@ + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); ++ g_free (data); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); +- dialog_init (manager); +- gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), +- "display-brightness-symbolic", +- TRUE); +- gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), +- percentage); +- dialog_show (manager); ++ guint osd_percentage; ++ ++ if (data->old_percentage == 100 && data->type == SCREEN_BRIGHTNESS_UP_KEY) ++ osd_percentage = 101; ++ else if (data->old_percentage == 0 && data->type == SCREEN_BRIGHTNESS_DOWN_KEY) ++ osd_percentage = -1; ++ else ++ osd_percentage = CLAMP (percentage, 0, 100); ++ ++ if (!ubuntu_osd_notification_show_brightness (manager, osd_percentage)) { ++ dialog_init (manager); ++ gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), ++ "display-brightness-symbolic", ++ TRUE); ++ gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), ++ percentage); ++ dialog_show (manager); ++ } ++ g_free (data); + g_variant_unref (new_percentage); + } + + static void ++do_screen_brightness_action_real (GObject *source_object, ++ GAsyncResult *res, ++ gpointer user_data) ++{ ++ GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; ++ GsdMediaKeysManager *manager = data->manager; ++ GError *error = NULL; ++ ++ GVariant *old_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), ++ res, &error); ++ if (old_percentage == NULL) { ++ g_warning ("Failed to get old screen percentage: %s", error->message); ++ g_error_free (error); ++ g_free (data); ++ return; ++ } ++ ++ g_variant_get (old_percentage, "(u)", &data->old_percentage); ++ ++ /* call into the power plugin */ ++ g_dbus_proxy_call (manager->priv->power_screen_proxy, ++ data->type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", ++ NULL, ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ update_screen_cb, ++ data); ++ ++ g_variant_unref (old_percentage); ++} ++ ++static void + do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) + { +@@ -1685,15 +1880,18 @@ + return; + } + +- /* call into the power plugin */ ++ GsdBrightnessActionData *data = g_new0 (GsdBrightnessActionData, 1); ++ data->manager = manager; ++ data->type = type; ++ + g_dbus_proxy_call (manager->priv->power_screen_proxy, +- type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", ++ "GetPercentage", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, +- update_screen_cb, +- manager); ++ do_screen_brightness_action_real, ++ data); + } + + static void +@@ -1717,13 +1915,18 @@ + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); +- dialog_init (manager); +- gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), +- "keyboard-brightness-symbolic", +- TRUE); +- gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), +- percentage); +- dialog_show (manager); ++ ++ /* FIXME: No overshoot effect for keyboard, as the power plugin has no interface ++ * to get the old brightness */ ++ if (!ubuntu_osd_notification_show_kb_backlight (manager, CLAMP (percentage, 0, 100))) { ++ dialog_init (manager); ++ gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), ++ "keyboard-brightness-symbolic", ++ TRUE); ++ gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), ++ percentage); ++ dialog_show (manager); ++ } + g_variant_unref (new_percentage); + } + +@@ -1894,23 +2097,23 @@ + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: +- return do_multimedia_player_action (manager, "Play"); ++ return do_multimedia_player_action (manager, NULL, "Play"); + case PAUSE_KEY: +- return do_multimedia_player_action (manager, "Pause"); ++ return do_multimedia_player_action (manager, NULL, "Pause"); + case STOP_KEY: +- return do_multimedia_player_action (manager, "Stop"); ++ return do_multimedia_player_action (manager, NULL, "Stop"); + case PREVIOUS_KEY: +- return do_multimedia_player_action (manager, "Previous"); ++ return do_multimedia_player_action (manager, NULL, "Previous"); + case NEXT_KEY: +- return do_multimedia_player_action (manager, "Next"); ++ return do_multimedia_player_action (manager, NULL, "Next"); + case REWIND_KEY: +- return do_multimedia_player_action (manager, "Rewind"); ++ return do_multimedia_player_action (manager, NULL, "Rewind"); + case FORWARD_KEY: +- return do_multimedia_player_action (manager, "FastForward"); ++ return do_multimedia_player_action (manager, NULL, "FastForward"); + case REPEAT_KEY: +- return do_multimedia_player_action (manager, "Repeat"); ++ return do_multimedia_player_action (manager, NULL, "Repeat"); + case RANDOM_KEY: +- return do_multimedia_player_action (manager, "Shuffle"); ++ return do_multimedia_player_action (manager, NULL, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; +@@ -2289,6 +2492,24 @@ + priv->connection = NULL; + } + ++ if (priv->volume_notification != NULL) { ++ notify_notification_close (priv->volume_notification, NULL); ++ g_object_unref (priv->volume_notification); ++ priv->volume_notification = NULL; ++ } ++ ++ if (priv->brightness_notification != NULL) { ++ notify_notification_close (priv->brightness_notification, NULL); ++ g_object_unref (priv->brightness_notification); ++ priv->brightness_notification = NULL; ++ } ++ ++ if (priv->kb_backlight_notification != NULL) { ++ notify_notification_close (priv->kb_backlight_notification, NULL); ++ g_object_unref (priv->kb_backlight_notification); ++ priv->kb_backlight_notification = NULL; ++ } ++ + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { +Index: gnome-settings-daemon-3.6.3/configure.ac +=================================================================== +--- gnome-settings-daemon-3.6.3.orig/configure.ac 2012-11-14 13:44:32.000000000 +0100 ++++ gnome-settings-daemon-3.6.3/configure.ac 2012-11-26 16:06:17.216448183 +0100 +@@ -203,7 +203,7 @@ + dnl - media-keys plugin stuff + dnl --------------------------------------------------------------------------- + +-PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra]) ++PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra libnotify]) + + dnl --------------------------------------------------------------------------- + dnl - xrandr plugin stuff diff --git a/debian/patches/43_disable_locale_settings.patch b/debian/patches/43_disable_locale_settings.patch new file mode 100644 index 00000000..998092b3 --- /dev/null +++ b/debian/patches/43_disable_locale_settings.patch @@ -0,0 +1,25 @@ +Description: Make sure that no locales are set, even if the gsettings "region" key has + been assigned a value in the past, since they are set in Ubuntu via ~/.pam_environment. +Forwarded: not-needed +Author: Gunnar Hjalmarsson + +* +* The set_locale() function is questionable anyhow, since it's called after ~/.profile +* is sourced by e.g. lightdm or gdm, which prevents users from fine tuning the locale +* settings by editing ~/.profile. +* + +Index: gnome-settings-daemon-3.6.1/gnome-settings-daemon/main.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/gnome-settings-daemon/main.c 2012-10-05 14:41:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/gnome-settings-daemon/main.c 2012-10-26 10:20:14.163005369 +0200 +@@ -316,9 +316,6 @@ + g_debug ("Could not connect to the Session manager: %s", error->message); + g_error_free (error); + } else { +- /* Always call this first, as Setenv can only be called before +- any client registers */ +- set_locale (proxy); + #ifdef HAVE_IBUS + /* This will register with gnome-session after calling Setenv. */ + set_legacy_ibus_env_vars (proxy); diff --git a/debian/patches/45_suppress-printer-may-not-be-connected-notification.patch b/debian/patches/45_suppress-printer-may-not-be-connected-notification.patch new file mode 100644 index 00000000..7c3e5789 --- /dev/null +++ b/debian/patches/45_suppress-printer-may-not-be-connected-notification.patch @@ -0,0 +1,32 @@ +# Ubuntu: https://launchpad.net/bugs/842768 +Index: gnome-settings-daemon-3.6.1/plugins/print-notifications/gsd-print-notifications-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/print-notifications/gsd-print-notifications-manager.c 2012-10-05 13:56:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/print-notifications/gsd-print-notifications-manager.c 2012-10-26 10:19:49.487004175 +0200 +@@ -293,7 +293,7 @@ + static const char * const reasons[] = { + "toner-low", + "toner-empty", +- "connecting-to-device", ++ /*"connecting-to-device",*/ + "cover-open", + "cups-missing-filter", + "door-open", +@@ -310,7 +310,7 @@ + /* Translators: The printer has no toner left (same as in system-config-printer) */ + N_("Toner empty"), + /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ +- N_("Not connected?"), ++ /*N_("Not connected?"),*/ + /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ + N_("Cover open"), + /* Translators: A filter or backend is not installed (same as in system-config-printer) */ +@@ -336,7 +336,7 @@ + /* Translators: The printer has no toner left (same as in system-config-printer) */ + N_("Printer '%s' has no toner left."), + /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ +- N_("Printer '%s' may not be connected."), ++ /*N_("Printer '%s' may not be connected."),*/ + /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ + N_("The cover is open on printer '%s'."), + /* Translators: A filter or backend is not installed (same as in system-config-printer) */ diff --git a/debian/patches/47_delay_pa_connect_to_idle.patch b/debian/patches/47_delay_pa_connect_to_idle.patch new file mode 100644 index 00000000..d4ee614d --- /dev/null +++ b/debian/patches/47_delay_pa_connect_to_idle.patch @@ -0,0 +1,23 @@ +Index: gnome-settings-daemon-3.6.1/plugins/media-keys/gsd-media-keys-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/media-keys/gsd-media-keys-manager.c 2012-10-26 10:19:49.447004173 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/media-keys/gsd-media-keys-manager.c 2012-10-26 10:20:09.391005138 +0200 +@@ -2291,6 +2291,9 @@ + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + ++ ++ gvc_mixer_control_open (manager->priv->volume); ++ + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); +@@ -2395,8 +2398,6 @@ + G_CALLBACK (on_control_stream_removed), + manager); + +- gvc_mixer_control_open (manager->priv->volume); +- + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); diff --git a/debian/patches/48_register_client_before_idle_callbacks.patch b/debian/patches/48_register_client_before_idle_callbacks.patch new file mode 100644 index 00000000..5faf1bf9 --- /dev/null +++ b/debian/patches/48_register_client_before_idle_callbacks.patch @@ -0,0 +1,116 @@ +Index: gnome-settings-daemon-3.6.1/gnome-settings-daemon/main.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/gnome-settings-daemon/main.c 2012-10-26 10:19:49.467004174 +0200 ++++ gnome-settings-daemon-3.6.1/gnome-settings-daemon/main.c 2012-10-26 10:19:49.527004177 +0200 +@@ -303,28 +303,6 @@ + } + #endif + +-static void +-got_session_proxy (GObject *source_object, +- GAsyncResult *res, +- gpointer user_data) +-{ +- GDBusProxy *proxy; +- GError *error = NULL; +- +- proxy = g_dbus_proxy_new_finish (res, &error); +- if (proxy == NULL) { +- g_debug ("Could not connect to the Session manager: %s", error->message); +- g_error_free (error); +- } else { +-#ifdef HAVE_IBUS +- /* This will register with gnome-session after calling Setenv. */ +- set_legacy_ibus_env_vars (proxy); +-#else +- register_with_gnome_session (proxy); +-#endif +- } +-} +- + static gboolean + on_term_signal_pipe_closed (GIOChannel *source, + GIOCondition condition, +@@ -374,16 +352,6 @@ + { + g_assert (bus != NULL); + +- g_dbus_proxy_new (bus, +- G_DBUS_PROXY_FLAGS_NONE, +- NULL, +- GNOME_SESSION_DBUS_NAME, +- GNOME_SESSION_DBUS_OBJECT, +- GNOME_SESSION_DBUS_INTERFACE, +- NULL, +- (GAsyncReadyCallback) got_session_proxy, +- NULL); +- + watch_for_term_signal (manager); + } + +@@ -406,6 +374,56 @@ + gtk_main_quit (); + } + ++static gboolean ++do_register_client (gpointer user_data) ++{ ++ GDBusProxy *proxy = (GDBusProxy *) user_data; ++ g_assert (proxy != NULL); ++ ++ const char *startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); ++ g_dbus_proxy_call (proxy, ++ "RegisterClient", ++ g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ (GAsyncReadyCallback) on_client_registered, ++ manager); ++ ++ return FALSE; ++} ++ ++static void ++queue_register_client (void) ++{ ++ GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); ++ if (!bus) ++ return; ++ ++ GError *error = NULL; ++ GDBusProxy *proxy = g_dbus_proxy_new_sync (bus, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ GNOME_SESSION_DBUS_NAME, ++ GNOME_SESSION_DBUS_OBJECT, ++ GNOME_SESSION_DBUS_INTERFACE, ++ NULL, ++ &error); ++ g_object_unref (bus); ++ ++ if (proxy == NULL) { ++ g_debug ("Could not connect to the Session manager: %s", error->message); ++ g_error_free (error); ++ return; ++ } ++ ++ /* Register the daemon with gnome-session */ ++ g_signal_connect (G_OBJECT (proxy), "g-signal", ++ G_CALLBACK (on_session_over), NULL); ++ ++ g_idle_add_full (G_PRIORITY_DEFAULT, do_register_client, proxy, NULL); ++} ++ + static void + bus_register (void) + { +@@ -499,6 +517,8 @@ + + notify_init ("gnome-settings-daemon"); + ++ queue_register_client (); ++ + bus_register (); + + gnome_settings_profile_start ("gnome_settings_manager_new"); diff --git a/debian/patches/51_lock_screen_on_suspend.patch b/debian/patches/51_lock_screen_on_suspend.patch new file mode 100644 index 00000000..52910994 --- /dev/null +++ b/debian/patches/51_lock_screen_on_suspend.patch @@ -0,0 +1,63 @@ +Description: when suspending or hibernating, use the new ubuntu-lock-on-suspend preference. +Author: Marc Deslauriers +Forwarded: no, likely a Ubuntu-specific preference +Bug-Ubuntu: https://bugs.launchpad.net/bugs/938076 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/847814 + +Index: gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/power/gsd-power-manager.c 2012-10-05 13:56:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c 2012-10-26 10:20:11.739005253 +0200 +@@ -2249,9 +2249,6 @@ + GError *error = NULL; + GsdPowerActionType action_type; + +- /* maybe lock the screen if the lid is closed */ +- lock_screensaver (manager); +- + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, +@@ -2268,6 +2265,9 @@ + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; ++ } else { ++ /* maybe lock the screen if the lid is closed */ ++ lock_screensaver (manager); + } + } + +@@ -3499,7 +3499,31 @@ + UpSleepKind sleep_kind, + GsdPowerManager *manager) + { +- lock_screensaver (manager); ++ gboolean do_lock; ++ ++ do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, ++ "ubuntu-lock-on-suspend"); ++ if (!do_lock) ++ return; ++ ++ if (manager->priv->screensaver_proxy != NULL) { ++ g_debug ("doing gnome-screensaver lock"); ++ g_dbus_proxy_call (manager->priv->screensaver_proxy, ++ "Lock", ++ NULL, G_DBUS_CALL_FLAGS_NONE, -1, ++ NULL, NULL, NULL); ++ } else { ++ /* connect to the screensaver first */ ++ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, ++ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, ++ NULL, ++ GS_DBUS_NAME, ++ GS_DBUS_PATH, ++ GS_DBUS_INTERFACE, ++ NULL, ++ sleep_cb_screensaver_proxy_ready_cb, ++ manager); ++ } + } + + static void diff --git a/debian/patches/52_sync_background_to_accountsservice.patch b/debian/patches/52_sync_background_to_accountsservice.patch new file mode 100644 index 00000000..dbaf5080 --- /dev/null +++ b/debian/patches/52_sync_background_to_accountsservice.patch @@ -0,0 +1,112 @@ +Index: gnome-settings-daemon-3.6.1/plugins/background/gsd-background-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/background/gsd-background-manager.c 2012-05-24 11:50:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/background/gsd-background-manager.c 2012-10-26 10:19:49.567004179 +0200 +@@ -412,6 +412,98 @@ + setup_bg_and_draw_background (manager); + } + ++static void ++set_accountsservice_background (const gchar *background) ++{ ++ GDBusProxy *proxy = NULL; ++ GDBusProxy *user = NULL; ++ GVariant *variant = NULL; ++ GError *error = NULL; ++ gchar *object_path = NULL; ++ ++ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ "org.freedesktop.Accounts", ++ "/org/freedesktop/Accounts", ++ "org.freedesktop.Accounts", ++ NULL, ++ &error); ++ ++ if (proxy == NULL) { ++ g_warning ("Failed to contact accounts service: %s", error->message); ++ g_error_free (error); ++ return; ++ } ++ ++ variant = g_dbus_proxy_call_sync (proxy, ++ "FindUserByName", ++ g_variant_new ("(s)", g_get_user_name ()), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ &error); ++ ++ if (variant == NULL) { ++ g_warning ("Could not contact accounts service to look up '%s': %s", ++ g_get_user_name (), error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ ++ g_variant_get (variant, "(o)", &object_path); ++ user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ "org.freedesktop.Accounts", ++ object_path, ++ "org.freedesktop.Accounts.User", ++ NULL, ++ &error); ++ g_free (object_path); ++ ++ if (user == NULL) { ++ g_warning ("Could not create proxy for user '%s': %s", ++ g_variant_get_string (variant, NULL), error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ g_variant_unref (variant); ++ ++ variant = g_dbus_proxy_call_sync (user, ++ "SetBackgroundFile", ++ g_variant_new ("(s)", background ? background : ""), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ &error); ++ ++ if (variant == NULL) { ++ g_warning ("Failed to set the background '%s': %s", background, error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ ++bail: ++ if (proxy != NULL) ++ g_object_unref (proxy); ++ if (variant != NULL) ++ g_variant_unref (variant); ++} ++ ++static void ++picture_uri_changed (GSettings *settings, ++ const char *key, ++ GsdBackgroundManager *manager) ++{ ++ const char *picture_uri = g_settings_get_string (settings, key); ++ GFile *picture_file = g_file_new_for_uri (picture_uri); ++ char *picture_path = g_file_get_path (picture_file); ++ set_accountsservice_background (picture_path); ++ g_free (picture_path); ++ g_object_unref (picture_file); ++} ++ + gboolean + gsd_background_manager_start (GsdBackgroundManager *manager, + GError **error) +@@ -424,6 +516,8 @@ + manager->priv->settings = g_settings_new ("org.gnome.desktop.background"); + g_signal_connect (manager->priv->settings, "changed::draw-background", + G_CALLBACK (draw_background_changed), manager); ++ g_signal_connect (manager->priv->settings, "changed::picture-uri", ++ G_CALLBACK (picture_uri_changed), manager); + + /* If this is set, nautilus will draw the background and is + * almost definitely in our session. however, it may not be diff --git a/debian/patches/60_unity_hide_status_icon.patch b/debian/patches/60_unity_hide_status_icon.patch new file mode 100644 index 00000000..51380bbf --- /dev/null +++ b/debian/patches/60_unity_hide_status_icon.patch @@ -0,0 +1,29 @@ +Index: gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/power/gsd-power-manager.c 2012-10-26 10:19:49.551004178 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c 2012-10-26 10:20:05.591004954 +0200 +@@ -690,7 +690,7 @@ + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); +- gtk_status_icon_set_visible (manager->priv->status_icon, icon != NULL); ++ gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + if (icon == NULL) { + /* none before, now none */ +@@ -706,6 +706,7 @@ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ ++ gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; +@@ -3690,6 +3691,7 @@ + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); ++ gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, diff --git a/debian/patches/61_revert_libgnomekbd_drop b/debian/patches/61_revert_libgnomekbd_drop new file mode 100644 index 00000000..c9dc1fff --- /dev/null +++ b/debian/patches/61_revert_libgnomekbd_drop @@ -0,0 +1,1064 @@ +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -47,7 +47,7 @@ + GTK_REQUIRED_VERSION=3.3.18 + GCONF_REQUIRED_VERSION=2.6.1 + GIO_REQUIRED_VERSION=2.26.0 +-GNOME_DESKTOP_REQUIRED_VERSION=3.5.3 ++GNOME_DESKTOP_REQUIRED_VERSION=3.3.92 + LIBNOTIFY_REQUIRED_VERSION=0.7.3 + UPOWER_GLIB_REQUIRED_VERSION=0.9.1 + PA_REQUIRED_VERSION=0.9.16 +@@ -175,7 +175,8 @@ + dnl - Keyboard plugin stuff + dnl --------------------------------------------------------------------------- + +-PKG_CHECK_MODULES(KEYBOARD, xkbfile gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) ++LIBGNOMEKBD_REQUIRED=3.5.1 ++PKG_CHECK_MODULES(KEYBOARD, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0 kbproto]) + + dnl --------------------------------------------------------------------------- + dnl - Housekeeping plugin stuff +Index: b/plugins/keyboard/delayed-dialog.c +=================================================================== +--- /dev/null ++++ b/plugins/keyboard/delayed-dialog.c +@@ -0,0 +1,128 @@ ++/* ++ * Copyright © 2006 Novell, Inc. ++ * ++ * 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, 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 ++#include ++ ++#include ++#include ++ ++#include "delayed-dialog.h" ++ ++static gboolean delayed_show_timeout (gpointer data); ++static GdkFilterReturn message_filter (GdkXEvent *xevent, ++ GdkEvent *event, ++ gpointer data); ++ ++static GSList *dialogs = NULL; ++ ++/** ++ * gsd_delayed_show_dialog: ++ * @dialog: the dialog ++ * ++ * Shows the dialog as with gtk_widget_show(), unless a window manager ++ * hasn't been started yet, in which case it will wait up to 5 seconds ++ * for that to happen before showing the dialog. ++ **/ ++void ++gsd_delayed_show_dialog (GtkWidget *dialog) ++{ ++ GdkDisplay *display = gtk_widget_get_display (dialog); ++ Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); ++ GdkScreen *screen = gtk_widget_get_screen (dialog); ++ char selection_name[10]; ++ Atom selection_atom; ++ ++ /* We can't use gdk_selection_owner_get() for this, because ++ * it's an unknown out-of-process window. ++ */ ++ snprintf (selection_name, sizeof (selection_name), "WM_S%d", ++ gdk_screen_get_number (screen)); ++ selection_atom = XInternAtom (xdisplay, selection_name, True); ++ if (selection_atom && ++ XGetSelectionOwner (xdisplay, selection_atom) != None) { ++ gtk_widget_show (dialog); ++ return; ++ } ++ ++ dialogs = g_slist_prepend (dialogs, dialog); ++ ++ gdk_window_add_filter (NULL, message_filter, NULL); ++ ++ g_timeout_add (5000, delayed_show_timeout, NULL); ++} ++ ++static gboolean ++delayed_show_timeout (gpointer data) ++{ ++ GSList *l; ++ ++ for (l = dialogs; l; l = l->next) ++ gtk_widget_show (l->data); ++ g_slist_free (dialogs); ++ dialogs = NULL; ++ ++ /* FIXME: There's no gdk_display_remove_client_message_filter */ ++ ++ return FALSE; ++} ++ ++static GdkFilterReturn ++message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) ++{ ++ XClientMessageEvent *evt; ++ char *selection_name; ++ int screen; ++ GSList *l, *next; ++ ++ if (((XEvent *)xevent)->type != ClientMessage) ++ return GDK_FILTER_CONTINUE; ++ ++ evt = (XClientMessageEvent *)xevent; ++ ++ if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE)) ++ return GDK_FILTER_CONTINUE; ++ ++ selection_name = XGetAtomName (evt->display, evt->data.l[1]); ++ ++ if (strncmp (selection_name, "WM_S", 4) != 0) { ++ XFree (selection_name); ++ return GDK_FILTER_CONTINUE; ++ } ++ ++ screen = atoi (selection_name + 4); ++ ++ for (l = dialogs; l; l = next) { ++ GtkWidget *dialog = l->data; ++ next = l->next; ++ ++ if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { ++ gtk_widget_show (dialog); ++ dialogs = g_slist_remove (dialogs, dialog); ++ } ++ } ++ ++ if (!dialogs) { ++ gdk_window_remove_filter (NULL, message_filter, NULL); ++ } ++ ++ XFree (selection_name); ++ ++ return GDK_FILTER_CONTINUE; ++} +Index: b/plugins/keyboard/delayed-dialog.h +=================================================================== +--- /dev/null ++++ b/plugins/keyboard/delayed-dialog.h +@@ -0,0 +1,32 @@ ++/* ++ * Copyright © 2006 Novell, Inc. ++ * ++ * 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, 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 __DELAYED_DIALOG_H ++#define __DELAYED_DIALOG_H ++ ++#include ++ ++G_BEGIN_DECLS ++ ++void gsd_delayed_show_dialog (GtkWidget *dialog); ++ ++G_END_DECLS ++ ++#endif +Index: b/plugins/keyboard/gsd-keyboard-manager.c +=================================================================== +--- a/plugins/keyboard/gsd-keyboard-manager.c ++++ b/plugins/keyboard/gsd-keyboard-manager.c +@@ -40,15 +40,19 @@ + + #include + #include +-#include + +-#define GNOME_DESKTOP_USE_UNSTABLE_API +-#include ++#include ++#include ++#include ++#include ++#include ++#include + + #include "gnome-settings-profile.h" + #include "gsd-keyboard-manager.h" + #include "gsd-input-helper.h" + #include "gsd-enums.h" ++#include "delayed-dialog.h" + + #define GSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerPrivate)) + +@@ -66,26 +70,31 @@ + #define KEY_BELL_DURATION "bell-duration" + #define KEY_BELL_MODE "bell-mode" + +-#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +- +-#define KEY_CURRENT_INPUT_SOURCE "current" +-#define KEY_INPUT_SOURCES "sources" +- +-#define INPUT_SOURCE_TYPE_XKB "xkb" +- + #define DEFAULT_LANGUAGE "en_US" + + struct GsdKeyboardManagerPrivate + { + guint start_idle_id; + GSettings *settings; +- GSettings *input_sources_settings; +- GnomeXkbInfo *xkb_info; + gint xkb_event_base; + GsdNumLockState old_state; + GdkDeviceManager *device_manager; + guint device_added_id; + guint device_removed_id; ++ ++ /* XKB */ ++ XklEngine *xkl_engine; ++ XklConfigRegistry *xkl_registry; ++ ++ GkbdDesktopConfig current_config; ++ GkbdKeyboardConfig current_kbd_config; ++ ++ GkbdKeyboardConfig initial_sys_kbd_config; ++ GSettings *settings_desktop; ++ GSettings *settings_keyboard; ++ ++ GtkStatusIcon *icon; ++ GtkMenu *popup_menu; + }; + + static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass); +@@ -96,6 +105,367 @@ + + static gpointer manager_object = NULL; + ++static gboolean try_activating_xkb_config_if_new (GsdKeyboardManager *manager, ++ GkbdKeyboardConfig *current_sys_kbd_config); ++static gboolean filter_xkb_config (GsdKeyboardManager *manager); ++static void show_hide_icon (GsdKeyboardManager *manager); ++ ++static void ++activation_error (void) ++{ ++ char const *vendor; ++ GtkWidget *dialog; ++ ++ vendor = ++ ServerVendor (GDK_DISPLAY_XDISPLAY ++ (gdk_display_get_default ())); ++ ++ /* VNC viewers will not work, do not barrage them with warnings */ ++ if (NULL != vendor && NULL != strstr (vendor, "VNC")) ++ return; ++ ++ dialog = gtk_message_dialog_new_with_markup (NULL, ++ 0, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_CLOSE, ++ _ ++ ("Error activating XKB configuration.\n" ++ "There can be various reasons for that.\n\n" ++ "If you report this situation as a bug, include the results of\n" ++ " • %s\n" ++ " • %s\n" ++ " • %s\n" ++ " • %s"), ++ "xprop -root | grep XKB", ++ "gsettings get org.gnome.libgnomekbd.keyboard model", ++ "gsettings get org.gnome.libgnomekbd.keyboard layouts", ++ "gsettings get org.gnome.libgnomekbd.keyboard options"); ++ g_signal_connect (dialog, "response", ++ G_CALLBACK (gtk_widget_destroy), NULL); ++ gsd_delayed_show_dialog (dialog); ++} ++ ++static gboolean ++ensure_manager_xkl_registry (GsdKeyboardManager *manager) ++{ ++ if (!manager->priv->xkl_registry) { ++ manager->priv->xkl_registry = ++ xkl_config_registry_get_instance (manager->priv->xkl_engine); ++ /* load all materials, unconditionally! */ ++ if (!xkl_config_registry_load (manager->priv->xkl_registry, TRUE)) { ++ g_object_unref (manager->priv->xkl_registry); ++ manager->priv->xkl_registry = NULL; ++ return FALSE; ++ } ++ } ++ ++ return TRUE; ++} ++ ++static void ++apply_desktop_settings (GsdKeyboardManager *manager) ++{ ++ if (manager->priv->xkl_engine == NULL) ++ return; ++ ++ gsd_keyboard_manager_apply_settings (manager); ++ gkbd_desktop_config_load (&manager->priv->current_config); ++ /* again, probably it would be nice to compare things ++ before activating them */ ++ gkbd_desktop_config_activate (&manager->priv->current_config); ++} ++ ++static void ++apply_xkb_settings (GsdKeyboardManager *manager) ++{ ++ GkbdKeyboardConfig current_sys_kbd_config; ++ ++ if (manager->priv->xkl_engine == NULL) ++ return; ++ ++ gkbd_keyboard_config_init (¤t_sys_kbd_config, manager->priv->xkl_engine); ++ ++ gkbd_keyboard_config_load (&manager->priv->current_kbd_config, ++ &manager->priv->initial_sys_kbd_config); ++ ++ gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config, ++ NULL); ++ ++ if (!try_activating_xkb_config_if_new (manager, ¤t_sys_kbd_config)) { ++ if (filter_xkb_config (manager)) { ++ if (!try_activating_xkb_config_if_new ++ (manager, ¤t_sys_kbd_config)) { ++ g_warning ++ ("Could not activate the filtered XKB configuration"); ++ activation_error (); ++ } ++ } else { ++ g_warning ++ ("Could not activate the XKB configuration"); ++ activation_error (); ++ } ++ } else ++ g_debug ( ++ "Actual KBD configuration was not changed: redundant notification\n"); ++ ++ gkbd_keyboard_config_term (¤t_sys_kbd_config); ++ show_hide_icon (manager); ++} ++ ++static void ++desktop_settings_changed (GSettings *settings, ++ gchar *key, ++ GsdKeyboardManager *manager) ++{ ++ apply_desktop_settings (manager); ++} ++ ++static void ++xkb_settings_changed (GSettings *settings, ++ gchar *key, ++ GsdKeyboardManager *manager) ++{ ++ apply_xkb_settings (manager); ++} ++ ++static void ++popup_menu_launch_capplet (void) ++{ ++ GAppInfo *info; ++ GdkAppLaunchContext *ctx; ++ GError *error = NULL; ++ ++ info = g_app_info_create_from_commandline ("gnome-control-center region", NULL, 0, NULL); ++ if (info == NULL) ++ return; ++ ++ ctx = gdk_display_get_app_launch_context (gdk_display_get_default ()); ++ ++ if (g_app_info_launch (info, NULL, ++ G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) { ++ g_warning ("Could not execute keyboard properties capplet: [%s]\n", ++ error->message); ++ g_error_free (error); ++ } ++ ++ g_object_unref (info); ++ g_object_unref (ctx); ++} ++ ++static void ++popup_menu_show_layout (GtkMenuItem *menuitem, ++ GsdKeyboardManager *manager) ++{ ++ XklState *xkl_state; ++ char *command; ++ ++ xkl_state = xkl_engine_get_current_state (manager->priv->xkl_engine); ++ if (xkl_state->group < 0) ++ return; ++ ++ command = g_strdup_printf ("gkbd-keyboard-display -g %d", xkl_state->group + 1); ++ g_spawn_command_line_async (command, NULL); ++ g_free (command); ++} ++ ++static void ++popup_menu_set_group (GtkMenuItem * item, gpointer param) ++{ ++ gint group_number = GPOINTER_TO_INT (param); ++ XklEngine *engine = gkbd_status_get_xkl_engine (); ++ XklState st; ++ Window cur; ++ ++ st.group = group_number; ++ xkl_engine_allow_one_switch_to_secondary_group (engine); ++ cur = xkl_engine_get_current_window (engine); ++ if (cur != (Window) NULL) { ++ g_debug ("Enforcing the state %d for window %lx\n", ++ st.group, cur); ++ xkl_engine_save_state (engine, ++ xkl_engine_get_current_window ++ (engine), &st); ++/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ ++ } else { ++ g_debug ( ++ "??? Enforcing the state %d for unknown window\n", ++ st.group); ++ /* strange situation - bad things can happen */ ++ } ++ xkl_engine_lock_group (engine, st.group); ++} ++ ++static void ++ensure_popup_menu (GsdKeyboardManager *manager) ++{ ++ GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ()); ++ GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ()); ++ int i = 0; ++ gchar **current_name = gkbd_status_get_group_names (); ++ ++ GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Layouts")); ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), ++ GTK_WIDGET (groups_menu)); ++ ++ item = gtk_menu_item_new_with_mnemonic (_("Show _Keyboard Layout...")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", G_CALLBACK (popup_menu_show_layout), manager); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ ++ /* translators note: ++ * This is the name of the gnome-control-center "region" panel */ ++ item = gtk_menu_item_new_with_mnemonic (_("Region and Language Settings")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ ++ for (i = 0; *current_name; i++, current_name++) { ++ item = gtk_menu_item_new_with_label (*current_name); ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item); ++ g_signal_connect (item, "activate", ++ G_CALLBACK (popup_menu_set_group), ++ GINT_TO_POINTER (i)); ++ } ++ ++ if (manager->priv->popup_menu != NULL) ++ gtk_widget_destroy (GTK_WIDGET (manager->priv->popup_menu)); ++ manager->priv->popup_menu = popup_menu; ++} ++ ++static void ++status_icon_popup_menu_cb (GtkStatusIcon *icon, ++ guint button, ++ guint time, ++ GsdKeyboardManager *manager) ++{ ++ ensure_popup_menu (manager); ++ gtk_menu_popup (manager->priv->popup_menu, NULL, NULL, ++ gtk_status_icon_position_menu, ++ (gpointer) icon, button, time); ++} ++ ++static void ++show_hide_icon (GsdKeyboardManager *manager) ++{ ++ if (g_strv_length (manager->priv->current_kbd_config.layouts_variants) > 1) { ++ if (manager->priv->icon == NULL) { ++ g_debug ("Creating keyboard status icon\n"); ++ manager->priv->icon = gkbd_status_new (); ++ g_signal_connect (manager->priv->icon, "popup-menu", ++ G_CALLBACK ++ (status_icon_popup_menu_cb), ++ manager); ++ ++ } ++ } else { ++ if (manager->priv->icon != NULL) { ++ g_debug ("Destroying icon\n"); ++ g_object_unref (manager->priv->icon); ++ manager->priv->icon = NULL; ++ } ++ } ++} ++ ++static gboolean ++try_activating_xkb_config_if_new (GsdKeyboardManager *manager, ++ GkbdKeyboardConfig *current_sys_kbd_config) ++{ ++ /* Activate - only if different! */ ++ if (!gkbd_keyboard_config_equals ++ (&manager->priv->current_kbd_config, current_sys_kbd_config)) { ++ if (gkbd_keyboard_config_activate (&manager->priv->current_kbd_config)) { ++ return FALSE; ++ } ++ } ++ return TRUE; ++} ++ ++static gboolean ++filter_xkb_config (GsdKeyboardManager *manager) ++{ ++ XklConfigItem *item; ++ gchar *lname; ++ gchar *vname; ++ gchar **lv; ++ gboolean any_change = FALSE; ++ ++ g_debug ("Filtering configuration against the registry\n"); ++ if (!ensure_manager_xkl_registry (manager)) ++ return FALSE; ++ ++ lv = manager->priv->current_kbd_config.layouts_variants; ++ item = xkl_config_item_new (); ++ while (*lv) { ++ g_debug ("Checking [%s]\n", *lv); ++ if (gkbd_keyboard_config_split_items (*lv, &lname, &vname)) { ++ gboolean should_be_dropped = FALSE; ++ g_snprintf (item->name, sizeof (item->name), "%s", ++ lname); ++ if (!xkl_config_registry_find_layout ++ (manager->priv->xkl_registry, item)) { ++ g_debug ("Bad layout [%s]\n", ++ lname); ++ should_be_dropped = TRUE; ++ } else if (vname) { ++ g_snprintf (item->name, ++ sizeof (item->name), "%s", ++ vname); ++ if (!xkl_config_registry_find_variant ++ (manager->priv->xkl_registry, lname, item)) { ++ g_debug ( ++ "Bad variant [%s(%s)]\n", ++ lname, vname); ++ should_be_dropped = TRUE; ++ } ++ } ++ if (should_be_dropped) { ++ gkbd_strv_behead (lv); ++ any_change = TRUE; ++ continue; ++ } ++ } ++ lv++; ++ } ++ g_object_unref (item); ++ return any_change; ++} ++ ++static void ++gsd_keyboard_xkb_init (GsdKeyboardManager *manager) ++{ ++ Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); ++ ++ manager->priv->xkl_engine = xkl_engine_get_instance (dpy); ++ if (!manager->priv->xkl_engine) ++ return; ++ ++ gkbd_desktop_config_init (&manager->priv->current_config, manager->priv->xkl_engine); ++ gkbd_keyboard_config_init (&manager->priv->current_kbd_config, ++ manager->priv->xkl_engine); ++ xkl_engine_backup_names_prop (manager->priv->xkl_engine); ++ gkbd_keyboard_config_init (&manager->priv->initial_sys_kbd_config, manager->priv->xkl_engine); ++ gkbd_keyboard_config_load_from_x_initial (&manager->priv->initial_sys_kbd_config, ++ NULL); ++ ++ gnome_settings_profile_start ("xkl_engine_start_listen"); ++ xkl_engine_start_listen (manager->priv->xkl_engine, ++ XKLL_MANAGE_LAYOUTS | ++ XKLL_MANAGE_WINDOW_STATES); ++ gnome_settings_profile_end ("xkl_engine_start_listen"); ++ ++ gnome_settings_profile_start ("apply_desktop_settings"); ++ apply_desktop_settings (manager); ++ gnome_settings_profile_end ("apply_desktop_settings"); ++ gnome_settings_profile_start ("apply_xkb_settings"); ++ apply_xkb_settings (manager); ++ gnome_settings_profile_end ("apply_xkb_settings"); ++ ++ gnome_settings_profile_end (NULL); ++} ++ + static gboolean + xkb_set_keyboard_autorepeat_rate (guint delay, guint interval) + { +@@ -118,11 +488,12 @@ + &error_base, + &major, + &minor); ++ + return have_xkb; + } + + static void +-xkb_init (GsdKeyboardManager *manager) ++numlock_xkb_init (GsdKeyboardManager *manager) + { + Display *dpy; + +@@ -161,8 +532,15 @@ + XkbEvent *xkbev = (XkbEvent *) xev; + GsdKeyboardManager *manager = (GsdKeyboardManager *) user_data; + +- if (xev->type != manager->priv->xkb_event_base || +- xkbev->any.xkb_type != XkbStateNotify) ++ /* libxklavier's events first */ ++ if (manager->priv->xkl_engine != NULL) ++ xkl_engine_filter_events (manager->priv->xkl_engine, xev); ++ ++ /* Then XKB specific events */ ++ if (xev->type != manager->priv->xkb_event_base) ++ return GDK_FILTER_CONTINUE; ++ ++ if (xkbev->any.xkb_type != XkbStateNotify) + return GDK_FILTER_CONTINUE; + + if (xkbev->state.changed & XkbModifierLockMask) { +@@ -200,262 +578,6 @@ + } + + static void +-free_xkb_component_names (XkbComponentNamesRec *p) +-{ +- g_return_if_fail (p != NULL); +- +- free (p->keymap); +- free (p->keycodes); +- free (p->types); +- free (p->compat); +- free (p->symbols); +- free (p->geometry); +- +- g_free (p); +-} +- +-static void +-upload_xkb_description (const gchar *rules_file_path, +- XkbRF_VarDefsRec *var_defs, +- XkbComponentNamesRec *comp_names) +-{ +- Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); +- XkbDescRec *xkb_desc; +- gchar *rules_file; +- +- /* Upload it to the X server using the same method as setxkbmap */ +- xkb_desc = XkbGetKeyboardByName (display, +- XkbUseCoreKbd, +- comp_names, +- XkbGBN_AllComponentsMask, +- XkbGBN_AllComponentsMask & +- (~XkbGBN_GeometryMask), True); +- if (!xkb_desc) { +- g_warning ("Couldn't upload new XKB keyboard description"); +- return; +- } +- +- XkbFreeKeyboard (xkb_desc, 0, True); +- +- rules_file = g_path_get_basename (rules_file_path); +- +- if (!XkbRF_SetNamesProp (display, rules_file, var_defs)) +- g_warning ("Couldn't update the XKB root window property"); +- +- g_free (rules_file); +-} +- +-static gchar * +-language_code_from_locale (const gchar *locale) +-{ +- if (!locale || !locale[0] || !locale[1]) +- return NULL; +- +- if (!locale[2] || locale[2] == '_' || locale[2] == '.') +- return g_strndup (locale, 2); +- +- if (!locale[3] || locale[3] == '_' || locale[3] == '.') +- return g_strndup (locale, 3); +- +- return NULL; +-} +- +-static gchar * +-build_xkb_group_string (const gchar *user, +- const gchar *locale, +- const gchar *latin) +-{ +- gchar *string; +- gsize length = 0; +- guint commas = 2; +- +- if (latin) +- length += strlen (latin); +- else +- commas -= 1; +- +- if (locale) +- length += strlen (locale); +- else +- commas -= 1; +- +- length += strlen (user) + commas + 1; +- +- string = malloc (length); +- +- if (locale && latin) +- sprintf (string, "%s,%s,%s", user, locale, latin); +- else if (locale) +- sprintf (string, "%s,%s", user, locale); +- else if (latin) +- sprintf (string, "%s,%s", user, latin); +- else +- sprintf (string, "%s", user); +- +- return string; +-} +- +-static gboolean +-layout_equal (const gchar *layout_a, +- const gchar *variant_a, +- const gchar *layout_b, +- const gchar *variant_b) +-{ +- return !g_strcmp0 (layout_a, layout_b) && !g_strcmp0 (variant_a, variant_b); +-} +- +-static void +-replace_layout_and_variant (GsdKeyboardManager *manager, +- XkbRF_VarDefsRec *xkb_var_defs, +- const gchar *layout, +- const gchar *variant) +-{ +- /* Toolkits need to know about both a latin layout to handle +- * accelerators which are usually defined like Ctrl+C and a +- * layout with the symbols for the language used in UI strings +- * to handle mnemonics like Alt+Ф, so we try to find and add +- * them in XKB group slots after the layout which the user +- * actually intends to type with. */ +- const gchar *latin_layout = "us"; +- const gchar *latin_variant = ""; +- const gchar *locale_layout = NULL; +- const gchar *locale_variant = NULL; +- const gchar *locale; +- gchar *language; +- +- locale = setlocale (LC_MESSAGES, NULL); +- /* If LANG is empty, default to en_US */ +- if (!locale) +- language = g_strdup (DEFAULT_LANGUAGE); +- else +- language = language_code_from_locale (locale); +- +- if (!language) +- language = language_code_from_locale (DEFAULT_LANGUAGE); +- +- gnome_xkb_info_get_layout_info_for_language (manager->priv->xkb_info, +- language, +- NULL, +- NULL, +- NULL, +- &locale_layout, +- &locale_variant); +- g_free (language); +- +- /* We want to minimize the number of XKB groups if we have +- * duplicated layout+variant pairs. +- * +- * Also, if a layout doesn't have a variant we still have to +- * include it in the variants string because the number of +- * variants must agree with the number of layouts. For +- * instance: +- * +- * layouts: "us,ru,us" +- * variants: "dvorak,," +- */ +- if (layout_equal (latin_layout, latin_variant, locale_layout, locale_variant) || +- layout_equal (latin_layout, latin_variant, layout, variant)) { +- latin_layout = NULL; +- latin_variant = NULL; +- } +- +- if (layout_equal (locale_layout, locale_variant, layout, variant)) { +- locale_layout = NULL; +- locale_variant = NULL; +- } +- +- free (xkb_var_defs->layout); +- xkb_var_defs->layout = build_xkb_group_string (layout, locale_layout, latin_layout); +- +- free (xkb_var_defs->variant); +- xkb_var_defs->variant = build_xkb_group_string (variant, locale_variant, latin_variant); +-} +- +-static void +-apply_xkb_layout (GsdKeyboardManager *manager, +- const gchar *layout, +- const gchar *variant) +-{ +- XkbRF_RulesRec *xkb_rules; +- XkbRF_VarDefsRec *xkb_var_defs; +- gchar *rules_file_path; +- +- gnome_xkb_info_get_var_defs (&rules_file_path, &xkb_var_defs); +- +- replace_layout_and_variant (manager, xkb_var_defs, layout, variant); +- +- gdk_error_trap_push (); +- +- xkb_rules = XkbRF_Load (rules_file_path, NULL, True, True); +- if (xkb_rules) { +- XkbComponentNamesRec *xkb_comp_names; +- xkb_comp_names = g_new0 (XkbComponentNamesRec, 1); +- +- XkbRF_GetComponents (xkb_rules, xkb_var_defs, xkb_comp_names); +- upload_xkb_description (rules_file_path, xkb_var_defs, xkb_comp_names); +- +- free_xkb_component_names (xkb_comp_names); +- XkbRF_Free (xkb_rules, True); +- } else { +- g_warning ("Couldn't load XKB rules"); +- } +- +- if (gdk_error_trap_pop ()) +- g_warning ("Error loading XKB rules"); +- +- gnome_xkb_info_free_var_defs (xkb_var_defs); +- g_free (rules_file_path); +-} +- +-static void +-apply_input_sources_settings (GSettings *settings, +- gchar *key, +- GsdKeyboardManager *manager) +-{ +- GsdKeyboardManagerPrivate *priv = manager->priv; +- GVariant *sources; +- guint current; +- const gchar *type = NULL; +- const gchar *id = NULL; +- const gchar *layout = NULL; +- const gchar *variant = NULL; +- +- sources = g_settings_get_value (priv->input_sources_settings, KEY_INPUT_SOURCES); +- current = g_settings_get_uint (priv->input_sources_settings, KEY_CURRENT_INPUT_SOURCE); +- +- if (g_variant_n_children (sources) < 1) { +- g_warning ("No input source configured, resetting"); +- g_settings_reset (priv->input_sources_settings, KEY_INPUT_SOURCES); +- goto exit; +- } +- if (current >= g_variant_n_children (sources)) { +- g_settings_set_uint (priv->input_sources_settings, +- KEY_CURRENT_INPUT_SOURCE, +- g_variant_n_children (sources) - 1); +- goto exit; +- } +- +- g_variant_get_child (sources, current, "(&s&s)", &type, &id); +- +- if (!g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) { +- g_warning ("Unknown input source type '%s'", type); +- goto exit; +- } +- +- gnome_xkb_info_get_layout_info (priv->xkb_info, id, NULL, NULL, &layout, &variant); +- +- if (!layout || !layout[0]) { +- g_warning ("Couldn't find XKB input source '%s'", id); +- goto exit; +- } +- +- apply_xkb_layout (manager, layout, variant); +- +- exit: +- g_variant_unref (sources); +-} +- +-static void + apply_settings (GSettings *settings, + const char *key, + GsdKeyboardManager *manager) +@@ -523,6 +645,12 @@ + gdk_error_trap_pop_ignored (); + } + ++void ++gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager) ++{ ++ apply_settings (manager->priv->settings, NULL, manager); ++} ++ + static void + device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, +@@ -532,8 +660,8 @@ + + source = gdk_device_get_source (device); + if (source == GDK_SOURCE_KEYBOARD) { +- apply_settings (manager->priv->settings, NULL, manager); +- apply_input_sources_settings (manager->priv->input_sources_settings, NULL, manager); ++ apply_desktop_settings (manager); ++ apply_xkb_settings (manager); + run_custom_command (device, COMMAND_DEVICE_ADDED); + } + } +@@ -573,23 +701,23 @@ + g_debug ("Starting keyboard manager"); + + manager->priv->settings = g_settings_new (GSD_KEYBOARD_DIR); ++ manager->priv->settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); ++ manager->priv->settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); + +- xkb_init (manager); ++ gsd_keyboard_xkb_init (manager); ++ numlock_xkb_init (manager); + + set_devicepresence_handler (manager); + +- manager->priv->input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); +- +- manager->priv->xkb_info = gnome_xkb_info_new (); +- + /* apply current settings before we install the callback */ +- apply_settings (manager->priv->settings, NULL, manager); +- apply_input_sources_settings (manager->priv->input_sources_settings, NULL, manager); ++ gsd_keyboard_manager_apply_settings (manager); + + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (apply_settings), manager); +- g_signal_connect (G_OBJECT (manager->priv->input_sources_settings), "changed", +- G_CALLBACK (apply_input_sources_settings), manager); ++ g_signal_connect (manager->priv->settings_desktop, "changed", ++ (GCallback) desktop_settings_changed, manager); ++ g_signal_connect (manager->priv->settings_keyboard, "changed", ++ (GCallback) xkb_settings_changed, manager); + + install_xkb_filter (manager); + +@@ -625,9 +753,18 @@ + + g_debug ("Stopping keyboard manager"); + +- g_clear_object (&p->settings); +- g_clear_object (&p->input_sources_settings); +- g_clear_object (&p->xkb_info); ++ if (p->settings != NULL) { ++ g_object_unref (p->settings); ++ p->settings = NULL; ++ } ++ if (p->settings_desktop != NULL) { ++ g_object_unref (p->settings_desktop); ++ p->settings_desktop = NULL; ++ } ++ if (p->settings_keyboard != NULL) { ++ g_object_unref (p->settings_keyboard); ++ p->settings_keyboard = NULL; ++ } + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); +@@ -635,7 +772,24 @@ + p->device_manager = NULL; + } + ++ if (p->popup_menu != NULL) { ++ gtk_widget_destroy (GTK_WIDGET (p->popup_menu)); ++ p->popup_menu = NULL; ++ } ++ + remove_xkb_filter (manager); ++ ++ if (p->xkl_registry != NULL) { ++ g_object_unref (p->xkl_registry); ++ p->xkl_registry = NULL; ++ } ++ ++ if (p->xkl_engine != NULL) { ++ xkl_engine_stop_listen (p->xkl_engine, ++ XKLL_MANAGE_LAYOUTS | XKLL_MANAGE_WINDOW_STATES); ++ g_object_unref (p->xkl_engine); ++ p->xkl_engine = NULL; ++ } + } + + static void +Index: b/plugins/keyboard/gsd-keyboard-manager.h +=================================================================== +--- a/plugins/keyboard/gsd-keyboard-manager.h ++++ b/plugins/keyboard/gsd-keyboard-manager.h +@@ -51,6 +51,7 @@ + gboolean gsd_keyboard_manager_start (GsdKeyboardManager *manager, + GError **error); + void gsd_keyboard_manager_stop (GsdKeyboardManager *manager); ++void gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager); + + G_END_DECLS + +Index: b/plugins/keyboard/Makefile.am +=================================================================== +--- a/plugins/keyboard/Makefile.am ++++ b/plugins/keyboard/Makefile.am +@@ -20,6 +20,8 @@ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ ++ delayed-dialog.h \ ++ delayed-dialog.c \ + $(NULL) + + libkeyboard_la_CPPFLAGS = \ +@@ -52,8 +54,8 @@ + test-keyboard.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ +- $(NULL) +- ++ delayed-dialog.h \ ++ delayed-dialog.c + test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS) + test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) + test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la diff --git a/debian/patches/61_unity_use_application_indicator.patch b/debian/patches/61_unity_use_application_indicator.patch new file mode 100644 index 00000000..f06967d6 --- /dev/null +++ b/debian/patches/61_unity_use_application_indicator.patch @@ -0,0 +1,231 @@ +Index: gnome-settings-daemon-3.6.3/configure.ac +=================================================================== +--- gnome-settings-daemon-3.6.3.orig/configure.ac 2012-11-19 19:54:25.827630032 +0100 ++++ gnome-settings-daemon-3.6.3/configure.ac 2012-11-19 19:54:35.111630482 +0100 +@@ -53,6 +53,7 @@ + PA_REQUIRED_VERSION=0.9.16 + LIBWACOM_REQUIRED_VERSION=0.6 + UPOWER_REQUIRED_VERSION=0.9.11 ++APPINDICATOR_REQUIRED_VERSION=0.3.0 + IBUS_REQUIRED_VERSION=1.4.99 + + EXTRA_COMPILE_WARNINGS(yes) +@@ -149,6 +150,32 @@ + + PKG_CHECK_MODULES(AUTOMOUNT, x11 kbproto) + ++dnl --------------------------------- ++dnl - Application indicator ++dnl --------------------------------- ++ ++AC_ARG_ENABLE([appindicator], ++ AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support for application indicators]), ++ [enable_appindicator=$enableval], ++ [enable_appindicator="auto"]) ++ ++ ++if test x$enable_appindicator = xauto ; then ++ PKG_CHECK_EXISTS(appindicator3-0.1 >= $APPINDICATOR_REQUIRED_VERSION, ++ [enable_appindicator="yes"], ++ [enable_appindicator="no"]) ++fi ++ ++if test x$enable_appindicator = xyes ; then ++ PKG_CHECK_MODULES(APPINDICATOR, ++ [appindicator3-0.1 >= $APPINDICATOR_REQUIRED_VERSION], ++ [AC_DEFINE(HAVE_APPINDICATOR, 1, [Have AppIndicator])]) ++fi ++ ++AM_CONDITIONAL(HAVE_APPINDICATOR, test x$enable_appindicator = xyes) ++AC_SUBST(APPINDICATOR_CFLAGS) ++AC_SUBST(APPINDICATOR_LIBS) ++ + dnl --------------------------------------------------------------------------- + dnl - background + dnl --------------------------------------------------------------------------- +@@ -569,6 +596,7 @@ + LCMS DICT support: ${have_new_lcms} + IBus support: ${enable_ibus} + Libnotify support: ${have_libnotify} ++ App indicator support: ${enable_appindicator} + PackageKit support: ${have_packagekit} + Smartcard support: ${have_smartcard_support} + Cups support: ${enable_cups} +Index: gnome-settings-daemon-3.6.3/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.3.orig/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c 2012-11-14 13:19:27.000000000 +0100 ++++ gnome-settings-daemon-3.6.3/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c 2012-11-19 19:54:25.991630041 +0100 +@@ -41,6 +41,10 @@ + #include + #include + ++#ifdef HAVE_APPINDICATOR ++#include ++#endif ++ + #include "gnome-settings-profile.h" + #include "gsd-a11y-keyboard-manager.h" + #include "gsd-a11y-preferences-dialog.h" +@@ -61,7 +65,11 @@ + GtkWidget *stickykeys_alert; + GtkWidget *slowkeys_alert; + GtkWidget *preferences_dialog; ++#ifdef HAVE_APPINDICATOR ++ AppIndicator *app_indicator; ++#else + GtkStatusIcon *status_icon; ++#endif + + GSettings *settings; + +@@ -427,11 +435,24 @@ + /* for now, show if accessx is enabled */ + show = g_settings_get_boolean (manager->priv->settings, "enable"); + ++#ifdef HAVE_APPINDICATOR ++ if (!show && manager->priv->app_indicator == NULL) ++ return; ++ ++ gsd_a11y_keyboard_manager_ensure_status_icon (manager); ++ if (show) ++ app_indicator_set_status (manager->priv->app_indicator, ++ APP_INDICATOR_STATUS_ACTIVE); ++ else ++ app_indicator_set_status (manager->priv->app_indicator, ++ APP_INDICATOR_STATUS_PASSIVE); ++#else + if (!show && manager->priv->status_icon == NULL) + return; + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, show); ++#endif + } + + static void +@@ -509,9 +530,11 @@ + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + ++#ifndef HAVE_APPINDICATOR + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } ++#endif + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); +@@ -644,9 +667,11 @@ + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + ++#ifndef HAVE_APPINDICATOR + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } ++#endif + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); +@@ -1000,10 +1025,16 @@ + p->device_manager = NULL; + } + ++#ifdef HAVE_APPINDICATOR ++ if (p->app_indicator) ++ app_indicator_set_status (p->app_indicator, ++ APP_INDICATOR_STATUS_PASSIVE); ++#else + if (p->status_icon) { + gtk_status_icon_set_visible (p->status_icon, FALSE); + p->status_icon = NULL; + } ++#endif + + if (p->settings != NULL) { + g_signal_handlers_disconnect_by_func (p->settings, keyboard_callback, manager); +@@ -1068,8 +1099,13 @@ + } + + static void ++#ifdef HAVE_APPINDICATOR ++on_status_icon_activate (GtkMenuItem *item, ++ GsdA11yKeyboardManager *manager) ++#else + on_status_icon_activate (GtkStatusIcon *status_icon, + GsdA11yKeyboardManager *manager) ++#endif + { + if (manager->priv->preferences_dialog == NULL) { + manager->priv->preferences_dialog = gsd_a11y_preferences_dialog_new (); +@@ -1102,6 +1138,26 @@ + { + gnome_settings_profile_start (NULL); + ++#ifdef HAVE_APPINDICATOR ++ if (!manager->priv->app_indicator) { ++ GtkWidget *menu = gtk_menu_new (); ++ GtkWidget *item = gtk_menu_item_new_with_label (_("Universal Access Preferences")); ++ ++ g_signal_connect (item, ++ "activate", ++ G_CALLBACK (on_status_icon_activate), ++ manager); ++ ++ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); ++ gtk_widget_show_all (menu); ++ ++ manager->priv->app_indicator = app_indicator_new ("a11y-keyboard", ++ "preferences-desktop-accessibility", ++ APP_INDICATOR_CATEGORY_OTHER); ++ app_indicator_set_menu (manager->priv->app_indicator, ++ GTK_MENU (menu)); ++ } ++#else + if (!manager->priv->status_icon) { + + manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility"); +@@ -1115,6 +1171,7 @@ + G_CALLBACK (on_status_icon_popup_menu), + manager); + } ++#endif + + gnome_settings_profile_end (NULL); + } +Index: gnome-settings-daemon-3.6.3/plugins/a11y-keyboard/Makefile.am +=================================================================== +--- gnome-settings-daemon-3.6.3.orig/plugins/a11y-keyboard/Makefile.am 2012-11-14 13:19:27.000000000 +0100 ++++ gnome-settings-daemon-3.6.3/plugins/a11y-keyboard/Makefile.am 2012-11-19 19:54:26.275630058 +0100 +@@ -25,6 +25,7 @@ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + $(PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ ++ $(APPINDICATOR_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +@@ -32,6 +33,7 @@ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(LIBNOTIFY_LIBS) \ ++ $(APPINDICATOR_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + + test_a11y_preferences_dialog_SOURCES = \ +@@ -79,6 +79,7 @@ + liba11y_keyboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ ++ $(APPINDICATOR_CFLAGS) \ + $(AM_CFLAGS) + + liba11y_keyboard_la_LDFLAGS = \ +@@ -89,6 +90,7 @@ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(LIBNOTIFY_LIBS) \ ++ $(APPINDICATOR_LIBS) \ + $(NULL) + + plugin_in_files = \ diff --git a/debian/patches/62_unity_disable_gsd_printer.patch b/debian/patches/62_unity_disable_gsd_printer.patch new file mode 100644 index 00000000..1451c4db --- /dev/null +++ b/debian/patches/62_unity_disable_gsd_printer.patch @@ -0,0 +1,57 @@ +Description: Disable gsd-printer plugin under Unity. We are still using system-config-printer for this, so no need to start another service for this. +Author: Martin Pitt +Forwarded: No, Ubuntu specific + +Index: gnome-settings-daemon-3.6.1/plugins/print-notifications/gsd-print-notifications-plugin.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/print-notifications/gsd-print-notifications-plugin.c 2012-10-05 13:56:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/print-notifications/gsd-print-notifications-plugin.c 2012-10-26 10:19:49.611004182 +0200 +@@ -38,6 +38,12 @@ + static void + gsd_print_notifications_plugin_init (GsdPrintNotificationsPlugin *plugin) + { ++ if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) { ++ plugin->priv = NULL; ++ g_debug ("GsdPrintNotificationsPlugin: Disabling for Unity, using system-config-printer"); ++ return; ++ } ++ + plugin->priv = GSD_PRINT_NOTIFICATIONS_PLUGIN_GET_PRIVATE (plugin); + + plugin->priv->manager = gsd_print_notifications_manager_new (); +@@ -55,6 +61,11 @@ + + plugin = GSD_PRINT_NOTIFICATIONS_PLUGIN (object); + ++ if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) { ++ G_OBJECT_CLASS (gsd_print_notifications_plugin_parent_class)->finalize (object); ++ return; ++ } ++ + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { +@@ -70,6 +81,11 @@ + gboolean res; + GError *error; + ++ if (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv == NULL) { ++ g_debug ("Not activating disabled print-notifications plugin"); ++ return; ++ } ++ + g_debug ("Activating print-notifications plugin"); + + error = NULL; +@@ -83,6 +99,11 @@ + static void + impl_deactivate (GnomeSettingsPlugin *plugin) + { ++ if (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv == NULL) { ++ g_debug ("Not deactivating disabled print-notifications plugin"); ++ return; ++ } ++ + g_debug ("Deactivating print_notifications plugin"); + gsd_print_notifications_manager_stop (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv->manager); + } diff --git a/debian/patches/63_unity_start_mounter.patch b/debian/patches/63_unity_start_mounter.patch new file mode 100644 index 00000000..a5587e87 --- /dev/null +++ b/debian/patches/63_unity_start_mounter.patch @@ -0,0 +1,15 @@ +Description: Show in Unity too +Author: Michael Terry +Bug: https://bugzilla.gnome.org/show_bug.cgi?id=654919 +Bug-Ubuntu: https://launchpad.net/bugs/803519 + +Index: gnome-settings-daemon-3.6.1/plugins/automount/gnome-fallback-mount-helper.desktop.in.in +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/automount/gnome-fallback-mount-helper.desktop.in.in 2012-05-24 11:50:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/automount/gnome-fallback-mount-helper.desktop.in.in 2012-10-26 10:19:49.627004182 +0200 +@@ -9,4 +9,4 @@ + NoDisplay=true + OnlyShowIn=GNOME;Unity; + X-GNOME-Autostart-Notify=true +-AutostartCondition=GNOME3 if-session gnome-fallback ++AutostartCondition=GNOME3 unless-session gnome diff --git a/debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch b/debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch new file mode 100644 index 00000000..e9d2a381 --- /dev/null +++ b/debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch @@ -0,0 +1,73 @@ +Index: gnome-settings-daemon-3.6.1/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in 2012-10-05 13:56:43.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in 2012-10-26 10:19:49.647004183 +0200 +@@ -130,6 +130,11 @@ + <_summary>Copy a screenshot of an area to clipboard + <_description>Binding to copy a screenshot of an area to clipboard. + ++ ++ '<Primary><Alt>t' ++ <_summary>Launch terminal ++ <_description>Binding to launch the terminal. ++ + + 'XF86WWW' + <_summary>Launch web browser +Index: gnome-settings-daemon-3.6.1/plugins/media-keys/gsd-media-keys-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/media-keys/gsd-media-keys-manager.c 2012-10-26 10:19:49.507004176 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/media-keys/gsd-media-keys-manager.c 2012-10-26 10:20:04.815004917 +0200 +@@ -891,6 +891,22 @@ + } + + static void ++do_terminal_action (GsdMediaKeysManager *manager) ++{ ++ GSettings *settings; ++ char *term; ++ ++ settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); ++ term = g_settings_get_string (settings, "exec"); ++ ++ if (term) ++ execute (manager, term, FALSE); ++ ++ g_free (term); ++ g_object_unref (settings); ++} ++ ++static void + gnome_session_shutdown (GsdMediaKeysManager *manager) + { + GError *error = NULL; +@@ -2087,6 +2103,9 @@ + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; ++ case TERMINAL_KEY: ++ do_terminal_action (manager); ++ break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; +Index: gnome-settings-daemon-3.6.1/plugins/media-keys/shortcuts-list.h +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/media-keys/shortcuts-list.h 2012-10-05 13:56:44.000000000 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/media-keys/shortcuts-list.h 2012-10-26 10:19:49.651004184 +0200 +@@ -50,6 +50,7 @@ + SCREENSHOT_CLIP_KEY, + WINDOW_SCREENSHOT_CLIP_KEY, + AREA_SCREENSHOT_CLIP_KEY, ++ TERMINAL_KEY, + WWW_KEY, + PLAY_KEY, + PAUSE_KEY, +@@ -115,6 +116,7 @@ + { SCREENSHOT_CLIP_KEY, "screenshot-clip", NULL }, + { WINDOW_SCREENSHOT_CLIP_KEY, "window-screenshot-clip", NULL }, + { AREA_SCREENSHOT_CLIP_KEY, "area-screenshot-clip", NULL }, ++ { TERMINAL_KEY, "terminal", NULL }, + { WWW_KEY, "www", NULL }, + { PLAY_KEY, "play", NULL }, + { PAUSE_KEY, "pause", NULL }, diff --git a/debian/patches/90_set_gmenus_xsettings.patch b/debian/patches/90_set_gmenus_xsettings.patch new file mode 100644 index 00000000..3da7536d --- /dev/null +++ b/debian/patches/90_set_gmenus_xsettings.patch @@ -0,0 +1,134 @@ +Index: gnome-settings-daemon-3.6.3/plugins/xsettings/gsd-xsettings-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.3.orig/plugins/xsettings/gsd-xsettings-manager.c 2012-11-07 10:08:12.000000000 +0100 ++++ gnome-settings-daemon-3.6.3/plugins/xsettings/gsd-xsettings-manager.c 2012-11-20 13:26:46.306775857 +0100 +@@ -242,7 +242,9 @@ + GsdXSettingsGtk *gtk; + + guint shell_name_watch_id; ++ guint unity_name_watch_id; + gboolean have_shell; ++ gboolean have_unity; + + guint notify_idle_id; + }; +@@ -703,17 +705,18 @@ + } + + static void +-notify_have_shell (GnomeXSettingsManager *manager, +- gboolean have_shell) ++notify_have_shell (GnomeXSettingsManager *manager) + { + int i; + + gnome_settings_profile_start (NULL); +- if (manager->priv->have_shell == have_shell) +- return; +- manager->priv->have_shell = have_shell; + for (i = 0; manager->priv->managers [i]; i++) { +- xsettings_manager_set_int (manager->priv->managers [i], "Gtk/ShellShowsAppMenu", have_shell); ++ /* Shell is showing appmenu if either GNOME Shell or Unity is running. */ ++ xsettings_manager_set_int (manager->priv->managers [i], "Gtk/ShellShowsAppMenu", ++ manager->priv->have_shell || manager->priv->have_unity); ++ /* Shell is showing menubar *only* if Unity runs */ ++ xsettings_manager_set_int (manager->priv->managers [i], "Gtk/ShellShowsMenubar", ++ manager->priv->have_unity); + } + queue_notify (manager); + gnome_settings_profile_end (NULL); +@@ -725,7 +728,10 @@ + const gchar *name_owner, + gpointer user_data) + { +- notify_have_shell (user_data, TRUE); ++ GnomeXSettingsManager *manager = user_data; ++ ++ manager->priv->have_shell = TRUE; ++ notify_have_shell (manager); + } + + static void +@@ -733,7 +739,33 @@ + const gchar *name, + gpointer user_data) + { +- notify_have_shell (user_data, FALSE); ++ GnomeXSettingsManager *manager = user_data; ++ ++ manager->priv->have_shell = FALSE; ++ notify_have_shell (manager); ++} ++ ++static void ++on_unity_appeared (GDBusConnection *connection, ++ const gchar *name, ++ const gchar *name_owner, ++ gpointer user_data) ++{ ++ GnomeXSettingsManager *manager = user_data; ++ ++ manager->priv->have_unity = TRUE; ++ notify_have_shell (manager); ++} ++ ++static void ++on_unity_disappeared (GDBusConnection *connection, ++ const gchar *name, ++ gpointer user_data) ++{ ++ GnomeXSettingsManager *manager = user_data; ++ ++ manager->priv->have_unity = FALSE; ++ notify_have_shell (manager); + } + + static void +@@ -856,7 +888,7 @@ + static void + start_shell_monitor (GnomeXSettingsManager *manager) + { +- notify_have_shell (manager, TRUE); ++ notify_have_shell (manager); + manager->priv->have_shell = TRUE; + manager->priv->shell_name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + "org.gnome.Shell", +@@ -867,6 +899,20 @@ + NULL); + } + ++static void ++start_unity_monitor (GnomeXSettingsManager *manager) ++{ ++ notify_have_shell (manager); ++ manager->priv->have_unity = TRUE; ++ manager->priv->shell_name_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, ++ "com.canonical.AppMenu.Registrar", ++ 0, ++ on_unity_appeared, ++ on_unity_disappeared, ++ manager, ++ NULL); ++} ++ + gboolean + gnome_xsettings_manager_start (GnomeXSettingsManager *manager, + GError **error) +@@ -933,6 +979,7 @@ + start_fontconfig_monitor (manager); + + start_shell_monitor (manager); ++ start_unity_monitor (manager); + + for (i = 0; manager->priv->managers [i]; i++) + xsettings_manager_set_string (manager->priv->managers [i], +@@ -978,6 +1025,9 @@ + if (manager->priv->shell_name_watch_id > 0) + g_bus_unwatch_name (manager->priv->shell_name_watch_id); + ++ if (manager->priv->unity_name_watch_id > 0) ++ g_bus_unwatch_name (manager->priv->unity_name_watch_id); ++ + if (p->settings != NULL) { + g_hash_table_destroy (p->settings); + p->settings = NULL; diff --git a/debian/patches/bugzilla_segfault_dpms.patch b/debian/patches/bugzilla_segfault_dpms.patch new file mode 100644 index 00000000..ad9194f7 --- /dev/null +++ b/debian/patches/bugzilla_segfault_dpms.patch @@ -0,0 +1,20 @@ +# Comment: can be dropped when updating to 3.8 +# Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=672245 +# +Index: gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/power/gsd-power-manager.c 2012-10-26 10:19:49.591004180 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c 2012-10-26 10:20:03.975004876 +0200 +@@ -3852,6 +3852,12 @@ + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } ++ g_signal_handlers_disconnect_by_func (manager->priv->idletime, ++ idle_idletime_reset_cb, ++ manager); ++ g_signal_handlers_disconnect_by_func (manager->priv->idletime, ++ idle_idletime_alarm_expired_cb, ++ manager); + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); diff --git a/debian/patches/correct_logout_action.patch b/debian/patches/correct_logout_action.patch new file mode 100644 index 00000000..8ef235a6 --- /dev/null +++ b/debian/patches/correct_logout_action.patch @@ -0,0 +1,29 @@ +# Description: let the logout key do what it's supposed to do +# Ubuntu: https://launchpad.net/bugs/961501 +# Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=671979 +Index: gnome-settings-daemon-3.6.1/plugins/media-keys/gsd-media-keys-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/media-keys/gsd-media-keys-manager.c 2012-10-26 10:19:49.651004184 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/media-keys/gsd-media-keys-manager.c 2012-10-26 10:19:50.103004206 +0200 +@@ -938,6 +938,12 @@ + } + + static void ++do_logout_action (GsdMediaKeysManager *manager) ++{ ++ execute (manager, "gnome-session-quit --logout", FALSE); ++} ++ ++static void + do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +@@ -2060,7 +2066,7 @@ + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: +- gnome_session_shutdown (manager); ++ do_logout_action (manager); + break; + case EJECT_KEY: + do_eject_action (manager); diff --git a/debian/patches/disable_three_touch_tap.patch b/debian/patches/disable_three_touch_tap.patch new file mode 100644 index 00000000..67f94ba3 --- /dev/null +++ b/debian/patches/disable_three_touch_tap.patch @@ -0,0 +1,17 @@ +# Description: disable three-touch tap to click by default, it conflicts +with the unity resize handles, see that email for details: +https://lists.ubuntu.com/archives/ubuntu-desktop/2012-February/003694.html +# Forwarded: no, Ubuntu specific since it's for unity +Index: gnome-settings-daemon-3.6.1/plugins/mouse/gsd-mouse-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/mouse/gsd-mouse-manager.c 2012-10-26 10:19:49.427004172 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/mouse/gsd-mouse-manager.c 2012-10-26 10:19:49.691004186 +0200 +@@ -657,7 +657,7 @@ + /* Set RLM mapping for 1/2/3 fingers*/ + data[4] = (state) ? ((left_handed) ? 3 : 1) : 0; + data[5] = (state) ? ((left_handed) ? 1 : 3) : 0; +- data[6] = (state) ? 2 : 0; ++ data[6] = 0; /* Disable three touch tap so gestures work */ + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } diff --git a/debian/patches/migrate_metacity_keys.patch b/debian/patches/migrate_metacity_keys.patch new file mode 100644 index 00000000..9ef9253f --- /dev/null +++ b/debian/patches/migrate_metacity_keys.patch @@ -0,0 +1,15 @@ +Description: Migrate screenshot/terminal keys from metacity gconf as well +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1058004 + +--- gnome-settings-daemon/data/gnome-settings-daemon.convert.old 2012-10-02 08:50:01.384413000 +0300 ++++ gnome-settings-daemon/data/gnome-settings-daemon.convert 2012-10-02 09:05:22.243096198 +0300 +@@ -61,6 +61,9 @@ + volume-mute = /apps/gnome_settings_daemon/keybindings/volume_mute + volume-up = /apps/gnome_settings_daemon/keybindings/volume_up + www = /apps/gnome_settings_daemon/keybindings/www ++screenshot = /apps/metacity/global_keybindings/run_command_screenshot ++window-screenshot = /apps/metacity/global_keybindings/run_command_window_screenshot ++terminal = /apps/metacity/global_keybindings/run_command_terminal + + [org.gnome.settings-daemon.plugins.mouse] + active = /apps/gnome_settings_daemon/plugins/mouse/active diff --git a/debian/patches/nexus-orientation.patch b/debian/patches/nexus-orientation.patch new file mode 100644 index 00000000..7caf1cb8 --- /dev/null +++ b/debian/patches/nexus-orientation.patch @@ -0,0 +1,130 @@ +## Description: Autorotate Nexus screen +## Origin/Author: jani@ubuntu.com +## Bug: https://bugs.launchpad.net/ubuntu-nexus7/+bug/1110360 +Index: gnome-settings-daemon-3.6.4/plugins/orientation/gsd-orientation-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/orientation/gsd-orientation-manager.c 2013-02-13 13:36:14.606221356 +0200 ++++ gnome-settings-daemon-3.6.4/plugins/orientation/gsd-orientation-manager.c 2013-02-13 13:36:38.130337989 +0200 +@@ -23,6 +23,7 @@ + + #include "config.h" + ++#include + #include + #include + #include +@@ -87,6 +88,14 @@ + + static gpointer manager_object = NULL; + ++#define MPU_THRESHOLD 12000 ++#define MPU_POLL_INTERVAL 1 ++ ++static gboolean is_mpu6050 = FALSE; ++static char *mpu6050_accel_x = NULL; ++static char *mpu6050_accel_y = NULL; ++static gboolean mpu_timer(GsdOrientationManager *manager); ++ + static GObject * + gsd_orientation_manager_constructor (GType type, + guint n_construct_properties, +@@ -312,8 +321,11 @@ + return; + + manager->priv->orientation_lock = new; +- ++ + if (new == FALSE) { ++ if (is_mpu6050) { ++ g_timeout_add_seconds(MPU_POLL_INTERVAL, (GSourceFunc) mpu_timer, manager); ++ } + /* Handle the rotations that could have occurred while + * we were locked */ + do_rotation (manager); +@@ -372,12 +384,14 @@ + static GUdevDevice * + get_accelerometer (GUdevClient *client) + { +- GList *list, *l; ++ GList *list, *listiio, *l; + GUdevDevice *ret, *parent; + + /* Look for a device with the ID_INPUT_ACCELEROMETER=1 property */ + ret = NULL; + list = g_udev_client_query_by_subsystem (client, "input"); ++ listiio = g_udev_client_query_by_subsystem (client, "iio"); ++ list = g_list_concat(list, listiio); + for (l = list; l != NULL; l = l->next) { + GUdevDevice *dev; + +@@ -408,6 +422,53 @@ + return ret; + } + ++static int read_sysfs_attr_as_int(const char *filename) { ++ int i, c; ++ char buf[40]; ++ int fd = open(filename, O_RDONLY); ++ if (fd < 0) ++ return 0; ++ c = read(fd, buf, 40); ++ if (c < 0) ++ return 0; ++ close(fd); ++ sscanf(buf, "%d", &i); ++ ++ return i; ++} ++ ++static gboolean mpu_timer(GsdOrientationManager *manager) { ++ int x, y; ++ static gboolean first = TRUE; ++ OrientationUp orientation = manager->priv->prev_orientation; ++ ++ if (manager->priv->xrandr_proxy == NULL) ++ return TRUE; ++ ++ x = read_sysfs_attr_as_int(mpu6050_accel_x); ++ y = read_sysfs_attr_as_int(mpu6050_accel_y); ++ ++ if (x > MPU_THRESHOLD) ++ orientation = ORIENTATION_NORMAL; ++ if (x < -MPU_THRESHOLD) ++ orientation = ORIENTATION_BOTTOM_UP; ++ if (y > MPU_THRESHOLD) ++ orientation = ORIENTATION_RIGHT_UP; ++ if (y < -MPU_THRESHOLD) ++ orientation = ORIENTATION_LEFT_UP; ++ ++ if (orientation != manager->priv->prev_orientation || first) { ++ first = FALSE; ++ manager->priv->prev_orientation = orientation; ++ g_debug ("Orientation changed to '%s', switching screen rotation", ++ orientation_to_string (manager->priv->prev_orientation)); ++ ++ do_rotation (manager); ++ } ++ ++ return !manager->priv->orientation_lock; ++} ++ + static gboolean + gsd_orientation_manager_idle_cb (GsdOrientationManager *manager) + { +@@ -432,6 +493,16 @@ + g_debug ("Found accelerometer at sysfs path '%s'", manager->priv->sysfs_path); + + manager->priv->prev_orientation = get_orientation_from_device (dev); ++ ++ /* Poll the sysfs attributes exposed by MPU6050 as it is not an uevent based input driver */ ++ if (g_strcmp0 (g_udev_device_get_sysfs_attr (dev, "name"), "mpu6050") == 0) { ++ manager->priv->prev_orientation = ORIENTATION_NORMAL; ++ g_timeout_add_seconds(MPU_POLL_INTERVAL, (GSourceFunc) mpu_timer, manager); ++ mpu6050_accel_x = g_build_filename(manager->priv->sysfs_path, "in_accel_x_raw", NULL); ++ mpu6050_accel_y = g_build_filename(manager->priv->sysfs_path, "in_accel_y_raw", NULL); ++ is_mpu6050 = TRUE; ++ } ++ + g_object_unref (dev); + + /* Start process of owning a D-Bus name */ diff --git a/debian/patches/power-check-null-devices.patch b/debian/patches/power-check-null-devices.patch new file mode 100644 index 00000000..a368adce --- /dev/null +++ b/debian/patches/power-check-null-devices.patch @@ -0,0 +1,13 @@ +Index: gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/power/gsd-power-manager.c 2012-10-26 10:19:50.127004207 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c 2012-10-26 10:19:50.151004207 +0200 +@@ -1167,7 +1167,7 @@ + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); +- for (i=0;ilen;i++) { ++ for (i = 0; array != NULL && i < array->len; i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); diff --git a/debian/patches/power-no-fallback-notifications.patch b/debian/patches/power-no-fallback-notifications.patch new file mode 100644 index 00000000..ca215280 --- /dev/null +++ b/debian/patches/power-no-fallback-notifications.patch @@ -0,0 +1,22 @@ +Index: gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.1.orig/plugins/power/gsd-power-manager.c 2012-10-26 10:19:50.083004205 +0200 ++++ gnome-settings-daemon-3.6.1/plugins/power/gsd-power-manager.c 2012-10-26 10:20:02.915004826 +0200 +@@ -1636,7 +1636,7 @@ + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, +- GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); ++ GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); +@@ -1783,7 +1783,7 @@ + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, +- GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER); ++ GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); diff --git a/debian/patches/revert_new_ibus_use.patch b/debian/patches/revert_new_ibus_use.patch new file mode 100644 index 00000000..c083f405 --- /dev/null +++ b/debian/patches/revert_new_ibus_use.patch @@ -0,0 +1,4313 @@ +Index: gnome-settings-daemon-3.6.4/configure.ac +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/configure.ac 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/configure.ac 2013-02-18 12:57:16.511698776 +0000 +@@ -54,7 +54,6 @@ + LIBWACOM_REQUIRED_VERSION=0.6 + UPOWER_REQUIRED_VERSION=0.9.11 + APPINDICATOR_REQUIRED_VERSION=0.3.0 +-IBUS_REQUIRED_VERSION=1.4.99 + + EXTRA_COMPILE_WARNINGS(yes) + +@@ -204,21 +203,8 @@ + dnl - Keyboard plugin stuff + dnl --------------------------------------------------------------------------- + +-AC_ARG_ENABLE(ibus, +- AS_HELP_STRING([--disable-ibus], +- [Disable IBus support]), +- enable_ibus=$enableval, +- enable_ibus=yes) +- +-if test "x$enable_ibus" = "xyes" ; then +- IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION" +- AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled]) +-else +- IBUS_MODULE= +-fi +-AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes") +- +-PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) ++LIBGNOMEKBD_REQUIRED=2.91.1 ++PKG_CHECK_MODULES(KEYBOARD, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0 kbproto]) + + dnl --------------------------------------------------------------------------- + dnl - Housekeeping plugin stuff +@@ -595,7 +581,6 @@ + + Session tracking: ${SESSION_TRACKING} + LCMS DICT support: ${have_new_lcms} +- IBus support: ${enable_ibus} + Libnotify support: ${have_libnotify} + App indicator support: ${enable_appindicator} + PackageKit support: ${have_packagekit} +Index: gnome-settings-daemon-3.6.4/data/Makefile.am +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/data/Makefile.am 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/data/Makefile.am 2013-02-18 12:57:16.511698776 +0000 +@@ -67,12 +67,3 @@ + Makefile.in \ + $(gsettings_SCHEMAS:.xml=.valid) + +-if HAVE_IBUS +-dbusservicedir=${datadir}/dbus-1/services +-dbusservice_DATA = $(dbusservice_in_files:.service.in=.service) +- +-org.freedesktop.IBus.service: org.freedesktop.IBus.service.in +- $(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@.tmp && mv $@.tmp $@ +- +-CLEANFILES = $(dbusservice_DATA) +-endif +Index: gnome-settings-daemon-3.6.4/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-02-18 12:57:16.515698776 +0000 +@@ -180,16 +180,6 @@ + <_summary>Magnifier zoom out + <_description>Binding for the magnifier to zoom out + +- +- '' +- <_summary>Switch input source +- <_description>Binding to select the next input source +- +- +- '' +- <_summary>Switch input source backward +- <_description>Binding to select the previous input source +- + + + +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/delayed-dialog.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/delayed-dialog.c 2013-02-18 12:57:16.515698776 +0000 +@@ -0,0 +1,128 @@ ++/* ++ * Copyright © 2006 Novell, Inc. ++ * ++ * 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, 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 ++#include ++ ++#include ++#include ++ ++#include "delayed-dialog.h" ++ ++static gboolean delayed_show_timeout (gpointer data); ++static GdkFilterReturn message_filter (GdkXEvent *xevent, ++ GdkEvent *event, ++ gpointer data); ++ ++static GSList *dialogs = NULL; ++ ++/** ++ * gsd_delayed_show_dialog: ++ * @dialog: the dialog ++ * ++ * Shows the dialog as with gtk_widget_show(), unless a window manager ++ * hasn't been started yet, in which case it will wait up to 5 seconds ++ * for that to happen before showing the dialog. ++ **/ ++void ++gsd_delayed_show_dialog (GtkWidget *dialog) ++{ ++ GdkDisplay *display = gtk_widget_get_display (dialog); ++ Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); ++ GdkScreen *screen = gtk_widget_get_screen (dialog); ++ char selection_name[10]; ++ Atom selection_atom; ++ ++ /* We can't use gdk_selection_owner_get() for this, because ++ * it's an unknown out-of-process window. ++ */ ++ snprintf (selection_name, sizeof (selection_name), "WM_S%d", ++ gdk_screen_get_number (screen)); ++ selection_atom = XInternAtom (xdisplay, selection_name, True); ++ if (selection_atom && ++ XGetSelectionOwner (xdisplay, selection_atom) != None) { ++ gtk_widget_show (dialog); ++ return; ++ } ++ ++ dialogs = g_slist_prepend (dialogs, dialog); ++ ++ gdk_window_add_filter (NULL, message_filter, NULL); ++ ++ g_timeout_add (5000, delayed_show_timeout, NULL); ++} ++ ++static gboolean ++delayed_show_timeout (gpointer data) ++{ ++ GSList *l; ++ ++ for (l = dialogs; l; l = l->next) ++ gtk_widget_show (l->data); ++ g_slist_free (dialogs); ++ dialogs = NULL; ++ ++ /* FIXME: There's no gdk_display_remove_client_message_filter */ ++ ++ return FALSE; ++} ++ ++static GdkFilterReturn ++message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) ++{ ++ XClientMessageEvent *evt; ++ char *selection_name; ++ int screen; ++ GSList *l, *next; ++ ++ if (((XEvent *)xevent)->type != ClientMessage) ++ return GDK_FILTER_CONTINUE; ++ ++ evt = (XClientMessageEvent *)xevent; ++ ++ if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE)) ++ return GDK_FILTER_CONTINUE; ++ ++ selection_name = XGetAtomName (evt->display, evt->data.l[1]); ++ ++ if (strncmp (selection_name, "WM_S", 4) != 0) { ++ XFree (selection_name); ++ return GDK_FILTER_CONTINUE; ++ } ++ ++ screen = atoi (selection_name + 4); ++ ++ for (l = dialogs; l; l = next) { ++ GtkWidget *dialog = l->data; ++ next = l->next; ++ ++ if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { ++ gtk_widget_show (dialog); ++ dialogs = g_slist_remove (dialogs, dialog); ++ } ++ } ++ ++ if (!dialogs) { ++ gdk_window_remove_filter (NULL, message_filter, NULL); ++ } ++ ++ XFree (selection_name); ++ ++ return GDK_FILTER_CONTINUE; ++} +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/delayed-dialog.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/delayed-dialog.h 2013-02-18 12:57:16.515698776 +0000 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright © 2006 Novell, Inc. ++ * ++ * 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, 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 __DELAYED_DIALOG_H ++#define __DELAYED_DIALOG_H ++ ++#include ++ ++G_BEGIN_DECLS ++ ++void gsd_delayed_show_dialog (GtkWidget *dialog); ++ ++G_END_DECLS ++ ++#endif +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/gkbd-configuration.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/gkbd-configuration.c 2013-02-18 12:57:16.515698776 +0000 +@@ -0,0 +1,350 @@ ++/* ++ * Copyright (C) 2010 Canonical Ltd. ++ * ++ * Authors: Jan Arne Petersen ++ * ++ * Based on gkbd-status.c by Sergey V. Udaltsov ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser 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 Lesser 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. ++ */ ++ ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "gkbd-configuration.h" ++ ++struct _GkbdConfigurationPrivate { ++ XklEngine *engine; ++ XklConfigRegistry *registry; ++ ++ GkbdDesktopConfig cfg; ++ GkbdIndicatorConfig ind_cfg; ++ GkbdKeyboardConfig kbd_cfg; ++ ++ gchar **full_group_names; ++ gchar **short_group_names; ++ ++ gulong state_changed_handler; ++ gulong config_changed_handler; ++}; ++ ++enum { ++ SIGNAL_CHANGED, ++ SIGNAL_GROUP_CHANGED, ++ LAST_SIGNAL ++}; ++ ++static guint signals[LAST_SIGNAL] = { 0, }; ++ ++#define GKBD_CONFIGURATION_GET_PRIVATE(o) \ ++ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GKBD_TYPE_CONFIGURATION, GkbdConfigurationPrivate)) ++ ++G_DEFINE_TYPE (GkbdConfiguration, gkbd_configuration, G_TYPE_OBJECT) ++ ++/* Should be called once for all widgets */ ++static void ++gkbd_configuration_cfg_changed (GSettings *settings, ++ const char *key, ++ GkbdConfiguration * configuration) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ ++ xkl_debug (100, ++ "General configuration changed in GSettings - reiniting...\n"); ++ gkbd_desktop_config_load (&priv->cfg); ++ gkbd_desktop_config_activate (&priv->cfg); ++ ++ g_signal_emit (configuration, ++ signals[SIGNAL_CHANGED], 0); ++} ++ ++/* Should be called once for all widgets */ ++static void ++gkbd_configuration_ind_cfg_changed (GSettings *settings, ++ const char *key, ++ GkbdConfiguration * configuration) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ xkl_debug (100, ++ "Applet configuration changed in GSettings - reiniting...\n"); ++ gkbd_indicator_config_load (&priv->ind_cfg); ++ ++ gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); ++ gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, ++ &priv->kbd_cfg); ++ ++ gkbd_indicator_config_activate (&priv->ind_cfg); ++ ++ g_signal_emit (configuration, ++ signals[SIGNAL_CHANGED], 0); ++} ++ ++static void ++gkbd_configuration_load_group_names (GkbdConfiguration * configuration, ++ XklConfigRec * xklrec) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ ++ if (!gkbd_desktop_config_load_group_descriptions (&priv->cfg, ++ priv->registry, ++ (const char **) xklrec->layouts, ++ (const char **) xklrec->variants, ++ &priv->short_group_names, ++ &priv->full_group_names)) { ++ /* We just populate no short names (remain NULL) - ++ * full names are going to be used anyway */ ++ gint i, total_groups = ++ xkl_engine_get_num_groups (priv->engine); ++ xkl_debug (150, "group descriptions loaded: %d!\n", ++ total_groups); ++ priv->full_group_names = ++ g_new0 (char *, total_groups + 1); ++ ++ if (xkl_engine_get_features (priv->engine) & ++ XKLF_MULTIPLE_LAYOUTS_SUPPORTED) { ++ for (i = 0; priv->kbd_cfg.layouts_variants[i]; i++) { ++ priv->full_group_names[i] = ++ g_strdup ((char *) priv->kbd_cfg.layouts_variants[i]); ++ } ++ } else { ++ for (i = total_groups; --i >= 0;) { ++ priv->full_group_names[i] = ++ g_strdup_printf ("Group %d", i); ++ } ++ } ++ } ++} ++ ++/* Should be called once for all widgets */ ++static void ++gkbd_configuration_kbd_cfg_callback (XklEngine *engine, ++ GkbdConfiguration *configuration) ++{ ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ XklConfigRec *xklrec = xkl_config_rec_new (); ++ xkl_debug (100, ++ "XKB configuration changed on X Server - reiniting...\n"); ++ ++ gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, ++ xklrec); ++ ++ gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); ++ gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, ++ &priv->kbd_cfg); ++ ++ g_strfreev (priv->full_group_names); ++ priv->full_group_names = NULL; ++ ++ g_strfreev (priv->short_group_names); ++ priv->short_group_names = NULL; ++ ++ gkbd_configuration_load_group_names (configuration, ++ xklrec); ++ ++ g_signal_emit (configuration, ++ signals[SIGNAL_CHANGED], ++ 0); ++ ++ g_object_unref (G_OBJECT (xklrec)); ++} ++ ++/* Should be called once for all applets */ ++static void ++gkbd_configuration_state_callback (XklEngine * engine, ++ XklEngineStateChange changeType, ++ gint group, gboolean restore, ++ GkbdConfiguration * configuration) ++{ ++ xkl_debug (150, "group is now %d, restore: %d\n", group, restore); ++ ++ if (changeType == GROUP_CHANGED) { ++ g_signal_emit (configuration, ++ signals[SIGNAL_GROUP_CHANGED], 0, ++ group); ++ } ++} ++ ++static void ++gkbd_configuration_init (GkbdConfiguration *configuration) ++{ ++ GkbdConfigurationPrivate *priv; ++ XklConfigRec *xklrec = xkl_config_rec_new (); ++ ++ priv = GKBD_CONFIGURATION_GET_PRIVATE (configuration); ++ configuration->priv = priv; ++ ++ priv->engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); ++ if (priv->engine == NULL) { ++ xkl_debug (0, "Libxklavier initialization error"); ++ return; ++ } ++ ++ priv->state_changed_handler = ++ g_signal_connect (priv->engine, "X-state-changed", ++ G_CALLBACK (gkbd_configuration_state_callback), ++ configuration); ++ priv->config_changed_handler = ++ g_signal_connect (priv->engine, "X-config-changed", ++ G_CALLBACK (gkbd_configuration_kbd_cfg_callback), ++ configuration); ++ ++ gkbd_desktop_config_init (&priv->cfg, priv->engine); ++ gkbd_keyboard_config_init (&priv->kbd_cfg, priv->engine); ++ gkbd_indicator_config_init (&priv->ind_cfg, priv->engine); ++ ++ gkbd_desktop_config_load (&priv->cfg); ++ gkbd_desktop_config_activate (&priv->cfg); ++ ++ priv->registry = xkl_config_registry_get_instance (priv->engine); ++ xkl_config_registry_load (priv->registry, ++ priv->cfg.load_extra_items); ++ ++ gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, ++ xklrec); ++ ++ gkbd_indicator_config_load (&priv->ind_cfg); ++ ++ gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, ++ &priv->kbd_cfg); ++ ++ gkbd_indicator_config_activate (&priv->ind_cfg); ++ ++ gkbd_configuration_load_group_names (configuration, ++ xklrec); ++ g_object_unref (G_OBJECT (xklrec)); ++ ++ gkbd_desktop_config_start_listen (&priv->cfg, ++ G_CALLBACK (gkbd_configuration_cfg_changed), ++ configuration); ++ gkbd_indicator_config_start_listen (&priv->ind_cfg, ++ G_CALLBACK (gkbd_configuration_ind_cfg_changed), ++ configuration); ++ xkl_engine_start_listen (priv->engine, ++ XKLL_TRACK_KEYBOARD_STATE); ++ ++ xkl_debug (100, "Initiating the widget startup process for %p\n", ++ configuration); ++} ++ ++static void ++gkbd_configuration_finalize (GObject * obj) ++{ ++ GkbdConfiguration *configuration = GKBD_CONFIGURATION (obj); ++ GkbdConfigurationPrivate *priv = configuration->priv; ++ ++ xkl_debug (100, ++ "Starting the gnome-kbd-configuration widget shutdown process for %p\n", ++ configuration); ++ ++ xkl_engine_stop_listen (priv->engine, ++ XKLL_TRACK_KEYBOARD_STATE); ++ ++ gkbd_desktop_config_stop_listen (&priv->cfg); ++ gkbd_indicator_config_stop_listen (&priv->ind_cfg); ++ ++ gkbd_indicator_config_term (&priv->ind_cfg); ++ gkbd_keyboard_config_term (&priv->kbd_cfg); ++ gkbd_desktop_config_term (&priv->cfg); ++ ++ if (g_signal_handler_is_connected (priv->engine, ++ priv->state_changed_handler)) { ++ g_signal_handler_disconnect (priv->engine, ++ priv->state_changed_handler); ++ priv->state_changed_handler = 0; ++ } ++ if (g_signal_handler_is_connected (priv->engine, ++ priv->config_changed_handler)) { ++ g_signal_handler_disconnect (priv->engine, ++ priv->config_changed_handler); ++ priv->config_changed_handler = 0; ++ } ++ ++ g_object_unref (priv->registry); ++ priv->registry = NULL; ++ g_object_unref (priv->engine); ++ priv->engine = NULL; ++ ++ G_OBJECT_CLASS (gkbd_configuration_parent_class)->finalize (obj); ++} ++ ++static void ++gkbd_configuration_class_init (GkbdConfigurationClass * klass) ++{ ++ GObjectClass *object_class = G_OBJECT_CLASS (klass); ++ ++ /* Initing vtable */ ++ object_class->finalize = gkbd_configuration_finalize; ++ ++ /* Signals */ ++ signals[SIGNAL_CHANGED] = g_signal_new ("changed", ++ GKBD_TYPE_CONFIGURATION, ++ G_SIGNAL_RUN_LAST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__VOID, ++ G_TYPE_NONE, ++ 0); ++ signals[SIGNAL_GROUP_CHANGED] = g_signal_new ("group-changed", ++ GKBD_TYPE_CONFIGURATION, ++ G_SIGNAL_RUN_LAST, ++ 0, ++ NULL, NULL, ++ g_cclosure_marshal_VOID__INT, ++ G_TYPE_NONE, ++ 1, ++ G_TYPE_INT); ++ ++ g_type_class_add_private (klass, sizeof (GkbdConfigurationPrivate)); ++} ++ ++GkbdConfiguration * ++gkbd_configuration_get (void) ++{ ++ static gpointer instance = NULL; ++ ++ if (!instance) { ++ instance = g_object_new (GKBD_TYPE_CONFIGURATION, NULL); ++ g_object_add_weak_pointer (instance, &instance); ++ } else { ++ g_object_ref (instance); ++ } ++ ++ return instance; ++} ++ ++XklEngine * ++gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration) ++{ ++ return configuration->priv->engine; ++} ++ ++const char * const * ++gkbd_configuration_get_group_names (GkbdConfiguration *configuration) ++{ ++ return configuration->priv->full_group_names; ++} ++ ++const char * const * ++gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration) ++{ ++ return configuration->priv->short_group_names; ++} +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/gkbd-configuration.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/gkbd-configuration.h 2013-02-18 12:57:16.515698776 +0000 +@@ -0,0 +1,65 @@ ++/* ++ * Copyright (C) 2010 Canonical Ltd. ++ * ++ * Authors: Jan Arne Petersen ++ * ++ * Based on gkbd-status.h by Sergey V. Udaltsov ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser 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 Lesser 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. ++ */ ++ ++#ifndef __GKBD_CONFIGURATION_H__ ++#define __GKBD_CONFIGURATION_H__ ++ ++#include ++ ++#include ++ ++G_BEGIN_DECLS ++ ++typedef struct _GkbdConfiguration GkbdConfiguration; ++typedef struct _GkbdConfigurationPrivate GkbdConfigurationPrivate; ++typedef struct _GkbdConfigurationClass GkbdConfigurationClass; ++ ++#define GKBD_TYPE_CONFIGURATION (gkbd_configuration_get_type ()) ++#define GKBD_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfiguration)) ++#define GKBD_INDCATOR_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) ++#define GKBD_IS_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) ++#define GKBD_IS_CONFIGURATION_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) ++#define GKBD_CONFIGURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) ++ ++struct _GkbdConfiguration { ++ GObject parent; ++ ++ GkbdConfigurationPrivate *priv; ++}; ++ ++struct _GkbdConfigurationClass { ++ GObjectClass parent_class; ++}; ++ ++extern GType gkbd_configuration_get_type (void); ++ ++extern GkbdConfiguration *gkbd_configuration_get (void); ++ ++extern XklEngine *gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration); ++ ++extern const char * const *gkbd_configuration_get_group_names (GkbdConfiguration *configuration); ++extern const char * const *gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration); ++ ++G_END_DECLS ++ ++#endif +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/keyboard/gsd-keyboard-manager.c 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-manager.c 2013-02-18 12:57:16.519698776 +0000 +@@ -40,22 +40,19 @@ + + #include + #include +-#include +- +-#define GNOME_DESKTOP_USE_UNSTABLE_API +-#include +- +-#ifdef HAVE_IBUS +-#include +-#endif + + #include "gnome-settings-profile.h" + #include "gsd-keyboard-manager.h" +-#include "gsd-input-helper.h" + #include "gsd-enums.h" + ++#include "gsd-keyboard-xkb.h" ++ + #define GSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerPrivate)) + ++#ifndef HOST_NAME_MAX ++# define HOST_NAME_MAX 255 ++#endif ++ + #define GSD_KEYBOARD_DIR "org.gnome.settings-daemon.peripherals.keyboard" + + #define KEY_REPEAT "repeat" +@@ -63,7 +60,6 @@ + #define KEY_INTERVAL "repeat-interval" + #define KEY_DELAY "delay" + #define KEY_CLICK_VOLUME "click-volume" +-#define KEY_REMEMBER_NUMLOCK_STATE "remember-numlock-state" + #define KEY_NUMLOCK_STATE "numlock-state" + + #define KEY_BELL_VOLUME "bell-volume" +@@ -71,560 +67,27 @@ + #define KEY_BELL_DURATION "bell-duration" + #define KEY_BELL_MODE "bell-mode" + +-#define KEY_SWITCHER "input-sources-switcher" +- +-#define GNOME_DESKTOP_INTERFACE_DIR "org.gnome.desktop.interface" +- +-#define KEY_GTK_IM_MODULE "gtk-im-module" +-#define GTK_IM_MODULE_SIMPLE "gtk-im-context-simple" +-#define GTK_IM_MODULE_IBUS "ibus" +- +-#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +- +-#define KEY_CURRENT_INPUT_SOURCE "current" +-#define KEY_INPUT_SOURCES "sources" +-#define KEY_KEYBOARD_OPTIONS "xkb-options" +- +-#define INPUT_SOURCE_TYPE_XKB "xkb" +-#define INPUT_SOURCE_TYPE_IBUS "ibus" +- +-#define DEFAULT_LANGUAGE "en_US" ++#define LIBGNOMEKBD_KEYBOARD_DIR "org.gnome.libgnomekbd.keyboard" ++#define LIBGNOMEKBD_KEY_LAYOUTS "layouts" + + struct GsdKeyboardManagerPrivate + { + guint start_idle_id; + GSettings *settings; +- GSettings *input_sources_settings; +- GSettings *interface_settings; +- GnomeXkbInfo *xkb_info; +-#ifdef HAVE_IBUS +- IBusBus *ibus; +- GHashTable *ibus_engines; +- GHashTable *ibus_xkb_engines; +- GCancellable *ibus_cancellable; +- gboolean session_is_fallback; +-#endif ++ GSettings *libgnomekbd_settings; ++ gboolean have_xkb; + gint xkb_event_base; + GsdNumLockState old_state; +- GdkDeviceManager *device_manager; +- guint device_added_id; +- guint device_removed_id; +- +- gboolean input_sources_switcher_spawned; +- GPid input_sources_switcher_pid; + }; + + static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass); + static void gsd_keyboard_manager_init (GsdKeyboardManager *keyboard_manager); + static void gsd_keyboard_manager_finalize (GObject *object); +-static gboolean apply_input_sources_settings (GSettings *settings, +- gpointer keys, +- gint n_keys, +- GsdKeyboardManager *manager); +-static void set_gtk_im_module (GsdKeyboardManager *manager, +- const gchar *new_module); + + G_DEFINE_TYPE (GsdKeyboardManager, gsd_keyboard_manager, G_TYPE_OBJECT) + + static gpointer manager_object = NULL; + +-static void +-init_builder_with_sources (GVariantBuilder *builder, +- GSettings *settings) +-{ +- const gchar *type; +- const gchar *id; +- GVariantIter iter; +- GVariant *sources; +- +- sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); +- +- g_variant_builder_init (builder, G_VARIANT_TYPE ("a(ss)")); +- +- g_variant_iter_init (&iter, sources); +- while (g_variant_iter_next (&iter, "(&s&s)", &type, &id)) +- g_variant_builder_add (builder, "(ss)", type, id); +- +- g_variant_unref (sources); +-} +- +-static gboolean +-schema_is_installed (const gchar *name) +-{ +- const gchar * const *schemas; +- const gchar * const *s; +- +- schemas = g_settings_list_schemas (); +- for (s = schemas; *s; ++s) +- if (g_str_equal (*s, name)) +- return TRUE; +- +- return FALSE; +-} +- +-#ifdef HAVE_IBUS +-static void +-clear_ibus (GsdKeyboardManager *manager) +-{ +- GsdKeyboardManagerPrivate *priv = manager->priv; +- +- g_cancellable_cancel (priv->ibus_cancellable); +- g_clear_object (&priv->ibus_cancellable); +- g_clear_pointer (&priv->ibus_engines, g_hash_table_destroy); +- g_clear_pointer (&priv->ibus_xkb_engines, g_hash_table_destroy); +- g_clear_object (&priv->ibus); +-} +- +-static gchar * +-make_xkb_source_id (const gchar *engine_id) +-{ +- gchar *id; +- gchar *p; +- gint n_colons = 0; +- +- /* engine_id is like "xkb:layout:variant:lang" where +- * 'variant' and 'lang' might be empty */ +- +- engine_id += 4; +- +- for (p = (gchar *)engine_id; *p; ++p) +- if (*p == ':') +- if (++n_colons == 2) +- break; +- if (!*p) +- return NULL; +- +- id = g_strndup (engine_id, p - engine_id + 1); +- +- id[p - engine_id] = '\0'; +- +- /* id is "layout:variant" where 'variant' might be empty */ +- +- for (p = id; *p; ++p) +- if (*p == ':') { +- if (*(p + 1) == '\0') +- *p = '\0'; +- else +- *p = '+'; +- break; +- } +- +- /* id is "layout+variant" or "layout" */ +- +- return id; +-} +- +-static void +-fetch_ibus_engines_result (GObject *object, +- GAsyncResult *result, +- GsdKeyboardManager *manager) +-{ +- GsdKeyboardManagerPrivate *priv = manager->priv; +- GList *list, *l; +- GError *error = NULL; +- +- /* engines shouldn't be there yet */ +- g_return_if_fail (priv->ibus_engines == NULL); +- +- g_clear_object (&priv->ibus_cancellable); +- +- list = ibus_bus_list_engines_async_finish (priv->ibus, +- result, +- &error); +- if (!list && error) { +- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) +- g_warning ("Couldn't finish IBus request: %s", error->message); +- g_error_free (error); +- +- clear_ibus (manager); +- return; +- } +- +- /* Maps IBus engine ids to engine description objects */ +- priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); +- /* Maps XKB source id strings to engine description objects */ +- priv->ibus_xkb_engines = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); +- +- for (l = list; l; l = l->next) { +- IBusEngineDesc *engine = l->data; +- const gchar *engine_id = ibus_engine_desc_get_name (engine); +- +- g_hash_table_replace (priv->ibus_engines, (gpointer)engine_id, engine); +- +- if (strncmp ("xkb:", engine_id, 4) == 0) { +- gchar *xkb_source_id = make_xkb_source_id (engine_id); +- if (xkb_source_id) +- g_hash_table_replace (priv->ibus_xkb_engines, +- xkb_source_id, +- engine); +- } +- } +- g_list_free (list); +- +- apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager); +-} +- +-static void +-fetch_ibus_engines (GsdKeyboardManager *manager) +-{ +- GsdKeyboardManagerPrivate *priv = manager->priv; +- +- /* engines shouldn't be there yet */ +- g_return_if_fail (priv->ibus_engines == NULL); +- g_return_if_fail (priv->ibus_cancellable == NULL); +- +- priv->ibus_cancellable = g_cancellable_new (); +- +- ibus_bus_list_engines_async (priv->ibus, +- -1, +- priv->ibus_cancellable, +- (GAsyncReadyCallback)fetch_ibus_engines_result, +- manager); +-} +- +-static void +-maybe_start_ibus (GsdKeyboardManager *manager, +- GVariant *sources) +-{ +- gboolean need_ibus = FALSE; +- GVariantIter iter; +- const gchar *type; +- +- if (manager->priv->session_is_fallback) +- return; +- +- g_variant_iter_init (&iter, sources); +- while (g_variant_iter_next (&iter, "(&s&s)", &type, NULL)) +- if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) { +- need_ibus = TRUE; +- break; +- } +- +- if (!need_ibus) +- return; +- +- if (!manager->priv->ibus) { +- ibus_init (); +- manager->priv->ibus = ibus_bus_new_async (); +- g_signal_connect_swapped (manager->priv->ibus, "connected", +- G_CALLBACK (fetch_ibus_engines), manager); +- g_signal_connect_swapped (manager->priv->ibus, "disconnected", +- G_CALLBACK (clear_ibus), manager); +- } +- /* IBus doesn't export API in the session bus. The only thing +- * we have there is a well known name which we can use as a +- * sure-fire way to activate it. */ +- g_bus_unwatch_name (g_bus_watch_name (G_BUS_TYPE_SESSION, +- IBUS_SERVICE_IBUS, +- G_BUS_NAME_WATCHER_FLAGS_AUTO_START, +- NULL, +- NULL, +- NULL, +- NULL)); +-} +- +-static void +-got_session_name (GObject *object, +- GAsyncResult *res, +- GsdKeyboardManager *manager) +-{ +- GVariant *result, *variant; +- GDBusConnection *connection = G_DBUS_CONNECTION (object); +- GsdKeyboardManagerPrivate *priv = manager->priv; +- const gchar *session_name = NULL; +- GError *error = NULL; +- +- /* IBus shouldn't have been touched yet */ +- g_return_if_fail (priv->ibus == NULL); +- +- g_clear_object (&priv->ibus_cancellable); +- +- result = g_dbus_connection_call_finish (connection, res, &error); +- if (!result) { +- g_warning ("Couldn't get session name: %s", error->message); +- g_error_free (error); +- goto out; +- } +- +- g_variant_get (result, "(v)", &variant); +- g_variant_unref (result); +- +- g_variant_get (variant, "&s", &session_name); +- +- if (g_strcmp0 (session_name, "gnome") == 0) +- manager->priv->session_is_fallback = FALSE; +- +- g_variant_unref (variant); +- out: +- apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); +- g_object_unref (connection); +-} +- +-static void +-got_bus (GObject *object, +- GAsyncResult *res, +- GsdKeyboardManager *manager) +-{ +- GDBusConnection *connection; +- GsdKeyboardManagerPrivate *priv = manager->priv; +- GError *error = NULL; +- +- /* IBus shouldn't have been touched yet */ +- g_return_if_fail (priv->ibus == NULL); +- +- g_clear_object (&priv->ibus_cancellable); +- +- connection = g_bus_get_finish (res, &error); +- if (!connection) { +- g_warning ("Couldn't get session bus: %s", error->message); +- g_error_free (error); +- apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager); +- return; +- } +- +- priv->ibus_cancellable = g_cancellable_new (); +- +- g_dbus_connection_call (connection, +- "org.gnome.SessionManager", +- "/org/gnome/SessionManager", +- "org.freedesktop.DBus.Properties", +- "Get", +- g_variant_new ("(ss)", +- "org.gnome.SessionManager", +- "SessionName"), +- NULL, +- G_DBUS_CALL_FLAGS_NONE, +- -1, +- priv->ibus_cancellable, +- (GAsyncReadyCallback)got_session_name, +- manager); +-} +- +-static void +-set_ibus_engine_finish (GObject *object, +- GAsyncResult *res, +- GsdKeyboardManager *manager) +-{ +- gboolean result; +- IBusBus *ibus = IBUS_BUS (object); +- GsdKeyboardManagerPrivate *priv = manager->priv; +- GError *error = NULL; +- +- g_clear_object (&priv->ibus_cancellable); +- +- result = ibus_bus_set_global_engine_async_finish (ibus, res, &error); +- if (!result) { +- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) +- g_warning ("Couldn't set IBus engine: %s", error->message); +- g_error_free (error); +- } +-} +- +-static void +-set_ibus_engine (GsdKeyboardManager *manager, +- const gchar *engine_id) +-{ +- GsdKeyboardManagerPrivate *priv = manager->priv; +- +- g_return_if_fail (priv->ibus != NULL); +- g_return_if_fail (priv->ibus_engines != NULL); +- +- g_cancellable_cancel (priv->ibus_cancellable); +- g_clear_object (&priv->ibus_cancellable); +- priv->ibus_cancellable = g_cancellable_new (); +- +- ibus_bus_set_global_engine_async (priv->ibus, +- engine_id, +- -1, +- priv->ibus_cancellable, +- (GAsyncReadyCallback)set_ibus_engine_finish, +- manager); +-} +- +-static void +-set_ibus_xkb_engine (GsdKeyboardManager *manager, +- const gchar *xkb_id) +-{ +- IBusEngineDesc *engine; +- GsdKeyboardManagerPrivate *priv = manager->priv; +- +- if (!priv->ibus_xkb_engines) +- return; +- +- engine = g_hash_table_lookup (priv->ibus_xkb_engines, xkb_id); +- if (!engine) +- return; +- +- set_ibus_engine (manager, ibus_engine_desc_get_name (engine)); +-} +- +-/* XXX: See upstream bug: +- * https://codereview.appspot.com/6586075/ */ +-static gchar * +-layout_from_ibus_layout (const gchar *ibus_layout) +-{ +- const gchar *p; +- +- /* we get something like "layout(variant)[option1,option2]" */ +- +- p = ibus_layout; +- while (*p) { +- if (*p == '(' || *p == '[') +- break; +- p += 1; +- } +- +- return g_strndup (ibus_layout, p - ibus_layout); +-} +- +-static gchar * +-variant_from_ibus_layout (const gchar *ibus_layout) +-{ +- const gchar *a, *b; +- +- /* we get something like "layout(variant)[option1,option2]" */ +- +- a = ibus_layout; +- while (*a) { +- if (*a == '(') +- break; +- a += 1; +- } +- if (!*a) +- return NULL; +- +- a += 1; +- b = a; +- while (*b) { +- if (*b == ')') +- break; +- b += 1; +- } +- if (!*b) +- return NULL; +- +- return g_strndup (a, b - a); +-} +- +-static gchar ** +-options_from_ibus_layout (const gchar *ibus_layout) +-{ +- const gchar *a, *b; +- GPtrArray *opt_array; +- +- /* we get something like "layout(variant)[option1,option2]" */ +- +- a = ibus_layout; +- while (*a) { +- if (*a == '[') +- break; +- a += 1; +- } +- if (!*a) +- return NULL; +- +- opt_array = g_ptr_array_new (); +- +- do { +- a += 1; +- b = a; +- while (*b) { +- if (*b == ',' || *b == ']') +- break; +- b += 1; +- } +- if (!*b) +- goto out; +- +- g_ptr_array_add (opt_array, g_strndup (a, b - a)); +- +- a = b; +- } while (*a && *a == ','); +- +-out: +- g_ptr_array_add (opt_array, NULL); +- return (gchar **) g_ptr_array_free (opt_array, FALSE); +-} +- +-static const gchar * +-engine_from_locale (void) +-{ +- const gchar *locale; +- const gchar *locale_engine[][2] = { +- { "as_IN", "m17n:as:phonetic" }, +- { "bn_IN", "m17n:bn:inscript" }, +- { "gu_IN", "m17n:gu:inscript" }, +- { "hi_IN", "m17n:hi:inscript" }, +- { "ja_JP", "anthy" }, +- { "kn_IN", "m17n:kn:kgp" }, +- { "ko_KR", "hangul" }, +- { "mai_IN", "m17n:mai:inscript" }, +- { "ml_IN", "m17n:ml:inscript" }, +- { "mr_IN", "m17n:mr:inscript" }, +- { "or_IN", "m17n:or:inscript" }, +- { "pa_IN", "m17n:pa:inscript" }, +- { "sd_IN", "m17n:sd:inscript" }, +- { "ta_IN", "m17n:ta:tamil99" }, +- { "te_IN", "m17n:te:inscript" }, +- { "zh_CN", "pinyin" }, +- { "zh_HK", "cangjie3" }, +- { "zh_TW", "chewing" }, +- }; +- gint i; +- +- locale = setlocale (LC_CTYPE, NULL); +- if (!locale) +- return NULL; +- +- for (i = 0; i < G_N_ELEMENTS (locale_engine); ++i) +- if (g_str_has_prefix (locale, locale_engine[i][0])) +- return locale_engine[i][1]; +- +- return NULL; +-} +- +-static void +-add_ibus_sources_from_locale (GSettings *settings) +-{ +- const gchar *locale_engine; +- GVariantBuilder builder; +- +- locale_engine = engine_from_locale (); +- if (!locale_engine) +- return; +- +- init_builder_with_sources (&builder, settings); +- g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, locale_engine); +- g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +-} +- +-static void +-convert_ibus (GSettings *settings) +-{ +- GVariantBuilder builder; +- GSettings *ibus_settings; +- gchar **engines, **e; +- +- if (!schema_is_installed ("org.freedesktop.ibus.general")) +- return; +- +- init_builder_with_sources (&builder, settings); +- +- ibus_settings = g_settings_new ("org.freedesktop.ibus.general"); +- engines = g_settings_get_strv (ibus_settings, "preload-engines"); +- for (e = engines; *e; ++e) { +- if (g_str_has_prefix (*e, "xkb:")) +- continue; +- g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, *e); +- } +- +- g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +- +- g_strfreev (engines); +- g_object_unref (ibus_settings); +-} +-#endif /* HAVE_IBUS */ +- + static gboolean + xkb_set_keyboard_autorepeat_rate (guint delay, guint interval) + { +@@ -634,33 +97,32 @@ + interval); + } + +-static gboolean +-check_xkb_extension (GsdKeyboardManager *manager) ++static void ++numlock_xkb_init (GsdKeyboardManager *manager) + { + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); +- int opcode, error_base, major, minor; + gboolean have_xkb; ++ int opcode, error_base, major, minor; + + have_xkb = XkbQueryExtension (dpy, + &opcode, + &manager->priv->xkb_event_base, + &error_base, + &major, +- &minor); +- return have_xkb; +-} ++ &minor) ++ && XkbUseExtension (dpy, &major, &minor); + +-static void +-xkb_init (GsdKeyboardManager *manager) +-{ +- Display *dpy; ++ if (have_xkb) { ++ XkbSelectEventDetails (dpy, ++ XkbUseCoreKbd, ++ XkbStateNotifyMask, ++ XkbModifierLockMask, ++ XkbModifierLockMask); ++ } else { ++ g_warning ("XKB extension not available"); ++ } + +- dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); +- XkbSelectEventDetails (dpy, +- XkbUseCoreKbd, +- XkbStateNotify, +- XkbModifierLockMask, +- XkbModifierLockMask); ++ manager->priv->have_xkb = have_xkb; + } + + static unsigned +@@ -681,32 +143,19 @@ + XkbLockModifiers (dpy, XkbUseCoreKbd, num_mask, new_state == GSD_NUM_LOCK_STATE_ON ? num_mask : 0); + } + +-static const char * +-num_lock_state_to_string (GsdNumLockState numlock_state) +-{ +- switch (numlock_state) { +- case GSD_NUM_LOCK_STATE_UNKNOWN: +- return "GSD_NUM_LOCK_STATE_UNKNOWN"; +- case GSD_NUM_LOCK_STATE_ON: +- return "GSD_NUM_LOCK_STATE_ON"; +- case GSD_NUM_LOCK_STATE_OFF: +- return "GSD_NUM_LOCK_STATE_OFF"; +- default: +- return "UNKNOWN"; +- } +-} +- + static GdkFilterReturn +-xkb_events_filter (GdkXEvent *xev_, +- GdkEvent *gdkev_, +- gpointer user_data) ++numlock_xkb_callback (GdkXEvent *xev_, ++ GdkEvent *gdkev_, ++ gpointer user_data) + { + XEvent *xev = (XEvent *) xev_; + XkbEvent *xkbev = (XkbEvent *) xev; + GsdKeyboardManager *manager = (GsdKeyboardManager *) user_data; + +- if (xev->type != manager->priv->xkb_event_base || +- xkbev->any.xkb_type != XkbStateNotify) ++ if (xev->type != manager->priv->xkb_event_base) ++ return GDK_FILTER_CONTINUE; ++ ++ if (xkbev->any.xkb_type != XkbStateNotify) + return GDK_FILTER_CONTINUE; + + if (xkbev->state.changed & XkbModifierLockMask) { +@@ -717,9 +166,6 @@ + numlock_state = (num_mask & locked_mods) ? GSD_NUM_LOCK_STATE_ON : GSD_NUM_LOCK_STATE_OFF; + + if (numlock_state != manager->priv->old_state) { +- g_debug ("New num-lock state '%s' != Old num-lock state '%s'", +- num_lock_state_to_string (numlock_state), +- num_lock_state_to_string (manager->priv->old_state)); + g_settings_set_enum (manager->priv->settings, + KEY_NUMLOCK_STATE, + numlock_state); +@@ -731,509 +177,57 @@ + } + + static void +-install_xkb_filter (GsdKeyboardManager *manager) ++numlock_install_xkb_callback (GsdKeyboardManager *manager) + { +- gdk_window_add_filter (NULL, +- xkb_events_filter, +- manager); +-} +- +-static void +-remove_xkb_filter (GsdKeyboardManager *manager) +-{ +- gdk_window_remove_filter (NULL, +- xkb_events_filter, +- manager); +-} +- +-static void +-free_xkb_component_names (XkbComponentNamesRec *p) +-{ +- g_return_if_fail (p != NULL); +- +- free (p->keymap); +- free (p->keycodes); +- free (p->types); +- free (p->compat); +- free (p->symbols); +- free (p->geometry); +- +- g_free (p); +-} +- +-static void +-upload_xkb_description (const gchar *rules_file_path, +- XkbRF_VarDefsRec *var_defs, +- XkbComponentNamesRec *comp_names) +-{ +- Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); +- XkbDescRec *xkb_desc; +- gchar *rules_file; +- +- /* Upload it to the X server using the same method as setxkbmap */ +- xkb_desc = XkbGetKeyboardByName (display, +- XkbUseCoreKbd, +- comp_names, +- XkbGBN_AllComponentsMask, +- XkbGBN_AllComponentsMask & +- (~XkbGBN_GeometryMask), True); +- if (!xkb_desc) { +- g_warning ("Couldn't upload new XKB keyboard description"); ++ if (!manager->priv->have_xkb) + return; +- } +- +- XkbFreeKeyboard (xkb_desc, 0, True); +- +- rules_file = g_path_get_basename (rules_file_path); + +- if (!XkbRF_SetNamesProp (display, rules_file, var_defs)) +- g_warning ("Couldn't update the XKB root window property"); +- +- g_free (rules_file); +-} +- +-static gchar * +-language_code_from_locale (const gchar *locale) +-{ +- if (!locale || !locale[0] || !locale[1]) +- return NULL; +- +- if (!locale[2] || locale[2] == '_' || locale[2] == '.') +- return g_strndup (locale, 2); +- +- if (!locale[3] || locale[3] == '_' || locale[3] == '.') +- return g_strndup (locale, 3); +- +- return NULL; +-} +- +-static gchar * +-build_xkb_group_string (const gchar *user, +- const gchar *locale, +- const gchar *latin) +-{ +- gchar *string; +- gsize length = 0; +- guint commas = 2; +- +- if (latin) +- length += strlen (latin); +- else +- commas -= 1; +- +- if (locale) +- length += strlen (locale); +- else +- commas -= 1; +- +- length += strlen (user) + commas + 1; +- +- string = malloc (length); +- +- if (locale && latin) +- sprintf (string, "%s,%s,%s", user, locale, latin); +- else if (locale) +- sprintf (string, "%s,%s", user, locale); +- else if (latin) +- sprintf (string, "%s,%s", user, latin); +- else +- sprintf (string, "%s", user); +- +- return string; +-} +- +-static gboolean +-layout_equal (const gchar *layout_a, +- const gchar *variant_a, +- const gchar *layout_b, +- const gchar *variant_b) +-{ +- return !g_strcmp0 (layout_a, layout_b) && !g_strcmp0 (variant_a, variant_b); +-} +- +-static void +-replace_layout_and_variant (GsdKeyboardManager *manager, +- XkbRF_VarDefsRec *xkb_var_defs, +- const gchar *layout, +- const gchar *variant) +-{ +- /* Toolkits need to know about both a latin layout to handle +- * accelerators which are usually defined like Ctrl+C and a +- * layout with the symbols for the language used in UI strings +- * to handle mnemonics like Alt+Ф, so we try to find and add +- * them in XKB group slots after the layout which the user +- * actually intends to type with. */ +- const gchar *latin_layout = "us"; +- const gchar *latin_variant = ""; +- const gchar *locale_layout = NULL; +- const gchar *locale_variant = NULL; +- const gchar *locale; +- gchar *language; +- +- if (!layout) +- return; +- +- if (!variant) +- variant = ""; +- +- locale = setlocale (LC_MESSAGES, NULL); +- /* If LANG is empty, default to en_US */ +- if (!locale) +- language = g_strdup (DEFAULT_LANGUAGE); +- else +- language = language_code_from_locale (locale); +- +- if (!language) +- language = language_code_from_locale (DEFAULT_LANGUAGE); +- +- gnome_xkb_info_get_layout_info_for_language (manager->priv->xkb_info, +- language, +- NULL, +- NULL, +- NULL, +- &locale_layout, +- &locale_variant); +- g_free (language); +- +- /* We want to minimize the number of XKB groups if we have +- * duplicated layout+variant pairs. +- * +- * Also, if a layout doesn't have a variant we still have to +- * include it in the variants string because the number of +- * variants must agree with the number of layouts. For +- * instance: +- * +- * layouts: "us,ru,us" +- * variants: "dvorak,," +- */ +- if (layout_equal (latin_layout, latin_variant, locale_layout, locale_variant) || +- layout_equal (latin_layout, latin_variant, layout, variant)) { +- latin_layout = NULL; +- latin_variant = NULL; +- } +- +- if (layout_equal (locale_layout, locale_variant, layout, variant)) { +- locale_layout = NULL; +- locale_variant = NULL; +- } +- +- free (xkb_var_defs->layout); +- xkb_var_defs->layout = build_xkb_group_string (layout, locale_layout, latin_layout); +- +- free (xkb_var_defs->variant); +- xkb_var_defs->variant = build_xkb_group_string (variant, locale_variant, latin_variant); +-} +- +-static gchar * +-build_xkb_options_string (gchar **options) +-{ +- gchar *string; +- +- if (*options) { +- gint i; +- gsize len; +- gchar *ptr; +- +- /* First part, getting length */ +- len = 1 + strlen (options[0]); +- for (i = 1; options[i] != NULL; i++) +- len += strlen (options[i]); +- len += (i - 1); /* commas */ +- +- /* Second part, building string */ +- string = malloc (len); +- ptr = g_stpcpy (string, *options); +- for (i = 1; options[i] != NULL; i++) { +- ptr = g_stpcpy (ptr, ","); +- ptr = g_stpcpy (ptr, options[i]); +- } +- } else { +- string = malloc (1); +- *string = '\0'; +- } +- +- return string; +-} +- +-static gchar ** +-append_options (gchar **a, +- gchar **b) +-{ +- gchar **c, **p; +- +- if (!a && !b) +- return NULL; +- else if (!a) +- return g_strdupv (b); +- else if (!b) +- return g_strdupv (a); +- +- c = g_new0 (gchar *, g_strv_length (a) + g_strv_length (b) + 1); +- p = c; +- +- while (*a) { +- *p = g_strdup (*a); +- p += 1; +- a += 1; +- } +- while (*b) { +- *p = g_strdup (*b); +- p += 1; +- b += 1; +- } +- +- return c; +-} +- +-static void +-add_xkb_options (GsdKeyboardManager *manager, +- XkbRF_VarDefsRec *xkb_var_defs, +- gchar **extra_options) +-{ +- gchar **options; +- gchar **settings_options; +- +- settings_options = g_settings_get_strv (manager->priv->input_sources_settings, +- KEY_KEYBOARD_OPTIONS); +- options = append_options (settings_options, extra_options); +- g_strfreev (settings_options); +- +- free (xkb_var_defs->options); +- xkb_var_defs->options = build_xkb_options_string (options); +- +- g_strfreev (options); ++ gdk_window_add_filter (NULL, ++ numlock_xkb_callback, ++ manager); + } + +-static void +-apply_xkb_settings (GsdKeyboardManager *manager, +- const gchar *layout, +- const gchar *variant, +- gchar **options) ++static guint ++_gsd_settings_get_uint (GSettings *settings, ++ const char *key) + { +- XkbRF_RulesRec *xkb_rules; +- XkbRF_VarDefsRec *xkb_var_defs; +- gchar *rules_file_path; +- +- gnome_xkb_info_get_var_defs (&rules_file_path, &xkb_var_defs); +- +- add_xkb_options (manager, xkb_var_defs, options); +- replace_layout_and_variant (manager, xkb_var_defs, layout, variant); +- +- gdk_error_trap_push (); +- +- xkb_rules = XkbRF_Load (rules_file_path, NULL, True, True); +- if (xkb_rules) { +- XkbComponentNamesRec *xkb_comp_names; +- xkb_comp_names = g_new0 (XkbComponentNamesRec, 1); +- +- XkbRF_GetComponents (xkb_rules, xkb_var_defs, xkb_comp_names); +- upload_xkb_description (rules_file_path, xkb_var_defs, xkb_comp_names); ++ guint value; + +- free_xkb_component_names (xkb_comp_names); +- XkbRF_Free (xkb_rules, True); +- } else { +- g_warning ("Couldn't load XKB rules"); +- } +- +- if (gdk_error_trap_pop ()) +- g_warning ("Error loading XKB rules"); +- +- gnome_xkb_info_free_var_defs (xkb_var_defs); +- g_free (rules_file_path); ++ g_settings_get (settings, key, "u", &value); ++ return value; + } + + static void +-set_gtk_im_module (GsdKeyboardManager *manager, +- const gchar *new_module) +-{ +- GsdKeyboardManagerPrivate *priv = manager->priv; +- gchar *current_module; +- +- current_module = g_settings_get_string (priv->interface_settings, +- KEY_GTK_IM_MODULE); +- if (!g_str_equal (current_module, new_module)) +- g_settings_set_string (priv->interface_settings, +- KEY_GTK_IM_MODULE, +- new_module); +- g_free (current_module); +-} +- +-static gboolean +-apply_input_sources_settings (GSettings *settings, +- gpointer keys, +- gint n_keys, +- GsdKeyboardManager *manager) ++apply_settings (GSettings *settings, ++ const char *key, ++ GsdKeyboardManager *manager) + { +- GsdKeyboardManagerPrivate *priv = manager->priv; +- GVariant *sources; +- guint current; +- guint n_sources; +- const gchar *type = NULL; +- const gchar *id = NULL; +- gchar *layout = NULL; +- gchar *variant = NULL; +- gchar **options = NULL; +- +- sources = g_settings_get_value (priv->input_sources_settings, KEY_INPUT_SOURCES); +- current = g_settings_get_uint (priv->input_sources_settings, KEY_CURRENT_INPUT_SOURCE); +- n_sources = g_variant_n_children (sources); +- +- if (n_sources < 1) +- goto exit; +- +- if (current >= n_sources) { +- g_settings_set_uint (priv->input_sources_settings, +- KEY_CURRENT_INPUT_SOURCE, +- n_sources - 1); +- goto exit; +- } +- +-#ifdef HAVE_IBUS +- maybe_start_ibus (manager, sources); +-#endif +- +- g_variant_get_child (sources, current, "(&s&s)", &type, &id); +- +- if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) { +- const gchar *l, *v; +- gnome_xkb_info_get_layout_info (priv->xkb_info, id, NULL, NULL, &l, &v); +- +- layout = g_strdup (l); +- variant = g_strdup (v); +- +- if (!layout || !layout[0]) { +- g_warning ("Couldn't find XKB input source '%s'", id); +- goto exit; +- } +- set_gtk_im_module (manager, GTK_IM_MODULE_SIMPLE); +-#ifdef HAVE_IBUS +- set_ibus_xkb_engine (manager, id); +-#endif +- } else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) { +-#ifdef HAVE_IBUS +- IBusEngineDesc *engine_desc = NULL; +- +- if (priv->session_is_fallback) +- goto exit; +- +- if (priv->ibus_engines) +- engine_desc = g_hash_table_lookup (priv->ibus_engines, id); +- else +- goto exit; /* we'll be called again when ibus is up and running */ +- +- if (engine_desc) { +- const gchar *ibus_layout; +- ibus_layout = ibus_engine_desc_get_layout (engine_desc); +- +- if (ibus_layout) { +- layout = layout_from_ibus_layout (ibus_layout); +- variant = variant_from_ibus_layout (ibus_layout); +- options = options_from_ibus_layout (ibus_layout); +- } +- } else { +- g_warning ("Couldn't find IBus input source '%s'", id); +- goto exit; +- } +- +- set_gtk_im_module (manager, GTK_IM_MODULE_IBUS); +- set_ibus_engine (manager, id); +-#else +- g_warning ("IBus input source type specified but IBus support was not compiled"); +-#endif +- } else { +- g_warning ("Unknown input source type '%s'", type); +- } +- +- exit: +- apply_xkb_settings (manager, layout, variant, options); +- g_variant_unref (sources); +- g_free (layout); +- g_free (variant); +- g_strfreev (options); +- /* Prevent individual "changed" signal invocations since we +- don't need them. */ +- return TRUE; +-} +- +-static void +-apply_bell (GsdKeyboardManager *manager) +-{ +- GSettings *settings; + XKeyboardControl kbdcontrol; ++ gboolean repeat; + gboolean click; ++ guint interval; ++ guint delay; ++ int click_volume; + int bell_volume; + int bell_pitch; + int bell_duration; + GsdBellMode bell_mode; +- int click_volume; ++ gboolean rnumlock; + +- g_debug ("Applying the bell settings"); +- settings = manager->priv->settings; ++ if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) ++ return; ++ ++ repeat = g_settings_get_boolean (settings, KEY_REPEAT); + click = g_settings_get_boolean (settings, KEY_CLICK); ++ interval = _gsd_settings_get_uint (settings, KEY_INTERVAL); ++ delay = _gsd_settings_get_uint (settings, KEY_DELAY); + click_volume = g_settings_get_int (settings, KEY_CLICK_VOLUME); +- + bell_pitch = g_settings_get_int (settings, KEY_BELL_PITCH); + bell_duration = g_settings_get_int (settings, KEY_BELL_DURATION); + + bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE); + bell_volume = (bell_mode == GSD_BELL_MODE_ON) ? 50 : 0; + +- /* as percentage from 0..100 inclusive */ +- if (click_volume < 0) { +- click_volume = 0; +- } else if (click_volume > 100) { +- click_volume = 100; +- } +- kbdcontrol.key_click_percent = click ? click_volume : 0; +- kbdcontrol.bell_percent = bell_volume; +- kbdcontrol.bell_pitch = bell_pitch; +- kbdcontrol.bell_duration = bell_duration; +- +- gdk_error_trap_push (); +- XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), +- KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, +- &kbdcontrol); +- +- XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); +- gdk_error_trap_pop_ignored (); +-} +- +-static void +-apply_numlock (GsdKeyboardManager *manager) +-{ +- GSettings *settings; +- gboolean rnumlock; +- +- g_debug ("Applying the num-lock settings"); +- settings = manager->priv->settings; +- rnumlock = g_settings_get_boolean (settings, KEY_REMEMBER_NUMLOCK_STATE); +- manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE); +- +- gdk_error_trap_push (); +- if (rnumlock) { +- g_debug ("Remember num-lock is set, so applying setting '%s'", +- num_lock_state_to_string (manager->priv->old_state)); +- numlock_set_xkb_state (manager->priv->old_state); +- } +- +- XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); +- gdk_error_trap_pop_ignored (); +-} +- +-static void +-apply_repeat (GsdKeyboardManager *manager) +-{ +- GSettings *settings; +- gboolean repeat; +- guint interval; +- guint delay; +- +- g_debug ("Applying the repeat settings"); +- settings = manager->priv->settings; +- repeat = g_settings_get_boolean (settings, KEY_REPEAT); +- interval = g_settings_get_uint (settings, KEY_INTERVAL); +- delay = g_settings_get_uint (settings, KEY_DELAY); +- + gdk_error_trap_push (); + if (repeat) { + gboolean rate_set = FALSE; +@@ -1249,319 +243,124 @@ + XAutoRepeatOff (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + } + +- XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); +- gdk_error_trap_pop_ignored (); +-} +- +-static void +-apply_all_settings (GsdKeyboardManager *manager) +-{ +- apply_repeat (manager); +- apply_bell (manager); +- apply_numlock (manager); +-} +- +-static void +-set_input_sources_switcher (GsdKeyboardManager *manager, +- gboolean state) +-{ +- if (state) { +- GError *error = NULL; +- char *args[2]; +- +- if (manager->priv->input_sources_switcher_spawned) +- set_input_sources_switcher (manager, FALSE); +- +- args[0] = LIBEXECDIR "/gsd-input-sources-switcher"; +- args[1] = NULL; +- +- g_spawn_async (NULL, args, NULL, +- 0, NULL, NULL, +- &manager->priv->input_sources_switcher_pid, &error); +- +- manager->priv->input_sources_switcher_spawned = (error == NULL); +- +- if (error) { +- g_warning ("Couldn't spawn %s: %s", args[0], error->message); +- g_error_free (error); +- } +- } else if (manager->priv->input_sources_switcher_spawned) { +- kill (manager->priv->input_sources_switcher_pid, SIGHUP); +- g_spawn_close_pid (manager->priv->input_sources_switcher_pid); +- manager->priv->input_sources_switcher_spawned = FALSE; ++ /* as percentage from 0..100 inclusive */ ++ if (click_volume < 0) { ++ click_volume = 0; ++ } else if (click_volume > 100) { ++ click_volume = 100; + } +-} +- +-static gboolean +-enable_switcher (GsdKeyboardManager *manager) +-{ +- GsdInputSourcesSwitcher switcher; ++ kbdcontrol.key_click_percent = click ? click_volume : 0; ++ kbdcontrol.bell_percent = bell_volume; ++ kbdcontrol.bell_pitch = bell_pitch; ++ kbdcontrol.bell_duration = bell_duration; ++ XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), ++ KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, ++ &kbdcontrol); + +- switcher = g_settings_get_enum (manager->priv->settings, KEY_SWITCHER); ++ if (g_strcmp0 (key, "remember-numlock-state") == 0 || key == NULL) { ++ rnumlock = g_settings_get_boolean (settings, "remember-numlock-state"); + +- return switcher != GSD_INPUT_SOURCES_SWITCHER_OFF; +-} ++ manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE); + +-static void +-settings_changed (GSettings *settings, +- const char *key, +- GsdKeyboardManager *manager) +-{ +- if (g_strcmp0 (key, KEY_CLICK) == 0|| +- g_strcmp0 (key, KEY_CLICK_VOLUME) == 0 || +- g_strcmp0 (key, KEY_BELL_PITCH) == 0 || +- g_strcmp0 (key, KEY_BELL_DURATION) == 0 || +- g_strcmp0 (key, KEY_BELL_MODE) == 0) { +- g_debug ("Bell setting '%s' changed, applying bell settings", key); +- apply_bell (manager); +- } else if (g_strcmp0 (key, KEY_REMEMBER_NUMLOCK_STATE) == 0) { +- g_debug ("Remember Num-Lock state '%s' changed, applying num-lock settings", key); +- apply_numlock (manager); +- } else if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) { +- g_debug ("Num-Lock state '%s' changed, will apply at next startup", key); +- } else if (g_strcmp0 (key, KEY_REPEAT) == 0 || +- g_strcmp0 (key, KEY_INTERVAL) == 0 || +- g_strcmp0 (key, KEY_DELAY) == 0) { +- g_debug ("Key repeat setting '%s' changed, applying key repeat settings", key); +- apply_repeat (manager); +- } else if (g_strcmp0 (key, KEY_SWITCHER) == 0) { +- set_input_sources_switcher (manager, enable_switcher (manager)); +- } else { +- g_warning ("Unhandled settings change, key '%s'", key); ++ if (manager->priv->have_xkb && rnumlock) ++ numlock_set_xkb_state (manager->priv->old_state); + } + ++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); ++ gdk_error_trap_pop_ignored (); + } + +-static void +-device_added_cb (GdkDeviceManager *device_manager, +- GdkDevice *device, +- GsdKeyboardManager *manager) +-{ +- GdkInputSource source; +- +- source = gdk_device_get_source (device); +- if (source == GDK_SOURCE_KEYBOARD) { +- g_debug ("New keyboard plugged in, applying all settings"); +- apply_all_settings (manager); +- apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); +- run_custom_command (device, COMMAND_DEVICE_ADDED); +- } +-} +- +-static void +-device_removed_cb (GdkDeviceManager *device_manager, +- GdkDevice *device, +- GsdKeyboardManager *manager) +-{ +- GdkInputSource source; +- +- source = gdk_device_get_source (device); +- if (source == GDK_SOURCE_KEYBOARD) { +- run_custom_command (device, COMMAND_DEVICE_REMOVED); +- } +-} +- +-static void +-set_devicepresence_handler (GsdKeyboardManager *manager) +-{ +- GdkDeviceManager *device_manager; +- +- device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); +- +- manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", +- G_CALLBACK (device_added_cb), manager); +- manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", +- G_CALLBACK (device_removed_cb), manager); +- manager->priv->device_manager = device_manager; +-} +- +-static void +-create_sources_from_current_xkb_config (GSettings *settings) +-{ +- GVariantBuilder builder; +- XkbRF_VarDefsRec *xkb_var_defs; +- gchar *tmp; +- gchar **layouts = NULL; +- gchar **variants = NULL; +- guint i, n; +- +- gnome_xkb_info_get_var_defs (&tmp, &xkb_var_defs); +- g_free (tmp); +- +- if (xkb_var_defs->layout) +- layouts = g_strsplit (xkb_var_defs->layout, ",", 0); +- if (xkb_var_defs->variant) +- variants = g_strsplit (xkb_var_defs->variant, ",", 0); +- +- gnome_xkb_info_free_var_defs (xkb_var_defs); +- +- if (!layouts) +- goto out; +- +- if (variants && variants[0]) +- n = MIN (g_strv_length (layouts), g_strv_length (variants)); +- else +- n = g_strv_length (layouts); +- +- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); +- for (i = 0; i < n && layouts[i][0]; ++i) { +- if (variants && variants[i] && variants[i][0]) +- tmp = g_strdup_printf ("%s+%s", layouts[i], variants[i]); +- else +- tmp = g_strdup (layouts[i]); +- +- g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, tmp); +- g_free (tmp); +- } +- g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +-out: +- g_strfreev (layouts); +- g_strfreev (variants); +-} +- +-static void +-convert_libgnomekbd_options (GSettings *settings) ++void ++gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager) + { +- GPtrArray *opt_array; +- GSettings *libgnomekbd_settings; +- gchar **options, **o; +- +- if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard")) +- return; +- +- opt_array = g_ptr_array_new_with_free_func (g_free); +- +- libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard"); +- options = g_settings_get_strv (libgnomekbd_settings, "options"); +- +- for (o = options; *o; ++o) { +- gchar **strv; +- +- strv = g_strsplit (*o, "\t", 2); +- if (strv[0] && strv[1]) { +- /* We don't want the group switcher because +- * it's incompatible with the way we use XKB +- * groups. */ +- if (!g_str_has_prefix (strv[1], "grp:")) +- g_ptr_array_add (opt_array, g_strdup (strv[1])); +- } +- g_strfreev (strv); +- } +- g_ptr_array_add (opt_array, NULL); +- +- g_settings_set_strv (settings, KEY_KEYBOARD_OPTIONS, (const gchar * const*) opt_array->pdata); +- +- g_strfreev (options); +- g_object_unref (libgnomekbd_settings); +- g_ptr_array_free (opt_array, TRUE); ++ apply_settings (manager->priv->settings, NULL, manager); + } + + static void +-convert_libgnomekbd_layouts (GSettings *settings) ++apply_libgnomekbd_settings (GSettings *settings, ++ const char *key, ++ GsdKeyboardManager *manager) + { +- GVariantBuilder builder; +- GSettings *libgnomekbd_settings; +- gchar **layouts, **l; +- +- if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard")) +- return; ++ gchar **layouts; + +- init_builder_with_sources (&builder, settings); ++ layouts = g_settings_get_strv (settings, LIBGNOMEKBD_KEY_LAYOUTS); + +- libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard"); +- layouts = g_settings_get_strv (libgnomekbd_settings, "layouts"); +- +- for (l = layouts; *l; ++l) { +- gchar *id; +- gchar **strv; +- +- strv = g_strsplit (*l, "\t", 2); +- if (strv[0] && !strv[1]) +- id = g_strdup (strv[0]); +- else if (strv[0] && strv[1]) +- id = g_strdup_printf ("%s+%s", strv[0], strv[1]); +- else +- id = NULL; +- +- if (id) +- g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, id); +- +- g_free (id); +- g_strfreev (strv); +- } +- +- g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +- +- g_strfreev (layouts); +- g_object_unref (libgnomekbd_settings); +-} +- +-static void +-maybe_convert_old_settings (GSettings *settings) +-{ +- GVariant *sources; +- gchar **options; +- gchar *stamp_dir_path = NULL; +- gchar *stamp_file_path = NULL; ++ /* Get accounts daemon */ ++ GDBusProxy *proxy = NULL; ++ GDBusProxy *user = NULL; ++ GVariant *variant = NULL; + GError *error = NULL; ++ gchar *object_path = NULL; + +- stamp_dir_path = g_build_filename (g_get_user_data_dir (), PACKAGE_NAME, NULL); +- if (g_mkdir_with_parents (stamp_dir_path, 0755)) { +- g_warning ("Failed to create directory %s: %s", stamp_dir_path, g_strerror (errno)); +- goto out; +- } ++ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ "org.freedesktop.Accounts", ++ "/org/freedesktop/Accounts", ++ "org.freedesktop.Accounts", ++ NULL, ++ &error); + +- stamp_file_path = g_build_filename (stamp_dir_path, "input-sources-converted", NULL); +- if (g_file_test (stamp_file_path, G_FILE_TEST_EXISTS)) +- goto out; +- +- sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); +- if (g_variant_n_children (sources) < 1) { +- convert_libgnomekbd_layouts (settings); +-#ifdef HAVE_IBUS +- convert_ibus (settings); +-#endif ++ if (proxy == NULL) { ++ g_warning ("Failed to contact accounts service: %s", error->message); ++ g_error_free (error); ++ goto bail; + } +- g_variant_unref (sources); + +- options = g_settings_get_strv (settings, KEY_KEYBOARD_OPTIONS); +- if (g_strv_length (options) < 1) +- convert_libgnomekbd_options (settings); +- g_strfreev (options); ++ variant = g_dbus_proxy_call_sync (proxy, ++ "FindUserByName", ++ g_variant_new ("(s)", g_get_user_name ()), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ &error); + +- if (!g_file_set_contents (stamp_file_path, "", 0, &error)) { +- g_warning ("%s", error->message); ++ if (variant == NULL) { ++ g_warning ("Could not contact accounts service to look up '%s': %s", ++ g_get_user_name (), error->message); + g_error_free (error); ++ goto bail; + } +-out: +- g_free (stamp_file_path); +- g_free (stamp_dir_path); +-} + +-static void +-maybe_create_input_sources (GsdKeyboardManager *manager) +-{ +- GSettings *settings; +- GVariant *sources; +- +- settings = manager->priv->input_sources_settings; ++ g_variant_get (variant, "(o)", &object_path); ++ user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ "org.freedesktop.Accounts", ++ object_path, ++ "org.freedesktop.Accounts.User", ++ NULL, ++ &error); ++ g_free (object_path); + +- if (g_getenv ("RUNNING_UNDER_GDM")) { +- create_sources_from_current_xkb_config (settings); +- return; ++ if (user == NULL) { ++ g_warning ("Could not create proxy for user '%s': %s", ++ g_variant_get_string (variant, NULL), error->message); ++ g_error_free (error); ++ goto bail; + } ++ g_variant_unref (variant); + +- maybe_convert_old_settings (settings); ++ variant = g_dbus_proxy_call_sync (user, ++ "SetXKeyboardLayouts", ++ g_variant_new ("(^as)", layouts), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ &error); + +- /* if we still don't have anything do some educated guesses */ +- sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); +- if (g_variant_n_children (sources) < 1) { +- create_sources_from_current_xkb_config (settings); +-#ifdef HAVE_IBUS +- add_ibus_sources_from_locale (settings); +-#endif ++ if (variant == NULL) { ++ g_warning ("Failed to set the keyboard layouts: %s", error->message); ++ g_error_free (error); ++ goto bail; + } +- g_variant_unref (sources); ++ ++bail: ++ if (proxy != NULL) ++ g_object_unref (proxy); ++ if (variant != NULL) ++ g_variant_unref (variant); ++ g_strfreev (layouts); + } + + static gboolean +@@ -1571,41 +370,26 @@ + + g_debug ("Starting keyboard manager"); + ++ manager->priv->have_xkb = 0; + manager->priv->settings = g_settings_new (GSD_KEYBOARD_DIR); ++ manager->priv->libgnomekbd_settings = g_settings_new (LIBGNOMEKBD_KEYBOARD_DIR); + +- xkb_init (manager); ++ /* Essential - xkb initialization should happen before */ ++ gsd_keyboard_xkb_init (manager); + +- set_devicepresence_handler (manager); ++ numlock_xkb_init (manager); + +- manager->priv->input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); +- manager->priv->interface_settings = g_settings_new (GNOME_DESKTOP_INTERFACE_DIR); +- manager->priv->xkb_info = gnome_xkb_info_new (); +- +- maybe_create_input_sources (manager); +- +-#ifdef HAVE_IBUS +- /* We don't want to touch IBus until we are sure this isn't a +- fallback session. */ +- manager->priv->session_is_fallback = TRUE; +- manager->priv->ibus_cancellable = g_cancellable_new (); +- g_bus_get (G_BUS_TYPE_SESSION, +- manager->priv->ibus_cancellable, +- (GAsyncReadyCallback)got_bus, +- manager); +-#else +- apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager); +-#endif + /* apply current settings before we install the callback */ +- g_debug ("Started the keyboard plugin, applying all settings"); +- apply_all_settings (manager); ++ gsd_keyboard_manager_apply_settings (manager); + + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", +- G_CALLBACK (settings_changed), manager); +- g_signal_connect (G_OBJECT (manager->priv->input_sources_settings), "change-event", +- G_CALLBACK (apply_input_sources_settings), manager); ++ G_CALLBACK (apply_settings), manager); ++ ++ apply_libgnomekbd_settings (manager->priv->libgnomekbd_settings, NULL, manager); ++ g_signal_connect (G_OBJECT (manager->priv->libgnomekbd_settings), "changed", ++ G_CALLBACK (apply_libgnomekbd_settings), manager); + +- install_xkb_filter (manager); +- set_input_sources_switcher (manager, enable_switcher (manager)); ++ numlock_install_xkb_callback (manager); + + gnome_settings_profile_end (NULL); + +@@ -1620,11 +404,6 @@ + { + gnome_settings_profile_start (NULL); + +- if (check_xkb_extension (manager) == FALSE) { +- g_debug ("XKB is not supported, not applying any settings"); +- return TRUE; +- } +- + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager); + + gnome_settings_profile_end (NULL); +@@ -1639,24 +418,37 @@ + + g_debug ("Stopping keyboard manager"); + +- g_clear_object (&p->settings); +- g_clear_object (&p->input_sources_settings); +- g_clear_object (&p->interface_settings); +- g_clear_object (&p->xkb_info); ++ if (p->settings != NULL) { ++ g_object_unref (p->settings); ++ p->settings = NULL; ++ } + +-#ifdef HAVE_IBUS +- clear_ibus (manager); +-#endif ++ if (p->libgnomekbd_settings != NULL) { ++ g_object_unref (p->libgnomekbd_settings); ++ p->libgnomekbd_settings = NULL; ++ } + +- if (p->device_manager != NULL) { +- g_signal_handler_disconnect (p->device_manager, p->device_added_id); +- g_signal_handler_disconnect (p->device_manager, p->device_removed_id); +- p->device_manager = NULL; ++ if (p->have_xkb) { ++ gdk_window_remove_filter (NULL, ++ numlock_xkb_callback, ++ manager); + } + +- remove_xkb_filter (manager); ++ gsd_keyboard_xkb_shutdown (); ++} ++ ++static GObject * ++gsd_keyboard_manager_constructor (GType type, ++ guint n_construct_properties, ++ GObjectConstructParam *construct_properties) ++{ ++ GsdKeyboardManager *keyboard_manager; ++ ++ keyboard_manager = GSD_KEYBOARD_MANAGER (G_OBJECT_CLASS (gsd_keyboard_manager_parent_class)->constructor (type, ++ n_construct_properties, ++ construct_properties)); + +- set_input_sources_switcher (manager, FALSE); ++ return G_OBJECT (keyboard_manager); + } + + static void +@@ -1664,6 +456,7 @@ + { + GObjectClass *object_class = G_OBJECT_CLASS (klass); + ++ object_class->constructor = gsd_keyboard_manager_constructor; + object_class->finalize = gsd_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdKeyboardManagerPrivate)); +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-manager.h +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/keyboard/gsd-keyboard-manager.h 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-manager.h 2013-02-18 12:57:16.523698776 +0000 +@@ -51,6 +51,7 @@ + gboolean gsd_keyboard_manager_start (GsdKeyboardManager *manager, + GError **error); + void gsd_keyboard_manager_stop (GsdKeyboardManager *manager); ++void gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager); + + G_END_DECLS + +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-xkb.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-xkb.c 2013-02-18 12:57:16.523698776 +0000 +@@ -0,0 +1,851 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * ++ * Copyright (C) 2001 Udaltsoft ++ * ++ * Written by Sergey V. Oudaltsov ++ * ++ * 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, 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 ++#include ++ ++#include ++#include ++#include ++#include ++ ++#ifndef HAVE_APPINDICATOR ++#include ++#endif ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef HAVE_APPINDICATOR ++#include ++#include "gkbd-configuration.h" ++#endif ++ ++#include "gsd-keyboard-xkb.h" ++#include "delayed-dialog.h" ++#include "gnome-settings-profile.h" ++ ++#define SETTINGS_KEYBOARD_DIR "org.gnome.settings-daemon.plugins.keyboard" ++ ++static GsdKeyboardManager *manager = NULL; ++ ++static XklEngine *xkl_engine; ++static XklConfigRegistry *xkl_registry = NULL; ++ ++static GkbdDesktopConfig current_config; ++static GkbdKeyboardConfig current_kbd_config; ++ ++/* never terminated */ ++static GkbdKeyboardConfig initial_sys_kbd_config; ++ ++static gboolean inited_ok = FALSE; ++ ++static GSettings *settings_desktop = NULL; ++static GSettings *settings_keyboard = NULL; ++ ++static PostActivationCallback pa_callback = NULL; ++static void *pa_callback_user_data = NULL; ++ ++#ifdef HAVE_APPINDICATOR ++static AppIndicator *app_indicator = NULL; ++static GkbdConfiguration *gkbd_configuration = NULL; ++static GkbdIndicatorConfig current_ind_config; ++static GSList *groups_items_group = NULL; ++static size_t lang_menu_items = 0; ++ ++static void state_callback (XklEngine * engine, ++ XklEngineStateChange changeType, ++ gint group, gboolean restore); ++static void gsd_keyboard_configuration_changed (GkbdConfiguration *configuration); ++ ++#else ++static GtkStatusIcon *icon = NULL; ++#endif ++ ++static GHashTable *preview_dialogs = NULL; ++ ++static void ++activation_error (void) ++{ ++ char const *vendor; ++ GtkWidget *dialog; ++ ++ vendor = ++ ServerVendor (GDK_DISPLAY_XDISPLAY ++ (gdk_display_get_default ())); ++ ++ /* VNC viewers will not work, do not barrage them with warnings */ ++ if (NULL != vendor && NULL != strstr (vendor, "VNC")) ++ return; ++ ++ dialog = gtk_message_dialog_new_with_markup (NULL, ++ 0, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_CLOSE, ++ _ ++ ("Error activating XKB configuration.\n" ++ "There can be various reasons for that.\n\n" ++ "If you report this situation as a bug, include the results of\n" ++ " • %s\n" ++ " • %s\n" ++ " • %s\n" ++ " • %s"), ++ "xprop -root | grep XKB", ++ "gsettings get org.gnome.libgnomekbd.keyboard model", ++ "gsettings get org.gnome.libgnomekbd.keyboard layouts", ++ "gsettings get org.gnome.libgnomekbd.keyboard options"); ++ g_signal_connect (dialog, "response", ++ G_CALLBACK (gtk_widget_destroy), NULL); ++ gsd_delayed_show_dialog (dialog); ++} ++ ++static gboolean ++ensure_xkl_registry (void) ++{ ++ if (!xkl_registry) { ++ xkl_registry = ++ xkl_config_registry_get_instance (xkl_engine); ++ /* load all materials, unconditionally! */ ++ if (!xkl_config_registry_load (xkl_registry, TRUE)) { ++ g_object_unref (xkl_registry); ++ xkl_registry = NULL; ++ return FALSE; ++ } ++ } ++ ++ return TRUE; ++} ++ ++static void ++apply_desktop_settings (void) ++{ ++ if (!inited_ok) ++ return; ++ ++ gsd_keyboard_manager_apply_settings (manager); ++ gkbd_desktop_config_load (¤t_config); ++ /* again, probably it would be nice to compare things ++ before activating them */ ++ gkbd_desktop_config_activate (¤t_config); ++} ++ ++static void ++popup_menu_launch_capplet () ++{ ++ GAppInfo *info; ++ GdkAppLaunchContext *ctx; ++ GError *error = NULL; ++ ++ info = ++ g_app_info_create_from_commandline ++ ("gnome-control-center region", NULL, 0, &error); ++ ++ if (info != NULL) { ++ ctx = ++ gdk_display_get_app_launch_context ++ (gdk_display_get_default ()); ++ ++ if (g_app_info_launch (info, NULL, ++ G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) { ++ g_warning ++ ("Could not execute keyboard properties capplet: [%s]\n", ++ error->message); ++ g_error_free (error); ++ } ++ ++ g_object_unref (info); ++ g_object_unref (ctx); ++ } ++ ++} ++ ++static void ++show_layout_destroy (GtkWidget * dialog, gint group) ++{ ++ g_hash_table_remove (preview_dialogs, GINT_TO_POINTER (group)); ++} ++ ++static void ++popup_menu_show_layout () ++{ ++ GtkWidget *dialog; ++ XklEngine *engine = ++ xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY ++ (gdk_display_get_default ())); ++ XklState *xkl_state = xkl_engine_get_current_state (engine); ++#ifdef HAVE_APPINDICATOR ++ gchar **group_names = gkbd_configuration_get_group_names (gkbd_configuration); ++#else ++ gchar **group_names = gkbd_status_get_group_names (); ++#endif ++ gpointer p = g_hash_table_lookup (preview_dialogs, ++ GINT_TO_POINTER ++ (xkl_state->group)); ++ ++ if (xkl_state->group < 0 ++ || xkl_state->group >= g_strv_length (group_names)) { ++ return; ++ } ++ ++ if (p != NULL) { ++ /* existing window */ ++ gtk_window_present (GTK_WINDOW (p)); ++ return; ++ } ++ ++ if (!ensure_xkl_registry ()) ++ return; ++ ++ dialog = gkbd_keyboard_drawing_dialog_new (); ++ gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group); ++ ++ g_signal_connect (dialog, "destroy", ++ G_CALLBACK (show_layout_destroy), ++ GINT_TO_POINTER (xkl_state->group)); ++ g_hash_table_insert (preview_dialogs, ++ GINT_TO_POINTER (xkl_state->group), dialog); ++ gtk_widget_show_all (dialog); ++} ++ ++static void ++popup_menu_set_group (gint group_number, gboolean only_menu) ++{ ++#ifdef HAVE_APPINDICATOR ++ XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration); ++#else ++ XklEngine *engine = gkbd_status_get_xkl_engine (); ++#endif ++ XklState *st = xkl_engine_get_current_state(engine); ++ Window cur; ++ st->group = group_number; ++ xkl_engine_allow_one_switch_to_secondary_group (engine); ++ cur = xkl_engine_get_current_window (engine); ++ if (cur != (Window) NULL) { ++ xkl_debug (150, "Enforcing the state %d for window %lx\n", ++ st->group, cur); ++#ifdef HAVE_APPINDICATOR ++ // Setting the state may trigger state_callback to be called, which will then ++ // cause popup_menu_set_group to be called again. ++ g_signal_handlers_block_by_func (engine, G_CALLBACK (state_callback), NULL); ++#endif ++ xkl_engine_save_state (engine, ++ xkl_engine_get_current_window ++ (engine), st); ++#ifdef HAVE_APPINDICATOR ++ g_signal_handlers_unblock_by_func (engine, G_CALLBACK (state_callback), NULL); ++#endif ++/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ ++ } else { ++ xkl_debug (150, ++ "??? Enforcing the state %d for unknown window\n", ++ st->group); ++ /* strange situation - bad things can happen */ ++ } ++ if (!only_menu) ++ xkl_engine_lock_group (engine, st->group); ++#ifdef HAVE_APPINDICATOR ++ XklConfigRec * xklrec = xkl_config_rec_new(); ++ xkl_config_rec_get_from_server (xklrec, engine); ++ XklConfigRegistry *registry = xkl_config_registry_get_instance(engine); ++ ++ gkbd_keyboard_config_load_from_x_current (¤t_kbd_config, xklrec); ++ xkl_config_registry_load (registry, current_config.load_extra_items); ++ ++ int g; ++ ++ if (current_ind_config.show_flags) { ++ gchar *image_file = gkbd_indicator_config_get_images_file (¤t_ind_config, ++ ¤t_kbd_config, ++ st->group); ++ ++ ++ app_indicator_set_icon_full(app_indicator, image_file, _("Keyboard")); ++ app_indicator_set_label(app_indicator, NULL, NULL); ++ g_free(image_file); ++ } else { ++ gchar * guide = "XXX"; ++ gchar ** shortnames; ++ gchar ** longnames; ++ gchar * layout_name = NULL; ++ gchar * lname = NULL; ++ GHashTable *ln2cnt_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); ++ ++ gkbd_desktop_config_load_group_descriptions(¤t_config, registry, ++ (const gchar **) xklrec->layouts, ++ (const gchar **) xklrec->variants, ++ &shortnames, ++ &longnames); ++ ++ for (g = 0; g < g_strv_length (shortnames);g++) { ++ gpointer pcounter = NULL; ++ gchar *prev_layout_name = NULL; ++ int counter = 0; ++ ++ if (g < g_strv_length (shortnames)) { ++ if (xkl_engine_get_features (engine) & ++ XKLF_MULTIPLE_LAYOUTS_SUPPORTED) { ++ gchar *longname = (gchar *) current_kbd_config.layouts_variants[g]; ++ gchar *variant_name; ++ if (!gkbd_keyboard_config_split_items (longname, &lname, &variant_name)) ++ /* just in case */ ++ lname = longname; ++ ++ if (shortnames != NULL) { ++ gchar *shortname = shortnames[g]; ++ if (shortname != NULL && *shortname != '\0') { ++ lname = shortname; ++ } ++ } ++ } else { ++ lname = longnames[g]; ++ } ++ } ++ if (lname == NULL) ++ lname = ""; ++ ++ /* Process layouts with repeating description */ ++ if (g_hash_table_lookup_extended (ln2cnt_map, lname, (gpointer *) & prev_layout_name, &pcounter)) { ++ /* "next" same description */ ++ counter = GPOINTER_TO_INT (pcounter); ++ guide = "XXX1"; ++ } ++ g_hash_table_insert (ln2cnt_map, g_strdup (lname), GINT_TO_POINTER (counter+1)); ++ ++ if (st->group == g) { ++ if (counter > 0) { ++ gchar appendix[10] = ""; ++ gint utf8length; ++ gunichar cidx; ++ /* Unicode subscript 2, 3, 4 */ ++ cidx = 0x2081 + counter; ++ utf8length = g_unichar_to_utf8 (cidx, appendix); ++ appendix[utf8length] = '\0'; ++ layout_name = g_strconcat (lname, appendix, NULL); ++ } else { ++ layout_name = g_strdup(lname); ++ } ++ } ++ } ++ ++ // Guide of 3 wide-ish and one thin ++ app_indicator_set_label(app_indicator, layout_name, guide); ++ g_hash_table_destroy(ln2cnt_map); ++ g_free(layout_name); ++ g_strfreev(longnames); ++ g_strfreev(shortnames); ++ } ++ ++ // Refresh popup menu ++ gsd_keyboard_configuration_changed (gkbd_configuration); ++ ++ g_object_unref (G_OBJECT (xklrec)); ++ g_object_unref (G_OBJECT (registry)); ++#endif ++} ++ ++static void ++popup_menu_set_group_cb (GtkMenuItem * item, gpointer param) ++{ ++ gint group_number = GPOINTER_TO_INT (param); ++ ++#ifdef HAVE_APPINDICATOR ++ if ((item) != NULL && (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))) ++ return; ++#endif ++ ++ popup_menu_set_group(group_number, FALSE); ++} ++ ++#ifdef HAVE_APPINDICATOR ++static void ++state_callback (XklEngine * engine, ++ XklEngineStateChange changeType, ++ gint group, gboolean restore) ++{ ++ if ((changeType == GROUP_CHANGED) || (changeType == INDICATORS_CHANGED)) ++ popup_menu_set_group (GINT_TO_POINTER(group), TRUE); ++} ++ ++static int ++get_current_group(void) ++{ ++ XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration); ++ return xkl_engine_get_current_window_group (engine); ++} ++#endif ++ ++static GtkMenu * ++create_status_menu (void) ++{ ++ GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ()); ++ int i = 0; ++#ifdef HAVE_APPINDICATOR ++ const char * const *current_name = gkbd_configuration_get_group_names (gkbd_configuration); ++ groups_items_group = NULL; ++ GtkWidget *item; ++ int group = get_current_group(); ++ lang_menu_items = 0; ++#else ++ GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ()); ++ gchar **current_name = gkbd_status_get_group_names (); ++ ++ GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Layouts")); ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), ++ GTK_WIDGET (groups_menu)); ++ ++ item = gtk_menu_item_new_with_mnemonic (_("Show _Keyboard Layout...")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_show_layout, NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ ++ /* translators note: ++ * This is the name of the gnome-control-center "region" panel */ ++ item = gtk_menu_item_new_with_mnemonic (_("Region and Language Settings")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++#endif ++ ++ for (i = 0; current_name && *current_name; i++, current_name++) { ++#ifdef HAVE_APPINDICATOR ++ item = gtk_radio_menu_item_new_with_label (groups_items_group, *current_name); ++ groups_items_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); ++ ++ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), ++ i == group); ++ ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ g_signal_connect (item, "activate", ++ G_CALLBACK (popup_menu_set_group_cb), ++ GINT_TO_POINTER (i)); ++ lang_menu_items++; ++#else ++ gchar *image_file = gkbd_status_get_image_filename (i); ++ ++ if (image_file == NULL) { ++ item = ++ gtk_menu_item_new_with_label (*current_name); ++ } else { ++ GdkPixbuf *pixbuf = ++ gdk_pixbuf_new_from_file_at_size (image_file, ++ 24, 24, ++ NULL); ++ GtkWidget *img = ++ gtk_image_new_from_pixbuf (pixbuf); ++ item = ++ gtk_image_menu_item_new_with_label ++ (*current_name); ++ gtk_widget_show (img); ++ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM ++ (item), img); ++ gtk_image_menu_item_set_always_show_image ++ (GTK_IMAGE_MENU_ITEM (item), TRUE); ++ g_free (image_file); ++ } ++ gtk_widget_show (item); ++ gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item); ++ g_signal_connect (item, "activate", ++ G_CALLBACK (popup_menu_set_group_cb), ++ GINT_TO_POINTER (i)); ++#endif ++ } ++ ++#ifdef HAVE_APPINDICATOR ++ item = gtk_separator_menu_item_new(); ++ gtk_widget_show(item); ++ gtk_menu_shell_append(GTK_MENU_SHELL (popup_menu), item); ++ ++ item = ++ gtk_menu_item_new_with_mnemonic (_("Show _Layout Chart")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_show_layout, ++ NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++ ++ item = gtk_menu_item_new_with_mnemonic (_("Keyboard Layout _Settings...")); ++ gtk_widget_show (item); ++ g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); ++ gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); ++#endif ++ ++ return popup_menu; ++} ++ ++#ifndef HAVE_APPINDICATOR ++static void ++status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time) ++{ ++ GtkMenu *popup_menu = create_status_menu (); ++ ++ gtk_menu_popup (popup_menu, NULL, NULL, ++ gtk_status_icon_position_menu, ++ (gpointer) icon, button, time); ++} ++#endif ++ ++#ifdef HAVE_APPINDICATOR ++static void ++scroll_event (AppIndicator *indicator, gint delta, guint direction) ++{ ++ g_return_if_fail(IS_APP_INDICATOR(indicator)); ++ int group = get_current_group(); ++ ++ if ((direction == 0 && group == 0) || ++ (direction == 1 && group == lang_menu_items-1)) ++ return; ++ ++ popup_menu_set_group((direction == 0 ? group-1 : group+1), FALSE); ++} ++#endif ++ ++static void ++show_hide_icon () ++{ ++ if (g_strv_length (current_kbd_config.layouts_variants) > 1) { ++#ifdef HAVE_APPINDICATOR ++ if (app_indicator == NULL) { ++ GtkMenu *popup_menu = create_status_menu (); ++ ++ app_indicator = app_indicator_new ("keyboard", ++ "keyboard", ++ APP_INDICATOR_CATEGORY_HARDWARE); ++ int group = get_current_group(); ++ popup_menu_set_group(GINT_TO_POINTER(group), TRUE); ++ app_indicator_set_status (app_indicator, ++ APP_INDICATOR_STATUS_ACTIVE); ++ app_indicator_set_menu (app_indicator, ++ popup_menu); ++ app_indicator_set_title (app_indicator, _("Keyboard")); ++ g_signal_connect (app_indicator, "scroll-event", G_CALLBACK (scroll_event), NULL); ++ } else { ++ XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration); ++ XklState *st = xkl_engine_get_current_state(engine); ++ popup_menu_set_group(GINT_TO_POINTER(st->group), TRUE); ++ } ++#else ++ if (icon == NULL) { ++ xkl_debug (150, "Creating keyboard status icon\n"); ++ icon = gkbd_status_new (); ++ g_signal_connect (icon, "popup-menu", ++ G_CALLBACK ++ (status_icon_popup_menu_cb), ++ NULL); ++ ++ } ++#endif ++ } else { ++#ifdef HAVE_APPINDICATOR ++ g_clear_object (&app_indicator); ++#else ++ if (icon != NULL) { ++ xkl_debug (150, "Destroying icon\n"); ++ g_object_unref (icon); ++ icon = NULL; ++ } ++#endif ++ } ++} ++ ++static gboolean ++try_activating_xkb_config_if_new (GkbdKeyboardConfig * ++ current_sys_kbd_config) ++{ ++ /* Activate - only if different! */ ++ if (!gkbd_keyboard_config_equals ++ (¤t_kbd_config, current_sys_kbd_config)) { ++ if (gkbd_keyboard_config_activate (¤t_kbd_config)) { ++ if (pa_callback != NULL) { ++ (*pa_callback) (pa_callback_user_data); ++ return TRUE; ++ } ++ } else { ++ return FALSE; ++ } ++ } ++ return TRUE; ++} ++ ++static gboolean ++filter_xkb_config (void) ++{ ++ XklConfigItem *item; ++ gchar *lname; ++ gchar *vname; ++ gchar **lv; ++ gboolean any_change = FALSE; ++ ++ xkl_debug (100, "Filtering configuration against the registry\n"); ++ if (!ensure_xkl_registry ()) ++ return FALSE; ++ ++ lv = current_kbd_config.layouts_variants; ++ item = xkl_config_item_new (); ++ while (*lv) { ++ xkl_debug (100, "Checking [%s]\n", *lv); ++ if (gkbd_keyboard_config_split_items (*lv, &lname, &vname)) { ++ gboolean should_be_dropped = FALSE; ++ g_snprintf (item->name, sizeof (item->name), "%s", ++ lname); ++ if (!xkl_config_registry_find_layout ++ (xkl_registry, item)) { ++ xkl_debug (100, "Bad layout [%s]\n", ++ lname); ++ should_be_dropped = TRUE; ++ } else if (vname) { ++ g_snprintf (item->name, ++ sizeof (item->name), "%s", ++ vname); ++ if (!xkl_config_registry_find_variant ++ (xkl_registry, lname, item)) { ++ xkl_debug (100, ++ "Bad variant [%s(%s)]\n", ++ lname, vname); ++ should_be_dropped = TRUE; ++ } ++ } ++ if (should_be_dropped) { ++ gkbd_strv_behead (lv); ++ any_change = TRUE; ++ continue; ++ } ++ } ++ lv++; ++ } ++ g_object_unref (item); ++ return any_change; ++} ++ ++static void ++apply_xkb_settings (void) ++{ ++ GkbdKeyboardConfig current_sys_kbd_config; ++ ++ if (!inited_ok) ++ return; ++ ++ gkbd_keyboard_config_init (¤t_sys_kbd_config, xkl_engine); ++ ++ gkbd_keyboard_config_load (¤t_kbd_config, ++ &initial_sys_kbd_config); ++ ++ gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config, ++ NULL); ++ ++#ifdef HAVE_APPINDICATOR ++ gkbd_indicator_config_init (¤t_ind_config, xkl_engine); ++ gkbd_indicator_config_load (¤t_ind_config); ++ ++ gkbd_indicator_config_load_image_filenames (¤t_ind_config, ++ ¤t_kbd_config); ++ gkbd_indicator_config_activate (¤t_ind_config); ++#endif /* HAVE_APPINDICATOR */ ++ ++ if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) { ++ if (filter_xkb_config ()) { ++ if (!try_activating_xkb_config_if_new ++ (¤t_sys_kbd_config)) { ++ g_warning ++ ("Could not activate the filtered XKB configuration"); ++ activation_error (); ++ } ++ } else { ++ g_warning ++ ("Could not activate the XKB configuration"); ++ activation_error (); ++ } ++ } else ++ xkl_debug (100, ++ "Actual KBD configuration was not changed: redundant notification\n"); ++ ++ gkbd_keyboard_config_term (¤t_sys_kbd_config); ++ show_hide_icon (); ++} ++ ++static void ++gsd_keyboard_xkb_analyze_sysconfig (void) ++{ ++ if (!inited_ok) ++ return; ++ ++ gkbd_keyboard_config_init (&initial_sys_kbd_config, xkl_engine); ++ gkbd_keyboard_config_load_from_x_initial (&initial_sys_kbd_config, ++ NULL); ++} ++ ++#ifdef HAVE_APPINDICATOR ++/* When the configuration changed update the indicator */ ++static void ++gsd_keyboard_configuration_changed (GkbdConfiguration *configuration) ++{ ++ GtkMenu *popup_menu; ++ ++ if (!app_indicator) ++ return; ++ ++ popup_menu = create_status_menu (); ++ app_indicator_set_menu (app_indicator, ++ popup_menu); ++} ++#endif ++ ++void ++gsd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, ++ void *user_data) ++{ ++ pa_callback = fun; ++ pa_callback_user_data = user_data; ++} ++ ++static GdkFilterReturn ++gsd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event) ++{ ++ XEvent *xevent = (XEvent *) xev; ++ xkl_engine_filter_events (xkl_engine, xevent); ++ return GDK_FILTER_CONTINUE; ++} ++ ++/* When new Keyboard is plugged in - reload the settings */ ++static void ++gsd_keyboard_new_device (XklEngine * engine) ++{ ++ apply_desktop_settings (); ++ apply_xkb_settings (); ++} ++ ++void ++gsd_keyboard_xkb_init (GsdKeyboardManager * kbd_manager) ++{ ++ Display *display = ++ GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); ++ gnome_settings_profile_start (NULL); ++ ++ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), ++ DATADIR G_DIR_SEPARATOR_S ++ "icons"); ++ ++#ifdef HAVE_APPINDICATOR ++ gkbd_configuration = gkbd_configuration_get (); ++ g_signal_connect (gkbd_configuration, "changed", ++ G_CALLBACK (gsd_keyboard_configuration_changed), NULL); ++ g_signal_connect (gkbd_configuration, "group-changed", ++ G_CALLBACK (gsd_keyboard_configuration_changed), NULL); ++#endif ++ manager = kbd_manager; ++ gnome_settings_profile_start ("xkl_engine_get_instance"); ++ xkl_engine = xkl_engine_get_instance (display); ++ gnome_settings_profile_end ("xkl_engine_get_instance"); ++ if (xkl_engine) { ++ inited_ok = TRUE; ++ ++ gkbd_desktop_config_init (¤t_config, xkl_engine); ++ gkbd_keyboard_config_init (¤t_kbd_config, ++ xkl_engine); ++ xkl_engine_backup_names_prop (xkl_engine); ++ gsd_keyboard_xkb_analyze_sysconfig (); ++ ++ settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); ++ settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); ++ g_signal_connect (settings_desktop, "changed", ++ (GCallback) apply_desktop_settings, ++ NULL); ++ g_signal_connect (settings_keyboard, "changed", ++ (GCallback) apply_xkb_settings, NULL); ++ ++#ifdef HAVE_APPINDICATOR ++ g_signal_connect (xkl_engine, "X-state-changed", G_CALLBACK (state_callback), NULL); ++#endif ++ gdk_window_add_filter (NULL, (GdkFilterFunc) ++ gsd_keyboard_xkb_evt_filter, NULL); ++ ++ if (xkl_engine_get_features (xkl_engine) & ++ XKLF_DEVICE_DISCOVERY) ++ g_signal_connect (xkl_engine, "X-new-device", ++ G_CALLBACK ++ (gsd_keyboard_new_device), NULL); ++ ++ gnome_settings_profile_start ("xkl_engine_start_listen"); ++ xkl_engine_start_listen (xkl_engine, ++ XKLL_MANAGE_LAYOUTS | ++ XKLL_MANAGE_WINDOW_STATES); ++ gnome_settings_profile_end ("xkl_engine_start_listen"); ++ ++ gnome_settings_profile_start ("apply_desktop_settings"); ++ apply_desktop_settings (); ++ gnome_settings_profile_end ("apply_desktop_settings"); ++ gnome_settings_profile_start ("apply_xkb_settings"); ++ apply_xkb_settings (); ++ gnome_settings_profile_end ("apply_xkb_settings"); ++ } ++ preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); ++ ++ gnome_settings_profile_end (NULL); ++} ++ ++void ++gsd_keyboard_xkb_shutdown (void) ++{ ++ if (!inited_ok) ++ return; ++ ++ pa_callback = NULL; ++ pa_callback_user_data = NULL; ++ manager = NULL; ++ ++ if (preview_dialogs != NULL) ++ g_hash_table_destroy (preview_dialogs); ++ ++ if (!inited_ok) ++ return; ++ ++ xkl_engine_stop_listen (xkl_engine, ++ XKLL_MANAGE_LAYOUTS | ++ XKLL_MANAGE_WINDOW_STATES); ++ ++ gdk_window_remove_filter (NULL, (GdkFilterFunc) ++ gsd_keyboard_xkb_evt_filter, NULL); ++ ++ g_object_unref (settings_desktop); ++ settings_desktop = NULL; ++ g_object_unref (settings_keyboard); ++ settings_keyboard = NULL; ++ ++ if (xkl_registry) { ++ g_object_unref (xkl_registry); ++ } ++ ++ g_object_unref (xkl_engine); ++ ++ xkl_engine = NULL; ++ ++#ifdef HAVE_APPINDICATOR ++ g_clear_object (&gkbd_configuration); ++#endif ++ ++ inited_ok = FALSE; ++} +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-xkb.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/gsd-keyboard-xkb.h 2013-02-18 12:57:16.523698776 +0000 +@@ -0,0 +1,39 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * gnome-settings-keyboard-xkb.h ++ * ++ * Copyright (C) 2001 Udaltsoft ++ * ++ * Written by Sergey V. Oudaltsov ++ * ++ * 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, 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_KEYBOARD_XKB_H ++#define __GSD_KEYBOARD_XKB_H ++ ++#include ++#include "gsd-keyboard-manager.h" ++ ++void gsd_keyboard_xkb_init (GsdKeyboardManager *manager); ++void gsd_keyboard_xkb_shutdown (void); ++ ++typedef void (*PostActivationCallback) (void *userData); ++ ++void ++gsd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, ++ void *userData); ++ ++#endif +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/Makefile.am +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/keyboard/Makefile.am 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/Makefile.am 2013-02-18 12:57:16.523698776 +0000 +@@ -20,20 +20,25 @@ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ ++ gsd-keyboard-xkb.h \ ++ gsd-keyboard-xkb.c \ ++ delayed-dialog.h \ ++ delayed-dialog.c \ ++ gkbd-configuration.c \ ++ gkbd-configuration.h \ + $(NULL) + + libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/data \ +- -I$(top_srcdir)/plugins/common \ + -DDATADIR=\""$(pkgdatadir)"\" \ +- -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + + libkeyboard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ ++ $(APPINDICATOR_CFLAGS) \ + $(KEYBOARD_CFLAGS) \ + $(AM_CFLAGS) + +@@ -41,63 +46,19 @@ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +-libkeyboard_la_LIBADD = \ +- $(top_builddir)/plugins/common/libcommon.la \ +- $(SETTINGS_PLUGIN_LIBS) \ +- $(XF86MISC_LIBS) \ +- $(KEYBOARD_LIBS) \ ++libkeyboard_la_LIBADD = \ ++ $(SETTINGS_PLUGIN_LIBS) \ ++ $(XF86MISC_LIBS) \ ++ $(KEYBOARD_LIBS) \ ++ $(APPINDICATOR_LIBS) \ + $(NULL) + +-libexec_PROGRAMS = gsd-test-keyboard +-gsd_test_keyboard_SOURCES = \ +- test-keyboard.c \ +- gsd-keyboard-manager.h \ +- gsd-keyboard-manager.c \ +- $(NULL) +- +-gsd_test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS) +-gsd_test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +-gsd_test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la +- + plugin_in_files = \ + keyboard.gnome-settings-plugin.in \ + $(NULL) + + plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +-if HAVE_IBUS +-noinst_PROGRAMS = test-keyboard-ibus-utils +-test_keyboard_ibus_utils_SOURCES = test-keyboard-ibus-utils.c +-test_keyboard_ibus_utils_CFLAGS = $(libkeyboard_la_CFLAGS) +-test_keyboard_ibus_utils_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +-test_keyboard_ibus_utils_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la +- +-check-local: test-keyboard-ibus-utils +- $(builddir)/test-keyboard-ibus-utils > /dev/null +-endif +- +-libexec_PROGRAMS += gsd-input-sources-switcher +- +-gsd_input_sources_switcher_SOURCES = \ +- gsd-input-sources-switcher.c \ +- $(NULL) +- +-gsd_input_sources_switcher_CPPFLAGS = \ +- -I$(top_srcdir)/data \ +- -I$(top_srcdir)/plugins/common \ +- $(AM_CPPFLAGS) \ +- $(NULL) +- +-gsd_input_sources_switcher_CFLAGS = \ +- $(SETTINGS_PLUGIN_CFLAGS) \ +- $(AM_CFLAGS) \ +- $(NULL) +- +-gsd_input_sources_switcher_LDADD = \ +- $(top_builddir)/plugins/common/libcommon.la \ +- $(SETTINGS_PLUGIN_LIBS) \ +- $(NULL) +- + EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/Makefile.in +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/keyboard/Makefile.in 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/keyboard/Makefile.in 2013-02-18 12:57:16.527698777 +0000 +@@ -1,8 +1,9 @@ +-# Makefile.in generated by automake 1.12.2 from Makefile.am. ++# Makefile.in generated by automake 1.11.3 from Makefile.am. + # @configure_input@ + +-# Copyright (C) 1994-2012 Free Software Foundation, Inc. +- ++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ++# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software ++# Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. +@@ -15,25 +16,7 @@ + @SET_MAKE@ + + +- + VPATH = @srcdir@ +-am__make_dryrun = \ +- { \ +- am__dry=no; \ +- case $$MAKEFLAGS in \ +- *\\[\ \ ]*) \ +- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ +- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ +- *) \ +- for am__flg in $$MAKEFLAGS; do \ +- case $$am__flg in \ +- *=*|--*) ;; \ +- *n*) am__dry=yes; break;; \ +- esac; \ +- done;; \ +- esac; \ +- test $$am__dry = yes; \ +- } + pkgdatadir = $(datadir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + pkglibdir = $(libdir)/@PACKAGE@ +@@ -52,12 +35,8 @@ + POST_UNINSTALL = : + build_triplet = @build@ + host_triplet = @host@ +-libexec_PROGRAMS = gsd-test-keyboard$(EXEEXT) \ +- gsd-input-sources-switcher$(EXEEXT) +-@HAVE_IBUS_TRUE@noinst_PROGRAMS = test-keyboard-ibus-utils$(EXEEXT) + subdir = plugins/keyboard +-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ +- $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs ++DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +@@ -94,76 +73,25 @@ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +-am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ +- "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(plugindir)" ++am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(iconsdir)" \ ++ "$(DESTDIR)$(plugindir)" + LTLIBRARIES = $(plugin_LTLIBRARIES) + am__DEPENDENCIES_1 = +-libkeyboard_la_DEPENDENCIES = \ +- $(top_builddir)/plugins/common/libcommon.la \ +- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) ++libkeyboard_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + am__objects_1 = + am_libkeyboard_la_OBJECTS = libkeyboard_la-gsd-keyboard-plugin.lo \ +- libkeyboard_la-gsd-keyboard-manager.lo $(am__objects_1) ++ libkeyboard_la-gsd-keyboard-manager.lo \ ++ libkeyboard_la-gsd-keyboard-xkb.lo \ ++ libkeyboard_la-delayed-dialog.lo $(am__objects_1) + libkeyboard_la_OBJECTS = $(am_libkeyboard_la_OBJECTS) + AM_V_lt = $(am__v_lt_@AM_V@) + am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) + am__v_lt_0 = --silent +-am__v_lt_1 = + libkeyboard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libkeyboard_la_CFLAGS) $(CFLAGS) $(libkeyboard_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +-PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS) +-am_gsd_input_sources_switcher_OBJECTS = gsd_input_sources_switcher-gsd-input-sources-switcher.$(OBJEXT) \ +- $(am__objects_1) +-gsd_input_sources_switcher_OBJECTS = \ +- $(am_gsd_input_sources_switcher_OBJECTS) +-gsd_input_sources_switcher_DEPENDENCIES = \ +- $(top_builddir)/plugins/common/libcommon.la \ +- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +-gsd_input_sources_switcher_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ +- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ +- $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ +- $(LDFLAGS) -o $@ +-am_gsd_test_keyboard_OBJECTS = \ +- gsd_test_keyboard-test-keyboard.$(OBJEXT) \ +- gsd_test_keyboard-gsd-keyboard-manager.$(OBJEXT) \ +- $(am__objects_1) +-gsd_test_keyboard_OBJECTS = $(am_gsd_test_keyboard_OBJECTS) +-am__DEPENDENCIES_2 = $(top_builddir)/plugins/common/libcommon.la \ +- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) +-gsd_test_keyboard_DEPENDENCIES = $(am__DEPENDENCIES_2) \ +- $(top_builddir)/gnome-settings-daemon/libgsd.la +-gsd_test_keyboard_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ +- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ +- $(gsd_test_keyboard_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ +- -o $@ +-am__test_keyboard_ibus_utils_SOURCES_DIST = \ +- test-keyboard-ibus-utils.c +-@HAVE_IBUS_TRUE@am_test_keyboard_ibus_utils_OBJECTS = test_keyboard_ibus_utils-test-keyboard-ibus-utils.$(OBJEXT) +-test_keyboard_ibus_utils_OBJECTS = \ +- $(am_test_keyboard_ibus_utils_OBJECTS) +-@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_DEPENDENCIES = \ +-@HAVE_IBUS_TRUE@ $(am__DEPENDENCIES_2) \ +-@HAVE_IBUS_TRUE@ $(top_builddir)/gnome-settings-daemon/libgsd.la +-test_keyboard_ibus_utils_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ +- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ +- $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ +- $(LDFLAGS) -o $@ +-AM_V_P = $(am__v_P_@AM_V@) +-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +-am__v_P_0 = false +-am__v_P_1 = : +-AM_V_GEN = $(am__v_GEN_@AM_V@) +-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +-am__v_GEN_0 = @echo " GEN " $@; +-am__v_GEN_1 = +-AM_V_at = $(am__v_at_@AM_V@) +-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +-am__v_at_0 = @ +-am__v_at_1 = + DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) + depcomp = $(SHELL) $(top_srcdir)/depcomp + am__depfiles_maybe = depfiles +@@ -176,29 +104,22 @@ + $(AM_CFLAGS) $(CFLAGS) + AM_V_CC = $(am__v_CC_@AM_V@) + am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +-am__v_CC_0 = @echo " CC " $@; +-am__v_CC_1 = ++am__v_CC_0 = @echo " CC " $@; ++AM_V_at = $(am__v_at_@AM_V@) ++am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) ++am__v_at_0 = @ + CCLD = $(CC) + LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ + AM_V_CCLD = $(am__v_CCLD_@AM_V@) + am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +-am__v_CCLD_0 = @echo " CCLD " $@; +-am__v_CCLD_1 = +-SOURCES = $(libkeyboard_la_SOURCES) \ +- $(gsd_input_sources_switcher_SOURCES) \ +- $(gsd_test_keyboard_SOURCES) \ +- $(test_keyboard_ibus_utils_SOURCES) +-DIST_SOURCES = $(libkeyboard_la_SOURCES) \ +- $(gsd_input_sources_switcher_SOURCES) \ +- $(gsd_test_keyboard_SOURCES) \ +- $(am__test_keyboard_ibus_utils_SOURCES_DIST) +-am__can_run_installinfo = \ +- case $$AM_UPDATE_INFO_DIR in \ +- n|no|NO) false;; \ +- *) (install-info --version) >/dev/null 2>&1;; \ +- esac ++am__v_CCLD_0 = @echo " CCLD " $@; ++AM_V_GEN = $(am__v_GEN_@AM_V@) ++am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) ++am__v_GEN_0 = @echo " GEN " $@; ++SOURCES = $(libkeyboard_la_SOURCES) ++DIST_SOURCES = $(libkeyboard_la_SOURCES) + DATA = $(icons_DATA) $(plugin_DATA) + ETAGS = etags + CTAGS = ctags +@@ -252,6 +173,8 @@ + EGREP = @EGREP@ + EXEEXT = @EXEEXT@ + FGREP = @FGREP@ ++FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ ++FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ + GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ + GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ + GIOUNIX_LIBS = @GIOUNIX_LIBS@ +@@ -316,8 +239,6 @@ + NSS_LIBS = @NSS_LIBS@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ +-ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +-ORIENTATION_LIBS = @ORIENTATION_LIBS@ + OTOOL = @OTOOL@ + OTOOL64 = @OTOOL64@ + PACKAGE = @PACKAGE@ +@@ -336,8 +257,6 @@ + PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ + POFILES = @POFILES@ + POSUB = @POSUB@ +-POWER_CFLAGS = @POWER_CFLAGS@ +-POWER_LIBS = @POWER_LIBS@ + PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ + PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ + RANLIB = @RANLIB@ +@@ -348,22 +267,17 @@ + SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +-SOUND_CFLAGS = @SOUND_CFLAGS@ +-SOUND_LIBS = @SOUND_LIBS@ + STRIP = @STRIP@ + SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ + SYSTEMD_LIBS = @SYSTEMD_LIBS@ ++UPOWER_CFLAGS = @UPOWER_CFLAGS@ ++UPOWER_LIBS = @UPOWER_LIBS@ + USE_NLS = @USE_NLS@ + VERSION = @VERSION@ + WACOM_CFLAGS = @WACOM_CFLAGS@ + WACOM_LIBS = @WACOM_LIBS@ + WARN_CFLAGS = @WARN_CFLAGS@ + XGETTEXT = @XGETTEXT@ +-XRANDR_CFLAGS = @XRANDR_CFLAGS@ +-XRANDR_LIBS = @XRANDR_LIBS@ +-XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +-XSETTINGS_LIBS = @XSETTINGS_LIBS@ +-XSLTPROC = @XSLTPROC@ + abs_builddir = @abs_builddir@ + abs_srcdir = @abs_srcdir@ + abs_top_builddir = @abs_top_builddir@ +@@ -440,14 +354,16 @@ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ ++ gsd-keyboard-xkb.h \ ++ gsd-keyboard-xkb.c \ ++ delayed-dialog.h \ ++ delayed-dialog.c \ + $(NULL) + + libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/data \ +- -I$(top_srcdir)/plugins/common \ + -DDATADIR=\""$(pkgdatadir)"\" \ +- -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +@@ -462,50 +378,16 @@ + $(NULL) + + libkeyboard_la_LIBADD = \ +- $(top_builddir)/plugins/common/libcommon.la \ +- $(SETTINGS_PLUGIN_LIBS) \ +- $(XF86MISC_LIBS) \ +- $(KEYBOARD_LIBS) \ +- $(NULL) +- +-gsd_test_keyboard_SOURCES = \ +- test-keyboard.c \ +- gsd-keyboard-manager.h \ +- gsd-keyboard-manager.c \ ++ $(SETTINGS_PLUGIN_LIBS) \ ++ $(XF86MISC_LIBS) \ ++ $(KEYBOARD_LIBS) \ + $(NULL) + +-gsd_test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS) +-gsd_test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +-gsd_test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la + plugin_in_files = \ + keyboard.gnome-settings-plugin.in \ + $(NULL) + + plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +-@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_SOURCES = test-keyboard-ibus-utils.c +-@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_CFLAGS = $(libkeyboard_la_CFLAGS) +-@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_CPPFLAGS = $(libkeyboard_la_CPPFLAGS) +-@HAVE_IBUS_TRUE@test_keyboard_ibus_utils_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/gnome-settings-daemon/libgsd.la +-gsd_input_sources_switcher_SOURCES = \ +- gsd-input-sources-switcher.c \ +- $(NULL) +- +-gsd_input_sources_switcher_CPPFLAGS = \ +- -I$(top_srcdir)/data \ +- -I$(top_srcdir)/plugins/common \ +- $(AM_CPPFLAGS) \ +- $(NULL) +- +-gsd_input_sources_switcher_CFLAGS = \ +- $(SETTINGS_PLUGIN_CFLAGS) \ +- $(AM_CFLAGS) \ +- $(NULL) +- +-gsd_input_sources_switcher_LDADD = \ +- $(top_builddir)/plugins/common/libcommon.la \ +- $(SETTINGS_PLUGIN_LIBS) \ +- $(NULL) +- + EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ +@@ -556,6 +438,7 @@ + $(am__aclocal_m4_deps): + install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) ++ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ +@@ -563,8 +446,6 @@ + else :; fi; \ + done; \ + test -z "$$list2" || { \ +- echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } +@@ -580,80 +461,14 @@ + + clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) +- @list='$(plugin_LTLIBRARIES)'; \ +- locs=`for p in $$list; do echo $$p; done | \ +- sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ +- sort -u`; \ +- test -z "$$locs" || { \ +- echo rm -f $${locs}; \ +- rm -f $${locs}; \ +- } ++ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ ++ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ ++ test "$$dir" != "$$p" || dir=.; \ ++ echo "rm -f \"$${dir}/so_locations\""; \ ++ rm -f "$${dir}/so_locations"; \ ++ done + libkeyboard.la: $(libkeyboard_la_OBJECTS) $(libkeyboard_la_DEPENDENCIES) $(EXTRA_libkeyboard_la_DEPENDENCIES) + $(AM_V_CCLD)$(libkeyboard_la_LINK) -rpath $(plugindir) $(libkeyboard_la_OBJECTS) $(libkeyboard_la_LIBADD) $(LIBS) +-install-libexecPROGRAMS: $(libexec_PROGRAMS) +- @$(NORMAL_INSTALL) +- @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ +- if test -n "$$list"; then \ +- echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ +- fi; \ +- for p in $$list; do echo "$$p $$p"; done | \ +- sed 's/$(EXEEXT)$$//' | \ +- while read p p1; do if test -f $$p || test -f $$p1; \ +- then echo "$$p"; echo "$$p"; else :; fi; \ +- done | \ +- sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ +- -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ +- sed 'N;N;N;s,\n, ,g' | \ +- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ +- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ +- if ($$2 == $$4) files[d] = files[d] " " $$1; \ +- else { print "f", $$3 "/" $$4, $$1; } } \ +- END { for (d in files) print "f", d, files[d] }' | \ +- while read type dir files; do \ +- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ +- test -z "$$files" || { \ +- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ +- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ +- } \ +- ; done +- +-uninstall-libexecPROGRAMS: +- @$(NORMAL_UNINSTALL) +- @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ +- files=`for p in $$list; do echo "$$p"; done | \ +- sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ +- -e 's/$$/$(EXEEXT)/' `; \ +- test -n "$$list" || exit 0; \ +- echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ +- cd "$(DESTDIR)$(libexecdir)" && rm -f $$files +- +-clean-libexecPROGRAMS: +- @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ +- echo " rm -f" $$list; \ +- rm -f $$list || exit $$?; \ +- test -n "$(EXEEXT)" || exit 0; \ +- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ +- echo " rm -f" $$list; \ +- rm -f $$list +- +-clean-noinstPROGRAMS: +- @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ +- echo " rm -f" $$list; \ +- rm -f $$list || exit $$?; \ +- test -n "$(EXEEXT)" || exit 0; \ +- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ +- echo " rm -f" $$list; \ +- rm -f $$list +-gsd-input-sources-switcher$(EXEEXT): $(gsd_input_sources_switcher_OBJECTS) $(gsd_input_sources_switcher_DEPENDENCIES) $(EXTRA_gsd_input_sources_switcher_DEPENDENCIES) +- @rm -f gsd-input-sources-switcher$(EXEEXT) +- $(AM_V_CCLD)$(gsd_input_sources_switcher_LINK) $(gsd_input_sources_switcher_OBJECTS) $(gsd_input_sources_switcher_LDADD) $(LIBS) +-gsd-test-keyboard$(EXEEXT): $(gsd_test_keyboard_OBJECTS) $(gsd_test_keyboard_DEPENDENCIES) $(EXTRA_gsd_test_keyboard_DEPENDENCIES) +- @rm -f gsd-test-keyboard$(EXEEXT) +- $(AM_V_CCLD)$(gsd_test_keyboard_LINK) $(gsd_test_keyboard_OBJECTS) $(gsd_test_keyboard_LDADD) $(LIBS) +-test-keyboard-ibus-utils$(EXEEXT): $(test_keyboard_ibus_utils_OBJECTS) $(test_keyboard_ibus_utils_DEPENDENCIES) $(EXTRA_test_keyboard_ibus_utils_DEPENDENCIES) +- @rm -f test-keyboard-ibus-utils$(EXEEXT) +- $(AM_V_CCLD)$(test_keyboard_ibus_utils_LINK) $(test_keyboard_ibus_utils_OBJECTS) $(test_keyboard_ibus_utils_LDADD) $(LIBS) + + mostlyclean-compile: + -rm -f *.$(OBJEXT) +@@ -661,12 +476,10 @@ + distclean-compile: + -rm -f *.tab.c + +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_keyboard-test-keyboard.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-delayed-dialog.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Plo@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Plo@am__quote@ + + .c.o: + @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@@ -703,61 +516,19 @@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-manager.lo `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c + +-gsd_input_sources_switcher-gsd-input-sources-switcher.o: gsd-input-sources-switcher.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -MT gsd_input_sources_switcher-gsd-input-sources-switcher.o -MD -MP -MF $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.o `test -f 'gsd-input-sources-switcher.c' || echo '$(srcdir)/'`gsd-input-sources-switcher.c +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-input-sources-switcher.c' object='gsd_input_sources_switcher-gsd-input-sources-switcher.o' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.o `test -f 'gsd-input-sources-switcher.c' || echo '$(srcdir)/'`gsd-input-sources-switcher.c +- +-gsd_input_sources_switcher-gsd-input-sources-switcher.obj: gsd-input-sources-switcher.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -MT gsd_input_sources_switcher-gsd-input-sources-switcher.obj -MD -MP -MF $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.obj `if test -f 'gsd-input-sources-switcher.c'; then $(CYGPATH_W) 'gsd-input-sources-switcher.c'; else $(CYGPATH_W) '$(srcdir)/gsd-input-sources-switcher.c'; fi` +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Tpo $(DEPDIR)/gsd_input_sources_switcher-gsd-input-sources-switcher.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-input-sources-switcher.c' object='gsd_input_sources_switcher-gsd-input-sources-switcher.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_input_sources_switcher_CPPFLAGS) $(CPPFLAGS) $(gsd_input_sources_switcher_CFLAGS) $(CFLAGS) -c -o gsd_input_sources_switcher-gsd-input-sources-switcher.obj `if test -f 'gsd-input-sources-switcher.c'; then $(CYGPATH_W) 'gsd-input-sources-switcher.c'; else $(CYGPATH_W) '$(srcdir)/gsd-input-sources-switcher.c'; fi` +- +-gsd_test_keyboard-test-keyboard.o: test-keyboard.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-test-keyboard.o -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo -c -o gsd_test_keyboard-test-keyboard.o `test -f 'test-keyboard.c' || echo '$(srcdir)/'`test-keyboard.c +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo $(DEPDIR)/gsd_test_keyboard-test-keyboard.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard.c' object='gsd_test_keyboard-test-keyboard.o' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-test-keyboard.o `test -f 'test-keyboard.c' || echo '$(srcdir)/'`test-keyboard.c +- +-gsd_test_keyboard-test-keyboard.obj: test-keyboard.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-test-keyboard.obj -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo -c -o gsd_test_keyboard-test-keyboard.obj `if test -f 'test-keyboard.c'; then $(CYGPATH_W) 'test-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard.c'; fi` +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-test-keyboard.Tpo $(DEPDIR)/gsd_test_keyboard-test-keyboard.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard.c' object='gsd_test_keyboard-test-keyboard.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-test-keyboard.obj `if test -f 'test-keyboard.c'; then $(CYGPATH_W) 'test-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard.c'; fi` +- +-gsd_test_keyboard-gsd-keyboard-manager.o: gsd-keyboard-manager.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-gsd-keyboard-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo -c -o gsd_test_keyboard-gsd-keyboard-manager.o `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-manager.c' object='gsd_test_keyboard-gsd-keyboard-manager.o' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-gsd-keyboard-manager.o `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c +- +-gsd_test_keyboard-gsd-keyboard-manager.obj: gsd-keyboard-manager.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_keyboard-gsd-keyboard-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo -c -o gsd_test_keyboard-gsd-keyboard-manager.obj `if test -f 'gsd-keyboard-manager.c'; then $(CYGPATH_W) 'gsd-keyboard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-keyboard-manager.c'; fi` +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Tpo $(DEPDIR)/gsd_test_keyboard-gsd-keyboard-manager.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-manager.c' object='gsd_test_keyboard-gsd-keyboard-manager.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_keyboard_CPPFLAGS) $(CPPFLAGS) $(gsd_test_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_keyboard-gsd-keyboard-manager.obj `if test -f 'gsd-keyboard-manager.c'; then $(CYGPATH_W) 'gsd-keyboard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-keyboard-manager.c'; fi` +- +-test_keyboard_ibus_utils-test-keyboard-ibus-utils.o: test-keyboard-ibus-utils.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -MT test_keyboard_ibus_utils-test-keyboard-ibus-utils.o -MD -MP -MF $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.o `test -f 'test-keyboard-ibus-utils.c' || echo '$(srcdir)/'`test-keyboard-ibus-utils.c +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard-ibus-utils.c' object='test_keyboard_ibus_utils-test-keyboard-ibus-utils.o' libtool=no @AMDEPBACKSLASH@ ++libkeyboard_la-gsd-keyboard-xkb.lo: gsd-keyboard-xkb.c ++@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-gsd-keyboard-xkb.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Tpo -c -o libkeyboard_la-gsd-keyboard-xkb.lo `test -f 'gsd-keyboard-xkb.c' || echo '$(srcdir)/'`gsd-keyboard-xkb.c ++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Tpo $(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Plo ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-xkb.c' object='libkeyboard_la-gsd-keyboard-xkb.lo' libtool=yes @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-xkb.lo `test -f 'gsd-keyboard-xkb.c' || echo '$(srcdir)/'`gsd-keyboard-xkb.c ++ ++libkeyboard_la-delayed-dialog.lo: delayed-dialog.c ++@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-delayed-dialog.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-delayed-dialog.Tpo -c -o libkeyboard_la-delayed-dialog.lo `test -f 'delayed-dialog.c' || echo '$(srcdir)/'`delayed-dialog.c ++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-delayed-dialog.Tpo $(DEPDIR)/libkeyboard_la-delayed-dialog.Plo ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='delayed-dialog.c' object='libkeyboard_la-delayed-dialog.lo' libtool=yes @AMDEPBACKSLASH@ + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.o `test -f 'test-keyboard-ibus-utils.c' || echo '$(srcdir)/'`test-keyboard-ibus-utils.c +- +-test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj: test-keyboard-ibus-utils.c +-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -MT test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj -MD -MP -MF $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj `if test -f 'test-keyboard-ibus-utils.c'; then $(CYGPATH_W) 'test-keyboard-ibus-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard-ibus-utils.c'; fi` +-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Tpo $(DEPDIR)/test_keyboard_ibus_utils-test-keyboard-ibus-utils.Po +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-keyboard-ibus-utils.c' object='test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj' libtool=no @AMDEPBACKSLASH@ +-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_keyboard_ibus_utils_CPPFLAGS) $(CPPFLAGS) $(test_keyboard_ibus_utils_CFLAGS) $(CFLAGS) -c -o test_keyboard_ibus_utils-test-keyboard-ibus-utils.obj `if test -f 'test-keyboard-ibus-utils.c'; then $(CYGPATH_W) 'test-keyboard-ibus-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-keyboard-ibus-utils.c'; fi` ++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-delayed-dialog.lo `test -f 'delayed-dialog.c' || echo '$(srcdir)/'`delayed-dialog.c + + mostlyclean-libtool: + -rm -f *.lo +@@ -766,11 +537,8 @@ + -rm -rf .libs _libs + install-iconsDATA: $(icons_DATA) + @$(NORMAL_INSTALL) ++ test -z "$(iconsdir)" || $(MKDIR_P) "$(DESTDIR)$(iconsdir)" + @list='$(icons_DATA)'; test -n "$(iconsdir)" || list=; \ +- if test -n "$$list"; then \ +- echo " $(MKDIR_P) '$(DESTDIR)$(iconsdir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(iconsdir)" || exit 1; \ +- fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ +@@ -787,11 +555,8 @@ + dir='$(DESTDIR)$(iconsdir)'; $(am__uninstall_files_from_dir) + install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) ++ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ +- if test -n "$$list"; then \ +- echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ +- $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ +- fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ +@@ -856,20 +621,6 @@ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +-cscopelist: $(HEADERS) $(SOURCES) $(LISP) +- list='$(SOURCES) $(HEADERS) $(LISP)'; \ +- case "$(srcdir)" in \ +- [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ +- *) sdir=$(subdir)/$(srcdir) ;; \ +- esac; \ +- for i in $$list; do \ +- if test -f "$$i"; then \ +- echo "$(subdir)/$$i"; \ +- else \ +- echo "$$sdir/$$i"; \ +- fi; \ +- done >> $(top_builddir)/cscope.files +- + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +@@ -903,13 +654,11 @@ + || exit 1; \ + fi; \ + done +-@HAVE_IBUS_FALSE@check-local: + check-am: all-am +- $(MAKE) $(AM_MAKEFLAGS) check-local + check: check-am +-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) ++all-am: Makefile $(LTLIBRARIES) $(DATA) + installdirs: +- for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(plugindir)"; do \ ++ for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done + install: install-am +@@ -946,8 +695,8 @@ + @echo "it deletes files that may require special tools to rebuild." + clean: clean-am + +-clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ +- clean-noinstPROGRAMS clean-pluginLTLIBRARIES mostlyclean-am ++clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ ++ mostlyclean-am + + distclean: distclean-am + -rm -rf ./$(DEPDIR) +@@ -974,7 +723,7 @@ + + install-dvi-am: + +-install-exec-am: install-libexecPROGRAMS ++install-exec-am: + + install-html: install-html-am + +@@ -1014,32 +763,27 @@ + + ps-am: + +-uninstall-am: uninstall-iconsDATA uninstall-libexecPROGRAMS \ +- uninstall-pluginDATA uninstall-pluginLTLIBRARIES ++uninstall-am: uninstall-iconsDATA uninstall-pluginDATA \ ++ uninstall-pluginLTLIBRARIES + +-.MAKE: check-am install-am install-strip ++.MAKE: install-am install-strip + +-.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ +- clean-generic clean-libexecPROGRAMS clean-libtool \ +- clean-noinstPROGRAMS clean-pluginLTLIBRARIES cscopelist ctags \ +- distclean distclean-compile distclean-generic \ +- distclean-libtool distclean-tags distdir dvi dvi-am html \ +- html-am info info-am install install-am install-data \ +- install-data-am install-dvi install-dvi-am install-exec \ +- install-exec-am install-html install-html-am install-iconsDATA \ +- install-info install-info-am install-libexecPROGRAMS \ ++.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ ++ clean-libtool clean-pluginLTLIBRARIES ctags distclean \ ++ distclean-compile distclean-generic distclean-libtool \ ++ distclean-tags distdir dvi dvi-am html html-am info info-am \ ++ install install-am install-data install-data-am install-dvi \ ++ install-dvi-am install-exec install-exec-am install-html \ ++ install-html-am install-iconsDATA install-info install-info-am \ + install-man install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ +- uninstall-iconsDATA uninstall-libexecPROGRAMS \ +- uninstall-pluginDATA uninstall-pluginLTLIBRARIES +- ++ uninstall-iconsDATA uninstall-pluginDATA \ ++ uninstall-pluginLTLIBRARIES + +-@HAVE_IBUS_TRUE@check-local: test-keyboard-ibus-utils +-@HAVE_IBUS_TRUE@ $(builddir)/test-keyboard-ibus-utils > /dev/null + + @GSD_INTLTOOL_PLUGIN_RULE@ + +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/test-keyboard.c +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/keyboard/test-keyboard.c 2013-02-18 12:57:16.535698777 +0000 ++++ /dev/null 1970-01-01 00:00:00.000000000 +0000 +@@ -1,7 +0,0 @@ +-#define NEW gsd_keyboard_manager_new +-#define START gsd_keyboard_manager_start +-#define STOP gsd_keyboard_manager_stop +-#define MANAGER GsdKeyboardManager +-#include "gsd-keyboard-manager.h" +- +-#include "test-plugin.h" +Index: gnome-settings-daemon-3.6.4/plugins/keyboard/test-keyboard-ibus-utils.c +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/keyboard/test-keyboard-ibus-utils.c 2013-02-18 12:57:16.535698777 +0000 ++++ /dev/null 1970-01-01 00:00:00.000000000 +0000 +@@ -1,116 +0,0 @@ +-#include "gsd-keyboard-manager.c" +- +-static void +-test_make_xkb_source_id (void) +-{ +- gint i; +- const gchar *test_strings[][2] = { +- /* input output */ +- { "xkb:aa:bb:cc", "aa+bb" }, +- { "xkb:aa:bb:", "aa+bb" }, +- { "xkb:aa::cc", "aa" }, +- { "xkb:aa::", "aa" }, +- { "xkb::bb:cc", "+bb" }, +- { "xkb::bb:", "+bb" }, +- { "xkb:::cc", "" }, +- { "xkb:::", "" }, +- }; +- +- for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) +- g_assert_cmpstr (make_xkb_source_id (test_strings[i][0]), ==, test_strings[i][1]); +-} +- +-static void +-test_layout_from_ibus_layout (void) +-{ +- gint i; +- const gchar *test_strings[][2] = { +- /* input output */ +- { "", "" }, +- { "a", "a" }, +- { "a(", "a" }, +- { "a[", "a" }, +- }; +- +- for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) +- g_assert_cmpstr (layout_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]); +-} +- +-static void +-test_variant_from_ibus_layout (void) +-{ +- gint i; +- const gchar *test_strings[][2] = { +- /* input output */ +- { "", NULL }, +- { "a", NULL }, +- { "(", NULL }, +- { "()", "" }, +- { "(b)", "b" }, +- { "a(", NULL }, +- { "a()", "" }, +- { "a(b)", "b" }, +- }; +- +- for (i = 0; i < G_N_ELEMENTS (test_strings); ++i) +- g_assert_cmpstr (variant_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]); +-} +- +-static void +-test_options_from_ibus_layout (void) +-{ +- gint i, j; +- gchar *output_0[] = { +- NULL +- }; +- gchar *output_1[] = { +- "", +- NULL +- }; +- gchar *output_2[] = { +- "b", +- NULL +- }; +- gchar *output_3[] = { +- "b", "", +- NULL +- }; +- gchar *output_4[] = { +- "b", "c", +- NULL +- }; +- const gpointer tests[][2] = { +- /* input output */ +- { "", NULL }, +- { "a", NULL }, +- { "a[", output_0 }, +- { "a[]", output_1 }, +- { "a[b]", output_2 }, +- { "a[b,]", output_3 }, +- { "a[b,c]", output_4 }, +- }; +- +- for (i = 0; i < G_N_ELEMENTS (tests); ++i) { +- if (tests[i][1] == NULL) { +- g_assert (options_from_ibus_layout (tests[i][0]) == NULL); +- } else { +- gchar **strv_a = options_from_ibus_layout (tests[i][0]); +- gchar **strv_b = tests[i][1]; +- +- g_assert (g_strv_length (strv_a) == g_strv_length (strv_b)); +- for (j = 0; j < g_strv_length (strv_a); ++j) +- g_assert_cmpstr (strv_a[j], ==, strv_b[j]); +- } +- } +-} +- +-int +-main (void) +-{ +- test_make_xkb_source_id (); +- test_layout_from_ibus_layout (); +- test_variant_from_ibus_layout (); +- test_options_from_ibus_layout (); +- +- return 0; +-} +Index: gnome-settings-daemon-3.6.4/plugins/media-keys/gsd-media-keys-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/media-keys/gsd-media-keys-manager.c 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/media-keys/gsd-media-keys-manager.c 2013-02-18 12:57:16.531698777 +0000 +@@ -103,10 +103,6 @@ + #define VOLUME_STEP 6 /* percents for one volume button press */ + #define MAX_VOLUME 65536.0 + +-#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +-#define KEY_CURRENT_INPUT_SOURCE "current" +-#define KEY_INPUT_SOURCES "sources" +- + #define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + + typedef struct { +@@ -1990,40 +1986,6 @@ + } + + static void +-do_switch_input_source_action (GsdMediaKeysManager *manager, +- MediaKeyType type) +-{ +- GSettings *settings; +- GVariant *sources; +- gint i, n; +- +- settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); +- sources = g_settings_get_value (settings, KEY_INPUT_SOURCES); +- +- n = g_variant_n_children (sources); +- if (n < 2) +- goto out; +- +- i = g_settings_get_uint (settings, KEY_CURRENT_INPUT_SOURCE); +- +- if (type == SWITCH_INPUT_SOURCE_KEY) +- i += 1; +- else +- i -= 1; +- +- if (i < 0) +- i = n - 1; +- else if (i >= n) +- i = 0; +- +- g_settings_set_uint (settings, KEY_CURRENT_INPUT_SOURCE, i); +- +- out: +- g_variant_unref (sources); +- g_object_unref (settings); +-} +- +-static void + do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +@@ -2189,10 +2151,6 @@ + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; +- case SWITCH_INPUT_SOURCE_KEY: +- case SWITCH_INPUT_SOURCE_BACKWARD_KEY: +- do_switch_input_source_action (manager, type); +- break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); +Index: gnome-settings-daemon-3.6.4/plugins/media-keys/shortcuts-list.h +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/media-keys/shortcuts-list.h 2013-02-18 12:57:16.535698777 +0000 ++++ gnome-settings-daemon-3.6.4/plugins/media-keys/shortcuts-list.h 2013-02-18 12:57:16.531698777 +0000 +@@ -81,8 +81,6 @@ + KEYBOARD_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_TOGGLE_KEY, + BATTERY_KEY, +- SWITCH_INPUT_SOURCE_KEY, +- SWITCH_INPUT_SOURCE_BACKWARD_KEY, + CUSTOM_KEY + } MediaKeyType; + +@@ -150,8 +148,6 @@ + { KEYBOARD_BRIGHTNESS_UP_KEY, NULL, "XF86KbdBrightnessUp" }, + { KEYBOARD_BRIGHTNESS_DOWN_KEY, NULL, "XF86KbdBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_TOGGLE_KEY, NULL, "XF86KbdLightOnOff" }, +- { SWITCH_INPUT_SOURCE_KEY, "switch-input-source", NULL }, +- { SWITCH_INPUT_SOURCE_BACKWARD_KEY, "switch-input-source-backward", NULL }, + { BATTERY_KEY, NULL, "XF86Battery" }, + }; + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..be332f18 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,23 @@ +05_disable_corner_tapping.patch +16_use_synchronous_notifications.patch +43_disable_locale_settings.patch +45_suppress-printer-may-not-be-connected-notification.patch +47_delay_pa_connect_to_idle.patch +48_register_client_before_idle_callbacks.patch +51_lock_screen_on_suspend.patch +52_sync_background_to_accountsservice.patch +60_unity_hide_status_icon.patch +61_unity_use_application_indicator.patch +62_unity_disable_gsd_printer.patch +63_unity_start_mounter.patch +64_restore_terminal_keyboard_shortcut_schema.patch +90_set_gmenus_xsettings.patch +disable_three_touch_tap.patch +bugzilla_segfault_dpms.patch +correct_logout_action.patch +power-no-fallback-notifications.patch +power-check-null-devices.patch +revert_new_ibus_use.patch +migrate_metacity_keys.patch +touchscreen_rotation.patch +nexus-orientation.patch diff --git a/debian/patches/sync_keyboard_layout_to_accountsservice.patch b/debian/patches/sync_keyboard_layout_to_accountsservice.patch new file mode 100644 index 00000000..2619a604 --- /dev/null +++ b/debian/patches/sync_keyboard_layout_to_accountsservice.patch @@ -0,0 +1,146 @@ +Index: b/plugins/keyboard/gsd-keyboard-manager.c +=================================================================== +--- a/plugins/keyboard/gsd-keyboard-manager.c ++++ b/plugins/keyboard/gsd-keyboard-manager.c +@@ -78,12 +78,16 @@ + #define KEY_BELL_DURATION "bell-duration" + #define KEY_BELL_MODE "bell-mode" + ++#define LIBGNOMEKBD_KEYBOARD_DIR "org.gnome.libgnomekbd.keyboard" ++#define LIBGNOMEKBD_KEY_LAYOUTS "layouts" ++ + #define DEFAULT_LANGUAGE "en_US" + + struct GsdKeyboardManagerPrivate + { + guint start_idle_id; + GSettings *settings; ++ GSettings *libgnomekbd_settings; + gint xkb_event_base; + GsdNumLockState old_state; + GdkDeviceManager *device_manager; +@@ -1021,6 +1025,93 @@ + manager->priv->device_manager = device_manager; + } + ++static void ++apply_libgnomekbd_settings (GSettings *settings, ++ const char *key, ++ GsdKeyboardManager *manager) ++{ ++ gchar **layouts; ++ ++ layouts = g_settings_get_strv (settings, LIBGNOMEKBD_KEY_LAYOUTS); ++ ++ /* Get accounts daemon */ ++ GDBusProxy *proxy = NULL; ++ GDBusProxy *user = NULL; ++ GVariant *variant = NULL; ++ GError *error = NULL; ++ gchar *object_path = NULL; ++ ++ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ "org.freedesktop.Accounts", ++ "/org/freedesktop/Accounts", ++ "org.freedesktop.Accounts", ++ NULL, ++ &error); ++ ++ if (proxy == NULL) { ++ g_warning ("Failed to contact accounts service: %s", error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ ++ variant = g_dbus_proxy_call_sync (proxy, ++ "FindUserByName", ++ g_variant_new ("(s)", g_get_user_name ()), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ &error); ++ ++ if (variant == NULL) { ++ g_warning ("Could not contact accounts service to look up '%s': %s", ++ g_get_user_name (), error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ ++ g_variant_get (variant, "(o)", &object_path); ++ user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, ++ G_DBUS_PROXY_FLAGS_NONE, ++ NULL, ++ "org.freedesktop.Accounts", ++ object_path, ++ "org.freedesktop.Accounts.User", ++ NULL, ++ &error); ++ g_free (object_path); ++ ++ if (user == NULL) { ++ g_warning ("Could not create proxy for user '%s': %s", ++ g_variant_get_string (variant, NULL), error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ g_variant_unref (variant); ++ ++ variant = g_dbus_proxy_call_sync (user, ++ "SetXKeyboardLayouts", ++ g_variant_new ("(^as)", layouts), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, ++ &error); ++ ++ if (variant == NULL) { ++ g_warning ("Failed to set the keyboard layouts: %s", error->message); ++ g_error_free (error); ++ goto bail; ++ } ++ ++bail: ++ if (proxy != NULL) ++ g_object_unref (proxy); ++ if (variant != NULL) ++ g_variant_unref (variant); ++ g_strfreev (layouts); ++} ++ + static gboolean + start_keyboard_idle_cb (GsdKeyboardManager *manager) + { +@@ -1029,6 +1120,7 @@ + g_debug ("Starting keyboard manager"); + + manager->priv->settings = g_settings_new (GSD_KEYBOARD_DIR); ++ manager->priv->libgnomekbd_settings = g_settings_new (LIBGNOMEKBD_KEYBOARD_DIR); + manager->priv->settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); + manager->priv->settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); + +@@ -1047,6 +1139,10 @@ + g_signal_connect (manager->priv->settings_keyboard, "changed", + (GCallback) xkb_settings_changed, manager); + ++ apply_libgnomekbd_settings (manager->priv->libgnomekbd_settings, NULL, manager); ++ g_signal_connect (G_OBJECT (manager->priv->libgnomekbd_settings), "changed", ++ G_CALLBACK (apply_libgnomekbd_settings), manager); ++ + install_xkb_filter (manager); + + gnome_settings_profile_end (NULL); +@@ -1119,6 +1215,11 @@ + p->xkl_engine = NULL; + } + ++ if (p->libgnomekbd_settings != NULL) { ++ g_object_unref(p->libgnomekbd_settings); ++ p->libgnomekbd_settings = NULL; ++ } ++ + #ifdef HAVE_APPINDICATOR + if (p->gkbd_configuration != NULL) { + g_object_unref (p->gkbd_configuration); diff --git a/debian/patches/touchscreen_rotation.patch b/debian/patches/touchscreen_rotation.patch new file mode 100644 index 00000000..2d6ce89b --- /dev/null +++ b/debian/patches/touchscreen_rotation.patch @@ -0,0 +1,99 @@ +## Description: correctly set up input coordinates when rotating touchscreens +## Origin/Author: jani@ubuntu.com +## Bug: https://bugzilla.gnome.org/show_bug.cgi?id=691691 +Index: gnome-settings-daemon-3.6.4/plugins/xrandr/gsd-xrandr-manager.c +=================================================================== +--- gnome-settings-daemon-3.6.4.orig/plugins/xrandr/gsd-xrandr-manager.c 2013-01-10 15:37:58.000000000 +0200 ++++ gnome-settings-daemon-3.6.4/plugins/xrandr/gsd-xrandr-manager.c 2013-01-29 16:28:08.946019381 +0200 +@@ -1492,15 +1492,16 @@ + + struct { + GnomeRRRotation rotation; +- /* evdev */ +- gboolean x_axis_inversion; +- gboolean y_axis_inversion; +- gboolean axes_swap; ++ gfloat matrix[9]; + } evdev_rotations[] = { +- { GNOME_RR_ROTATION_0, 0, 0, 0 }, +- { GNOME_RR_ROTATION_90, 1, 0, 1 }, +- { GNOME_RR_ROTATION_180, 1, 1, 0 }, +- { GNOME_RR_ROTATION_270, 0, 1, 1 } ++ { GNOME_RR_ROTATION_0, ++ {1, 0, 0, 0, 1, 0, 0, 0, 1}}, ++ { GNOME_RR_ROTATION_90, ++ {0, -1, 1, 1, 0, 0, 0, 0, 1}}, ++ { GNOME_RR_ROTATION_180, ++ {-1, 0, 1, 0, -1, 1, 0, 0, 1}}, ++ { GNOME_RR_ROTATION_270, ++ {0, 1, 0, -1, 0, 1, 0, 0, 1}} + }; + + static guint +@@ -1556,6 +1557,7 @@ + XDeviceInfo *device_info; + gint n_devices; + guint i, rot_idx; ++ Atom float_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "FLOAT", True); + + if (!supports_xinput_devices ()) + return; +@@ -1576,13 +1578,13 @@ + + if (device_info_is_touchscreen (&device_info[i])) { + XDevice *device; +- char c = evdev_rotations[rot_idx].axes_swap; +- PropertyHelper axes_swap = { +- .name = "Evdev Axes Swap", +- .nitems = 1, +- .format = 8, +- .type = XA_INTEGER, +- .data.c = &c, ++ gfloat *m = evdev_rotations[rot_idx].matrix; ++ PropertyHelper matrix = { ++ .name = "Coordinate Transformation Matrix", ++ .nitems = 9, ++ .format = 32, ++ .type = float_atom, ++ .data.i = (int *)m, + }; + + g_debug ("About to rotate '%s'", device_info[i].name); +@@ -1592,26 +1594,18 @@ + if (gdk_error_trap_pop () || (device == NULL)) + continue; + +- if (device_set_property (device, device_info[i].name, &axes_swap) != FALSE) { +- char axis[] = { +- evdev_rotations[rot_idx].x_axis_inversion, +- evdev_rotations[rot_idx].y_axis_inversion +- }; +- PropertyHelper axis_invert = { +- .name = "Evdev Axis Inversion", +- .nitems = 2, +- .format = 8, +- .type = XA_INTEGER, +- .data.c = axis, +- }; +- +- device_set_property (device, device_info[i].name, &axis_invert); +- +- g_debug ("Rotated '%s' to configuration '%d, %d, %d'", ++ if (device_set_property (device, device_info[i].name, &matrix) != FALSE) { ++ g_print ("Rotated '%s' to configuration '%f, %f, %f, %f, %f, %f, %f, %f, %f'\n", + device_info[i].name, +- evdev_rotations[rot_idx].x_axis_inversion, +- evdev_rotations[rot_idx].y_axis_inversion, +- evdev_rotations[rot_idx].axes_swap); ++ evdev_rotations[rot_idx].matrix[0], ++ evdev_rotations[rot_idx].matrix[1], ++ evdev_rotations[rot_idx].matrix[2], ++ evdev_rotations[rot_idx].matrix[3], ++ evdev_rotations[rot_idx].matrix[4], ++ evdev_rotations[rot_idx].matrix[5], ++ evdev_rotations[rot_idx].matrix[6], ++ evdev_rotations[rot_idx].matrix[7], ++ evdev_rotations[rot_idx].matrix[8]); + } + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device); diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..9dfee3df --- /dev/null +++ b/debian/rules @@ -0,0 +1,31 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/autoreconf.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/rules/utils.mk +include /usr/share/cdbs/1/class/gnome.mk +include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk +include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk + +LDFLAGS += -Wl,-O1 -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,--as-needed + +DEB_DH_MAKESHLIBS_ARGS_ALL += --no-act +DEB_CONFIGURE_EXTRA_FLAGS = --disable-systemd --disable-packagekit + +build/gnome-settings-daemon:: + gcc -o gnome-settings-daemon/gnome-update-wallpaper-cache debian/gnome-update-wallpaper-cache.c `pkg-config --cflags --libs glib-2.0 gdk-3.0 gdk-x11-3.0 gio-2.0 gnome-desktop-3.0` + +install/gnome-settings-daemon:: + /usr/bin/install -c gnome-settings-daemon/gnome-update-wallpaper-cache 'debian/tmp/usr/lib/gnome-settings-daemon' + install -m 644 -D debian/gnome-settings-daemon.user-session.upstart debian/gnome-settings-daemon/usr/share/upstart/sessions/gnome-settings-daemon.conf + install -m 644 -D debian/gnome-settings-daemon.user-session.desktop debian/gnome-settings-daemon/usr/share/upstart/xdg/autostart/gnome-settings-daemon.desktop + +binary-install/gnome-settings-daemon:: + find debian -name '*.a' -delete + find debian -name '*.la' -delete + +common-binary-post-install-arch:: list-missing + +clean:: + rm -f gnome-settings-daemon/gnome-update-wallpaper-cache + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source_gnome-settings-daemon.py b/debian/source_gnome-settings-daemon.py new file mode 100644 index 00000000..79447efb --- /dev/null +++ b/debian/source_gnome-settings-daemon.py @@ -0,0 +1,16 @@ +import os, apport.packaging, re +from apport.hookutils import * + +def add_info(report): + # the issue is not in the gnome-settings-daemon code so reassign + if "Stacktrace" in report and "/usr/lib/gnome-settings-daemon-3.0" in report["Stacktrace"]: + for words in report["Stacktrace"].split(): + if words.startswith("/usr/lib/gnome-settings-daemon-3.0"): + if apport.packaging.get_file_package(words) != 'gnome-settings-daemon': + report.add_package_info(apport.packaging.get_file_package(words)) + return + # update the title to reflect the component and tab + component = re.compile("lib(\w*).so").search(words).groups(1)[0] + report['Title'] = '[%s]: %s' % (component, report.get('Title', report.standard_title())) + report['Tags'] = '%s %s' % (report.get('Tags', ""), component) + break # Stop on the first .so that's the interesting one diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..1812120d --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=2 +http://ftp.gnome.org/pub/GNOME/sources/gnome-settings-daemon/([0-9.]+)/ \ +gnome-settings-daemon-([\d\.]+)\.tar\.xz diff --git a/depcomp b/depcomp new file mode 100755 index 00000000..debb6ffa --- /dev/null +++ b/depcomp @@ -0,0 +1,707 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2012-03-27.16; # UTC + +# Copyright (C) 1999-2012 Free Software Foundation, Inc. + +# 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, 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' "$nl" < "$tmpdepfile" | +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependent.h'. + # Do two passes, one to just change these to + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. + # However on + # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\': + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + # tcc 0.9.26 (FIXME still under development at the moment of writing) + # will emit a similar output, but also prepend the continuation lines + # with horizontal tabulation characters. + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form 'foo.o: dependent.h', + # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. + # Do two passes, one to just change these to + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ + < "$tmpdepfile" > "$depfile" + sed ' + s/[ '"$tab"'][ '"$tab"']*/ /g + s/^ *// + s/ *\\*$// + s/^[^:]*: *// + /^$/d + /:$/d + s/$/ :/ + ' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test "$stat" = 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' "$nl" < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am new file mode 100644 index 00000000..706235bd --- /dev/null +++ b/gnome-settings-daemon/Makefile.am @@ -0,0 +1,84 @@ +NULL = + +INCLUDES = \ + -DDATADIR=\""$(datadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DGNOME_SETTINGS_PLUGINDIR=\""$(plugindir)"\" \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(SETTINGS_DAEMON_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(GNOME_DESKTOP_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ + $(NULL) + +privlibdir = $(pkglibdir)-$(GSD_API_VERSION) + +privlib_LTLIBRARIES = \ + libgsd.la \ + $(NULL) + +libgsd_la_SOURCES = \ + gnome-settings-profile.c \ + gnome-settings-profile.h \ + gnome-settings-session.c \ + gnome-settings-session.h \ + $(NULL) + +libgsd_la_CPPFLAGS = \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(NULL) + +libgsd_la_CFLAGS = \ + $(NULL) + +libgsd_la_LIBADD = \ + $(SYSTEMD_LIBS) \ + $(GIOUNIX_LIBS) \ + $(NULL) + +libgsd_la_LDFLAGS = \ + -export-dynamic \ + -avoid-version \ + -no-undefined \ + $(NULL) + +gsddir = $(libexecdir) + +gsd_PROGRAMS = \ + gnome-settings-daemon + +apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon +api_DATA = \ + gnome-settings-plugin.h + +gnome_settings_daemon_SOURCES = \ + main.c \ + gnome-settings-manager.c \ + gnome-settings-manager.h \ + gnome-settings-plugin.c \ + gnome-settings-plugin.h \ + gnome-settings-plugin-info.c \ + gnome-settings-plugin-info.h \ + gnome-settings-module.c \ + gnome-settings-module.h \ + $(NULL) + +gnome_settings_daemon_CPPFLAGS = \ + $(AM_CPPFLAGS) + +gnome_settings_daemon_CFLAGS = \ + $(AM_CFLAGS) + +gnome_settings_daemon_LDFLAGS = \ + $(AM_LDFLAGS) + +gnome_settings_daemon_LDADD = \ + libgsd.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(LIBNOTIFY_LIBS) \ + $(GNOME_DESKTOP_LIBS) \ + $(NULL) + +# vim: ts=8 diff --git a/gnome-settings-daemon/Makefile.in b/gnome-settings-daemon/Makefile.in new file mode 100644 index 00000000..8200e8ad --- /dev/null +++ b/gnome-settings-daemon/Makefile.in @@ -0,0 +1,963 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +gsd_PROGRAMS = gnome-settings-daemon$(EXEEXT) +subdir = gnome-settings-daemon +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(privlibdir)" "$(DESTDIR)$(gsddir)" \ + "$(DESTDIR)$(apidir)" +LTLIBRARIES = $(privlib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgsd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_libgsd_la_OBJECTS = libgsd_la-gnome-settings-profile.lo \ + libgsd_la-gnome-settings-session.lo $(am__objects_1) +libgsd_la_OBJECTS = $(am_libgsd_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libgsd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libgsd_la_CFLAGS) \ + $(CFLAGS) $(libgsd_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(gsd_PROGRAMS) +am_gnome_settings_daemon_OBJECTS = \ + gnome_settings_daemon-main.$(OBJEXT) \ + gnome_settings_daemon-gnome-settings-manager.$(OBJEXT) \ + gnome_settings_daemon-gnome-settings-plugin.$(OBJEXT) \ + gnome_settings_daemon-gnome-settings-plugin-info.$(OBJEXT) \ + gnome_settings_daemon-gnome-settings-module.$(OBJEXT) \ + $(am__objects_1) +gnome_settings_daemon_OBJECTS = $(am_gnome_settings_daemon_OBJECTS) +gnome_settings_daemon_DEPENDENCIES = libgsd.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gnome_settings_daemon_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gnome_settings_daemon_CFLAGS) $(CFLAGS) \ + $(gnome_settings_daemon_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgsd_la_SOURCES) $(gnome_settings_daemon_SOURCES) +DIST_SOURCES = $(libgsd_la_SOURCES) $(gnome_settings_daemon_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(api_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +INCLUDES = \ + -DDATADIR=\""$(datadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DGNOME_SETTINGS_PLUGINDIR=\""$(plugindir)"\" \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(SETTINGS_DAEMON_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(GNOME_DESKTOP_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ + $(NULL) + +privlibdir = $(pkglibdir)-$(GSD_API_VERSION) +privlib_LTLIBRARIES = \ + libgsd.la \ + $(NULL) + +libgsd_la_SOURCES = \ + gnome-settings-profile.c \ + gnome-settings-profile.h \ + gnome-settings-session.c \ + gnome-settings-session.h \ + $(NULL) + +libgsd_la_CPPFLAGS = \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(NULL) + +libgsd_la_CFLAGS = \ + $(NULL) + +libgsd_la_LIBADD = \ + $(SYSTEMD_LIBS) \ + $(GIOUNIX_LIBS) \ + $(NULL) + +libgsd_la_LDFLAGS = \ + -export-dynamic \ + -avoid-version \ + -no-undefined \ + $(NULL) + +gsddir = $(libexecdir) +apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon +api_DATA = \ + gnome-settings-plugin.h + +gnome_settings_daemon_SOURCES = \ + main.c \ + gnome-settings-manager.c \ + gnome-settings-manager.h \ + gnome-settings-plugin.c \ + gnome-settings-plugin.h \ + gnome-settings-plugin-info.c \ + gnome-settings-plugin-info.h \ + gnome-settings-module.c \ + gnome-settings-module.h \ + $(NULL) + +gnome_settings_daemon_CPPFLAGS = \ + $(AM_CPPFLAGS) + +gnome_settings_daemon_CFLAGS = \ + $(AM_CFLAGS) + +gnome_settings_daemon_LDFLAGS = \ + $(AM_LDFLAGS) + +gnome_settings_daemon_LDADD = \ + libgsd.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(LIBNOTIFY_LIBS) \ + $(GNOME_DESKTOP_LIBS) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gnome-settings-daemon/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu gnome-settings-daemon/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-privlibLTLIBRARIES: $(privlib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(privlib_LTLIBRARIES)'; test -n "$(privlibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(privlibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(privlibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(privlibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(privlibdir)"; \ + } + +uninstall-privlibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(privlib_LTLIBRARIES)'; test -n "$(privlibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(privlibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(privlibdir)/$$f"; \ + done + +clean-privlibLTLIBRARIES: + -test -z "$(privlib_LTLIBRARIES)" || rm -f $(privlib_LTLIBRARIES) + @list='$(privlib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libgsd.la: $(libgsd_la_OBJECTS) $(libgsd_la_DEPENDENCIES) $(EXTRA_libgsd_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgsd_la_LINK) -rpath $(privlibdir) $(libgsd_la_OBJECTS) $(libgsd_la_LIBADD) $(LIBS) +install-gsdPROGRAMS: $(gsd_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(gsd_PROGRAMS)'; test -n "$(gsddir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(gsddir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(gsddir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(gsddir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(gsddir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-gsdPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(gsd_PROGRAMS)'; test -n "$(gsddir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(gsddir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(gsddir)" && rm -f $$files + +clean-gsdPROGRAMS: + @list='$(gsd_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gnome-settings-daemon$(EXEEXT): $(gnome_settings_daemon_OBJECTS) $(gnome_settings_daemon_DEPENDENCIES) $(EXTRA_gnome_settings_daemon_DEPENDENCIES) + @rm -f gnome-settings-daemon$(EXEEXT) + $(AM_V_CCLD)$(gnome_settings_daemon_LINK) $(gnome_settings_daemon_OBJECTS) $(gnome_settings_daemon_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_settings_daemon-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsd_la-gnome-settings-profile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsd_la-gnome-settings-session.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libgsd_la-gnome-settings-profile.lo: gnome-settings-profile.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsd_la_CPPFLAGS) $(CPPFLAGS) $(libgsd_la_CFLAGS) $(CFLAGS) -MT libgsd_la-gnome-settings-profile.lo -MD -MP -MF $(DEPDIR)/libgsd_la-gnome-settings-profile.Tpo -c -o libgsd_la-gnome-settings-profile.lo `test -f 'gnome-settings-profile.c' || echo '$(srcdir)/'`gnome-settings-profile.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgsd_la-gnome-settings-profile.Tpo $(DEPDIR)/libgsd_la-gnome-settings-profile.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-profile.c' object='libgsd_la-gnome-settings-profile.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsd_la_CPPFLAGS) $(CPPFLAGS) $(libgsd_la_CFLAGS) $(CFLAGS) -c -o libgsd_la-gnome-settings-profile.lo `test -f 'gnome-settings-profile.c' || echo '$(srcdir)/'`gnome-settings-profile.c + +libgsd_la-gnome-settings-session.lo: gnome-settings-session.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsd_la_CPPFLAGS) $(CPPFLAGS) $(libgsd_la_CFLAGS) $(CFLAGS) -MT libgsd_la-gnome-settings-session.lo -MD -MP -MF $(DEPDIR)/libgsd_la-gnome-settings-session.Tpo -c -o libgsd_la-gnome-settings-session.lo `test -f 'gnome-settings-session.c' || echo '$(srcdir)/'`gnome-settings-session.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgsd_la-gnome-settings-session.Tpo $(DEPDIR)/libgsd_la-gnome-settings-session.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-session.c' object='libgsd_la-gnome-settings-session.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsd_la_CPPFLAGS) $(CPPFLAGS) $(libgsd_la_CFLAGS) $(CFLAGS) -c -o libgsd_la-gnome-settings-session.lo `test -f 'gnome-settings-session.c' || echo '$(srcdir)/'`gnome-settings-session.c + +gnome_settings_daemon-main.o: main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-main.o -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-main.Tpo -c -o gnome_settings_daemon-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-main.Tpo $(DEPDIR)/gnome_settings_daemon-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='gnome_settings_daemon-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c + +gnome_settings_daemon-main.obj: main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-main.obj -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-main.Tpo -c -o gnome_settings_daemon-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-main.Tpo $(DEPDIR)/gnome_settings_daemon-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='gnome_settings_daemon-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` + +gnome_settings_daemon-gnome-settings-manager.o: gnome-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-manager.o -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Tpo -c -o gnome_settings_daemon-gnome-settings-manager.o `test -f 'gnome-settings-manager.c' || echo '$(srcdir)/'`gnome-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-manager.c' object='gnome_settings_daemon-gnome-settings-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-manager.o `test -f 'gnome-settings-manager.c' || echo '$(srcdir)/'`gnome-settings-manager.c + +gnome_settings_daemon-gnome-settings-manager.obj: gnome-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-manager.obj -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Tpo -c -o gnome_settings_daemon-gnome-settings-manager.obj `if test -f 'gnome-settings-manager.c'; then $(CYGPATH_W) 'gnome-settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-manager.c' object='gnome_settings_daemon-gnome-settings-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-manager.obj `if test -f 'gnome-settings-manager.c'; then $(CYGPATH_W) 'gnome-settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-manager.c'; fi` + +gnome_settings_daemon-gnome-settings-plugin.o: gnome-settings-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-plugin.o -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Tpo -c -o gnome_settings_daemon-gnome-settings-plugin.o `test -f 'gnome-settings-plugin.c' || echo '$(srcdir)/'`gnome-settings-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-plugin.c' object='gnome_settings_daemon-gnome-settings-plugin.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-plugin.o `test -f 'gnome-settings-plugin.c' || echo '$(srcdir)/'`gnome-settings-plugin.c + +gnome_settings_daemon-gnome-settings-plugin.obj: gnome-settings-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-plugin.obj -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Tpo -c -o gnome_settings_daemon-gnome-settings-plugin.obj `if test -f 'gnome-settings-plugin.c'; then $(CYGPATH_W) 'gnome-settings-plugin.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-plugin.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-plugin.c' object='gnome_settings_daemon-gnome-settings-plugin.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-plugin.obj `if test -f 'gnome-settings-plugin.c'; then $(CYGPATH_W) 'gnome-settings-plugin.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-plugin.c'; fi` + +gnome_settings_daemon-gnome-settings-plugin-info.o: gnome-settings-plugin-info.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-plugin-info.o -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Tpo -c -o gnome_settings_daemon-gnome-settings-plugin-info.o `test -f 'gnome-settings-plugin-info.c' || echo '$(srcdir)/'`gnome-settings-plugin-info.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-plugin-info.c' object='gnome_settings_daemon-gnome-settings-plugin-info.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-plugin-info.o `test -f 'gnome-settings-plugin-info.c' || echo '$(srcdir)/'`gnome-settings-plugin-info.c + +gnome_settings_daemon-gnome-settings-plugin-info.obj: gnome-settings-plugin-info.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-plugin-info.obj -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Tpo -c -o gnome_settings_daemon-gnome-settings-plugin-info.obj `if test -f 'gnome-settings-plugin-info.c'; then $(CYGPATH_W) 'gnome-settings-plugin-info.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-plugin-info.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-plugin-info.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-plugin-info.c' object='gnome_settings_daemon-gnome-settings-plugin-info.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-plugin-info.obj `if test -f 'gnome-settings-plugin-info.c'; then $(CYGPATH_W) 'gnome-settings-plugin-info.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-plugin-info.c'; fi` + +gnome_settings_daemon-gnome-settings-module.o: gnome-settings-module.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-module.o -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Tpo -c -o gnome_settings_daemon-gnome-settings-module.o `test -f 'gnome-settings-module.c' || echo '$(srcdir)/'`gnome-settings-module.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-module.c' object='gnome_settings_daemon-gnome-settings-module.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-module.o `test -f 'gnome-settings-module.c' || echo '$(srcdir)/'`gnome-settings-module.c + +gnome_settings_daemon-gnome-settings-module.obj: gnome-settings-module.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -MT gnome_settings_daemon-gnome-settings-module.obj -MD -MP -MF $(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Tpo -c -o gnome_settings_daemon-gnome-settings-module.obj `if test -f 'gnome-settings-module.c'; then $(CYGPATH_W) 'gnome-settings-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-module.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Tpo $(DEPDIR)/gnome_settings_daemon-gnome-settings-module.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-settings-module.c' object='gnome_settings_daemon-gnome-settings-module.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(gnome_settings_daemon_CFLAGS) $(CFLAGS) -c -o gnome_settings_daemon-gnome-settings-module.obj `if test -f 'gnome-settings-module.c'; then $(CYGPATH_W) 'gnome-settings-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-settings-module.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-apiDATA: $(api_DATA) + @$(NORMAL_INSTALL) + @list='$(api_DATA)'; test -n "$(apidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(apidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(apidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(apidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(apidir)" || exit $$?; \ + done + +uninstall-apiDATA: + @$(NORMAL_UNINSTALL) + @list='$(api_DATA)'; test -n "$(apidir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(apidir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(privlibdir)" "$(DESTDIR)$(gsddir)" "$(DESTDIR)$(apidir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-gsdPROGRAMS clean-libtool \ + clean-privlibLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-apiDATA install-gsdPROGRAMS \ + install-privlibLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-apiDATA uninstall-gsdPROGRAMS \ + uninstall-privlibLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-gsdPROGRAMS clean-libtool clean-privlibLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-apiDATA \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-gsdPROGRAMS install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-privlibLTLIBRARIES \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-apiDATA \ + uninstall-gsdPROGRAMS uninstall-privlibLTLIBRARIES + + +# vim: ts=8 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/gnome-settings-daemon/gnome-settings-manager.c b/gnome-settings-daemon/gnome-settings-manager.c new file mode 100644 index 00000000..60645bef --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-manager.c @@ -0,0 +1,475 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include + +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gnome-settings-plugin-info.h" +#include "gnome-settings-manager.h" +#include "gnome-settings-profile.h" + +#define GSD_MANAGER_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_MANAGER_DBUS_NAME "org.gnome.SettingsDaemon" + +#define DEFAULT_SETTINGS_PREFIX "org.gnome.settings-daemon" + +#define PLUGIN_EXT ".gnome-settings-plugin" + +#define GNOME_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerPrivate)) + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +struct GnomeSettingsManagerPrivate +{ + guint owner_id; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GSettings *settings; + GnomePnpIds *pnp_ids; + GSList *plugins; +}; + +static void gnome_settings_manager_class_init (GnomeSettingsManagerClass *klass); +static void gnome_settings_manager_init (GnomeSettingsManager *settings_manager); +static void gnome_settings_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GnomeSettingsManager, gnome_settings_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gnome_settings_manager_error_quark (void) +{ + static GQuark ret = 0; + if (ret == 0) { + ret = g_quark_from_static_string ("gnome_settings_manager_error"); + } + + return ret; +} + +static void +maybe_activate_plugin (GnomeSettingsPluginInfo *info, gpointer user_data) +{ + if (gnome_settings_plugin_info_get_enabled (info)) { + gboolean res; + res = gnome_settings_plugin_info_activate (info); + if (res) { + g_debug ("Plugin %s: active", gnome_settings_plugin_info_get_location (info)); + } else { + g_debug ("Plugin %s: activation failed", gnome_settings_plugin_info_get_location (info)); + } + } else { + g_debug ("Plugin %s: inactive", gnome_settings_plugin_info_get_location (info)); + } +} + +static gint +compare_location (GnomeSettingsPluginInfo *a, + GnomeSettingsPluginInfo *b) +{ + const char *loc_a; + const char *loc_b; + + loc_a = gnome_settings_plugin_info_get_location (a); + loc_b = gnome_settings_plugin_info_get_location (b); + + if (loc_a == NULL || loc_b == NULL) { + return -1; + } + + return strcmp (loc_a, loc_b); +} + +static int +compare_priority (GnomeSettingsPluginInfo *a, + GnomeSettingsPluginInfo *b) +{ + int prio_a; + int prio_b; + + prio_a = gnome_settings_plugin_info_get_priority (a); + prio_b = gnome_settings_plugin_info_get_priority (b); + + return prio_a - prio_b; +} + +static void +emit_signal (GnomeSettingsManager *manager, + const char *signal, + const char *name) +{ + GError *error = NULL; + + /* FIXME: maybe we should queue those up until the D-Bus + * connection is available... */ + if (manager->priv->connection == NULL) + return; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_MANAGER_DBUS_PATH, + GSD_MANAGER_DBUS_NAME, + "PluginActivated", + g_variant_new ("(s)", name), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + +} + +static void +on_plugin_activated (GnomeSettingsPluginInfo *info, + GnomeSettingsManager *manager) +{ + const char *name; + + name = gnome_settings_plugin_info_get_location (info); + g_debug ("GnomeSettingsManager: emitting plugin-activated %s", name); + emit_signal (manager, "PluginActivated", name); +} + +static void +on_plugin_deactivated (GnomeSettingsPluginInfo *info, + GnomeSettingsManager *manager) +{ + const char *name; + + name = gnome_settings_plugin_info_get_location (info); + g_debug ("GnomeSettingsManager: emitting plugin-deactivated %s", name); + emit_signal (manager, "PluginDeactivated", name); +} + +static gboolean +contained (const char * const *items, + const char *item) +{ + while (*items) { + if (g_strcmp0 (*items++, item) == 0) { + return TRUE; + } + } + + return FALSE; +} + +static gboolean +is_schema (const char *schema) +{ + return contained (g_settings_list_schemas (), schema); +} + + +static void +_load_file (GnomeSettingsManager *manager, + const char *filename) +{ + GnomeSettingsPluginInfo *info; + char *key_name; + GSList *l; + + g_debug ("Loading plugin: %s", filename); + gnome_settings_profile_start ("%s", filename); + + info = gnome_settings_plugin_info_new_from_file (filename); + if (info == NULL) { + goto out; + } + + l = g_slist_find_custom (manager->priv->plugins, + info, + (GCompareFunc) compare_location); + if (l != NULL) { + goto out; + } + + key_name = g_strdup_printf ("%s.plugins.%s", + DEFAULT_SETTINGS_PREFIX, + gnome_settings_plugin_info_get_location (info)); + + /* Ignore unknown schemas or else we'll assert */ + if (is_schema (key_name)) { + manager->priv->plugins = g_slist_prepend (manager->priv->plugins, + g_object_ref (info)); + + g_signal_connect (info, "activated", + G_CALLBACK (on_plugin_activated), manager); + g_signal_connect (info, "deactivated", + G_CALLBACK (on_plugin_deactivated), manager); + + gnome_settings_plugin_info_set_settings_prefix (info, key_name); + } else { + g_warning ("Ignoring unknown module '%s'", key_name); + } + + /* Priority is set in the call above */ + g_free (key_name); + + out: + if (info != NULL) { + g_object_unref (info); + } + + gnome_settings_profile_end ("%s", filename); +} + +static void +_load_dir (GnomeSettingsManager *manager, + const char *path) +{ + GError *error; + GDir *d; + const char *name; + + g_debug ("Loading settings plugins from dir: %s", path); + gnome_settings_profile_start (NULL); + + error = NULL; + d = g_dir_open (path, 0, &error); + if (d == NULL) { + g_warning ("%s", error->message); + g_error_free (error); + return; + } + + while ((name = g_dir_read_name (d))) { + char *filename; + + if (!g_str_has_suffix (name, PLUGIN_EXT)) { + continue; + } + + filename = g_build_filename (path, name, NULL); + if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { + _load_file (manager, filename); + } + g_free (filename); + } + + g_dir_close (d); + + gnome_settings_profile_end (NULL); +} + +static void +_load_all (GnomeSettingsManager *manager) +{ + gnome_settings_profile_start (NULL); + + /* load system plugins */ + _load_dir (manager, GNOME_SETTINGS_PLUGINDIR G_DIR_SEPARATOR_S); + + manager->priv->plugins = g_slist_sort (manager->priv->plugins, (GCompareFunc) compare_priority); + g_slist_foreach (manager->priv->plugins, (GFunc) maybe_activate_plugin, NULL); + gnome_settings_profile_end (NULL); +} + +static void +_unload_plugin (GnomeSettingsPluginInfo *info, gpointer user_data) +{ + if (gnome_settings_plugin_info_get_enabled (info)) { + gnome_settings_plugin_info_deactivate (info); + } + g_object_unref (info); +} + +static void +_unload_all (GnomeSettingsManager *manager) +{ + g_slist_foreach (manager->priv->plugins, (GFunc) _unload_plugin, NULL); + g_slist_free (manager->priv->plugins); + manager->priv->plugins = NULL; +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GnomeSettingsManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MANAGER_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + NULL, + NULL, + NULL, + NULL); +} + +static void +register_manager (GnomeSettingsManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + NULL, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +gboolean +gnome_settings_manager_start (GnomeSettingsManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting settings manager"); + + ret = FALSE; + + gnome_settings_profile_start (NULL); + + if (!g_module_supported ()) { + g_warning ("gnome-settings-daemon is not able to initialize the plugins."); + g_set_error (error, + GNOME_SETTINGS_MANAGER_ERROR, + GNOME_SETTINGS_MANAGER_ERROR_GENERAL, + "Plugins not supported"); + + goto out; + } + + g_debug ("loading PNPIDs"); + manager->priv->pnp_ids = gnome_pnp_ids_new (); + + gnome_settings_profile_start ("initializing plugins"); + manager->priv->settings = g_settings_new (DEFAULT_SETTINGS_PREFIX ".plugins"); + + _load_all (manager); + gnome_settings_profile_end ("initializing plugins"); + + ret = TRUE; + out: + gnome_settings_profile_end (NULL); + + return ret; +} + +void +gnome_settings_manager_stop (GnomeSettingsManager *manager) +{ + g_debug ("Stopping settings manager"); + + _unload_all (manager); + + if (manager->priv->owner_id > 0) { + g_bus_unown_name (manager->priv->owner_id); + manager->priv->owner_id = 0; + } + + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->pnp_ids); +} + +static void +gnome_settings_manager_dispose (GObject *object) +{ + GnomeSettingsManager *manager; + + manager = GNOME_SETTINGS_MANAGER (object); + + gnome_settings_manager_stop (manager); + + G_OBJECT_CLASS (gnome_settings_manager_parent_class)->dispose (object); +} + +static void +gnome_settings_manager_class_init (GnomeSettingsManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = gnome_settings_manager_dispose; + object_class->finalize = gnome_settings_manager_finalize; + + g_type_class_add_private (klass, sizeof (GnomeSettingsManagerPrivate)); +} + +static void +gnome_settings_manager_init (GnomeSettingsManager *manager) +{ + + manager->priv = GNOME_SETTINGS_MANAGER_GET_PRIVATE (manager); +} + +static void +gnome_settings_manager_finalize (GObject *object) +{ + GnomeSettingsManager *manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GNOME_IS_SETTINGS_MANAGER (object)); + + manager = GNOME_SETTINGS_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + G_OBJECT_CLASS (gnome_settings_manager_parent_class)->finalize (object); +} + +GnomeSettingsManager * +gnome_settings_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GNOME_TYPE_SETTINGS_MANAGER, + NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager (manager_object); + } + + return GNOME_SETTINGS_MANAGER (manager_object); +} diff --git a/gnome-settings-daemon/gnome-settings-manager.h b/gnome-settings-daemon/gnome-settings-manager.h new file mode 100644 index 00000000..be0a69c9 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-manager.h @@ -0,0 +1,70 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 __GNOME_SETTINGS_MANAGER_H +#define __GNOME_SETTINGS_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GNOME_TYPE_SETTINGS_MANAGER (gnome_settings_manager_get_type ()) +#define GNOME_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManager)) +#define GNOME_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerClass)) +#define GNOME_IS_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_TYPE_SETTINGS_MANAGER)) +#define GNOME_IS_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_TYPE_SETTINGS_MANAGER)) +#define GNOME_SETTINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerClass)) + +typedef struct GnomeSettingsManagerPrivate GnomeSettingsManagerPrivate; + +typedef struct +{ + GObject parent; + GnomeSettingsManagerPrivate *priv; +} GnomeSettingsManager; + +typedef struct +{ + GObjectClass parent_class; + + void (* plugin_activated) (GnomeSettingsManager *manager, + const char *name); + void (* plugin_deactivated) (GnomeSettingsManager *manager, + const char *name); +} GnomeSettingsManagerClass; + +typedef enum +{ + GNOME_SETTINGS_MANAGER_ERROR_GENERAL +} GnomeSettingsManagerError; + +#define GNOME_SETTINGS_MANAGER_ERROR gnome_settings_manager_error_quark () + +GQuark gnome_settings_manager_error_quark (void); +GType gnome_settings_manager_get_type (void); + +GnomeSettingsManager * gnome_settings_manager_new (void); +gboolean gnome_settings_manager_start (GnomeSettingsManager *manager, + GError **error); +void gnome_settings_manager_stop (GnomeSettingsManager *manager); + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_MANAGER_H */ diff --git a/gnome-settings-daemon/gnome-settings-module.c b/gnome-settings-daemon/gnome-settings-module.c new file mode 100644 index 00000000..dce66f32 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-module.c @@ -0,0 +1,166 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 - Paolo Maggi + * + * 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 "gnome-settings-module.h" + +#include + +typedef struct _GnomeSettingsModuleClass GnomeSettingsModuleClass; + +struct _GnomeSettingsModuleClass +{ + GTypeModuleClass parent_class; +}; + +struct _GnomeSettingsModule +{ + GTypeModule parent_instance; + + GModule *library; + + char *path; + GType type; +}; + +typedef GType (*GnomeSettingsModuleRegisterFunc) (GTypeModule *); + +G_DEFINE_TYPE (GnomeSettingsModule, gnome_settings_module, G_TYPE_TYPE_MODULE) + +static gboolean +gnome_settings_module_load (GTypeModule *gmodule) +{ + GnomeSettingsModule *module; + GnomeSettingsModuleRegisterFunc register_func; + gboolean res; + + module = GNOME_SETTINGS_MODULE (gmodule); + + g_debug ("Loading %s", module->path); + + module->library = g_module_open (module->path, 0); + + if (module->library == NULL) { + g_warning ("%s", g_module_error ()); + + return FALSE; + } + + /* extract symbols from the lib */ + res = g_module_symbol (module->library, "register_gnome_settings_plugin", (void *) ®ister_func); + if (! res) { + g_warning ("%s", g_module_error ()); + g_module_close (module->library); + + return FALSE; + } + + g_assert (register_func); + + module->type = register_func (gmodule); + + if (module->type == 0) { + g_warning ("Invalid gnome settings plugin in module %s", module->path); + return FALSE; + } + + return TRUE; +} + +static void +gnome_settings_module_unload (GTypeModule *gmodule) +{ + GnomeSettingsModule *module = GNOME_SETTINGS_MODULE (gmodule); + + g_debug ("Unloading %s", module->path); + + g_module_close (module->library); + + module->library = NULL; + module->type = 0; +} + +const gchar * +gnome_settings_module_get_path (GnomeSettingsModule *module) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_MODULE (module), NULL); + + return module->path; +} + +GObject * +gnome_settings_module_new_object (GnomeSettingsModule *module) +{ + g_debug ("Creating object of type %s", g_type_name (module->type)); + + if (module->type == 0) { + return NULL; + } + + return g_object_new (module->type, NULL); +} + +static void +gnome_settings_module_init (GnomeSettingsModule *module) +{ + g_debug ("GnomeSettingsModule %p initialising", module); +} + +static void +gnome_settings_module_finalize (GObject *object) +{ + GnomeSettingsModule *module = GNOME_SETTINGS_MODULE (object); + + g_debug ("GnomeSettingsModule %p finalizing", module); + + g_free (module->path); + + G_OBJECT_CLASS (gnome_settings_module_parent_class)->finalize (object); +} + +static void +gnome_settings_module_class_init (GnomeSettingsModuleClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class); + + object_class->finalize = gnome_settings_module_finalize; + + module_class->load = gnome_settings_module_load; + module_class->unload = gnome_settings_module_unload; +} + +GnomeSettingsModule * +gnome_settings_module_new (const char *path) +{ + GnomeSettingsModule *result; + + if (path == NULL || path[0] == '\0') { + return NULL; + } + + result = g_object_new (GNOME_TYPE_SETTINGS_MODULE, NULL); + + g_type_module_set_name (G_TYPE_MODULE (result), path); + result->path = g_strdup (path); + + return result; +} diff --git a/gnome-settings-daemon/gnome-settings-module.h b/gnome-settings-daemon/gnome-settings-module.h new file mode 100644 index 00000000..94e0a568 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-module.h @@ -0,0 +1,47 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 - Paolo Maggi + * + * 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 GNOME_SETTINGS_MODULE_H +#define GNOME_SETTINGS_MODULE_H + +#include + +G_BEGIN_DECLS + +#define GNOME_TYPE_SETTINGS_MODULE (gnome_settings_module_get_type ()) +#define GNOME_SETTINGS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SETTINGS_MODULE, GnomeSettingsModule)) +#define GNOME_SETTINGS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_SETTINGS_MODULE, GnomeSettingsModuleClass)) +#define GNOME_IS_SETTINGS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_SETTINGS_MODULE)) +#define GNOME_IS_SETTINGS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GNOME_TYPE_SETTINGS_MODULE)) +#define GNOME_SETTINGS_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_TYPE_SETTINGS_MODULE, GnomeSettingsModuleClass)) + +typedef struct _GnomeSettingsModule GnomeSettingsModule; + +GType gnome_settings_module_get_type (void) G_GNUC_CONST; + +GnomeSettingsModule *gnome_settings_module_new (const gchar *path); + +const char *gnome_settings_module_get_path (GnomeSettingsModule *module); + +GObject *gnome_settings_module_new_object (GnomeSettingsModule *module); + +G_END_DECLS + +#endif diff --git a/gnome-settings-daemon/gnome-settings-plugin-info.c b/gnome-settings-daemon/gnome-settings-plugin-info.c new file mode 100644 index 00000000..9edd4c9a --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-plugin-info.c @@ -0,0 +1,527 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 + +#include +#include +#include +#include + +#include "gnome-settings-plugin-info.h" +#include "gnome-settings-module.h" +#include "gnome-settings-plugin.h" +#include "gnome-settings-profile.h" + +#define GNOME_SETTINGS_PLUGIN_INFO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfoPrivate)) + +#define PLUGIN_GROUP "GNOME Settings Plugin" + +#define PLUGIN_PRIORITY_MAX 1 +#define PLUGIN_PRIORITY_DEFAULT 100 + +struct GnomeSettingsPluginInfoPrivate +{ + char *file; + GSettings *settings; + + char *location; + GTypeModule *module; + + char *name; + char *desc; + char **authors; + char *copyright; + char *website; + + GnomeSettingsPlugin *plugin; + + int enabled : 1; + int active : 1; + + /* A plugin is unavailable if it is not possible to activate it + due to an error loading the plugin module (e.g. for Python plugins + when the interpreter has not been correctly initializated) */ + int available : 1; + + /* Priority determines the order in which plugins are started and + * stopped. A lower number means higher priority. */ + guint priority; +}; + + +enum { + ACTIVATED, + DEACTIVATED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + +G_DEFINE_TYPE (GnomeSettingsPluginInfo, gnome_settings_plugin_info, G_TYPE_OBJECT) + +static void +gnome_settings_plugin_info_finalize (GObject *object) +{ + GnomeSettingsPluginInfo *info; + + g_return_if_fail (object != NULL); + g_return_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (object)); + + info = GNOME_SETTINGS_PLUGIN_INFO (object); + + g_return_if_fail (info->priv != NULL); + + if (info->priv->plugin != NULL) { + g_debug ("Unref plugin %s", info->priv->name); + + g_object_unref (info->priv->plugin); + + /* info->priv->module must not be unref since it is not possible to finalize + * a type module */ + } + + g_free (info->priv->file); + g_free (info->priv->location); + g_free (info->priv->name); + g_free (info->priv->desc); + g_free (info->priv->website); + g_free (info->priv->copyright); + g_strfreev (info->priv->authors); + + if (info->priv->settings != NULL) { + g_object_unref (info->priv->settings); + } + + G_OBJECT_CLASS (gnome_settings_plugin_info_parent_class)->finalize (object); +} + +static void +gnome_settings_plugin_info_class_init (GnomeSettingsPluginInfoClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gnome_settings_plugin_info_finalize; + + signals [ACTIVATED] = + g_signal_new ("activated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeSettingsPluginInfoClass, activated), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals [DEACTIVATED] = + g_signal_new ("deactivated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeSettingsPluginInfoClass, deactivated), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + g_type_class_add_private (klass, sizeof (GnomeSettingsPluginInfoPrivate)); +} + +static void +gnome_settings_plugin_info_init (GnomeSettingsPluginInfo *info) +{ + info->priv = GNOME_SETTINGS_PLUGIN_INFO_GET_PRIVATE (info); +} + +static void +debug_info (GnomeSettingsPluginInfo *info) +{ + g_debug ("GnomeSettingsPluginInfo: name='%s' file='%s' location='%s'", + info->priv->name, + info->priv->file, + info->priv->location); +} + +static gboolean +gnome_settings_plugin_info_fill_from_file (GnomeSettingsPluginInfo *info, + const char *filename) +{ + GKeyFile *plugin_file = NULL; + char *str; + int priority; + gboolean ret; + + gnome_settings_profile_start ("%s", filename); + + ret = FALSE; + + info->priv->file = g_strdup (filename); + + plugin_file = g_key_file_new (); + if (! g_key_file_load_from_file (plugin_file, filename, G_KEY_FILE_NONE, NULL)) { + g_warning ("Bad plugin file: %s", filename); + goto out; + } + + if (! g_key_file_has_key (plugin_file, PLUGIN_GROUP, "IAge", NULL)) { + g_debug ("IAge key does not exist in file: %s", filename); + goto out; + } + + /* Check IAge=2 */ + if (g_key_file_get_integer (plugin_file, PLUGIN_GROUP, "IAge", NULL) != 0) { + g_debug ("Wrong IAge in file: %s", filename); + goto out; + } + + /* Get Location */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Module", NULL); + + if ((str != NULL) && (*str != '\0')) { + info->priv->location = str; + } else { + g_free (str); + g_warning ("Could not find 'Module' in %s", filename); + goto out; + } + + /* Get Name */ + str = g_key_file_get_locale_string (plugin_file, PLUGIN_GROUP, "Name", NULL, NULL); + if (str != NULL) { + info->priv->name = str; + } else { + g_warning ("Could not find 'Name' in %s", filename); + goto out; + } + + /* Get Description */ + str = g_key_file_get_locale_string (plugin_file, PLUGIN_GROUP, "Description", NULL, NULL); + if (str != NULL) { + info->priv->desc = str; + } else { + g_debug ("Could not find 'Description' in %s", filename); + } + + /* Get Authors */ + info->priv->authors = g_key_file_get_string_list (plugin_file, PLUGIN_GROUP, "Authors", NULL, NULL); + if (info->priv->authors == NULL) { + g_debug ("Could not find 'Authors' in %s", filename); + } + + /* Get Copyright */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Copyright", NULL); + if (str != NULL) { + info->priv->copyright = str; + } else { + g_debug ("Could not find 'Copyright' in %s", filename); + } + + /* Get Website */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Website", NULL); + if (str != NULL) { + info->priv->website = str; + } else { + g_debug ("Could not find 'Website' in %s", filename); + } + + /* Get Priority */ + priority = g_key_file_get_integer (plugin_file, PLUGIN_GROUP, "Priority", NULL); + if (priority >= PLUGIN_PRIORITY_MAX) { + info->priv->priority = priority; + } else { + info->priv->priority = PLUGIN_PRIORITY_DEFAULT; + } + + g_key_file_free (plugin_file); + + debug_info (info); + + /* If we know nothing about the availability of the plugin, + set it as available */ + info->priv->available = TRUE; + + ret = TRUE; + out: + gnome_settings_profile_end ("%s", filename); + + return ret; +} + +GnomeSettingsPluginInfo * +gnome_settings_plugin_info_new_from_file (const char *filename) +{ + GnomeSettingsPluginInfo *info; + gboolean res; + + info = g_object_new (GNOME_TYPE_SETTINGS_PLUGIN_INFO, NULL); + + res = gnome_settings_plugin_info_fill_from_file (info, filename); + if (! res) { + g_object_unref (info); + info = NULL; + } + + return info; +} + +static void +plugin_enabled_cb (GSettings *settings, + const gchar *key, + GnomeSettingsPluginInfo *info) +{ + if (g_strcmp0 (key, "active") == 0) { + if (g_settings_get_boolean (settings, "active")) + gnome_settings_plugin_info_activate (info); + else + gnome_settings_plugin_info_deactivate (info); + } +} + +void +gnome_settings_plugin_info_set_settings_prefix (GnomeSettingsPluginInfo *info, + const char *settings_prefix) +{ + int priority; + + info->priv->settings = g_settings_new (settings_prefix); + info->priv->enabled = g_settings_get_boolean (info->priv->settings, "active"); + + priority = g_settings_get_int (info->priv->settings, "priority"); + if (priority > 0) + info->priv->priority = priority; + + g_signal_connect (G_OBJECT (info->priv->settings), + "changed", + G_CALLBACK (plugin_enabled_cb), + info); +} + +static void +_deactivate_plugin (GnomeSettingsPluginInfo *info) +{ + gnome_settings_plugin_deactivate (info->priv->plugin); + g_signal_emit (info, signals [DEACTIVATED], 0); +} + +gboolean +gnome_settings_plugin_info_deactivate (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + if (!info->priv->active || !info->priv->available) { + return TRUE; + } + + _deactivate_plugin (info); + + /* Update plugin state */ + info->priv->active = FALSE; + + return TRUE; +} + + +static gboolean +load_plugin_module (GnomeSettingsPluginInfo *info) +{ + char *path; + char *dirname; + gboolean ret; + + ret = FALSE; + + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + g_return_val_if_fail (info->priv->file != NULL, FALSE); + g_return_val_if_fail (info->priv->location != NULL, FALSE); + g_return_val_if_fail (info->priv->plugin == NULL, FALSE); + g_return_val_if_fail (info->priv->available, FALSE); + + gnome_settings_profile_start ("%s", info->priv->location); + + dirname = g_path_get_dirname (info->priv->file); + g_return_val_if_fail (dirname != NULL, FALSE); + + path = g_module_build_path (dirname, info->priv->location); + g_free (dirname); + g_return_val_if_fail (path != NULL, FALSE); + + info->priv->module = G_TYPE_MODULE (gnome_settings_module_new (path)); + g_free (path); + + if (!g_type_module_use (info->priv->module)) { + g_warning ("Cannot load plugin '%s' since file '%s' cannot be read.", + info->priv->name, + gnome_settings_module_get_path (GNOME_SETTINGS_MODULE (info->priv->module))); + + g_object_unref (G_OBJECT (info->priv->module)); + info->priv->module = NULL; + + /* Mark plugin as unavailable and fails */ + info->priv->available = FALSE; + + goto out; + } + + info->priv->plugin = GNOME_SETTINGS_PLUGIN (gnome_settings_module_new_object (GNOME_SETTINGS_MODULE (info->priv->module))); + + g_type_module_unuse (info->priv->module); + ret = TRUE; + out: + gnome_settings_profile_end ("%s", info->priv->location); + return ret; +} + +static gboolean +_activate_plugin (GnomeSettingsPluginInfo *info) +{ + gboolean res = TRUE; + + if (!info->priv->available) { + /* Plugin is not available, don't try to activate/load it */ + return FALSE; + } + + if (info->priv->plugin == NULL) { + res = load_plugin_module (info); + } + + if (res) { + gnome_settings_plugin_activate (info->priv->plugin); + g_signal_emit (info, signals [ACTIVATED], 0); + } else { + g_warning ("Error activating plugin '%s'", info->priv->name); + } + + return res; +} + +gboolean +gnome_settings_plugin_info_activate (GnomeSettingsPluginInfo *info) +{ + + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + if (! info->priv->available) { + return FALSE; + } + + if (info->priv->active) { + return TRUE; + } + + if (_activate_plugin (info)) { + info->priv->active = TRUE; + return TRUE; + } + + return FALSE; +} + +gboolean +gnome_settings_plugin_info_is_active (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->available && info->priv->active); +} + +gboolean +gnome_settings_plugin_info_get_enabled (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->enabled); +} + +gboolean +gnome_settings_plugin_info_is_available (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->available != FALSE); +} + +const char * +gnome_settings_plugin_info_get_name (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->name; +} + +const char * +gnome_settings_plugin_info_get_description (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->desc; +} + +const char ** +gnome_settings_plugin_info_get_authors (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), (const char **)NULL); + + return (const char **)info->priv->authors; +} + +const char * +gnome_settings_plugin_info_get_website (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->website; +} + +const char * +gnome_settings_plugin_info_get_copyright (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->copyright; +} + + +const char * +gnome_settings_plugin_info_get_location (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->location; +} + +int +gnome_settings_plugin_info_get_priority (GnomeSettingsPluginInfo *info) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info), PLUGIN_PRIORITY_DEFAULT); + + return info->priv->priority; +} + +void +gnome_settings_plugin_info_set_priority (GnomeSettingsPluginInfo *info, + int priority) +{ + g_return_if_fail (GNOME_IS_SETTINGS_PLUGIN_INFO (info)); + + info->priv->priority = priority; +} diff --git a/gnome-settings-daemon/gnome-settings-plugin-info.h b/gnome-settings-daemon/gnome-settings-plugin-info.h new file mode 100644 index 00000000..d3fac9b1 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-plugin-info.h @@ -0,0 +1,76 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GNOME_SETTINGS_PLUGIN_INFO_H__ +#define __GNOME_SETTINGS_PLUGIN_INFO_H__ + +#include +#include + +G_BEGIN_DECLS +#define GNOME_TYPE_SETTINGS_PLUGIN_INFO (gnome_settings_plugin_info_get_type()) +#define GNOME_SETTINGS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfo)) +#define GNOME_SETTINGS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfoClass)) +#define GNOME_IS_SETTINGS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_TYPE_SETTINGS_PLUGIN_INFO)) +#define GNOME_IS_SETTINGS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SETTINGS_PLUGIN_INFO)) +#define GNOME_SETTINGS_PLUGIN_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_TYPE_SETTINGS_PLUGIN_INFO, GnomeSettingsPluginInfoClass)) + +typedef struct GnomeSettingsPluginInfoPrivate GnomeSettingsPluginInfoPrivate; + +typedef struct +{ + GObject parent; + GnomeSettingsPluginInfoPrivate *priv; +} GnomeSettingsPluginInfo; + +typedef struct +{ + GObjectClass parent_class; + + void (* activated) (GnomeSettingsPluginInfo *info); + void (* deactivated) (GnomeSettingsPluginInfo *info); +} GnomeSettingsPluginInfoClass; + +GType gnome_settings_plugin_info_get_type (void) G_GNUC_CONST; + +GnomeSettingsPluginInfo *gnome_settings_plugin_info_new_from_file (const char *filename); + +void gnome_settings_plugin_info_set_settings_prefix (GnomeSettingsPluginInfo *info, const char *settings_prefix); +gboolean gnome_settings_plugin_info_activate (GnomeSettingsPluginInfo *info); +gboolean gnome_settings_plugin_info_deactivate (GnomeSettingsPluginInfo *info); + +gboolean gnome_settings_plugin_info_is_active (GnomeSettingsPluginInfo *info); +gboolean gnome_settings_plugin_info_get_enabled (GnomeSettingsPluginInfo *info); +gboolean gnome_settings_plugin_info_is_available (GnomeSettingsPluginInfo *info); + +const char *gnome_settings_plugin_info_get_name (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_description (GnomeSettingsPluginInfo *info); +const char **gnome_settings_plugin_info_get_authors (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_website (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_copyright (GnomeSettingsPluginInfo *info); +const char *gnome_settings_plugin_info_get_location (GnomeSettingsPluginInfo *info); +int gnome_settings_plugin_info_get_priority (GnomeSettingsPluginInfo *info); + +void gnome_settings_plugin_info_set_priority (GnomeSettingsPluginInfo *info, + int priority); + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_PLUGIN_INFO_H__ */ diff --git a/gnome-settings-daemon/gnome-settings-plugin.c b/gnome-settings-daemon/gnome-settings-plugin.c new file mode 100644 index 00000000..8005754d --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-plugin.c @@ -0,0 +1,61 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2007 William Jon McCann + * + * 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 "gnome-settings-plugin.h" + +G_DEFINE_TYPE (GnomeSettingsPlugin, gnome_settings_plugin, G_TYPE_OBJECT) + +static void +dummy (GnomeSettingsPlugin *plugin) +{ + /* Empty */ +} + +static void +gnome_settings_plugin_class_init (GnomeSettingsPluginClass *klass) +{ + klass->activate = dummy; + klass->deactivate = dummy; +} + +static void +gnome_settings_plugin_init (GnomeSettingsPlugin *plugin) +{ + /* Empty */ +} + +void +gnome_settings_plugin_activate (GnomeSettingsPlugin *plugin) +{ + g_return_if_fail (GNOME_IS_SETTINGS_PLUGIN (plugin)); + + GNOME_SETTINGS_PLUGIN_GET_CLASS (plugin)->activate (plugin); +} + +void +gnome_settings_plugin_deactivate (GnomeSettingsPlugin *plugin) +{ + g_return_if_fail (GNOME_IS_SETTINGS_PLUGIN (plugin)); + + GNOME_SETTINGS_PLUGIN_GET_CLASS (plugin)->deactivate (plugin); +} diff --git a/gnome-settings-daemon/gnome-settings-plugin.h b/gnome-settings-daemon/gnome-settings-plugin.h new file mode 100644 index 00000000..03a272a4 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-plugin.h @@ -0,0 +1,80 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2007 William Jon McCann + * + * 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 __GNOME_SETTINGS_PLUGIN_H__ +#define __GNOME_SETTINGS_PLUGIN_H__ + +#include +#include + +G_BEGIN_DECLS +#define GNOME_TYPE_SETTINGS_PLUGIN (gnome_settings_plugin_get_type()) +#define GNOME_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNOME_TYPE_SETTINGS_PLUGIN, GnomeSettingsPlugin)) +#define GNOME_SETTINGS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNOME_TYPE_SETTINGS_PLUGIN, GnomeSettingsPluginClass)) +#define GNOME_IS_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNOME_TYPE_SETTINGS_PLUGIN)) +#define GNOME_IS_SETTINGS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_SETTINGS_PLUGIN)) +#define GNOME_SETTINGS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNOME_TYPE_SETTINGS_PLUGIN, GnomeSettingsPluginClass)) + +typedef struct +{ + GObject parent; +} GnomeSettingsPlugin; + +typedef struct +{ + GObjectClass parent_class; + + /* Virtual public methods */ + void (*activate) (GnomeSettingsPlugin *plugin); + void (*deactivate) (GnomeSettingsPlugin *plugin); +} GnomeSettingsPluginClass; + +GType gnome_settings_plugin_get_type (void) G_GNUC_CONST; + +void gnome_settings_plugin_activate (GnomeSettingsPlugin *plugin); +void gnome_settings_plugin_deactivate (GnomeSettingsPlugin *plugin); + +/* + * Utility macro used to register plugins + * + * use: GNOME_SETTINGS_PLUGIN_REGISTER (PluginName, plugin_name) + */ +#define GNOME_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \ + G_DEFINE_DYNAMIC_TYPE (PluginName, \ + plugin_name, \ + GNOME_TYPE_SETTINGS_PLUGIN) \ + \ +G_MODULE_EXPORT GType \ +register_gnome_settings_plugin (GTypeModule *type_module) \ +{ \ + plugin_name##_register_type (type_module); \ + \ + return plugin_name##_get_type(); \ +} \ + \ +static void \ +plugin_name##_class_finalize (PluginName##Class *plugin_name##_class) \ +{ \ +} \ + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_PLUGIN_H__ */ diff --git a/gnome-settings-daemon/gnome-settings-profile.c b/gnome-settings-daemon/gnome-settings-profile.c new file mode 100644 index 00000000..7d7e019c --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-profile.c @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 William Jon McCann + * + * 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. + * + * Authors: William Jon McCann + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" + +void +_gnome_settings_profile_log (const char *func, + const char *note, + const char *format, + ...) +{ + va_list args; + char *str; + char *formatted; + + if (format == NULL) { + formatted = g_strdup (""); + } else { + va_start (args, format); + formatted = g_strdup_vprintf (format, args); + va_end (args); + } + + if (func != NULL) { + str = g_strdup_printf ("MARK: %s %s: %s %s", g_get_prgname(), func, note ? note : "", formatted); + } else { + str = g_strdup_printf ("MARK: %s: %s %s", g_get_prgname(), note ? note : "", formatted); + } + + g_free (formatted); + + g_access (str, F_OK); + g_free (str); +} diff --git a/gnome-settings-daemon/gnome-settings-profile.h b/gnome-settings-daemon/gnome-settings-profile.h new file mode 100644 index 00000000..ff85c1b7 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-profile.h @@ -0,0 +1,53 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 William Jon McCann + * + * 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. + * + * Authors: William Jon McCann + * + */ + +#ifndef __GNOME_SETTINGS_PROFILE_H +#define __GNOME_SETTINGS_PROFILE_H + +#include + +G_BEGIN_DECLS + +#ifdef ENABLE_PROFILING +#ifdef G_HAVE_ISO_VARARGS +#define gnome_settings_profile_start(...) _gnome_settings_profile_log (G_STRFUNC, "start", __VA_ARGS__) +#define gnome_settings_profile_end(...) _gnome_settings_profile_log (G_STRFUNC, "end", __VA_ARGS__) +#define gnome_settings_profile_msg(...) _gnome_settings_profile_log (NULL, NULL, __VA_ARGS__) +#elif defined(G_HAVE_GNUC_VARARGS) +#define gnome_settings_profile_start(format...) _gnome_settings_profile_log (G_STRFUNC, "start", format) +#define gnome_settings_profile_end(format...) _gnome_settings_profile_log (G_STRFUNC, "end", format) +#define gnome_settings_profile_msg(format...) _gnome_settings_profile_log (NULL, NULL, format) +#endif +#else +#define gnome_settings_profile_start(...) +#define gnome_settings_profile_end(...) +#define gnome_settings_profile_msg(...) +#endif + +void _gnome_settings_profile_log (const char *func, + const char *note, + const char *format, + ...) G_GNUC_PRINTF (3, 4); + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_PROFILE_H */ diff --git a/gnome-settings-daemon/gnome-settings-session.c b/gnome-settings-daemon/gnome-settings-session.c new file mode 100644 index 00000000..57863006 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-session.c @@ -0,0 +1,436 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2006-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "gnome-settings-session.h" + +#ifdef HAVE_SYSTEMD +#include + +typedef struct +{ + GSource source; + GPollFD pollfd; + sd_login_monitor *monitor; +} SdSource; + +static gboolean +sd_source_prepare (GSource *source, + gint *timeout) +{ + *timeout = -1; + return FALSE; +} + +static gboolean +sd_source_check (GSource *source) +{ + SdSource *sd_source = (SdSource *)source; + + return sd_source->pollfd.revents != 0; +} + +static gboolean +sd_source_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) + +{ + SdSource *sd_source = (SdSource *)source; + gboolean ret; + + g_warn_if_fail (callback != NULL); + + ret = (*callback) (user_data); + + sd_login_monitor_flush (sd_source->monitor); + return ret; +} + +static void +sd_source_finalize (GSource *source) +{ + SdSource *sd_source = (SdSource*)source; + + sd_login_monitor_unref (sd_source->monitor); +} + +static GSourceFuncs sd_source_funcs = { + sd_source_prepare, + sd_source_check, + sd_source_dispatch, + sd_source_finalize +}; + +static GSource * +sd_source_new (void) +{ + GSource *source; + SdSource *sd_source; + int ret; + + source = g_source_new (&sd_source_funcs, sizeof (SdSource)); + sd_source = (SdSource *)source; + + if ((ret = sd_login_monitor_new (NULL, &sd_source->monitor)) < 0) + { + g_printerr ("Error getting login monitor: %d", ret); + } + else + { + sd_source->pollfd.fd = sd_login_monitor_get_fd (sd_source->monitor); + sd_source->pollfd.events = G_IO_IN; + g_source_add_poll (source, &sd_source->pollfd); + } + + return source; +} + +#endif + +static void gnome_settings_session_finalize (GObject *object); + +#define GNOME_SETTINGS_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_SESSION, GnomeSettingsSessionPrivate)) + +#define CONSOLEKIT_NAME "org.freedesktop.ConsoleKit" +#define CONSOLEKIT_PATH "/org/freedesktop/ConsoleKit" +#define CONSOLEKIT_INTERFACE "org.freedesktop.ConsoleKit" + +#define CONSOLEKIT_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" +#define CONSOLEKIT_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" +#define CONSOLEKIT_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" +#define CONSOLEKIT_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" + +struct GnomeSettingsSessionPrivate +{ +#ifdef HAVE_SYSTEMD + GSource *sd_source; +#else + GDBusProxy *proxy_session; + GCancellable *cancellable; +#endif + gchar *session_id; + GnomeSettingsSessionState state; +}; + +enum { + PROP_0, + PROP_STATE, + PROP_LAST +}; + +G_DEFINE_TYPE (GnomeSettingsSession, gnome_settings_session, G_TYPE_OBJECT) + +GnomeSettingsSessionState +gnome_settings_session_get_state (GnomeSettingsSession *session) +{ + g_return_val_if_fail (GNOME_IS_SETTINGS_SESSION (session), + GNOME_SETTINGS_SESSION_STATE_UNKNOWN); + return session->priv->state; +} + +static void +gnome_settings_session_set_state (GnomeSettingsSession *session, + gboolean active) +{ + GnomeSettingsSessionState state; + + state = active ? GNOME_SETTINGS_SESSION_STATE_ACTIVE + : GNOME_SETTINGS_SESSION_STATE_INACTIVE; + if (session->priv->state != state) { + session->priv->state = state; + g_object_notify (G_OBJECT (session), "state"); + } +} + +static void +gnome_settings_session_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (object); + + switch (prop_id) { + case PROP_STATE: + g_value_set_enum (value, session->priv->state); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +GType +gnome_settings_session_state_get_type (void) +{ + static GType etype = 0; + if (etype == 0) { + static const GEnumValue values[] = { + { GNOME_SETTINGS_SESSION_STATE_UNKNOWN, + "unknown", "Unknown" }, + { GNOME_SETTINGS_SESSION_STATE_ACTIVE, + "active", "Active" }, + { GNOME_SETTINGS_SESSION_STATE_INACTIVE, + "inactive", "Inactive" }, + { 0, NULL, NULL } + }; + etype = g_enum_register_static ("GnomeSettingsSessionState", values); + } + return etype; +} + +static void +gnome_settings_session_class_init (GnomeSettingsSessionClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->get_property = gnome_settings_session_get_property; + object_class->finalize = gnome_settings_session_finalize; + g_type_class_add_private (klass, sizeof (GnomeSettingsSessionPrivate)); + + g_object_class_install_property (object_class, + PROP_STATE, + g_param_spec_enum ("state", + "The session state", + NULL, + GNOME_TYPE_SETTINGS_SESSION_STATE, + GNOME_SETTINGS_SESSION_STATE_UNKNOWN, + G_PARAM_READABLE)); +} + +#ifdef HAVE_SYSTEMD + +static gboolean +sessions_changed (gpointer user_data) +{ + GnomeSettingsSession *session = user_data; + gboolean active; + + active = sd_session_is_active (session->priv->session_id); + gnome_settings_session_set_state (session, active); + + return TRUE; +} + +#else /* HAVE_SYSTEMD */ + +static void +gnome_settings_session_proxy_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + GnomeSettingsSession *session) +{ + gboolean active; + if (g_strcmp0 (signal_name, "ActiveChanged") == 0) { + g_variant_get (parameters, "(b)", &active); + g_debug ("emitting active: %i", active); + gnome_settings_session_set_state (session, active); + } +} + +static void +is_active_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) +{ + gboolean active = FALSE; + GError *error = NULL; + GVariant *result; + GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (user_data); + + /* is our session active */ + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("IsActive failed: %s", error->message); + g_error_free (error); + return; + } + g_variant_get (result, "(b)", &active); + gnome_settings_session_set_state (session, active); + + /* watch for changes */ + g_signal_connect (session->priv->proxy_session, "g-signal", + G_CALLBACK (gnome_settings_session_proxy_signal_cb), + session); + + g_variant_unref (result); +} + +static void +got_session_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) +{ + GError *error = NULL; + GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (user_data); + + /* connect to session */ + session->priv->proxy_session = g_dbus_proxy_new_for_bus_finish (res, + &error); + if (session->priv->proxy_session == NULL) { + g_warning ("cannot connect to %s: %s", + session->priv->session_id, + error->message); + g_error_free (error); + return; + } + + /* is our session active */ + g_dbus_proxy_call (session->priv->proxy_session, + "IsActive", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + session->priv->cancellable, + is_active_cb, + session); +} + +static void +got_session_path_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (user_data); + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("Failed to get session for pid: %s", + error->message); + g_error_free (error); + return; + } + + g_variant_get (result, "(o)", &session->priv->session_id); + g_debug ("ConsoleKit session ID: %s", session->priv->session_id); + + /* connect to session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + CONSOLEKIT_NAME, + session->priv->session_id, + CONSOLEKIT_SESSION_INTERFACE, + session->priv->cancellable, + got_session_proxy_cb, + session); + g_variant_unref (result); +} + +static void +got_manager_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) +{ + GDBusProxy *proxy_manager; + GError *error = NULL; + guint32 pid; + GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (user_data); + + proxy_manager = g_dbus_proxy_new_for_bus_finish (res, &error); + if (proxy_manager == NULL) { + g_warning ("cannot connect to ConsoleKit: %s", + error->message); + g_error_free (error); + return; + } + + /* get the session we are running in */ + pid = getpid (); + g_dbus_proxy_call (proxy_manager, + "GetSessionForUnixProcess", + g_variant_new ("(u)", pid), + G_DBUS_CALL_FLAGS_NONE, + -1, session->priv->cancellable, + got_session_path_cb, + session); + g_object_unref (proxy_manager); +} + +#endif /* HAVE_SYSTEMD */ + +static void +gnome_settings_session_init (GnomeSettingsSession *session) +{ + session->priv = GNOME_SETTINGS_SESSION_GET_PRIVATE (session); + +#ifdef HAVE_SYSTEMD + sd_pid_get_session (getpid(), &session->priv->session_id); + + session->priv->sd_source = sd_source_new (); + g_source_set_callback (session->priv->sd_source, sessions_changed, session, NULL); + g_source_attach (session->priv->sd_source, NULL); + + sessions_changed (session); +#else + session->priv->cancellable = g_cancellable_new (); + + /* connect to ConsoleKit */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + CONSOLEKIT_NAME, + CONSOLEKIT_MANAGER_PATH, + CONSOLEKIT_MANAGER_INTERFACE, + session->priv->cancellable, + got_manager_proxy_cb, + session); +#endif +} + +static void +gnome_settings_session_finalize (GObject *object) +{ + GnomeSettingsSession *session; + + session = GNOME_SETTINGS_SESSION (object); + + g_free (session->priv->session_id); + +#ifdef HAVE_SYSTEMD + if (session->priv->sd_source != NULL) { + g_source_destroy (session->priv->sd_source); + g_source_unref (session->priv->sd_source); + } +#else + g_cancellable_cancel (session->priv->cancellable); + + if (session->priv->proxy_session != NULL) + g_object_unref (session->priv->proxy_session); + g_object_unref (session->priv->cancellable); +#endif + + G_OBJECT_CLASS (gnome_settings_session_parent_class)->finalize (object); +} + +GnomeSettingsSession * +gnome_settings_session_new (void) +{ + GnomeSettingsSession *session; + session = g_object_new (GNOME_TYPE_SETTINGS_SESSION, NULL); + return GNOME_SETTINGS_SESSION (session); +} diff --git a/gnome-settings-daemon/gnome-settings-session.h b/gnome-settings-daemon/gnome-settings-session.h new file mode 100644 index 00000000..c9b64ee9 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-session.h @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GNOME_SETTINGS_SESSION_H +#define __GNOME_SETTINGS_SESSION_H + +#include + +G_BEGIN_DECLS + +#define GNOME_TYPE_SETTINGS_SESSION (gnome_settings_session_get_type ()) +#define GNOME_SETTINGS_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_TYPE_SETTINGS_SESSION, GnomeSettingsSession)) +#define GNOME_SETTINGS_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNOME_TYPE_SETTINGS_SESSION, GnomeSettingsSessionClass)) +#define GNOME_IS_SETTINGS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_TYPE_SETTINGS_SESSION)) +#define GNOME_IS_SETTINGS_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_TYPE_SETTINGS_SESSION)) +#define GNOME_SETTINGS_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNOME_TYPE_SETTINGS_SESSION, GnomeSettingsSessionClass)) +#define GNOME_TYPE_SETTINGS_SESSION_STATE (gnome_settings_session_state_get_type()) + +typedef struct GnomeSettingsSessionPrivate GnomeSettingsSessionPrivate; + +typedef struct +{ + GObject parent; + GnomeSettingsSessionPrivate *priv; +} GnomeSettingsSession; + +typedef struct +{ + GObjectClass parent_class; +} GnomeSettingsSessionClass; + +typedef enum { + GNOME_SETTINGS_SESSION_STATE_UNKNOWN, + GNOME_SETTINGS_SESSION_STATE_ACTIVE, + GNOME_SETTINGS_SESSION_STATE_INACTIVE, +} GnomeSettingsSessionState; + +GType gnome_settings_session_get_type (void); +GType gnome_settings_session_state_get_type (void); +GnomeSettingsSession *gnome_settings_session_new (void); +GnomeSettingsSessionState gnome_settings_session_get_state (GnomeSettingsSession *session); + + +G_END_DECLS + +#endif /* __GNOME_SETTINGS_SESSION_H */ + diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c new file mode 100644 index 00000000..af46e493 --- /dev/null +++ b/gnome-settings-daemon/main.c @@ -0,0 +1,576 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "gnome-settings-manager.h" +#include "gnome-settings-profile.h" + +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_OBJECT "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE "org.gnome.SessionManager.ClientPrivate" + +static gboolean debug = FALSE; +static gboolean do_timed_exit = FALSE; +static int term_signal_pipe_fds[2]; +static guint name_id = 0; +static GnomeSettingsManager *manager = NULL; + +static GOptionEntry entries[] = { + {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL }, + { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, + {NULL} +}; + +static gboolean +timed_exit_cb (void) +{ + g_debug ("Doing timed exit"); + gtk_main_quit (); + return FALSE; +} + +static void +stop_manager (GnomeSettingsManager *manager) +{ + gnome_settings_manager_stop (manager); + gtk_main_quit (); +} + +static void +on_session_over (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + if (g_strcmp0 (signal_name, "SessionOver") == 0) { + g_debug ("Got a SessionOver signal - stopping"); + stop_manager (manager); + } +} + +static void +respond_to_end_session (GDBusProxy *proxy) +{ + /* we must answer with "EndSessionResponse" */ + g_dbus_proxy_call (proxy, "EndSessionResponse", + g_variant_new ("(bs)", + TRUE, ""), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); +} + +static void +client_proxy_signal_cb (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + if (g_strcmp0 (signal_name, "QueryEndSession") == 0) { + g_debug ("Got QueryEndSession signal"); + respond_to_end_session (proxy); + } else if (g_strcmp0 (signal_name, "EndSession") == 0) { + g_debug ("Got EndSession signal"); + respond_to_end_session (proxy); + } else if (g_strcmp0 (signal_name, "Stop") == 0) { + g_debug ("Got Stop signal"); + stop_manager (manager); + } +} + +static void +got_client_proxy (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + GDBusProxy *client_proxy; + GError *error = NULL; + + client_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + + if (error != NULL) { + g_debug ("Unable to get the session client proxy: %s", error->message); + g_error_free (error); + return; + } + + g_signal_connect (client_proxy, "g-signal", + G_CALLBACK (client_proxy_signal_cb), manager); +} + +static void +on_client_registered (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *variant; + GError *error = NULL; + gchar *object_path = NULL; + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (error != NULL) { + g_warning ("Unable to register client: %s", error->message); + g_error_free (error); + } else { + g_variant_get (variant, "(o)", &object_path); + + g_debug ("Registered client at path %s", object_path); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, 0, NULL, + GNOME_SESSION_DBUS_NAME, + object_path, + GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE, + NULL, + got_client_proxy, + manager); + + g_free (object_path); + g_variant_unref (variant); + } +} + +static void +session_env_done (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (result == NULL) { + g_debug ("Failed to set the environment: %s", error->message); + g_error_free (error); + return; + } + + g_variant_unref (result); +} + +static void +set_session_env (GDBusProxy *proxy, + const gchar *name, + const gchar *value) +{ + g_dbus_proxy_call (proxy, + "Setenv", + g_variant_new ("(ss)", name, value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) session_env_done, + NULL); +} + +static void +set_locale (GDBusProxy *proxy) +{ + GSettings *locale_settings; + gchar *region; + + /* Set locale environment */ + locale_settings = g_settings_new ("org.gnome.system.locale"); + region = g_settings_get_string (locale_settings, "region"); + if (region[0]) { + /* Only set the locale settings if the user has ever customized them */ + set_session_env (proxy, "LC_TIME", region); + set_session_env (proxy, "LC_NUMERIC", region); + set_session_env (proxy, "LC_MONETARY", region); + set_session_env (proxy, "LC_MEASUREMENT", region); + } + g_free (region); + + g_object_unref (locale_settings); +} + +static void +register_with_gnome_session (GDBusProxy *proxy) +{ + const char *startup_id; + + g_signal_connect (G_OBJECT (proxy), "g-signal", + G_CALLBACK (on_session_over), NULL); + startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); + g_dbus_proxy_call (proxy, + "RegisterClient", + g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) on_client_registered, + manager); +} + +#ifdef HAVE_IBUS +static gboolean +is_program_in_path (const char *binary) +{ + char *path; + + path = g_find_program_in_path (binary); + if (path == NULL) + return FALSE; + g_free (path); + return TRUE; +} + +static gboolean +keyboard_plugin_is_enabled (void) +{ + GSettings *settings; + gboolean enabled; + + settings = g_settings_new ("org.gnome.settings-daemon.plugins.keyboard"); + enabled = g_settings_get_boolean (settings, "active"); + g_object_unref (settings); + + return enabled; +} + +static void +got_session_name (GObject *object, + GAsyncResult *res, + gpointer data) +{ + GDBusProxy *proxy; + GVariant *result, *variant; + const gchar *session_name = NULL; + GError *error = NULL; + + proxy = G_DBUS_PROXY (object); + + result = g_dbus_proxy_call_finish (proxy, res, &error); + if (!result) { + g_debug ("Failed to get session name: %s", error->message); + g_error_free (error); + register_with_gnome_session (proxy); + return; + } + + g_variant_get (result, "(v)", &variant); + g_variant_unref (result); + + g_variant_get (variant, "&s", &session_name); + + if (g_strcmp0 (session_name, "gnome") == 0 && + is_program_in_path ("ibus-daemon") && + keyboard_plugin_is_enabled ()) { + set_session_env (proxy, "QT_IM_MODULE", "ibus"); + set_session_env (proxy, "XMODIFIERS", "@im=ibus"); + } + + g_variant_unref (variant); + + /* Finally we can register. */ + register_with_gnome_session (proxy); +} + +static void +set_legacy_ibus_env_vars (GDBusProxy *proxy) +{ + g_dbus_proxy_call (proxy, + "org.freedesktop.DBus.Properties.Get", + g_variant_new ("(ss)", + "org.gnome.SessionManager", + "SessionName"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + got_session_name, + NULL); +} +#endif + +static gboolean +on_term_signal_pipe_closed (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + term_signal_pipe_fds[0] = -1; + + g_debug ("Received SIGTERM - shutting down"); + /* Got SIGTERM, time to clean up and get out + */ + gtk_main_quit (); + + return FALSE; +} + +static void +on_term_signal (int signal) +{ + /* Wake up main loop to tell it to shutdown */ + close (term_signal_pipe_fds[1]); + term_signal_pipe_fds[1] = -1; +} + +static void +watch_for_term_signal (GnomeSettingsManager *manager) +{ + GIOChannel *channel; + + if (-1 == pipe (term_signal_pipe_fds) || + -1 == fcntl (term_signal_pipe_fds[0], F_SETFD, FD_CLOEXEC) || + -1 == fcntl (term_signal_pipe_fds[1], F_SETFD, FD_CLOEXEC)) { + g_error ("Could not create pipe: %s", g_strerror (errno)); + exit (EXIT_FAILURE); + } + + channel = g_io_channel_unix_new (term_signal_pipe_fds[0]); + g_io_channel_set_encoding (channel, NULL, NULL); + g_io_channel_set_buffered (channel, FALSE); + g_io_add_watch (channel, G_IO_HUP, on_term_signal_pipe_closed, manager); + g_io_channel_unref (channel); + + signal (SIGTERM, on_term_signal); +} + +static void +set_session_over_handler (GDBusConnection *bus) +{ + g_assert (bus != NULL); + + watch_for_term_signal (manager); +} + +static void +name_acquired_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + set_session_over_handler (connection); +} + +static void +name_lost_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + /* Name was already taken, or the bus went away */ + + g_warning ("Name taken or bus went away - shutting down"); + gtk_main_quit (); +} + +static gboolean +do_register_client (gpointer user_data) +{ + GDBusProxy *proxy = (GDBusProxy *) user_data; + g_assert (proxy != NULL); + + const char *startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); + g_dbus_proxy_call (proxy, + "RegisterClient", + g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) on_client_registered, + manager); + + return FALSE; +} + +static void +queue_register_client (void) +{ + GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + if (!bus) + return; + + GError *error = NULL; + GDBusProxy *proxy = g_dbus_proxy_new_sync (bus, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_OBJECT, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + &error); + g_object_unref (bus); + + if (proxy == NULL) { + g_debug ("Could not connect to the Session manager: %s", error->message); + g_error_free (error); + return; + } + + /* Register the daemon with gnome-session */ + g_signal_connect (G_OBJECT (proxy), "g-signal", + G_CALLBACK (on_session_over), NULL); + + g_idle_add_full (G_PRIORITY_DEFAULT, do_register_client, proxy, NULL); +} + +static void +bus_register (void) +{ + name_id = g_bus_own_name (G_BUS_TYPE_SESSION, + GSD_DBUS_NAME, + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, + (GBusNameAcquiredCallback) name_acquired_handler, + (GBusNameLostCallback) name_lost_handler, + NULL, + NULL); +} + +static void +gsd_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data) +{ + /* filter out DEBUG messages if debug isn't set */ + if ((log_level & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG + && ! debug) { + return; + } + + g_log_default_handler (log_domain, + log_level, + message, + unused_data); +} + +static void +parse_args (int *argc, char ***argv) +{ + GError *error; + GOptionContext *context; + + gnome_settings_profile_start (NULL); + + + context = g_option_context_new (NULL); + + g_option_context_add_main_entries (context, entries, NULL); + g_option_context_add_group (context, gtk_get_option_group (FALSE)); + + error = NULL; + if (!g_option_context_parse (context, argc, argv, &error)) { + if (error != NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } else { + g_warning ("Unable to initialize GTK+"); + } + exit (EXIT_FAILURE); + } + + g_option_context_free (context); + + gnome_settings_profile_end (NULL); + + if (debug) + g_setenv ("G_MESSAGES_DEBUG", "all", FALSE); +} + +int +main (int argc, char *argv[]) +{ + + gboolean res; + GError *error; + + gnome_settings_profile_start (NULL); + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + setlocale (LC_ALL, ""); + + parse_args (&argc, &argv); + + g_type_init (); + + gnome_settings_profile_start ("opening gtk display"); + if (! gtk_init_check (NULL, NULL)) { + g_warning ("Unable to initialize GTK+"); + exit (EXIT_FAILURE); + } + gnome_settings_profile_end ("opening gtk display"); + + g_log_set_default_handler (gsd_log_default_handler, NULL); + + notify_init ("gnome-settings-daemon"); + + queue_register_client (); + + bus_register (); + + gnome_settings_profile_start ("gnome_settings_manager_new"); + manager = gnome_settings_manager_new (); + gnome_settings_profile_end ("gnome_settings_manager_new"); + if (manager == NULL) { + g_warning ("Unable to register object"); + goto out; + } + + error = NULL; + res = gnome_settings_manager_start (manager, &error); + if (! res) { + g_warning ("Unable to start: %s", error->message); + g_error_free (error); + goto out; + } + + if (do_timed_exit) { + g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL); + } + + gtk_main (); + + g_debug ("Shutting down"); + +out: + if (name_id > 0) { + g_bus_unown_name (name_id); + name_id = 0; + } + + if (manager != NULL) { + g_object_unref (manager); + } + + g_debug ("SettingsDaemon finished"); + gnome_settings_profile_end (NULL); + + return 0; +} diff --git a/install-sh b/install-sh new file mode 100755 index 00000000..377bb868 --- /dev/null +++ b/install-sh @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-11-20.07; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/ltmain.sh b/ltmain.sh new file mode 100644 index 00000000..63ae69dc --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,9655 @@ + +# libtool (GNU libtool) 2.4.2 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.2 +TIMESTAMP="" +package_revision=1.3337 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 00000000..644259d2 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,19 @@ +XSLTPROC_FLAGS = \ + --nonet \ + --stringparam man.output.quietly 1 \ + --stringparam funcsynopsis.style ansi \ + --stringparam man.th.extra1.suppress 1 \ + --stringparam man.authors.section.enabled 0 \ + --stringparam man.copyright.section.enabled 0 + +.xml.1: + $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +man_MANS = \ + gnome-settings-daemon.1 + +xml_files = $(man_MANS:.1=.xml) + +EXTRA_DIST = $(xml_files) + +DISTCLEANFILES = $(man_MANS) diff --git a/man/Makefile.in b/man/Makefile.in new file mode 100644 index 00000000..9fde8339 --- /dev/null +++ b/man/Makefile.in @@ -0,0 +1,608 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = man +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +XSLTPROC_FLAGS = \ + --nonet \ + --stringparam man.output.quietly 1 \ + --stringparam funcsynopsis.style ansi \ + --stringparam man.th.extra1.suppress 1 \ + --stringparam man.authors.section.enabled 0 \ + --stringparam man.copyright.section.enabled 0 + +man_MANS = \ + gnome-settings-daemon.1 + +xml_files = $(man_MANS:.1=.xml) +EXTRA_DIST = $(xml_files) +DISTCLEANFILES = $(man_MANS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .1 .xml +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu man/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically 'make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-man uninstall-man1 + + +.xml.1: + $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/man/gnome-settings-daemon.xml b/man/gnome-settings-daemon.xml new file mode 100644 index 00000000..b5678e2f --- /dev/null +++ b/man/gnome-settings-daemon.xml @@ -0,0 +1,140 @@ + + + + + + + gnome-settings-daemon + GNOME + + + + Maintainer + Bastien + Nocera + hadess@hadess.net + + + + + + + gnome-settings-daemon + 1 + User Commands + + + + gnome-settings-daemon + GNOME settings daemon + + + + + gnome-settings-daemon OPTION + + + + + Description + + gnome-settings-daemon provides many + session-wide services and functions that require a + long-running process. + Among the services implemented by gnome-settings-daemon + are an XSettings manager, which provides theming, font + and other settings to GTK+ applications, and a clipboard + manager, which preserves clipboard contents when an + application exits. + Many user interface elements of + gnome-shell and + gnome-control-center rely on + gnome-settings-daemon for their functionality. + + + The internal architecture of gnome-settings-daemon + consists of a number of plugins, which provide functionality + such as printer notifications, software update monitoring, + background changing, etc. For debugging purposes, these + plugins can be individually disabled by changing the + gsettings key org.gnome.settings-daemon.plugins.plugin-name.active, where + plugin-name is + the name of the plugin. To see a list of all plugins, + use the command + + gsettings list-children org.gnome.settings-daemon.plugins + + + + gnome-settings-daemon takes the name + org.gnome.SettingsDaemon on the session bus to ensure + that only one instance is running. Some plugins export + objects under this name to make their functionality + available to other applications. The interfaces of + these objects should generally be considered private + and unstable. + + gnome-settings-daemon is a required component of + the GNOME desktop, i.e. it is listed in the + RequiredComponents field of + /usr/share/gnome-session/sessions/gnome.session. + It is started in the initialization phase of the session, + and gnome-session will restart it + if it crashes. + + + + + + Options + + + + , + + Prints a short help + text and exits. + + + + + + Enables debugging code. + + + + + + Exits after a timeout (30 seconds) for debugging. + + + + + + + Files + + + /usr/share/gnome-session/sessions/gnome.session + + GNOME session definition file where gnome-settings-daemon is listed as a required component. + + + /etc/xdg/autostart/gnome-settings-daemon.desktop + + Autostart file for gnome-settings-daemon, where its autostart phase is set. + + + + + + See Also + + gnome-shell1, + gnome-control-center1, + gnome-session1 + + + + diff --git a/missing b/missing new file mode 100755 index 00000000..9a556482 --- /dev/null +++ b/missing @@ -0,0 +1,330 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2012-01-06.18; # UTC + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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, 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, 'missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file 'aclocal.m4' + autoconf touch file 'configure' + autoheader touch file 'config.h.in' + autom4te touch the output file, or create a stub one + automake touch all 'Makefile.in' files + bison create 'y.tab.[ch]', if possible, from existing .[ch] + flex create 'lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create 'lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create 'y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running '$TOOL --version' or '$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified 'acinclude.m4' or '${configure_ac}'. You might want + to install the Automake and Perl packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified '${configure_ac}'. You might want to install the + Autoconf and GNU m4 packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified 'acconfig.h' or '${configure_ac}'. You might want + to install the Autoconf and GNU m4 packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'. + You might want to install the Automake and Perl packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: '$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get '$1' as part of Autoconf from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: '$1' $msg. You should only need it if + you modified a '.y' file. You may need the Bison package + in order for those modifications to take effect. You can get + Bison from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified a '.l' file. You may need the Flex package + in order for those modifications to take effect. You can get + Flex from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + Help2man package in order for those modifications to take + effect. You can get Help2man from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: '$1' is $msg. You should only need it if + you modified a '.texi' or '.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy 'make' (AIX, + DU, IRIX). You might want to install the Texinfo package or + the GNU make package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: '$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the 'README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing '$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 00000000..55d537f8 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,162 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2009-04-28.21; # UTC + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' +IFS=" "" $nl" +errstatus=0 +dirmode= + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit $? + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit $? + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the 'mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because '.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file + shift + IFS=$oIFS + + for d + do + test "x$d" = x && continue + + pathcomp=$pathcomp$d + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr= + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp=$pathcomp/ + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/plugins/Makefile.am b/plugins/Makefile.am new file mode 100644 index 00000000..69b71810 --- /dev/null +++ b/plugins/Makefile.am @@ -0,0 +1,56 @@ +NULL = + +enabled_plugins = \ + a11y-keyboard \ + a11y-settings \ + automount \ + background \ + clipboard \ + color \ + cursor \ + dummy \ + power \ + housekeeping \ + keyboard \ + media-keys \ + mouse \ + screensaver-proxy \ + sound \ + xrandr \ + xsettings \ + $(NULL) + +disabled_plugins = $(NULL) + +if HAVE_PACKAGEKIT +enabled_plugins += updates +else +disabled_plugins += updates +endif + +if SMARTCARD_SUPPORT +enabled_plugins += smartcard +else +disabled_plugins += smartcard +endif + +if HAVE_GUDEV +enabled_plugins += orientation +else +disabled_plugins += orientation +endif + +if HAVE_WACOM +enabled_plugins += wacom +else +disabled_plugins += wacom +endif + +if BUILD_PRINT_NOTIFICATIONS +enabled_plugins += print-notifications +else +disabled_plugins += print-notifications +endif + +SUBDIRS = common $(enabled_plugins) +DIST_SUBDIRS = $(SUBDIRS) $(disabled_plugins) diff --git a/plugins/Makefile.in b/plugins/Makefile.in new file mode 100644 index 00000000..bc5bcb17 --- /dev/null +++ b/plugins/Makefile.in @@ -0,0 +1,704 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_PACKAGEKIT_TRUE@am__append_1 = updates +@HAVE_PACKAGEKIT_FALSE@am__append_2 = updates +@SMARTCARD_SUPPORT_TRUE@am__append_3 = smartcard +@SMARTCARD_SUPPORT_FALSE@am__append_4 = smartcard +@HAVE_GUDEV_TRUE@am__append_5 = orientation +@HAVE_GUDEV_FALSE@am__append_6 = orientation +@HAVE_WACOM_TRUE@am__append_7 = wacom +@HAVE_WACOM_FALSE@am__append_8 = wacom +@BUILD_PRINT_NOTIFICATIONS_TRUE@am__append_9 = print-notifications +@BUILD_PRINT_NOTIFICATIONS_FALSE@am__append_10 = print-notifications +subdir = plugins +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +enabled_plugins = a11y-keyboard a11y-settings automount background \ + clipboard color cursor dummy power housekeeping keyboard \ + media-keys mouse screensaver-proxy sound xrandr xsettings \ + $(NULL) $(am__append_1) $(am__append_3) $(am__append_5) \ + $(am__append_7) $(am__append_9) +disabled_plugins = $(NULL) $(am__append_2) $(am__append_4) \ + $(am__append_6) $(am__append_8) $(am__append_10) +SUBDIRS = common $(enabled_plugins) +DIST_SUBDIRS = $(SUBDIRS) $(disabled_plugins) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + cscopelist cscopelist-recursive ctags ctags-recursive \ + distclean distclean-generic distclean-libtool distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/a11y-keyboard/Makefile.am b/plugins/a11y-keyboard/Makefile.am new file mode 100644 index 00000000..ed3f76b2 --- /dev/null +++ b/plugins/a11y-keyboard/Makefile.am @@ -0,0 +1,117 @@ +NULL = + +plugin_name = a11y-keyboard + +gtkbuilderdir = $(pkgdatadir) +gtkbuilder_DATA = \ + gsd-a11y-preferences-dialog.ui \ + $(NULL) + +noinst_PROGRAMS = test-a11y-preferences-dialog + +libexec_PROGRAMS = gsd-test-a11y-keyboard + +gsd_test_a11y_keyboard_SOURCES = \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-keyboard.c + +gsd_test_a11y_keyboard_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + $(PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(APPINDICATOR_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_a11y_keyboard_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(LIBNOTIFY_LIBS) \ + $(APPINDICATOR_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +test_a11y_preferences_dialog_SOURCES = \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-preferences-dialog.c \ + $(NULL) + +test_a11y_preferences_dialog_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_a11y_preferences_dialog_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_a11y_preferences_dialog_LDADD = \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + liba11y-keyboard.la \ + $(NULL) + +liba11y_keyboard_la_SOURCES = \ + gsd-a11y-keyboard-plugin.h \ + gsd-a11y-keyboard-plugin.c \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.h \ + gsd-a11y-preferences-dialog.c \ + $(NULL) + +liba11y_keyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(gtkbuilderdir)"\" \ + $(AM_CPPFLAGS) + +liba11y_keyboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(APPINDICATOR_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_keyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +liba11y_keyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(LIBNOTIFY_LIBS) \ + $(APPINDICATOR_LIBS) \ + $(NULL) + +plugin_in_files = \ + a11y-keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(gtkbuilder_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/a11y-keyboard/Makefile.in b/plugins/a11y-keyboard/Makefile.in new file mode 100644 index 00000000..3014085b --- /dev/null +++ b/plugins/a11y-keyboard/Makefile.in @@ -0,0 +1,1054 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = test-a11y-preferences-dialog$(EXEEXT) +libexec_PROGRAMS = gsd-test-a11y-keyboard$(EXEEXT) +subdir = plugins/a11y-keyboard +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(gtkbuilderdir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +liba11y_keyboard_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_liba11y_keyboard_la_OBJECTS = \ + liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo \ + liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo \ + liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo \ + $(am__objects_1) +liba11y_keyboard_la_OBJECTS = $(am_liba11y_keyboard_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +liba11y_keyboard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) \ + $(liba11y_keyboard_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS) +am_gsd_test_a11y_keyboard_OBJECTS = \ + gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.$(OBJEXT) \ + gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.$(OBJEXT) \ + gsd_test_a11y_keyboard-test-a11y-keyboard.$(OBJEXT) +gsd_test_a11y_keyboard_OBJECTS = $(am_gsd_test_a11y_keyboard_OBJECTS) +gsd_test_a11y_keyboard_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_a11y_keyboard_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_a11y_preferences_dialog_OBJECTS = test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.$(OBJEXT) \ + test_a11y_preferences_dialog-test-a11y-preferences-dialog.$(OBJEXT) \ + $(am__objects_1) +test_a11y_preferences_dialog_OBJECTS = \ + $(am_test_a11y_preferences_dialog_OBJECTS) +test_a11y_preferences_dialog_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +test_a11y_preferences_dialog_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(liba11y_keyboard_la_SOURCES) \ + $(gsd_test_a11y_keyboard_SOURCES) \ + $(test_a11y_preferences_dialog_SOURCES) +DIST_SOURCES = $(liba11y_keyboard_la_SOURCES) \ + $(gsd_test_a11y_keyboard_SOURCES) \ + $(test_a11y_preferences_dialog_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(gtkbuilder_DATA) $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +plugin_name = a11y-keyboard +gtkbuilderdir = $(pkgdatadir) +gtkbuilder_DATA = \ + gsd-a11y-preferences-dialog.ui \ + $(NULL) + +gsd_test_a11y_keyboard_SOURCES = \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-keyboard.c + +gsd_test_a11y_keyboard_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + $(PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_a11y_keyboard_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(LIBNOTIFY_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +test_a11y_preferences_dialog_SOURCES = \ + gsd-a11y-preferences-dialog.c \ + gsd-a11y-preferences-dialog.h \ + test-a11y-preferences-dialog.c \ + $(NULL) + +test_a11y_preferences_dialog_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_a11y_preferences_dialog_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_a11y_preferences_dialog_LDADD = \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + liba11y-keyboard.la \ + $(NULL) + +liba11y_keyboard_la_SOURCES = \ + gsd-a11y-keyboard-plugin.h \ + gsd-a11y-keyboard-plugin.c \ + gsd-a11y-keyboard-manager.h \ + gsd-a11y-keyboard-manager.c \ + gsd-a11y-preferences-dialog.h \ + gsd-a11y-preferences-dialog.c \ + $(NULL) + +liba11y_keyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(gtkbuilderdir)"\" \ + $(AM_CPPFLAGS) + +liba11y_keyboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_keyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +liba11y_keyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(LIBNOTIFY_LIBS) \ + $(NULL) + +plugin_in_files = \ + a11y-keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) \ + $(gtkbuilder_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/a11y-keyboard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/a11y-keyboard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +liba11y-keyboard.la: $(liba11y_keyboard_la_OBJECTS) $(liba11y_keyboard_la_DEPENDENCIES) $(EXTRA_liba11y_keyboard_la_DEPENDENCIES) + $(AM_V_CCLD)$(liba11y_keyboard_la_LINK) -rpath $(plugindir) $(liba11y_keyboard_la_OBJECTS) $(liba11y_keyboard_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-a11y-keyboard$(EXEEXT): $(gsd_test_a11y_keyboard_OBJECTS) $(gsd_test_a11y_keyboard_DEPENDENCIES) $(EXTRA_gsd_test_a11y_keyboard_DEPENDENCIES) + @rm -f gsd-test-a11y-keyboard$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_a11y_keyboard_LINK) $(gsd_test_a11y_keyboard_OBJECTS) $(gsd_test_a11y_keyboard_LDADD) $(LIBS) +test-a11y-preferences-dialog$(EXEEXT): $(test_a11y_preferences_dialog_OBJECTS) $(test_a11y_preferences_dialog_DEPENDENCIES) $(EXTRA_test_a11y_preferences_dialog_DEPENDENCIES) + @rm -f test-a11y-preferences-dialog$(EXEEXT) + $(AM_V_CCLD)$(test_a11y_preferences_dialog_LINK) $(test_a11y_preferences_dialog_OBJECTS) $(test_a11y_preferences_dialog_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo: gsd-a11y-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -MT liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo -MD -MP -MF $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Tpo -c -o liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo `test -f 'gsd-a11y-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Tpo $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-keyboard-plugin.c' object='liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -c -o liba11y_keyboard_la-gsd-a11y-keyboard-plugin.lo `test -f 'gsd-a11y-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-plugin.c + +liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo: gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -MT liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo -MD -MP -MF $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Tpo -c -o liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo `test -f 'gsd-a11y-keyboard-manager.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Tpo $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-keyboard-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-keyboard-manager.c' object='liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -c -o liba11y_keyboard_la-gsd-a11y-keyboard-manager.lo `test -f 'gsd-a11y-keyboard-manager.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-manager.c + +liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -MT liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo -MD -MP -MF $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Tpo -c -o liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/liba11y_keyboard_la-gsd-a11y-preferences-dialog.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-preferences-dialog.c' object='liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_keyboard_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_keyboard_la_CFLAGS) $(CFLAGS) -c -o liba11y_keyboard_la-gsd-a11y-preferences-dialog.lo `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c + +gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.o: gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Tpo -c -o gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.o `test -f 'gsd-a11y-keyboard-manager.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Tpo $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-keyboard-manager.c' object='gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.o `test -f 'gsd-a11y-keyboard-manager.c' || echo '$(srcdir)/'`gsd-a11y-keyboard-manager.c + +gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.obj: gsd-a11y-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Tpo -c -o gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.obj `if test -f 'gsd-a11y-keyboard-manager.c'; then $(CYGPATH_W) 'gsd-a11y-keyboard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-keyboard-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Tpo $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-keyboard-manager.c' object='gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_keyboard-gsd-a11y-keyboard-manager.obj `if test -f 'gsd-a11y-keyboard-manager.c'; then $(CYGPATH_W) 'gsd-a11y-keyboard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-keyboard-manager.c'; fi` + +gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.o: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.o -MD -MP -MF $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Tpo -c -o gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.o `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-preferences-dialog.c' object='gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.o `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c + +gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.obj: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.obj -MD -MP -MF $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Tpo -c -o gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.obj `if test -f 'gsd-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'gsd-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-preferences-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-preferences-dialog.c' object='gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_keyboard-gsd-a11y-preferences-dialog.obj `if test -f 'gsd-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'gsd-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-preferences-dialog.c'; fi` + +gsd_test_a11y_keyboard-test-a11y-keyboard.o: test-a11y-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_keyboard-test-a11y-keyboard.o -MD -MP -MF $(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Tpo -c -o gsd_test_a11y_keyboard-test-a11y-keyboard.o `test -f 'test-a11y-keyboard.c' || echo '$(srcdir)/'`test-a11y-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Tpo $(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-a11y-keyboard.c' object='gsd_test_a11y_keyboard-test-a11y-keyboard.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_keyboard-test-a11y-keyboard.o `test -f 'test-a11y-keyboard.c' || echo '$(srcdir)/'`test-a11y-keyboard.c + +gsd_test_a11y_keyboard-test-a11y-keyboard.obj: test-a11y-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_keyboard-test-a11y-keyboard.obj -MD -MP -MF $(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Tpo -c -o gsd_test_a11y_keyboard-test-a11y-keyboard.obj `if test -f 'test-a11y-keyboard.c'; then $(CYGPATH_W) 'test-a11y-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-keyboard.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Tpo $(DEPDIR)/gsd_test_a11y_keyboard-test-a11y-keyboard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-a11y-keyboard.c' object='gsd_test_a11y_keyboard-test-a11y-keyboard.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_keyboard_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_keyboard-test-a11y-keyboard.obj `if test -f 'test-a11y-keyboard.c'; then $(CYGPATH_W) 'test-a11y-keyboard.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-keyboard.c'; fi` + +test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.o `test -f 'gsd-a11y-preferences-dialog.c' || echo '$(srcdir)/'`gsd-a11y-preferences-dialog.c + +test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj: gsd-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj `if test -f 'gsd-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'gsd-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-preferences-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-gsd-a11y-preferences-dialog.obj `if test -f 'gsd-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'gsd-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-preferences-dialog.c'; fi` + +test_a11y_preferences_dialog-test-a11y-preferences-dialog.o: test-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-test-a11y-preferences-dialog.o -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.o `test -f 'test-a11y-preferences-dialog.c' || echo '$(srcdir)/'`test-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-test-a11y-preferences-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.o `test -f 'test-a11y-preferences-dialog.c' || echo '$(srcdir)/'`test-a11y-preferences-dialog.c + +test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj: test-a11y-preferences-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -MT test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj -MD -MP -MF $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj `if test -f 'test-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'test-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-preferences-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Tpo $(DEPDIR)/test_a11y_preferences_dialog-test-a11y-preferences-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-a11y-preferences-dialog.c' object='test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_a11y_preferences_dialog_CPPFLAGS) $(CPPFLAGS) $(test_a11y_preferences_dialog_CFLAGS) $(CFLAGS) -c -o test_a11y_preferences_dialog-test-a11y-preferences-dialog.obj `if test -f 'test-a11y-preferences-dialog.c'; then $(CYGPATH_W) 'test-a11y-preferences-dialog.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-preferences-dialog.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-gtkbuilderDATA: $(gtkbuilder_DATA) + @$(NORMAL_INSTALL) + @list='$(gtkbuilder_DATA)'; test -n "$(gtkbuilderdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(gtkbuilderdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(gtkbuilderdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gtkbuilderdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(gtkbuilderdir)" || exit $$?; \ + done + +uninstall-gtkbuilderDATA: + @$(NORMAL_UNINSTALL) + @list='$(gtkbuilder_DATA)'; test -n "$(gtkbuilderdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(gtkbuilderdir)'; $(am__uninstall_files_from_dir) +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(gtkbuilderdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-noinstPROGRAMS clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-gtkbuilderDATA install-pluginDATA \ + install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-gtkbuilderDATA uninstall-libexecPROGRAMS \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-noinstPROGRAMS \ + clean-pluginLTLIBRARIES cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am \ + install-gtkbuilderDATA install-html install-html-am \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-gtkbuilderDATA uninstall-libexecPROGRAMS \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.in b/plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.in new file mode 100644 index 00000000..e0d62535 --- /dev/null +++ b/plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=a11y-keyboard +IAge=0 +_Name=Accessibility Keyboard +_Description=Accessibility keyboard plugin +Authors=Jody Goldberg +Copyright=Copyright © 2001 Ximian, Inc. +Website= diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c new file mode 100644 index 00000000..47088a8e --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c @@ -0,0 +1,1215 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef HAVE_APPINDICATOR +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-a11y-keyboard-manager.h" +#include "gsd-a11y-preferences-dialog.h" + +#define KEYBOARD_A11Y_SCHEMA "org.gnome.desktop.a11y.keyboard" +#define NOTIFICATION_TIMEOUT 30 + +#define GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerPrivate)) + +struct GsdA11yKeyboardManagerPrivate +{ + guint start_idle_id; + int xkbEventBase; + GdkDeviceManager *device_manager; + guint device_added_id; + gboolean stickykeys_shortcut_val; + gboolean slowkeys_shortcut_val; + GtkWidget *stickykeys_alert; + GtkWidget *slowkeys_alert; + GtkWidget *preferences_dialog; +#ifdef HAVE_APPINDICATOR + AppIndicator *app_indicator; +#else + GtkStatusIcon *status_icon; +#endif + + GSettings *settings; + + NotifyNotification *notification; +}; + +static void gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass); +static void gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *a11y_keyboard_manager); +static void gsd_a11y_keyboard_manager_finalize (GObject *object); +static void gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager); +static void set_server_from_gsettings (GsdA11yKeyboardManager *manager); + +G_DEFINE_TYPE (GsdA11yKeyboardManager, gsd_a11y_keyboard_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdA11yKeyboardManager *manager) +{ + if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) + set_server_from_gsettings (manager); +} + +static void +set_devicepresence_handler (GsdA11yKeyboardManager *manager) +{ + GdkDeviceManager *device_manager; + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + if (device_manager == NULL) + return; + + manager->priv->device_manager = device_manager; + manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (device_added_cb), manager); +} + +static gboolean +xkb_enabled (GsdA11yKeyboardManager *manager) +{ + int opcode, errorBase, major, minor; + + if (!XkbQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + &opcode, + &manager->priv->xkbEventBase, + &errorBase, + &major, + &minor)) + return FALSE; + + if (!XkbUseExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor)) + return FALSE; + + return TRUE; +} + +static XkbDescRec * +get_xkb_desc_rec (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + Status status = Success; + + gdk_error_trap_push (); + desc = XkbGetMap (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XkbAllMapComponentsMask, XkbUseCoreKbd); + if (desc != NULL) { + desc->ctrls = NULL; + status = XkbGetControls (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XkbAllControlsMask, desc); + } + gdk_error_trap_pop_ignored (); + + g_return_val_if_fail (desc != NULL, NULL); + g_return_val_if_fail (desc->ctrls != NULL, NULL); + g_return_val_if_fail (status == Success, NULL); + + return desc; +} + +static int +get_int (GSettings *settings, + char const *key) +{ + int res = g_settings_get_int (settings, key); + if (res <= 0) { + res = 1; + } + return res; +} + +static gboolean +set_int (GSettings *settings, + char const *key, + int val) +{ + int prev_val; + + prev_val = g_settings_get_int (settings, key); + g_settings_set_int (settings, key, val); + if (val != prev_val) { + g_debug ("%s changed", key); + } + + return val != prev_val; +} + +static gboolean +set_bool (GSettings *settings, + char const *key, + int val) +{ + gboolean bval = (val != 0); + gboolean prev_val; + + prev_val = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, bval ? TRUE : FALSE); + if (bval != prev_val) { + g_debug ("%s changed", key); + return TRUE; + } + return (bval != prev_val); +} + +static unsigned long +set_clear (gboolean flag, + unsigned long value, + unsigned long mask) +{ + if (flag) { + return value | mask; + } + return value & ~mask; +} + +static gboolean +set_ctrl_from_gsettings (XkbDescRec *desc, + GSettings *settings, + char const *key, + unsigned long mask) +{ + gboolean result = g_settings_get_boolean (settings, key); + desc->ctrls->enabled_ctrls = set_clear (result, desc->ctrls->enabled_ctrls, mask); + return result; +} + +static void +set_server_from_gsettings (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + gboolean enable_accessX; + GSettings *settings; + + gnome_settings_profile_start (NULL); + + desc = get_xkb_desc_rec (manager); + if (!desc) { + return; + } + + settings = manager->priv->settings; + + /* general */ + enable_accessX = g_settings_get_boolean (settings, "enable"); + + desc->ctrls->enabled_ctrls = set_clear (enable_accessX, + desc->ctrls->enabled_ctrls, + XkbAccessXKeysMask); + + if (set_ctrl_from_gsettings (desc, settings, "timeout-enable", + XkbAccessXTimeoutMask)) { + desc->ctrls->ax_timeout = get_int (settings, "disable-timeout"); + /* disable only the master flag via the server we will disable + * the rest on the rebound without affecting GSettings state + * don't change the option flags at all. + */ + desc->ctrls->axt_ctrls_mask = XkbAccessXKeysMask | XkbAccessXFeedbackMask; + desc->ctrls->axt_ctrls_values = 0; + desc->ctrls->axt_opts_mask = 0; + } + + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "feature-state-change-beep"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask); + + /* bounce keys */ + if (set_ctrl_from_gsettings (desc, settings, "bouncekeys-enable", XkbBounceKeysMask)) { + desc->ctrls->debounce_delay = get_int (settings, "bouncekeys-delay"); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "bouncekeys-beep-reject"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_BKRejectFBMask); + } + + /* mouse keys */ + if (set_ctrl_from_gsettings (desc, settings, "mousekeys-enable", XkbMouseKeysMask | XkbMouseKeysAccelMask)) { + desc->ctrls->mk_interval = 100; /* msec between mousekey events */ + desc->ctrls->mk_curve = 50; + + /* We store pixels / sec, XKB wants pixels / event */ + desc->ctrls->mk_max_speed = get_int (settings, "mousekeys-max-speed") / (1000 / desc->ctrls->mk_interval); + if (desc->ctrls->mk_max_speed <= 0) + desc->ctrls->mk_max_speed = 1; + + desc->ctrls->mk_time_to_max = get_int (settings, /* events before max */ + "mousekeys-accel-time") / desc->ctrls->mk_interval; + if (desc->ctrls->mk_time_to_max <= 0) + desc->ctrls->mk_time_to_max = 1; + + desc->ctrls->mk_delay = get_int (settings, /* ms before 1st event */ + "mousekeys-init-delay"); + } + + /* slow keys */ + if (set_ctrl_from_gsettings (desc, settings, "slowkeys-enable", XkbSlowKeysMask)) { + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-press"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKPressFBMask); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-accept"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKAcceptFBMask); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-reject"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_SKRejectFBMask); + desc->ctrls->slow_keys_delay = get_int (settings, "slowkeys-delay"); + /* anything larger than 500 seems to loose all keyboard input */ + if (desc->ctrls->slow_keys_delay > 500) + desc->ctrls->slow_keys_delay = 500; + } + + /* sticky keys */ + if (set_ctrl_from_gsettings (desc, settings, "stickykeys-enable", XkbStickyKeysMask)) { + desc->ctrls->ax_options |= XkbAX_LatchToLockMask; + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "stickykeys-two-key-off"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_TwoKeysMask); + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "stickykeys-modifier-beep"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_StickyKeysFBMask); + } + + /* toggle keys */ + desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "togglekeys-enable"), + desc->ctrls->ax_options, + XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask); + + /* + g_debug ("CHANGE to : 0x%x", desc->ctrls->enabled_ctrls); + g_debug ("CHANGE to : 0x%x (2)", desc->ctrls->ax_options); + */ + + gdk_error_trap_push (); + XkbSetControls (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XkbSlowKeysMask | + XkbBounceKeysMask | + XkbStickyKeysMask | + XkbMouseKeysMask | + XkbMouseKeysAccelMask | + XkbAccessXKeysMask | + XkbAccessXTimeoutMask | + XkbAccessXFeedbackMask | + XkbControlsEnabledMask, + desc); + + XkbFreeKeyboard (desc, XkbAllComponentsMask, True); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + gdk_error_trap_pop_ignored (); + + gnome_settings_profile_end (NULL); +} + +static gboolean +ax_response_callback (GsdA11yKeyboardManager *manager, + GtkWindow *parent, + gint response_id, + guint revert_controls_mask, + gboolean enabled) +{ + GSettings *settings; + GdkScreen *screen; + GError *err; + + settings = manager->priv->settings; + + switch (response_id) { + case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_REJECT: + case GTK_RESPONSE_CANCEL: + + /* we're reverting, so we invert sense of 'enabled' flag */ + g_debug ("cancelling AccessX request"); + if (revert_controls_mask == XkbStickyKeysMask) { + g_settings_set_boolean (settings, + "stickykeys-enable", + !enabled); + } else if (revert_controls_mask == XkbSlowKeysMask) { + g_settings_set_boolean (settings, + "slowkeys-enable", + !enabled); + } + + set_server_from_gsettings (manager); + break; + + case GTK_RESPONSE_HELP: + if (!parent) + screen = gdk_screen_get_default (); + else + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); + + err = NULL; + if (!gtk_show_uri (screen, + "help:gnome-help/a11y", + gtk_get_current_event_time(), + &err)) { + GtkWidget *error_dialog = gtk_message_dialog_new (parent, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("There was an error displaying help: %s"), + err->message); + g_signal_connect (error_dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE); + gtk_widget_show (error_dialog); + g_error_free (err); + } + return FALSE; + default: + break; + } + return TRUE; +} + +static void +ax_stickykeys_response (GtkDialog *dialog, + gint response_id, + GsdA11yKeyboardManager *manager) +{ + if (ax_response_callback (manager, GTK_WINDOW (dialog), + response_id, XkbStickyKeysMask, + manager->priv->stickykeys_shortcut_val)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + } +} + +static void +ax_slowkeys_response (GtkDialog *dialog, + gint response_id, + GsdA11yKeyboardManager *manager) +{ + if (ax_response_callback (manager, GTK_WINDOW (dialog), + response_id, XkbSlowKeysMask, + manager->priv->slowkeys_shortcut_val)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + } +} + +static void +maybe_show_status_icon (GsdA11yKeyboardManager *manager) +{ + gboolean show; + + /* for now, show if accessx is enabled */ + show = g_settings_get_boolean (manager->priv->settings, "enable"); + +#ifdef HAVE_APPINDICATOR + if (!show && manager->priv->app_indicator == NULL) + return; + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + if (show) + app_indicator_set_status (manager->priv->app_indicator, + APP_INDICATOR_STATUS_ACTIVE); + else + app_indicator_set_status (manager->priv->app_indicator, + APP_INDICATOR_STATUS_PASSIVE); +#else + if (!show && manager->priv->status_icon == NULL) + return; + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, show); +#endif +} + +static void +on_notification_closed (NotifyNotification *notification, + GsdA11yKeyboardManager *manager) +{ + g_object_unref (manager->priv->notification); + manager->priv->notification = NULL; +} + +static void +on_slow_keys_action (NotifyNotification *notification, + const char *action, + GsdA11yKeyboardManager *manager) +{ + gboolean res; + int response_id; + + g_assert (action != NULL); + + if (strcmp (action, "accept") == 0) { + response_id = GTK_RESPONSE_ACCEPT; + } else if (strcmp (action, "reject") == 0) { + response_id = GTK_RESPONSE_REJECT; + } else { + return; + } + + res = ax_response_callback (manager, NULL, + response_id, XkbSlowKeysMask, + manager->priv->slowkeys_shortcut_val); + if (res) { + notify_notification_close (manager->priv->notification, NULL); + } +} + +static void +on_sticky_keys_action (NotifyNotification *notification, + const char *action, + GsdA11yKeyboardManager *manager) +{ + gboolean res; + int response_id; + + g_assert (action != NULL); + + if (strcmp (action, "accept") == 0) { + response_id = GTK_RESPONSE_ACCEPT; + } else if (strcmp (action, "reject") == 0) { + response_id = GTK_RESPONSE_REJECT; + } else { + return; + } + + res = ax_response_callback (manager, NULL, + response_id, XkbStickyKeysMask, + manager->priv->stickykeys_shortcut_val); + if (res) { + notify_notification_close (manager->priv->notification, NULL); + } +} + +static gboolean +ax_slowkeys_warning_post_bubble (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + gboolean res; + const char *title; + const char *message; + GError *error; + + title = enabled ? + _("Slow Keys Turned On") : + _("Slow Keys Turned Off"); + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + +#ifndef HAVE_APPINDICATOR + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } +#endif + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); + } + + if (manager->priv->notification != NULL) { + notify_notification_close (manager->priv->notification, NULL); + } + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + manager->priv->notification = notify_notification_new (title, + message, + "preferences-desktop-accessibility-symbolic"); + notify_notification_set_app_name (manager->priv->notification, _("Universal Access")); + notify_notification_set_timeout (manager->priv->notification, NOTIFICATION_TIMEOUT * 1000); + notify_notification_set_hint (manager->priv->notification, "transient", g_variant_new_boolean (TRUE)); + + notify_notification_add_action (manager->priv->notification, + "reject", + enabled ? _("Turn Off") : _("Turn On"), + (NotifyActionCallback) on_slow_keys_action, + manager, + NULL); + notify_notification_add_action (manager->priv->notification, + "accept", + enabled ? _("Leave On") : _("Leave Off"), + (NotifyActionCallback) on_slow_keys_action, + manager, + NULL); + + g_signal_connect (manager->priv->notification, + "closed", + G_CALLBACK (on_notification_closed), + manager); + + error = NULL; + res = notify_notification_show (manager->priv->notification, &error); + if (! res) { + g_warning ("GsdA11yKeyboardManager: unable to show notification: %s", error->message); + g_error_free (error); + notify_notification_close (manager->priv->notification, NULL); + } + + return res; +} + + +static void +ax_slowkeys_warning_post_dialog (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + const char *title; + const char *message; + + title = enabled ? + _("Slow Keys Turned On") : + _("Slow Keys Turned Off"); + message = _("You just held down the Shift key for 8 seconds. This is the shortcut " + "for the Slow Keys feature, which affects the way your keyboard works."); + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_show (manager->priv->slowkeys_alert); + return; + } + + manager->priv->slowkeys_alert = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + "%s", title); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->slowkeys_alert), + "%s", message); + + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + enabled ? _("_Turn Off") : _("_Turn On"), + GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->slowkeys_alert), + enabled ? _("_Leave On") : _("_Leave Off"), + GTK_RESPONSE_ACCEPT); + + gtk_window_set_title (GTK_WINDOW (manager->priv->slowkeys_alert), ""); + gtk_window_set_icon_name (GTK_WINDOW (manager->priv->slowkeys_alert), + "preferences-desktop-accessibility"); + gtk_dialog_set_default_response (GTK_DIALOG (manager->priv->slowkeys_alert), + GTK_RESPONSE_ACCEPT); + + g_signal_connect (manager->priv->slowkeys_alert, + "response", + G_CALLBACK (ax_slowkeys_response), + manager); + gtk_widget_show (manager->priv->slowkeys_alert); + + g_object_add_weak_pointer (G_OBJECT (manager->priv->slowkeys_alert), + (gpointer*) &manager->priv->slowkeys_alert); +} + +static void +ax_slowkeys_warning_post (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + + manager->priv->slowkeys_shortcut_val = enabled; + + /* alway try to show something */ + if (! ax_slowkeys_warning_post_bubble (manager, enabled)) { + ax_slowkeys_warning_post_dialog (manager, enabled); + } +} + +static gboolean +ax_stickykeys_warning_post_bubble (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ +#if 1 + gboolean res; + const char *title; + const char *message; + GError *error; + + title = enabled ? + _("Sticky Keys Turned On") : + _("Sticky Keys Turned Off"); + message = enabled ? + _("You just pressed the Shift key 5 times in a row. This is the shortcut " + "for the Sticky Keys feature, which affects the way your keyboard works.") : + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + +#ifndef HAVE_APPINDICATOR + if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) { + return FALSE; + } +#endif + + if (manager->priv->slowkeys_alert != NULL) { + gtk_widget_destroy (manager->priv->slowkeys_alert); + } + + if (manager->priv->notification != NULL) { + notify_notification_close (manager->priv->notification, NULL); + } + + gsd_a11y_keyboard_manager_ensure_status_icon (manager); + manager->priv->notification = notify_notification_new (title, + message, + "preferences-desktop-accessibility-symbolic"); + notify_notification_set_app_name (manager->priv->notification, _("Universal Access")); + notify_notification_set_timeout (manager->priv->notification, NOTIFICATION_TIMEOUT * 1000); + notify_notification_set_hint (manager->priv->notification, "transient", g_variant_new_boolean (TRUE)); + + notify_notification_add_action (manager->priv->notification, + "reject", + enabled ? _("Turn Off") : _("Turn On"), + (NotifyActionCallback) on_sticky_keys_action, + manager, + NULL); + notify_notification_add_action (manager->priv->notification, + "accept", + enabled ? _("Leave On") : _("Leave Off"), + (NotifyActionCallback) on_sticky_keys_action, + manager, + NULL); + + g_signal_connect (manager->priv->notification, + "closed", + G_CALLBACK (on_notification_closed), + manager); + + error = NULL; + res = notify_notification_show (manager->priv->notification, &error); + if (! res) { + g_warning ("GsdA11yKeyboardManager: unable to show notification: %s", error->message); + g_error_free (error); + notify_notification_close (manager->priv->notification, NULL); + } + + return res; +#endif /* 1 */ +} + +static void +ax_stickykeys_warning_post_dialog (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + const char *title; + const char *message; + + title = enabled ? + _("Sticky Keys Turned On") : + _("Sticky Keys Turned Off"); + message = enabled ? + _("You just pressed the Shift key 5 times in a row. This is the shortcut " + "for the Sticky Keys feature, which affects the way your keyboard works.") : + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " + "This turns off the Sticky Keys feature, which affects the way your keyboard works."); + + if (manager->priv->stickykeys_alert != NULL) { + gtk_widget_show (manager->priv->stickykeys_alert); + return; + } + + manager->priv->stickykeys_alert = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + "%s", title); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert), + "%s", message); + + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + GTK_STOCK_HELP, + GTK_RESPONSE_HELP); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + enabled ? _("_Turn Off") : _("_Turn On"), + GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert), + enabled ? _("_Leave On") : _("_Leave Off"), + GTK_RESPONSE_ACCEPT); + + gtk_window_set_title (GTK_WINDOW (manager->priv->stickykeys_alert), ""); + gtk_window_set_icon_name (GTK_WINDOW (manager->priv->stickykeys_alert), + "preferences-desktop-accessibility"); + gtk_dialog_set_default_response (GTK_DIALOG (manager->priv->stickykeys_alert), + GTK_RESPONSE_ACCEPT); + + g_signal_connect (manager->priv->stickykeys_alert, + "response", + G_CALLBACK (ax_stickykeys_response), + manager); + gtk_widget_show (manager->priv->stickykeys_alert); + + g_object_add_weak_pointer (G_OBJECT (manager->priv->stickykeys_alert), + (gpointer*) &manager->priv->stickykeys_alert); +} + +static void +ax_stickykeys_warning_post (GsdA11yKeyboardManager *manager, + gboolean enabled) +{ + + manager->priv->stickykeys_shortcut_val = enabled; + + /* alway try to show something */ + if (! ax_stickykeys_warning_post_bubble (manager, enabled)) { + ax_stickykeys_warning_post_dialog (manager, enabled); + } +} + +static void +set_gsettings_from_server (GsdA11yKeyboardManager *manager) +{ + XkbDescRec *desc; + gboolean changed = FALSE; + gboolean slowkeys_changed; + gboolean stickykeys_changed; + GSettings *settings; + + desc = get_xkb_desc_rec (manager); + if (! desc) { + return; + } + + /* Create a new one, so that only those settings + * are delayed */ + settings = g_settings_new (KEYBOARD_A11Y_SCHEMA); + g_settings_delay (settings); + + /* + fprintf (stderr, "changed to : 0x%x\n", desc->ctrls->enabled_ctrls); + fprintf (stderr, "changed to : 0x%x (2)\n", desc->ctrls->ax_options); + */ + + changed |= set_bool (settings, + "enable", + desc->ctrls->enabled_ctrls & XkbAccessXKeysMask); + + changed |= set_bool (settings, + "feature-state-change-beep", + desc->ctrls->ax_options & (XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask)); + changed |= set_bool (settings, + "timeout-enable", + desc->ctrls->enabled_ctrls & XkbAccessXTimeoutMask); + changed |= set_int (settings, + "disable-timeout", + desc->ctrls->ax_timeout); + + changed |= set_bool (settings, + "bouncekeys-enable", + desc->ctrls->enabled_ctrls & XkbBounceKeysMask); + changed |= set_int (settings, + "bouncekeys-delay", + desc->ctrls->debounce_delay); + changed |= set_bool (settings, + "bouncekeys-beep-reject", + desc->ctrls->ax_options & XkbAX_BKRejectFBMask); + + changed |= set_bool (settings, + "mousekeys-enable", + desc->ctrls->enabled_ctrls & XkbMouseKeysMask); + changed |= set_int (settings, + "mousekeys-max-speed", + desc->ctrls->mk_max_speed * (1000 / desc->ctrls->mk_interval)); + /* NOTE : mk_time_to_max is measured in events not time */ + changed |= set_int (settings, + "mousekeys-accel-time", + desc->ctrls->mk_time_to_max * desc->ctrls->mk_interval); + changed |= set_int (settings, + "mousekeys-init-delay", + desc->ctrls->mk_delay); + + slowkeys_changed = set_bool (settings, + "slowkeys-enable", + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + changed |= set_bool (settings, + "slowkeys-beep-press", + desc->ctrls->ax_options & XkbAX_SKPressFBMask); + changed |= set_bool (settings, + "slowkeys-beep-accept", + desc->ctrls->ax_options & XkbAX_SKAcceptFBMask); + changed |= set_bool (settings, + "slowkeys-beep-reject", + desc->ctrls->ax_options & XkbAX_SKRejectFBMask); + changed |= set_int (settings, + "slowkeys-delay", + desc->ctrls->slow_keys_delay); + + stickykeys_changed = set_bool (settings, + "stickykeys-enable", + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + changed |= set_bool (settings, + "stickykeys-two-key-off", + desc->ctrls->ax_options & XkbAX_TwoKeysMask); + changed |= set_bool (settings, + "stickykeys-modifier-beep", + desc->ctrls->ax_options & XkbAX_StickyKeysFBMask); + + changed |= set_bool (settings, + "togglekeys-enable", + desc->ctrls->ax_options & XkbAX_IndicatorFBMask); + + if (!changed && stickykeys_changed ^ slowkeys_changed) { + /* + * sticky or slowkeys has changed, singly, without our intervention. + * 99% chance this is due to a keyboard shortcut being used. + * we need to detect via this hack until we get + * XkbAXN_AXKWarning notifications working (probable XKB bug), + * at which time we can directly intercept such shortcuts instead. + * See cb_xkb_event_filter () below. + */ + + /* sanity check: are keyboard shortcuts available? */ + if (desc->ctrls->enabled_ctrls & XkbAccessXKeysMask) { + if (slowkeys_changed) { + ax_slowkeys_warning_post (manager, + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + } else { + ax_stickykeys_warning_post (manager, + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + } + } + } + + XkbFreeKeyboard (desc, XkbAllComponentsMask, True); + + g_settings_apply (settings); + g_object_unref (settings); +} + +static GdkFilterReturn +cb_xkb_event_filter (GdkXEvent *xevent, + GdkEvent *ignored1, + GsdA11yKeyboardManager *manager) +{ + XEvent *xev = (XEvent *) xevent; + XkbEvent *xkbEv = (XkbEvent *) xevent; + + /* 'event_type' is set to zero on notifying us of updates in + * response to client requests (including our own) and non-zero + * to notify us of key/mouse events causing changes (like + * pressing shift 5 times to enable sticky keys). + * + * We only want to update GSettings when it's in response to an + * explicit user input event, so require a non-zero event_type. + */ + if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) && + xkbEv->any.xkb_type == XkbControlsNotify && + xkbEv->ctrls.event_type != 0) { + g_debug ("XKB state changed"); + set_gsettings_from_server (manager); + } else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) && + xkbEv->any.xkb_type == XkbAccessXNotify) { + if (xkbEv->accessx.detail == XkbAXN_AXKWarning) { + g_debug ("About to turn on an AccessX feature from the keyboard!"); + /* + * TODO: when XkbAXN_AXKWarnings start working, we need to + * invoke ax_keys_warning_dialog_run here instead of in + * set_gsettings_from_server(). + */ + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +keyboard_callback (GSettings *settings, + const char *key, + GsdA11yKeyboardManager *manager) +{ + set_server_from_gsettings (manager); + maybe_show_status_icon (manager); +} + +static gboolean +start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager) +{ + guint event_mask; + + g_debug ("Starting a11y_keyboard manager"); + gnome_settings_profile_start (NULL); + + if (!xkb_enabled (manager)) + goto out; + + manager->priv->settings = g_settings_new (KEYBOARD_A11Y_SCHEMA); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (keyboard_callback), manager); + + set_devicepresence_handler (manager); + + event_mask = XkbControlsNotifyMask; + event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */ + + /* be sure to init before starting to monitor the server */ + set_server_from_gsettings (manager); + + XkbSelectEvents (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XkbUseCoreKbd, + event_mask, + event_mask); + + gdk_window_add_filter (NULL, + (GdkFilterFunc) cb_xkb_event_filter, + manager); + + maybe_show_status_icon (manager); + + out: + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_a11y_keyboard_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager) +{ + GsdA11yKeyboardManagerPrivate *p = manager->priv; + + g_debug ("Stopping a11y_keyboard manager"); + + if (p->start_idle_id != 0) { + g_source_remove (p->start_idle_id); + p->start_idle_id = 0; + } + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); + p->device_manager = NULL; + } + +#ifdef HAVE_APPINDICATOR + if (p->app_indicator) + app_indicator_set_status (p->app_indicator, + APP_INDICATOR_STATUS_PASSIVE); +#else + if (p->status_icon) { + gtk_status_icon_set_visible (p->status_icon, FALSE); + p->status_icon = NULL; + } +#endif + + if (p->settings != NULL) { + g_signal_handlers_disconnect_by_func (p->settings, keyboard_callback, manager); + g_object_unref (p->settings); + p->settings = NULL; + } + + gdk_window_remove_filter (NULL, + (GdkFilterFunc) cb_xkb_event_filter, + manager); + + if (p->slowkeys_alert != NULL) { + gtk_widget_destroy (p->slowkeys_alert); + p->slowkeys_alert = NULL; + } + + if (p->stickykeys_alert != NULL) { + gtk_widget_destroy (p->stickykeys_alert); + p->stickykeys_alert = NULL; + } + + p->slowkeys_shortcut_val = FALSE; + p->stickykeys_shortcut_val = FALSE; +} + +static GObject * +gsd_a11y_keyboard_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (a11y_keyboard_manager); +} + +static void +gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_a11y_keyboard_manager_constructor; + object_class->finalize = gsd_a11y_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdA11yKeyboardManagerPrivate)); +} + +static void +on_preferences_dialog_response (GtkDialog *dialog, + int response, + GsdA11yKeyboardManager *manager) +{ + g_signal_handlers_disconnect_by_func (dialog, + on_preferences_dialog_response, + manager); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + manager->priv->preferences_dialog = NULL; +} + +static void +#ifdef HAVE_APPINDICATOR +on_status_icon_activate (GtkMenuItem *item, + GsdA11yKeyboardManager *manager) +#else +on_status_icon_activate (GtkStatusIcon *status_icon, + GsdA11yKeyboardManager *manager) +#endif +{ + if (manager->priv->preferences_dialog == NULL) { + manager->priv->preferences_dialog = gsd_a11y_preferences_dialog_new (); + g_signal_connect (manager->priv->preferences_dialog, + "response", + G_CALLBACK (on_preferences_dialog_response), + manager); + + gtk_window_present (GTK_WINDOW (manager->priv->preferences_dialog)); + } else { + g_signal_handlers_disconnect_by_func (manager->priv->preferences_dialog, + on_preferences_dialog_response, + manager); + gtk_widget_destroy (GTK_WIDGET (manager->priv->preferences_dialog)); + manager->priv->preferences_dialog = NULL; + } +} + +static void +on_status_icon_popup_menu (GtkStatusIcon *status_icon, + guint button, + guint activate_time, + GsdA11yKeyboardManager *manager) +{ + on_status_icon_activate (status_icon, manager); +} + +static void +gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager) +{ + gnome_settings_profile_start (NULL); + +#ifdef HAVE_APPINDICATOR + if (!manager->priv->app_indicator) { + GtkWidget *menu = gtk_menu_new (); + GtkWidget *item = gtk_menu_item_new_with_label (_("Universal Access Preferences")); + + g_signal_connect (item, + "activate", + G_CALLBACK (on_status_icon_activate), + manager); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show_all (menu); + + manager->priv->app_indicator = app_indicator_new ("a11y-keyboard", + "preferences-desktop-accessibility", + APP_INDICATOR_CATEGORY_OTHER); + app_indicator_set_menu (manager->priv->app_indicator, + GTK_MENU (menu)); + } +#else + if (!manager->priv->status_icon) { + + manager->priv->status_icon = gtk_status_icon_new_from_icon_name ("preferences-desktop-accessibility"); + gtk_status_icon_set_name (manager->priv->status_icon, "a11y-keyboard"); + g_signal_connect (manager->priv->status_icon, + "activate", + G_CALLBACK (on_status_icon_activate), + manager); + g_signal_connect (manager->priv->status_icon, + "popup-menu", + G_CALLBACK (on_status_icon_popup_menu), + manager); + } +#endif + + gnome_settings_profile_end (NULL); +} + +static void +gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *manager) +{ + manager->priv = GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_a11y_keyboard_manager_finalize (GObject *object) +{ + GsdA11yKeyboardManager *a11y_keyboard_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_KEYBOARD_MANAGER (object)); + + a11y_keyboard_manager = GSD_A11Y_KEYBOARD_MANAGER (object); + + g_return_if_fail (a11y_keyboard_manager->priv != NULL); + + if (a11y_keyboard_manager->priv->start_idle_id != 0) + g_source_remove (a11y_keyboard_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->finalize (object); +} + +GsdA11yKeyboardManager * +gsd_a11y_keyboard_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_A11Y_KEYBOARD_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_A11Y_KEYBOARD_MANAGER (manager_object); +} diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h new file mode 100644 index 00000000..5ecb23da --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_A11Y_KEYBOARD_MANAGER_H +#define __GSD_A11Y_KEYBOARD_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_A11Y_KEYBOARD_MANAGER (gsd_a11y_keyboard_manager_get_type ()) +#define GSD_A11Y_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManager)) +#define GSD_A11Y_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerClass)) +#define GSD_IS_A11Y_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER)) +#define GSD_IS_A11Y_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_KEYBOARD_MANAGER)) +#define GSD_A11Y_KEYBOARD_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerClass)) + +typedef struct GsdA11yKeyboardManagerPrivate GsdA11yKeyboardManagerPrivate; + +typedef struct +{ + GObject parent; + GsdA11yKeyboardManagerPrivate *priv; +} GsdA11yKeyboardManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdA11yKeyboardManagerClass; + +GType gsd_a11y_keyboard_manager_get_type (void); + +GsdA11yKeyboardManager *gsd_a11y_keyboard_manager_new (void); +gboolean gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager, + GError **error); +void gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager); + +G_END_DECLS + +#endif /* __GSD_A11Y_KEYBOARD_MANAGER_H */ diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c new file mode 100644 index 00000000..bb2f80b2 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c @@ -0,0 +1,105 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-a11y-keyboard-plugin.h" +#include "gsd-a11y-keyboard-manager.h" + +struct GsdA11yKeyboardPluginPrivate { + GsdA11yKeyboardManager *manager; +}; + +#define GSD_A11Y_KEYBOARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdA11yKeyboardPlugin, gsd_a11y_keyboard_plugin) + +static void +gsd_a11y_keyboard_plugin_init (GsdA11yKeyboardPlugin *plugin) +{ + plugin->priv = GSD_A11Y_KEYBOARD_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdA11yKeyboardPlugin initializing"); + + plugin->priv->manager = gsd_a11y_keyboard_manager_new (); +} + +static void +gsd_a11y_keyboard_plugin_finalize (GObject *object) +{ + GsdA11yKeyboardPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_KEYBOARD_PLUGIN (object)); + + g_debug ("GsdA11yKeyboardPlugin finalizing"); + + plugin = GSD_A11Y_KEYBOARD_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_a11y_keyboard_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating a11y_keyboard plugin"); + + error = NULL; + res = gsd_a11y_keyboard_manager_start (GSD_A11Y_KEYBOARD_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start a11y_keyboard manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating a11y_keyboard plugin"); + gsd_a11y_keyboard_manager_stop (GSD_A11Y_KEYBOARD_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_a11y_keyboard_plugin_class_init (GsdA11yKeyboardPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_a11y_keyboard_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdA11yKeyboardPluginPrivate)); +} + diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h new file mode 100644 index 00000000..aa73ee31 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_A11Y_KEYBOARD_PLUGIN_H__ +#define __GSD_A11Y_KEYBOARD_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_A11Y_KEYBOARD_PLUGIN (gsd_a11y_keyboard_plugin_get_type ()) +#define GSD_A11Y_KEYBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPlugin)) +#define GSD_A11Y_KEYBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPluginClass)) +#define GSD_IS_A11Y_KEYBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_KEYBOARD_PLUGIN)) +#define GSD_IS_A11Y_KEYBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_KEYBOARD_PLUGIN)) +#define GSD_A11Y_KEYBOARD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_KEYBOARD_PLUGIN, GsdA11yKeyboardPluginClass)) + +typedef struct GsdA11yKeyboardPluginPrivate GsdA11yKeyboardPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdA11yKeyboardPluginPrivate *priv; +} GsdA11yKeyboardPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdA11yKeyboardPluginClass; + +GType gsd_a11y_keyboard_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_A11Y_KEYBOARD_PLUGIN_H__ */ diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c new file mode 100644 index 00000000..d2fb7354 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c @@ -0,0 +1,459 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "gsd-a11y-preferences-dialog.h" + +#define SM_DBUS_NAME "org.gnome.SessionManager" +#define SM_DBUS_PATH "/org/gnome/SessionManager" +#define SM_DBUS_INTERFACE "org.gnome.SessionManager" + + +#define GSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogPrivate)) + +#define GTKBUILDER_UI_FILE "gsd-a11y-preferences-dialog.ui" + +#define INTERFACE_SCHEMA "org.gnome.desktop.interface" +#define KEY_TEXT_SCALING_FACTOR "text-scaling-factor" + +#define KEYBOARD_A11Y_SCHEMA "org.gnome.desktop.a11y.keyboard" +#define KEY_STICKY_KEYS_ENABLED "stickykeys-enable" +#define KEY_BOUNCE_KEYS_ENABLED "bouncekeys-enable" +#define KEY_SLOW_KEYS_ENABLED "slowkeys-enable" + +#define KEY_AT_SCHEMA "org.gnome.desktop.a11y.applications" +#define KEY_AT_SCREEN_KEYBOARD_ENABLED "screen-keyboard-enabled" +#define KEY_AT_SCREEN_MAGNIFIER_ENABLED "screen-magnifier-enabled" +#define KEY_AT_SCREEN_READER_ENABLED "screen-reader-enabled" + +#define DPI_FACTOR_LARGE 1.25 +#define DPI_FACTOR_LARGER 1.5 +#define DPI_FACTOR_LARGEST 2.0 + +#define KEY_GTK_THEME "gtk-theme" +#define KEY_ICON_THEME "icon-theme" +#define KEY_METACITY_THEME "theme" + +#define HIGH_CONTRAST_THEME "HighContrast" + +struct GsdA11yPreferencesDialogPrivate +{ + GtkWidget *large_print_checkbutton; + GtkWidget *high_contrast_checkbutton; + + GSettings *a11y_settings; + GSettings *interface_settings; + GSettings *apps_settings; +}; + +enum { + PROP_0, +}; + +static void gsd_a11y_preferences_dialog_class_init (GsdA11yPreferencesDialogClass *klass); +static void gsd_a11y_preferences_dialog_init (GsdA11yPreferencesDialog *a11y_preferences_dialog); +static void gsd_a11y_preferences_dialog_finalize (GObject *object); + +G_DEFINE_TYPE (GsdA11yPreferencesDialog, gsd_a11y_preferences_dialog, GTK_TYPE_DIALOG) + +static GObject * +gsd_a11y_preferences_dialog_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdA11yPreferencesDialog *a11y_preferences_dialog; + + a11y_preferences_dialog = GSD_A11Y_PREFERENCES_DIALOG (G_OBJECT_CLASS (gsd_a11y_preferences_dialog_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (a11y_preferences_dialog); +} + +static void +gsd_a11y_preferences_dialog_class_init (GsdA11yPreferencesDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_a11y_preferences_dialog_constructor; + object_class->finalize = gsd_a11y_preferences_dialog_finalize; + + g_type_class_add_private (klass, sizeof (GsdA11yPreferencesDialogPrivate)); +} + +static void +on_response (GsdA11yPreferencesDialog *dialog, + gint response_id) +{ + switch (response_id) { + default: + break; + } +} + +static gboolean +config_get_large_print (GsdA11yPreferencesDialog *dialog, + gboolean *is_writable) +{ + gboolean ret; + gdouble factor; + + factor = g_settings_get_double (dialog->priv->interface_settings, KEY_TEXT_SCALING_FACTOR); + + ret = (factor > 1.0); + + *is_writable = g_settings_is_writable (dialog->priv->interface_settings, KEY_TEXT_SCALING_FACTOR); + + return ret; +} + +static void +config_set_large_print (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + if (enabled) + g_settings_set_double (dialog->priv->interface_settings, KEY_TEXT_SCALING_FACTOR, DPI_FACTOR_LARGER); + else + g_settings_reset (dialog->priv->interface_settings, KEY_TEXT_SCALING_FACTOR); +} + +static gboolean +config_get_high_contrast (GsdA11yPreferencesDialog *dialog) +{ + gboolean ret; + char *gtk_theme; + + ret = FALSE; + + gtk_theme = g_settings_get_string (dialog->priv->interface_settings, KEY_GTK_THEME); + if (gtk_theme != NULL && g_str_equal (gtk_theme, HIGH_CONTRAST_THEME)) { + ret = TRUE; + } + + g_free (gtk_theme); + + return ret; +} + +static void +config_set_high_contrast (gboolean enabled) +{ + GSettings *settings; + GSettings *wm_settings; + + settings = g_settings_new ("org.gnome.desktop.interface"); + wm_settings = g_settings_new ("org.gnome.desktop.wm.preferences"); + + if (enabled) { + g_settings_set_string (settings, KEY_GTK_THEME, HIGH_CONTRAST_THEME); + g_settings_set_string (settings, KEY_ICON_THEME, HIGH_CONTRAST_THEME); + /* there isn't a high contrast metacity theme afaik */ + } else { + g_settings_reset (settings, KEY_GTK_THEME); + g_settings_reset (settings, KEY_ICON_THEME); + g_settings_reset (wm_settings, KEY_METACITY_THEME); + } + + g_object_unref (settings); + g_object_unref (wm_settings); +} + +static gboolean +config_have_at_gsettings_condition (const char *condition) +{ + GDBusProxy *sm_proxy; + GDBusConnection *connection; + GError *error; + GVariant *res; + gboolean is_handled; + + error = NULL; + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + if (connection == NULL) { + g_warning ("Unable to connect to session bus: %s", error->message); + g_error_free (error); + return FALSE; + } + sm_proxy = g_dbus_proxy_new_sync (connection, + 0, NULL, + SM_DBUS_NAME, + SM_DBUS_PATH, + SM_DBUS_INTERFACE, + NULL, + &error); + if (sm_proxy == NULL) { + g_warning ("Unable to get proxy for %s: %s", SM_DBUS_NAME, error->message); + g_error_free (error); + return FALSE; + } + + is_handled = FALSE; + res = g_dbus_proxy_call_sync (sm_proxy, + "IsAutostartConditionHandled", + g_variant_new ("(s)", condition), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, &error); + if (! res) { + g_warning ("Unable to call IsAutostartConditionHandled (%s): %s", + condition, + error->message); + } + + if (g_variant_is_of_type (res, G_VARIANT_TYPE_BOOLEAN)) { + is_handled = g_variant_get_boolean (res); + } + + g_object_unref (sm_proxy); + g_variant_unref (res); + + return is_handled; +} + +static void +on_high_contrast_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_high_contrast (gtk_toggle_button_get_active (button)); +} + +static void +on_large_print_checkbutton_toggled (GtkToggleButton *button, + GsdA11yPreferencesDialog *dialog) +{ + config_set_large_print (dialog, gtk_toggle_button_get_active (button)); +} + +static void +ui_set_high_contrast (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->high_contrast_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->high_contrast_checkbutton), enabled); + } +} + +static void +ui_set_large_print (GsdA11yPreferencesDialog *dialog, + gboolean enabled) +{ + gboolean active; + + active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->large_print_checkbutton)); + if (active != enabled) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->large_print_checkbutton), enabled); + } +} + +static void +setup_dialog (GsdA11yPreferencesDialog *dialog, + GtkBuilder *builder) +{ + GtkWidget *widget; + gboolean enabled; + gboolean is_writable; + GSettings *settings; + + dialog->priv->a11y_settings = g_settings_new (KEYBOARD_A11Y_SCHEMA); + settings = dialog->priv->a11y_settings; + + dialog->priv->interface_settings = g_settings_new (INTERFACE_SCHEMA); + dialog->priv->apps_settings = g_settings_new (KEY_AT_SCHEMA); + + /* Sticky keys */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, "sticky_keys_checkbutton")); + g_settings_bind (settings, KEY_STICKY_KEYS_ENABLED, + G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind_writable (settings, KEY_STICKY_KEYS_ENABLED, + G_OBJECT (widget), "sensitive", TRUE); + + /* Bounce keys */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, "bounce_keys_checkbutton")); + g_settings_bind (settings, KEY_BOUNCE_KEYS_ENABLED, + G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind_writable (settings, KEY_BOUNCE_KEYS_ENABLED, + G_OBJECT (widget), "sensitive", TRUE); + + /* Slow keys */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, "slow_keys_checkbutton")); + g_settings_bind (settings, KEY_SLOW_KEYS_ENABLED, + G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind_writable (settings, KEY_SLOW_KEYS_ENABLED, + G_OBJECT (widget), "sensitive", TRUE); + + /* High contrast */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "high_contrast_checkbutton")); + g_settings_bind_writable (dialog->priv->interface_settings, KEY_GTK_THEME, + G_OBJECT (widget), "sensitive", TRUE); + dialog->priv->high_contrast_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_high_contrast_checkbutton_toggled), + dialog); + enabled = config_get_high_contrast (dialog); + ui_set_high_contrast (dialog, enabled); + + /* On-screen keyboard */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, "at_screen_keyboard_checkbutton")); + g_settings_bind (dialog->priv->apps_settings, KEY_AT_SCREEN_KEYBOARD_ENABLED, + G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind_writable (dialog->priv->apps_settings, KEY_AT_SCREEN_KEYBOARD_ENABLED, + G_OBJECT (widget), "sensitive", TRUE); + gtk_widget_set_no_show_all (widget, TRUE); + if (config_have_at_gsettings_condition ("GSettings " KEYBOARD_A11Y_SCHEMA " " KEY_AT_SCREEN_KEYBOARD_ENABLED)) { + gtk_widget_show_all (widget); + } else { + gtk_widget_hide (widget); + } + + /* Screen reader */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, "at_screen_reader_checkbutton")); + g_settings_bind (dialog->priv->apps_settings, KEY_AT_SCREEN_READER_ENABLED, + G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind_writable (dialog->priv->apps_settings, KEY_AT_SCREEN_READER_ENABLED, + G_OBJECT (widget), "sensitive", TRUE); + gtk_widget_set_no_show_all (widget, TRUE); + if (config_have_at_gsettings_condition ("GSettings " KEYBOARD_A11Y_SCHEMA " " KEY_AT_SCREEN_READER_ENABLED)) { + gtk_widget_show_all (widget); + } else { + gtk_widget_hide (widget); + } + + /* Screen magnifier */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, "at_screen_magnifier_checkbutton")); + g_settings_bind (dialog->priv->apps_settings, KEY_AT_SCREEN_MAGNIFIER_ENABLED, + G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind_writable (dialog->priv->apps_settings, KEY_AT_SCREEN_MAGNIFIER_ENABLED, + G_OBJECT (widget), "sensitive", TRUE); + gtk_widget_set_no_show_all (widget, TRUE); + if (config_have_at_gsettings_condition ("GSettings " KEYBOARD_A11Y_SCHEMA " " KEY_AT_SCREEN_MAGNIFIER_ENABLED)) { + gtk_widget_show_all (widget); + } else { + gtk_widget_hide (widget); + } + + /* Large print */ + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "large_print_checkbutton")); + dialog->priv->large_print_checkbutton = widget; + g_signal_connect (widget, + "toggled", + G_CALLBACK (on_large_print_checkbutton_toggled), + dialog); + enabled = config_get_large_print (dialog, &is_writable); + ui_set_large_print (dialog, enabled); + if (! is_writable) { + gtk_widget_set_sensitive (widget, FALSE); + } +} + +static void +gsd_a11y_preferences_dialog_init (GsdA11yPreferencesDialog *dialog) +{ + static const gchar *ui_file_path = GTKBUILDERDIR "/" GTKBUILDER_UI_FILE; + gchar *objects[] = {"main_box", NULL}; + GError *error = NULL; + GtkBuilder *builder; + + dialog->priv = GSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE (dialog); + + builder = gtk_builder_new (); + gtk_builder_set_translation_domain (builder, PACKAGE); + if (gtk_builder_add_objects_from_file (builder, ui_file_path, objects, + &error) == 0) { + g_warning ("Could not load A11Y-UI: %s", error->message); + g_error_free (error); + } else { + GtkWidget *widget; + + widget = GTK_WIDGET (gtk_builder_get_object (builder, + "main_box")); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + widget); + gtk_container_set_border_width (GTK_CONTAINER (widget), 12); + setup_dialog (dialog, builder); + } + + g_object_unref (builder); + + gtk_container_set_border_width (GTK_CONTAINER (dialog), 12); + gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access Preferences")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-desktop-accessibility"); + g_object_set (dialog, + "allow-shrink", FALSE, + "allow-grow", FALSE, + NULL); + + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); + g_signal_connect (dialog, + "response", + G_CALLBACK (on_response), + dialog); + + + gtk_widget_show_all (GTK_WIDGET (dialog)); +} + +static void +gsd_a11y_preferences_dialog_finalize (GObject *object) +{ + GsdA11yPreferencesDialog *dialog; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_PREFERENCES_DIALOG (object)); + + dialog = GSD_A11Y_PREFERENCES_DIALOG (object); + + g_return_if_fail (dialog->priv != NULL); + + g_object_unref (dialog->priv->a11y_settings); + g_object_unref (dialog->priv->interface_settings); + g_object_unref (dialog->priv->apps_settings); + + G_OBJECT_CLASS (gsd_a11y_preferences_dialog_parent_class)->finalize (object); +} + +GtkWidget * +gsd_a11y_preferences_dialog_new (void) +{ + GObject *object; + + object = g_object_new (GSD_TYPE_A11Y_PREFERENCES_DIALOG, + NULL); + + return GTK_WIDGET (object); +} diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h new file mode 100644 index 00000000..a300423d --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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_A11Y_PREFERENCES_DIALOG_H +#define __GSD_A11Y_PREFERENCES_DIALOG_H + +#include +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_A11Y_PREFERENCES_DIALOG (gsd_a11y_preferences_dialog_get_type ()) +#define GSD_A11Y_PREFERENCES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialog)) +#define GSD_A11Y_PREFERENCES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogClass)) +#define GSD_IS_A11Y_PREFERENCES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG)) +#define GSD_IS_A11Y_PREFERENCES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_PREFERENCES_DIALOG)) +#define GSD_A11Y_PREFERENCES_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_PREFERENCES_DIALOG, GsdA11yPreferencesDialogClass)) + +typedef struct GsdA11yPreferencesDialogPrivate GsdA11yPreferencesDialogPrivate; + +typedef struct +{ + GtkDialog parent; + GsdA11yPreferencesDialogPrivate *priv; +} GsdA11yPreferencesDialog; + +typedef struct +{ + GtkDialogClass parent_class; +} GsdA11yPreferencesDialogClass; + +GType gsd_a11y_preferences_dialog_get_type (void); + +GtkWidget * gsd_a11y_preferences_dialog_new (void); + +G_END_DECLS + +#endif /* __GSD_A11Y_PREFERENCES_DIALOG_H */ diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui new file mode 100644 index 00000000..6a0fcb06 --- /dev/null +++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui @@ -0,0 +1,199 @@ + + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + Universal Access Preferences + center-on-parent + preferences-desktop-accessibility + dialog + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 10 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + preferences-desktop-accessibility + 6 + + + 0 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 6 + + + Use on-screen _keyboard + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 0 + + + + + Use screen _reader + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 1 + + + + + Use screen _magnifier + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 2 + + + + + Enhance _contrast in colors + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 3 + + + + + Make _text larger and easier to read + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 4 + + + + + _Press keyboard shortcuts one key at a time (Sticky Keys) + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 5 + + + + + _Ignore duplicate keypresses (Bounce Keys) + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 6 + + + + + Press and _hold keys to accept them (Slow Keys) + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + True + + + 7 + + + + + False + False + 1 + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + end + + + gtk-close + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + False + False + 0 + + + + + False + end + 0 + + + + + + button1 + + + diff --git a/plugins/a11y-keyboard/test-a11y-keyboard.c b/plugins/a11y-keyboard/test-a11y-keyboard.c new file mode 100644 index 00000000..38ddef6b --- /dev/null +++ b/plugins/a11y-keyboard/test-a11y-keyboard.c @@ -0,0 +1,7 @@ +#define NEW gsd_a11y_keyboard_manager_new +#define START gsd_a11y_keyboard_manager_start +#define STOP gsd_a11y_keyboard_manager_stop +#define MANAGER GsdA11yKeyboardManager +#include "gsd-a11y-keyboard-manager.h" + +#include "test-plugin.h" diff --git a/plugins/a11y-keyboard/test-a11y-preferences-dialog.c b/plugins/a11y-keyboard/test-a11y-preferences-dialog.c new file mode 100644 index 00000000..a22e99af --- /dev/null +++ b/plugins/a11y-keyboard/test-a11y-preferences-dialog.c @@ -0,0 +1,60 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 + +#include +#include + +#include "gsd-a11y-preferences-dialog.h" + +static void +test_window (void) +{ + GtkWidget *window; + + window = gsd_a11y_preferences_dialog_new (); + gtk_dialog_run (GTK_DIALOG (window)); +} + +int +main (int argc, + char **argv) +{ + GError *error = NULL; + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) { + fprintf (stderr, "%s", error->message); + g_error_free (error); + exit (1); + } + + test_window (); + + return 0; +} diff --git a/plugins/a11y-settings/Makefile.am b/plugins/a11y-settings/Makefile.am new file mode 100644 index 00000000..02f85e38 --- /dev/null +++ b/plugins/a11y-settings/Makefile.am @@ -0,0 +1,63 @@ +plugin_name = a11y-settings + +libexec_PROGRAMS = gsd-test-a11y-settings + +gsd_test_a11y_settings_SOURCES = \ + gsd-a11y-settings-manager.h \ + gsd-a11y-settings-manager.c \ + test-a11y-settings.c + +gsd_test_a11y_settings_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_a11y_settings_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = \ + liba11y-settings.la + +liba11y_settings_la_SOURCES = \ + gsd-a11y-settings-manager.c \ + gsd-a11y-settings-manager.h \ + gsd-a11y-settings-plugin.c \ + gsd-a11y-settings-plugin.h + +liba11y_settings_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +liba11y_settings_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_settings_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +liba11y_settings_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + a11y-settings.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ + diff --git a/plugins/a11y-settings/Makefile.in b/plugins/a11y-settings/Makefile.in new file mode 100644 index 00000000..46d9752a --- /dev/null +++ b/plugins/a11y-settings/Makefile.in @@ -0,0 +1,899 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-a11y-settings$(EXEEXT) +subdir = plugins/a11y-settings +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +liba11y_settings_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_liba11y_settings_la_OBJECTS = \ + liba11y_settings_la-gsd-a11y-settings-manager.lo \ + liba11y_settings_la-gsd-a11y-settings-plugin.lo +liba11y_settings_la_OBJECTS = $(am_liba11y_settings_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +liba11y_settings_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(liba11y_settings_la_CFLAGS) $(CFLAGS) \ + $(liba11y_settings_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_test_a11y_settings_OBJECTS = \ + gsd_test_a11y_settings-gsd-a11y-settings-manager.$(OBJEXT) \ + gsd_test_a11y_settings-test-a11y-settings.$(OBJEXT) +gsd_test_a11y_settings_OBJECTS = $(am_gsd_test_a11y_settings_OBJECTS) +gsd_test_a11y_settings_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) +gsd_test_a11y_settings_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(liba11y_settings_la_SOURCES) \ + $(gsd_test_a11y_settings_SOURCES) +DIST_SOURCES = $(liba11y_settings_la_SOURCES) \ + $(gsd_test_a11y_settings_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = a11y-settings +gsd_test_a11y_settings_SOURCES = \ + gsd-a11y-settings-manager.h \ + gsd-a11y-settings-manager.c \ + test-a11y-settings.c + +gsd_test_a11y_settings_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_a11y_settings_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = \ + liba11y-settings.la + +liba11y_settings_la_SOURCES = \ + gsd-a11y-settings-manager.c \ + gsd-a11y-settings-manager.h \ + gsd-a11y-settings-plugin.c \ + gsd-a11y-settings-plugin.h + +liba11y_settings_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +liba11y_settings_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +liba11y_settings_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +liba11y_settings_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + a11y-settings.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/a11y-settings/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/a11y-settings/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +liba11y-settings.la: $(liba11y_settings_la_OBJECTS) $(liba11y_settings_la_DEPENDENCIES) $(EXTRA_liba11y_settings_la_DEPENDENCIES) + $(AM_V_CCLD)$(liba11y_settings_la_LINK) -rpath $(plugindir) $(liba11y_settings_la_OBJECTS) $(liba11y_settings_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-a11y-settings$(EXEEXT): $(gsd_test_a11y_settings_OBJECTS) $(gsd_test_a11y_settings_DEPENDENCIES) $(EXTRA_gsd_test_a11y_settings_DEPENDENCIES) + @rm -f gsd-test-a11y-settings$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_a11y_settings_LINK) $(gsd_test_a11y_settings_OBJECTS) $(gsd_test_a11y_settings_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +liba11y_settings_la-gsd-a11y-settings-manager.lo: gsd-a11y-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_settings_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_settings_la_CFLAGS) $(CFLAGS) -MT liba11y_settings_la-gsd-a11y-settings-manager.lo -MD -MP -MF $(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-manager.Tpo -c -o liba11y_settings_la-gsd-a11y-settings-manager.lo `test -f 'gsd-a11y-settings-manager.c' || echo '$(srcdir)/'`gsd-a11y-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-manager.Tpo $(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-settings-manager.c' object='liba11y_settings_la-gsd-a11y-settings-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_settings_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_settings_la_CFLAGS) $(CFLAGS) -c -o liba11y_settings_la-gsd-a11y-settings-manager.lo `test -f 'gsd-a11y-settings-manager.c' || echo '$(srcdir)/'`gsd-a11y-settings-manager.c + +liba11y_settings_la-gsd-a11y-settings-plugin.lo: gsd-a11y-settings-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_settings_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_settings_la_CFLAGS) $(CFLAGS) -MT liba11y_settings_la-gsd-a11y-settings-plugin.lo -MD -MP -MF $(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-plugin.Tpo -c -o liba11y_settings_la-gsd-a11y-settings-plugin.lo `test -f 'gsd-a11y-settings-plugin.c' || echo '$(srcdir)/'`gsd-a11y-settings-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-plugin.Tpo $(DEPDIR)/liba11y_settings_la-gsd-a11y-settings-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-settings-plugin.c' object='liba11y_settings_la-gsd-a11y-settings-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liba11y_settings_la_CPPFLAGS) $(CPPFLAGS) $(liba11y_settings_la_CFLAGS) $(CFLAGS) -c -o liba11y_settings_la-gsd-a11y-settings-plugin.lo `test -f 'gsd-a11y-settings-plugin.c' || echo '$(srcdir)/'`gsd-a11y-settings-plugin.c + +gsd_test_a11y_settings-gsd-a11y-settings-manager.o: gsd-a11y-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_settings-gsd-a11y-settings-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Tpo -c -o gsd_test_a11y_settings-gsd-a11y-settings-manager.o `test -f 'gsd-a11y-settings-manager.c' || echo '$(srcdir)/'`gsd-a11y-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Tpo $(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-settings-manager.c' object='gsd_test_a11y_settings-gsd-a11y-settings-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_settings-gsd-a11y-settings-manager.o `test -f 'gsd-a11y-settings-manager.c' || echo '$(srcdir)/'`gsd-a11y-settings-manager.c + +gsd_test_a11y_settings-gsd-a11y-settings-manager.obj: gsd-a11y-settings-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_settings-gsd-a11y-settings-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Tpo -c -o gsd_test_a11y_settings-gsd-a11y-settings-manager.obj `if test -f 'gsd-a11y-settings-manager.c'; then $(CYGPATH_W) 'gsd-a11y-settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-settings-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Tpo $(DEPDIR)/gsd_test_a11y_settings-gsd-a11y-settings-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-a11y-settings-manager.c' object='gsd_test_a11y_settings-gsd-a11y-settings-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_settings-gsd-a11y-settings-manager.obj `if test -f 'gsd-a11y-settings-manager.c'; then $(CYGPATH_W) 'gsd-a11y-settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-a11y-settings-manager.c'; fi` + +gsd_test_a11y_settings-test-a11y-settings.o: test-a11y-settings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_settings-test-a11y-settings.o -MD -MP -MF $(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Tpo -c -o gsd_test_a11y_settings-test-a11y-settings.o `test -f 'test-a11y-settings.c' || echo '$(srcdir)/'`test-a11y-settings.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Tpo $(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-a11y-settings.c' object='gsd_test_a11y_settings-test-a11y-settings.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_settings-test-a11y-settings.o `test -f 'test-a11y-settings.c' || echo '$(srcdir)/'`test-a11y-settings.c + +gsd_test_a11y_settings-test-a11y-settings.obj: test-a11y-settings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -MT gsd_test_a11y_settings-test-a11y-settings.obj -MD -MP -MF $(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Tpo -c -o gsd_test_a11y_settings-test-a11y-settings.obj `if test -f 'test-a11y-settings.c'; then $(CYGPATH_W) 'test-a11y-settings.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-settings.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Tpo $(DEPDIR)/gsd_test_a11y_settings-test-a11y-settings.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-a11y-settings.c' object='gsd_test_a11y_settings-test-a11y-settings.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_a11y_settings_CFLAGS) $(CFLAGS) -c -o gsd_test_a11y_settings-test-a11y-settings.obj `if test -f 'test-a11y-settings.c'; then $(CYGPATH_W) 'test-a11y-settings.c'; else $(CYGPATH_W) '$(srcdir)/test-a11y-settings.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/a11y-settings/a11y-settings.gnome-settings-plugin.in b/plugins/a11y-settings/a11y-settings.gnome-settings-plugin.in new file mode 100644 index 00000000..1e5872aa --- /dev/null +++ b/plugins/a11y-settings/a11y-settings.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=a11y-settings +IAge=0 +_Name=Accessibility settings +_Description=Accessibility settings plugin +Authors=Bastien Nocera +Copyright=Copyright © 2011 Red Hat Inc. +Website= diff --git a/plugins/a11y-settings/gsd-a11y-settings-manager.c b/plugins/a11y-settings/gsd-a11y-settings-manager.c new file mode 100644 index 00000000..07b1f948 --- /dev/null +++ b/plugins/a11y-settings/gsd-a11y-settings-manager.c @@ -0,0 +1,192 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-a11y-settings-manager.h" + +#define GSD_A11Y_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_SETTINGS_MANAGER, GsdA11ySettingsManagerPrivate)) + +struct GsdA11ySettingsManagerPrivate +{ + GSettings *interface_settings; + GSettings *a11y_apps_settings; +}; + +enum { + PROP_0, +}; + +static void gsd_a11y_settings_manager_class_init (GsdA11ySettingsManagerClass *klass); +static void gsd_a11y_settings_manager_init (GsdA11ySettingsManager *a11y_settings_manager); +static void gsd_a11y_settings_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdA11ySettingsManager, gsd_a11y_settings_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +apps_settings_changed (GSettings *settings, + const char *key, + GsdA11ySettingsManager *manager) +{ + gboolean screen_reader, keyboard; + + if (g_str_equal (key, "screen-reader-enabled") == FALSE && + g_str_equal (key, "screen-keyboard-enabled") == FALSE) + return; + + g_debug ("screen reader or OSK enablement changed"); + + screen_reader = g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-reader-enabled"); + keyboard = g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-keyboard-enabled"); + + if (screen_reader || keyboard) { + g_debug ("Enabling toolkit-accessibility, screen reader or OSK enabled"); + g_settings_set_boolean (manager->priv->interface_settings, "toolkit-accessibility", TRUE); + } else if (screen_reader == FALSE && keyboard == FALSE) { + g_debug ("Disabling toolkit-accessibility, screen reader and OSK disabled"); + g_settings_set_boolean (manager->priv->interface_settings, "toolkit-accessibility", FALSE); + } +} + +gboolean +gsd_a11y_settings_manager_start (GsdA11ySettingsManager *manager, + GError **error) +{ + g_debug ("Starting a11y_settings manager"); + gnome_settings_profile_start (NULL); + + manager->priv->interface_settings = g_settings_new ("org.gnome.desktop.interface"); + manager->priv->a11y_apps_settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + + g_signal_connect (G_OBJECT (manager->priv->a11y_apps_settings), "changed", + G_CALLBACK (apps_settings_changed), manager); + + /* If any of the screen reader or on-screen keyboard are enabled, + * make sure a11y is enabled for the toolkits. + * We don't do the same thing for the reverse so it's possible to + * enable AT-SPI for the toolkits without using an a11y app */ + if (g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-keyboard-enabled") || + g_settings_get_boolean (manager->priv->a11y_apps_settings, "screen-reader-enabled")) + g_settings_set_boolean (manager->priv->interface_settings, "toolkit-accessibility", TRUE); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_a11y_settings_manager_stop (GsdA11ySettingsManager *manager) +{ + if (manager->priv->interface_settings) { + g_object_unref (manager->priv->interface_settings); + manager->priv->interface_settings = NULL; + } + if (manager->priv->a11y_apps_settings) { + g_object_unref (manager->priv->a11y_apps_settings); + manager->priv->a11y_apps_settings = NULL; + } + g_debug ("Stopping a11y_settings manager"); +} + +static GObject * +gsd_a11y_settings_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdA11ySettingsManager *a11y_settings_manager; + + a11y_settings_manager = GSD_A11Y_SETTINGS_MANAGER (G_OBJECT_CLASS (gsd_a11y_settings_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (a11y_settings_manager); +} + +static void +gsd_a11y_settings_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_a11y_settings_manager_parent_class)->dispose (object); +} + +static void +gsd_a11y_settings_manager_class_init (GsdA11ySettingsManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_a11y_settings_manager_constructor; + object_class->dispose = gsd_a11y_settings_manager_dispose; + object_class->finalize = gsd_a11y_settings_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdA11ySettingsManagerPrivate)); +} + +static void +gsd_a11y_settings_manager_init (GsdA11ySettingsManager *manager) +{ + manager->priv = GSD_A11Y_SETTINGS_MANAGER_GET_PRIVATE (manager); + +} + +static void +gsd_a11y_settings_manager_finalize (GObject *object) +{ + GsdA11ySettingsManager *a11y_settings_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_SETTINGS_MANAGER (object)); + + a11y_settings_manager = GSD_A11Y_SETTINGS_MANAGER (object); + + g_return_if_fail (a11y_settings_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_a11y_settings_manager_parent_class)->finalize (object); +} + +GsdA11ySettingsManager * +gsd_a11y_settings_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_A11Y_SETTINGS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_A11Y_SETTINGS_MANAGER (manager_object); +} diff --git a/plugins/a11y-settings/gsd-a11y-settings-manager.h b/plugins/a11y-settings/gsd-a11y-settings-manager.h new file mode 100644 index 00000000..7ae0cbcf --- /dev/null +++ b/plugins/a11y-settings/gsd-a11y-settings-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_A11Y_SETTINGS_MANAGER_H +#define __GSD_A11Y_SETTINGS_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_A11Y_SETTINGS_MANAGER (gsd_a11y_settings_manager_get_type ()) +#define GSD_A11Y_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_SETTINGS_MANAGER, GsdA11ySettingsManager)) +#define GSD_A11Y_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_SETTINGS_MANAGER, GsdA11ySettingsManagerClass)) +#define GSD_IS_A11Y_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_SETTINGS_MANAGER)) +#define GSD_IS_A11Y_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_SETTINGS_MANAGER)) +#define GSD_A11Y_SETTINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_SETTINGS_MANAGER, GsdA11ySettingsManagerClass)) + +typedef struct GsdA11ySettingsManagerPrivate GsdA11ySettingsManagerPrivate; + +typedef struct +{ + GObject parent; + GsdA11ySettingsManagerPrivate *priv; +} GsdA11ySettingsManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdA11ySettingsManagerClass; + +GType gsd_a11y_settings_manager_get_type (void); + +GsdA11ySettingsManager *gsd_a11y_settings_manager_new (void); +gboolean gsd_a11y_settings_manager_start (GsdA11ySettingsManager *manager, + GError **error); +void gsd_a11y_settings_manager_stop (GsdA11ySettingsManager *manager); + +G_END_DECLS + +#endif /* __GSD_A11Y_SETTINGS_MANAGER_H */ diff --git a/plugins/a11y-settings/gsd-a11y-settings-plugin.c b/plugins/a11y-settings/gsd-a11y-settings-plugin.c new file mode 100644 index 00000000..cb1391d3 --- /dev/null +++ b/plugins/a11y-settings/gsd-a11y-settings-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-a11y-settings-plugin.h" +#include "gsd-a11y-settings-manager.h" + +struct GsdA11ySettingsPluginPrivate { + GsdA11ySettingsManager *manager; +}; + +#define GSD_A11Y_SETTINGS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_A11Y_SETTINGS_PLUGIN, GsdA11ySettingsPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdA11ySettingsPlugin, gsd_a11y_settings_plugin) + +static void +gsd_a11y_settings_plugin_init (GsdA11ySettingsPlugin *plugin) +{ + plugin->priv = GSD_A11Y_SETTINGS_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdA11ySettingsPlugin initializing"); + + plugin->priv->manager = gsd_a11y_settings_manager_new (); +} + +static void +gsd_a11y_settings_plugin_finalize (GObject *object) +{ + GsdA11ySettingsPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_A11Y_SETTINGS_PLUGIN (object)); + + g_debug ("GsdA11ySettingsPlugin finalizing"); + + plugin = GSD_A11Y_SETTINGS_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_a11y_settings_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating a11y-settings plugin"); + + error = NULL; + res = gsd_a11y_settings_manager_start (GSD_A11Y_SETTINGS_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start a11y-settings manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating a11y-settings plugin"); + gsd_a11y_settings_manager_stop (GSD_A11Y_SETTINGS_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_a11y_settings_plugin_class_init (GsdA11ySettingsPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_a11y_settings_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdA11ySettingsPluginPrivate)); +} diff --git a/plugins/a11y-settings/gsd-a11y-settings-plugin.h b/plugins/a11y-settings/gsd-a11y-settings-plugin.h new file mode 100644 index 00000000..698c0ee3 --- /dev/null +++ b/plugins/a11y-settings/gsd-a11y-settings-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Red Hat, Inc. + * + * 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, 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_A11Y_SETTINGS_PLUGIN_H__ +#define __GSD_A11Y_SETTINGS_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_A11Y_SETTINGS_PLUGIN (gsd_a11y_settings_plugin_get_type ()) +#define GSD_A11Y_SETTINGS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_A11Y_SETTINGS_PLUGIN, GsdA11ySettingsPlugin)) +#define GSD_A11Y_SETTINGS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_A11Y_SETTINGS_PLUGIN, GsdA11ySettingsPluginClass)) +#define GSD_IS_A11Y_SETTINGS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_A11Y_SETTINGS_PLUGIN)) +#define GSD_IS_A11Y_SETTINGS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_A11Y_SETTINGS_PLUGIN)) +#define GSD_A11Y_SETTINGS_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_A11Y_SETTINGS_PLUGIN, GsdA11ySettingsPluginClass)) + +typedef struct GsdA11ySettingsPluginPrivate GsdA11ySettingsPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdA11ySettingsPluginPrivate *priv; +} GsdA11ySettingsPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdA11ySettingsPluginClass; + +GType gsd_a11y_settings_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_A11Y_SETTINGS_PLUGIN_H__ */ diff --git a/plugins/a11y-settings/test-a11y-settings.c b/plugins/a11y-settings/test-a11y-settings.c new file mode 100644 index 00000000..10b71284 --- /dev/null +++ b/plugins/a11y-settings/test-a11y-settings.c @@ -0,0 +1,7 @@ +#define NEW gsd_a11y_settings_manager_new +#define START gsd_a11y_settings_manager_start +#define STOP gsd_a11y_settings_manager_stop +#define MANAGER GsdA11ySettingsManager +#include "gsd-a11y-settings-manager.h" + +#include "test-plugin.h" diff --git a/plugins/automount/Makefile.am b/plugins/automount/Makefile.am new file mode 100644 index 00000000..d5f3ea87 --- /dev/null +++ b/plugins/automount/Makefile.am @@ -0,0 +1,38 @@ +libexec_PROGRAMS = gnome-fallback-mount-helper + +gnome_fallback_mount_helper_SOURCES = \ + gnome-fallback-mount-helper.c \ + gsd-automount-manager.c \ + gsd-automount-manager.h \ + gsd-autorun.c \ + gsd-autorun.h + +gnome_fallback_mount_helper_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gnome_fallback_mount_helper_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ + $(AUTOMOUNT_CFLAGS) + +gnome_fallback_mount_helper_LDADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(SYSTEMD_LIBS) \ + $(AUTOMOUNT_LIBS) \ + $(top_builddir)/gnome-settings-daemon/libgsd.la + +autostartdir = $(sysconfdir)/xdg/autostart +autostart_in_files = gnome-fallback-mount-helper.desktop.in +autostart_in_in_files = gnome-fallback-mount-helper.desktop.in.in +autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) + +$(autostart_in_files): $(autostart_in_in_files) + @sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ + +@INTLTOOL_DESKTOP_RULE@ + +EXTRA_DIST = $(autostart_in_in_files) + +CLEANFILES = $(autostart_DATA) $(autostart_in_files) diff --git a/plugins/automount/Makefile.in b/plugins/automount/Makefile.in new file mode 100644 index 00000000..3cffafb3 --- /dev/null +++ b/plugins/automount/Makefile.in @@ -0,0 +1,820 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gnome-fallback-mount-helper$(EXEEXT) +subdir = plugins/automount +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(autostartdir)" +PROGRAMS = $(libexec_PROGRAMS) +am_gnome_fallback_mount_helper_OBJECTS = gnome_fallback_mount_helper-gnome-fallback-mount-helper.$(OBJEXT) \ + gnome_fallback_mount_helper-gsd-automount-manager.$(OBJEXT) \ + gnome_fallback_mount_helper-gsd-autorun.$(OBJEXT) +gnome_fallback_mount_helper_OBJECTS = \ + $(am_gnome_fallback_mount_helper_OBJECTS) +am__DEPENDENCIES_1 = +gnome_fallback_mount_helper_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(top_builddir)/gnome-settings-daemon/libgsd.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +gnome_fallback_mount_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(gnome_fallback_mount_helper_SOURCES) +DIST_SOURCES = $(gnome_fallback_mount_helper_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +DATA = $(autostart_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +gnome_fallback_mount_helper_SOURCES = \ + gnome-fallback-mount-helper.c \ + gsd-automount-manager.c \ + gsd-automount-manager.h \ + gsd-autorun.c \ + gsd-autorun.h + +gnome_fallback_mount_helper_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gnome_fallback_mount_helper_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ + $(AUTOMOUNT_CFLAGS) + +gnome_fallback_mount_helper_LDADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(SYSTEMD_LIBS) \ + $(AUTOMOUNT_LIBS) \ + $(top_builddir)/gnome-settings-daemon/libgsd.la + +autostartdir = $(sysconfdir)/xdg/autostart +autostart_in_files = gnome-fallback-mount-helper.desktop.in +autostart_in_in_files = gnome-fallback-mount-helper.desktop.in.in +autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) +EXTRA_DIST = $(autostart_in_in_files) +CLEANFILES = $(autostart_DATA) $(autostart_in_files) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/automount/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/automount/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gnome-fallback-mount-helper$(EXEEXT): $(gnome_fallback_mount_helper_OBJECTS) $(gnome_fallback_mount_helper_DEPENDENCIES) $(EXTRA_gnome_fallback_mount_helper_DEPENDENCIES) + @rm -f gnome-fallback-mount-helper$(EXEEXT) + $(AM_V_CCLD)$(gnome_fallback_mount_helper_LINK) $(gnome_fallback_mount_helper_OBJECTS) $(gnome_fallback_mount_helper_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +gnome_fallback_mount_helper-gnome-fallback-mount-helper.o: gnome-fallback-mount-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -MT gnome_fallback_mount_helper-gnome-fallback-mount-helper.o -MD -MP -MF $(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Tpo -c -o gnome_fallback_mount_helper-gnome-fallback-mount-helper.o `test -f 'gnome-fallback-mount-helper.c' || echo '$(srcdir)/'`gnome-fallback-mount-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Tpo $(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-fallback-mount-helper.c' object='gnome_fallback_mount_helper-gnome-fallback-mount-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -c -o gnome_fallback_mount_helper-gnome-fallback-mount-helper.o `test -f 'gnome-fallback-mount-helper.c' || echo '$(srcdir)/'`gnome-fallback-mount-helper.c + +gnome_fallback_mount_helper-gnome-fallback-mount-helper.obj: gnome-fallback-mount-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -MT gnome_fallback_mount_helper-gnome-fallback-mount-helper.obj -MD -MP -MF $(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Tpo -c -o gnome_fallback_mount_helper-gnome-fallback-mount-helper.obj `if test -f 'gnome-fallback-mount-helper.c'; then $(CYGPATH_W) 'gnome-fallback-mount-helper.c'; else $(CYGPATH_W) '$(srcdir)/gnome-fallback-mount-helper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Tpo $(DEPDIR)/gnome_fallback_mount_helper-gnome-fallback-mount-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gnome-fallback-mount-helper.c' object='gnome_fallback_mount_helper-gnome-fallback-mount-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -c -o gnome_fallback_mount_helper-gnome-fallback-mount-helper.obj `if test -f 'gnome-fallback-mount-helper.c'; then $(CYGPATH_W) 'gnome-fallback-mount-helper.c'; else $(CYGPATH_W) '$(srcdir)/gnome-fallback-mount-helper.c'; fi` + +gnome_fallback_mount_helper-gsd-automount-manager.o: gsd-automount-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -MT gnome_fallback_mount_helper-gsd-automount-manager.o -MD -MP -MF $(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Tpo -c -o gnome_fallback_mount_helper-gsd-automount-manager.o `test -f 'gsd-automount-manager.c' || echo '$(srcdir)/'`gsd-automount-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Tpo $(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-automount-manager.c' object='gnome_fallback_mount_helper-gsd-automount-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -c -o gnome_fallback_mount_helper-gsd-automount-manager.o `test -f 'gsd-automount-manager.c' || echo '$(srcdir)/'`gsd-automount-manager.c + +gnome_fallback_mount_helper-gsd-automount-manager.obj: gsd-automount-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -MT gnome_fallback_mount_helper-gsd-automount-manager.obj -MD -MP -MF $(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Tpo -c -o gnome_fallback_mount_helper-gsd-automount-manager.obj `if test -f 'gsd-automount-manager.c'; then $(CYGPATH_W) 'gsd-automount-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-automount-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Tpo $(DEPDIR)/gnome_fallback_mount_helper-gsd-automount-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-automount-manager.c' object='gnome_fallback_mount_helper-gsd-automount-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -c -o gnome_fallback_mount_helper-gsd-automount-manager.obj `if test -f 'gsd-automount-manager.c'; then $(CYGPATH_W) 'gsd-automount-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-automount-manager.c'; fi` + +gnome_fallback_mount_helper-gsd-autorun.o: gsd-autorun.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -MT gnome_fallback_mount_helper-gsd-autorun.o -MD -MP -MF $(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Tpo -c -o gnome_fallback_mount_helper-gsd-autorun.o `test -f 'gsd-autorun.c' || echo '$(srcdir)/'`gsd-autorun.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Tpo $(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-autorun.c' object='gnome_fallback_mount_helper-gsd-autorun.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -c -o gnome_fallback_mount_helper-gsd-autorun.o `test -f 'gsd-autorun.c' || echo '$(srcdir)/'`gsd-autorun.c + +gnome_fallback_mount_helper-gsd-autorun.obj: gsd-autorun.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -MT gnome_fallback_mount_helper-gsd-autorun.obj -MD -MP -MF $(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Tpo -c -o gnome_fallback_mount_helper-gsd-autorun.obj `if test -f 'gsd-autorun.c'; then $(CYGPATH_W) 'gsd-autorun.c'; else $(CYGPATH_W) '$(srcdir)/gsd-autorun.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Tpo $(DEPDIR)/gnome_fallback_mount_helper-gsd-autorun.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-autorun.c' object='gnome_fallback_mount_helper-gsd-autorun.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gnome_fallback_mount_helper_CPPFLAGS) $(CPPFLAGS) $(gnome_fallback_mount_helper_CFLAGS) $(CFLAGS) -c -o gnome_fallback_mount_helper-gsd-autorun.obj `if test -f 'gsd-autorun.c'; then $(CYGPATH_W) 'gsd-autorun.c'; else $(CYGPATH_W) '$(srcdir)/gsd-autorun.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-autostartDATA: $(autostart_DATA) + @$(NORMAL_INSTALL) + @list='$(autostart_DATA)'; test -n "$(autostartdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(autostartdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(autostartdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(autostartdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(autostartdir)" || exit $$?; \ + done + +uninstall-autostartDATA: + @$(NORMAL_UNINSTALL) + @list='$(autostart_DATA)'; test -n "$(autostartdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(autostartdir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(autostartdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-autostartDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-autostartDATA uninstall-libexecPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-autostartDATA install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-autostartDATA uninstall-libexecPROGRAMS + + +$(autostart_in_files): $(autostart_in_in_files) + @sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ + +@INTLTOOL_DESKTOP_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/automount/gnome-fallback-mount-helper.c b/plugins/automount/gnome-fallback-mount-helper.c new file mode 100644 index 00000000..4a52ba01 --- /dev/null +++ b/plugins/automount/gnome-fallback-mount-helper.c @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Red Hat, Inc. + * + * 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 + * + * Author: Tomas Bzatek + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "gsd-automount-manager.h" + +int +main (int argc, + char **argv) +{ + GMainLoop *loop; + GsdAutomountManager *manager; + GError *error = NULL; + + g_type_init (); + gtk_init (&argc, &argv); + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + loop = g_main_loop_new (NULL, FALSE); + manager = gsd_automount_manager_new (); + + gsd_automount_manager_start (manager, &error); + + if (error != NULL) { + g_printerr ("Unable to start the mount manager: %s", + error->message); + + g_error_free (error); + _exit (1); + } + + g_main_loop_run (loop); + + gsd_automount_manager_stop (manager); + g_main_loop_unref (loop); + + return 0; +} diff --git a/plugins/automount/gnome-fallback-mount-helper.desktop.in.in b/plugins/automount/gnome-fallback-mount-helper.desktop.in.in new file mode 100644 index 00000000..f7bd4b97 --- /dev/null +++ b/plugins/automount/gnome-fallback-mount-helper.desktop.in.in @@ -0,0 +1,12 @@ +[Desktop Entry] +_Name=Mount Helper +_Comment=Automount and autorun plugged devices +Exec=@LIBEXECDIR@/gnome-fallback-mount-helper +Icon=drive-optical +Terminal=false +Type=Application +Categories= +NoDisplay=true +OnlyShowIn=GNOME;Unity; +X-GNOME-Autostart-Notify=true +AutostartCondition=GNOME3 unless-session gnome diff --git a/plugins/automount/gsd-automount-manager.c b/plugins/automount/gsd-automount-manager.c new file mode 100644 index 00000000..7912f191 --- /dev/null +++ b/plugins/automount/gsd-automount-manager.c @@ -0,0 +1,540 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Red Hat, Inc. + * + * 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 + * + * Author: Tomas Bzatek + */ + +#include "config.h" + +#include +#include + +#include +#include +#include + +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-automount-manager.h" +#include "gsd-autorun.h" + +#define GSD_AUTOMOUNT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_AUTOMOUNT_MANAGER, GsdAutomountManagerPrivate)) + +struct GsdAutomountManagerPrivate +{ + GSettings *settings; + + GVolumeMonitor *volume_monitor; + unsigned int automount_idle_id; + + GnomeSettingsSession *session; + gboolean session_is_active; + gboolean screensaver_active; + guint ss_watch_id; + GDBusProxy *ss_proxy; + + GList *volume_queue; +}; + +static void gsd_automount_manager_class_init (GsdAutomountManagerClass *klass); +static void gsd_automount_manager_init (GsdAutomountManager *gsd_automount_manager); + +G_DEFINE_TYPE (GsdAutomountManager, gsd_automount_manager, G_TYPE_OBJECT) + +static GtkDialog * +show_error_dialog (const char *primary_text, + const char *secondary_text) +{ + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "%s", ""); + + g_object_set (dialog, + "text", primary_text, + "secondary-text", secondary_text, + NULL); + + gtk_widget_show (GTK_WIDGET (dialog)); + + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + + return GTK_DIALOG (dialog); +} + +static void +startup_volume_mount_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + g_volume_mount_finish (G_VOLUME (source_object), res, NULL); +} + +static void +automount_all_volumes (GsdAutomountManager *manager) +{ + GList *volumes, *l; + GMount *mount; + GVolume *volume; + + if (g_settings_get_boolean (manager->priv->settings, "automount")) { + /* automount all mountable volumes at start-up */ + volumes = g_volume_monitor_get_volumes (manager->priv->volume_monitor); + for (l = volumes; l != NULL; l = l->next) { + volume = l->data; + + if (!g_volume_should_automount (volume) || + !g_volume_can_mount (volume)) { + continue; + } + + mount = g_volume_get_mount (volume); + if (mount != NULL) { + g_object_unref (mount); + continue; + } + + /* pass NULL as GMountOperation to avoid user interaction */ + g_volume_mount (volume, 0, NULL, NULL, startup_volume_mount_cb, NULL); + } + g_list_free_full (volumes, g_object_unref); + } +} + +static gboolean +automount_all_volumes_idle_cb (gpointer data) +{ + GsdAutomountManager *manager = GSD_AUTOMOUNT_MANAGER (data); + + automount_all_volumes (manager); + + manager->priv->automount_idle_id = 0; + return FALSE; +} + +static void +volume_mount_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GMountOperation *mount_op = user_data; + GError *error; + char *primary; + char *name; + + error = NULL; + gsd_allow_autorun_for_volume_finish (G_VOLUME (source_object)); + if (!g_volume_mount_finish (G_VOLUME (source_object), res, &error)) { + if (error->code != G_IO_ERROR_FAILED_HANDLED) { + name = g_volume_get_name (G_VOLUME (source_object)); + primary = g_strdup_printf (_("Unable to mount %s"), name); + g_free (name); + show_error_dialog (primary, + error->message); + g_free (primary); + } + g_error_free (error); + } + + g_object_unref (mount_op); +} + +static void +do_mount_volume (GVolume *volume) +{ + GMountOperation *mount_op; + + mount_op = gtk_mount_operation_new (NULL); + g_mount_operation_set_password_save (mount_op, G_PASSWORD_SAVE_FOR_SESSION); + + gsd_allow_autorun_for_volume (volume); + g_volume_mount (volume, 0, mount_op, NULL, volume_mount_cb, mount_op); +} + +static void +check_volume_queue (GsdAutomountManager *manager) +{ + GList *l; + GVolume *volume; + + if (manager->priv->screensaver_active) + return; + + l = manager->priv->volume_queue; + + while (l != NULL) { + volume = l->data; + + do_mount_volume (volume); + manager->priv->volume_queue = + g_list_remove (manager->priv->volume_queue, volume); + + g_object_unref (volume); + l = l->next; + } + + manager->priv->volume_queue = NULL; +} + +static void +check_screen_lock_and_mount (GsdAutomountManager *manager, + GVolume *volume) +{ + if (!manager->priv->session_is_active) + return; + + if (manager->priv->screensaver_active) { + /* queue the volume, to mount it after the screensaver state changed */ + g_debug ("Queuing volume %p", volume); + manager->priv->volume_queue = g_list_prepend (manager->priv->volume_queue, + g_object_ref (volume)); + } else { + /* mount it immediately */ + do_mount_volume (volume); + } +} + +static void +volume_removed_callback (GVolumeMonitor *monitor, + GVolume *volume, + GsdAutomountManager *manager) +{ + g_debug ("Volume %p removed, removing from the queue", volume); + + /* clear it from the queue, if present */ + manager->priv->volume_queue = + g_list_remove (manager->priv->volume_queue, volume); +} + +static void +volume_added_callback (GVolumeMonitor *monitor, + GVolume *volume, + GsdAutomountManager *manager) +{ + if (g_settings_get_boolean (manager->priv->settings, "automount") && + g_volume_should_automount (volume) && + g_volume_can_mount (volume)) { + check_screen_lock_and_mount (manager, volume); + } else { + /* Allow gsd_autorun() to run. When the mount is later + * added programmatically (i.e. for a blank CD), + * gsd_autorun() will be called by mount_added_callback(). */ + gsd_allow_autorun_for_volume (volume); + gsd_allow_autorun_for_volume_finish (volume); + } +} + +static void +autorun_show_window (GMount *mount, gpointer user_data) +{ + GFile *location; + char *uri; + GError *error; + char *primary; + char *name; + + location = g_mount_get_root (mount); + uri = g_file_get_uri (location); + + error = NULL; + /* use default folder handler */ + if (! gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, &error)) { + name = g_mount_get_name (mount); + primary = g_strdup_printf (_("Unable to open a folder for %s"), name); + g_free (name); + show_error_dialog (primary, + error->message); + g_free (primary); + g_error_free (error); + } + + g_free (uri); + g_object_unref (location); +} + +static void +mount_added_callback (GVolumeMonitor *monitor, + GMount *mount, + GsdAutomountManager *manager) +{ + /* don't autorun if the session is not active */ + if (!manager->priv->session_is_active) { + return; + } + + gsd_autorun (mount, manager->priv->settings, autorun_show_window, manager); +} + + +static void +session_state_changed (GnomeSettingsSession *session, GParamSpec *pspec, gpointer user_data) +{ + GsdAutomountManager *manager = user_data; + GsdAutomountManagerPrivate *p = manager->priv; + + if (gnome_settings_session_get_state (session) == GNOME_SETTINGS_SESSION_STATE_ACTIVE) { + p->session_is_active = TRUE; + } + else { + p->session_is_active = FALSE; + } + + if (!p->session_is_active) { + if (p->volume_queue != NULL) { + g_list_free_full (p->volume_queue, g_object_unref); + p->volume_queue = NULL; + } + } +} + +static void +do_initialize_session (GsdAutomountManager *manager) +{ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (session_state_changed), manager); + session_state_changed (manager->priv->session, NULL, manager); +} + +#define SCREENSAVER_NAME "org.gnome.ScreenSaver" +#define SCREENSAVER_PATH "/org/gnome/ScreenSaver" +#define SCREENSAVER_INTERFACE "org.gnome.ScreenSaver" + +static void +screensaver_signal_callback (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdAutomountManager *manager = user_data; + + if (g_strcmp0 (signal_name, "ActiveChanged") == 0) { + g_variant_get (parameters, "(b)", &manager->priv->screensaver_active); + g_debug ("Screensaver active changed to %d", manager->priv->screensaver_active); + + check_volume_queue (manager); + } +} + +static void +screensaver_get_active_ready_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + GsdAutomountManager *manager = user_data; + GDBusProxy *proxy = manager->priv->ss_proxy; + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (proxy, + res, + &error); + + if (error != NULL) { + g_warning ("Can't call GetActive() on the ScreenSaver object: %s", + error->message); + g_error_free (error); + + return; + } + + g_variant_get (result, "(b)", &manager->priv->screensaver_active); + g_variant_unref (result); + + g_debug ("Screensaver GetActive() returned %d", manager->priv->screensaver_active); +} + +static void +screensaver_proxy_ready_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + GsdAutomountManager *manager = user_data; + GError *error = NULL; + GDBusProxy *ss_proxy; + + ss_proxy = g_dbus_proxy_new_finish (res, &error); + + if (error != NULL) { + g_warning ("Can't get proxy for the ScreenSaver object: %s", + error->message); + g_error_free (error); + + return; + } + + g_debug ("ScreenSaver proxy ready"); + + manager->priv->ss_proxy = ss_proxy; + + g_signal_connect (ss_proxy, "g-signal", + G_CALLBACK (screensaver_signal_callback), manager); + + g_dbus_proxy_call (ss_proxy, + "GetActive", + NULL, + G_DBUS_CALL_FLAGS_NO_AUTO_START, + -1, + NULL, + screensaver_get_active_ready_cb, + manager); +} + +static void +screensaver_appeared_callback (GDBusConnection *connection, + const gchar *name, + const gchar *name_owner, + gpointer user_data) +{ + GsdAutomountManager *manager = user_data; + + g_debug ("ScreenSaver name appeared"); + + manager->priv->screensaver_active = FALSE; + + g_dbus_proxy_new (connection, + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NULL, + name, + SCREENSAVER_PATH, + SCREENSAVER_INTERFACE, + NULL, + screensaver_proxy_ready_cb, + manager); +} + +static void +screensaver_vanished_callback (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + GsdAutomountManager *manager = user_data; + + g_debug ("ScreenSaver name vanished"); + + manager->priv->screensaver_active = FALSE; + g_clear_object (&manager->priv->ss_proxy); + + /* in this case force a clear of the volume queue, without + * mounting them. + */ + if (manager->priv->volume_queue != NULL) { + g_list_free_full (manager->priv->volume_queue, g_object_unref); + manager->priv->volume_queue = NULL; + } +} + +static void +do_initialize_screensaver (GsdAutomountManager *manager) +{ + GsdAutomountManagerPrivate *p = manager->priv; + + p->ss_watch_id = + g_bus_watch_name (G_BUS_TYPE_SESSION, + SCREENSAVER_NAME, + G_BUS_NAME_WATCHER_FLAGS_NONE, + screensaver_appeared_callback, + screensaver_vanished_callback, + manager, + NULL); +} + +static void +setup_automounter (GsdAutomountManager *manager) +{ + do_initialize_session (manager); + do_initialize_screensaver (manager); + + manager->priv->volume_monitor = g_volume_monitor_get (); + g_signal_connect_object (manager->priv->volume_monitor, "mount-added", + G_CALLBACK (mount_added_callback), manager, 0); + g_signal_connect_object (manager->priv->volume_monitor, "volume-added", + G_CALLBACK (volume_added_callback), manager, 0); + g_signal_connect_object (manager->priv->volume_monitor, "volume-removed", + G_CALLBACK (volume_removed_callback), manager, 0); + + manager->priv->automount_idle_id = + g_idle_add_full (G_PRIORITY_LOW, + automount_all_volumes_idle_cb, + manager, NULL); +} + +gboolean +gsd_automount_manager_start (GsdAutomountManager *manager, + GError **error) +{ + g_debug ("Starting automounting manager"); + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new ("org.gnome.desktop.media-handling"); + setup_automounter (manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_automount_manager_stop (GsdAutomountManager *manager) +{ + GsdAutomountManagerPrivate *p = manager->priv; + + g_debug ("Stopping automounting manager"); + + g_clear_object (&p->session); + g_clear_object (&p->volume_monitor); + g_clear_object (&p->settings); + g_clear_object (&p->ss_proxy); + + g_bus_unwatch_name (p->ss_watch_id); + + if (p->volume_queue != NULL) { + g_list_free_full (p->volume_queue, g_object_unref); + p->volume_queue = NULL; + } + + if (p->automount_idle_id != 0) { + g_source_remove (p->automount_idle_id); + p->automount_idle_id = 0; + } +} + +static void +gsd_automount_manager_class_init (GsdAutomountManagerClass *klass) +{ + g_type_class_add_private (klass, sizeof (GsdAutomountManagerPrivate)); +} + +static void +gsd_automount_manager_init (GsdAutomountManager *manager) +{ + manager->priv = GSD_AUTOMOUNT_MANAGER_GET_PRIVATE (manager); +} + +GsdAutomountManager * +gsd_automount_manager_new (void) +{ + return GSD_AUTOMOUNT_MANAGER (g_object_new (GSD_TYPE_AUTOMOUNT_MANAGER, NULL)); +} diff --git a/plugins/automount/gsd-automount-manager.h b/plugins/automount/gsd-automount-manager.h new file mode 100644 index 00000000..42f9f588 --- /dev/null +++ b/plugins/automount/gsd-automount-manager.h @@ -0,0 +1,58 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Red Hat, Inc. + * + * 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 + * + * Author: Tomas Bzatek + */ + +#ifndef __GSD_AUTOMOUNT_MANAGER_H +#define __GSD_AUTOMOUNT_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_AUTOMOUNT_MANAGER (gsd_automount_manager_get_type ()) +#define GSD_AUTOMOUNT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_AUTOMOUNT_MANAGER, GsdAutomountManager)) +#define GSD_AUTOMOUNT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_AUTOMOUNT_MANAGER, GsdAutomountManagerClass)) +#define GSD_IS_AUTOMOUNT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_AUTOMOUNT_MANAGER)) +#define GSD_IS_AUTOMOUNT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_AUTOMOUNT_MANAGER)) +#define GSD_AUTOMOUNT_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_AUTOMOUNT_MANAGER, GsdAutomountManagerClass)) + +typedef struct GsdAutomountManagerPrivate GsdAutomountManagerPrivate; + +typedef struct +{ + GObject parent; + GsdAutomountManagerPrivate *priv; +} GsdAutomountManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdAutomountManagerClass; + +GType gsd_automount_manager_get_type (void); + +GsdAutomountManager * gsd_automount_manager_new (void); +gboolean gsd_automount_manager_start (GsdAutomountManager *manager, + GError **error); +void gsd_automount_manager_stop (GsdAutomountManager *manager); + +G_END_DECLS + +#endif /* __GSD_AUTOMOUNT_MANAGER_H */ diff --git a/plugins/automount/gsd-autorun.c b/plugins/automount/gsd-autorun.c new file mode 100644 index 00000000..506d7f6b --- /dev/null +++ b/plugins/automount/gsd-autorun.c @@ -0,0 +1,975 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + +/* + * gsd-automount.c: helpers for automounting hotplugged volumes + * + * Copyright (C) 2008, 2010 Red Hat, Inc. + * + * Nautilus 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 + * + * Authors: David Zeuthen + * Cosimo Cecchi + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gsd-autorun.h" + +static gboolean should_autorun_mount (GMount *mount); + +#define CUSTOM_ITEM_ASK "gsd-item-ask" +#define CUSTOM_ITEM_DO_NOTHING "gsd-item-do-nothing" +#define CUSTOM_ITEM_OPEN_FOLDER "gsd-item-open-folder" + +typedef struct +{ + GtkWidget *dialog; + + GMount *mount; + gboolean should_eject; + + gboolean selected_ignore; + gboolean selected_open_folder; + GAppInfo *selected_app; + + gboolean remember; + + char *x_content_type; + + GsdAutorunOpenWindow open_window_func; + gpointer user_data; +} AutorunDialogData; + +static int +gsd_autorun_g_strv_find (char **strv, const char *find_me) +{ + guint index; + + g_return_val_if_fail (find_me != NULL, -1); + + for (index = 0; strv[index] != NULL; ++index) { + if (strcmp (strv[index], find_me) == 0) { + return index; + } + } + + return -1; +} + + +#define ICON_SIZE_STANDARD 48 + +static gint +get_icon_size_for_stock_size (GtkIconSize size) +{ + gint w, h; + + if (gtk_icon_size_lookup (size, &w, &h)) { + return MAX (w, h); + } + return ICON_SIZE_STANDARD; +} + +static GdkPixbuf * +render_icon (GIcon *icon, gint icon_size) +{ + GdkPixbuf *pixbuf; + GtkIconInfo *info; + + pixbuf = NULL; + + if (G_IS_THEMED_ICON (icon)) { + gchar const * const *names; + + info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (), + icon, + icon_size, + 0); + + if (info) { + pixbuf = gtk_icon_info_load_icon (info, NULL); + gtk_icon_info_free (info); + } + + if (pixbuf == NULL) { + names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + *names, + icon_size, + 0, NULL); + } + } + else + if (G_IS_FILE_ICON (icon)) { + GFile *icon_file; + gchar *path; + + icon_file = g_file_icon_get_file (G_FILE_ICON (icon)); + path = g_file_get_path (icon_file); + pixbuf = gdk_pixbuf_new_from_file_at_size (path, + icon_size, icon_size, + NULL); + g_free (path); + g_object_unref (G_OBJECT (icon_file)); + } + + return pixbuf; +} + +static void +gsd_autorun_get_preferences (const char *x_content_type, + gboolean *pref_start_app, + gboolean *pref_ignore, + gboolean *pref_open_folder) +{ + GSettings *settings; + char **x_content_start_app; + char **x_content_ignore; + char **x_content_open_folder; + + g_return_if_fail (pref_start_app != NULL); + g_return_if_fail (pref_ignore != NULL); + g_return_if_fail (pref_open_folder != NULL); + + settings = g_settings_new ("org.gnome.desktop.media-handling"); + + *pref_start_app = FALSE; + *pref_ignore = FALSE; + *pref_open_folder = FALSE; + x_content_start_app = g_settings_get_strv (settings, "autorun-x-content-start-app"); + x_content_ignore = g_settings_get_strv (settings, "autorun-x-content-ignore"); + x_content_open_folder = g_settings_get_strv (settings, "autorun-x-content-open-folder"); + if (x_content_start_app != NULL) { + *pref_start_app = gsd_autorun_g_strv_find (x_content_start_app, x_content_type) != -1; + } + if (x_content_ignore != NULL) { + *pref_ignore = gsd_autorun_g_strv_find (x_content_ignore, x_content_type) != -1; + } + if (x_content_open_folder != NULL) { + *pref_open_folder = gsd_autorun_g_strv_find (x_content_open_folder, x_content_type) != -1; + } + g_strfreev (x_content_ignore); + g_strfreev (x_content_start_app); + g_strfreev (x_content_open_folder); + g_object_unref (settings); +} + +static char ** +remove_elem_from_str_array (char **v, + const char *s) +{ + GPtrArray *array; + guint idx; + + array = g_ptr_array_new (); + + for (idx = 0; v[idx] != NULL; idx++) { + if (g_strcmp0 (v[idx], s) == 0) { + continue; + } + + g_ptr_array_add (array, v[idx]); + } + + g_ptr_array_add (array, NULL); + + g_free (v); + + return (char **) g_ptr_array_free (array, FALSE); +} + +static char ** +add_elem_to_str_array (char **v, + const char *s) +{ + GPtrArray *array; + guint idx; + + array = g_ptr_array_new (); + + for (idx = 0; v[idx] != NULL; idx++) { + g_ptr_array_add (array, v[idx]); + } + + g_ptr_array_add (array, g_strdup (s)); + g_ptr_array_add (array, NULL); + + g_free (v); + + return (char **) g_ptr_array_free (array, FALSE); +} + +static void +gsd_autorun_set_preferences (const char *x_content_type, + gboolean pref_start_app, + gboolean pref_ignore, + gboolean pref_open_folder) +{ + GSettings *settings; + char **x_content_start_app; + char **x_content_ignore; + char **x_content_open_folder; + + g_assert (x_content_type != NULL); + + settings = g_settings_new ("org.gnome.desktop.media-handling"); + + x_content_start_app = g_settings_get_strv (settings, "autorun-x-content-start-app"); + x_content_ignore = g_settings_get_strv (settings, "autorun-x-content-ignore"); + x_content_open_folder = g_settings_get_strv (settings, "autorun-x-content-open-folder"); + + x_content_start_app = remove_elem_from_str_array (x_content_start_app, x_content_type); + if (pref_start_app) { + x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type); + } + g_settings_set_strv (settings, "autorun-x-content-start-app", (const gchar * const*) x_content_start_app); + + x_content_ignore = remove_elem_from_str_array (x_content_ignore, x_content_type); + if (pref_ignore) { + x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type); + } + g_settings_set_strv (settings, "autorun-x-content-ignore", (const gchar * const*) x_content_ignore); + + x_content_open_folder = remove_elem_from_str_array (x_content_open_folder, x_content_type); + if (pref_open_folder) { + x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type); + } + g_settings_set_strv (settings, "autorun-x-content-open-folder", (const gchar * const*) x_content_open_folder); + + g_strfreev (x_content_open_folder); + g_strfreev (x_content_ignore); + g_strfreev (x_content_start_app); + g_object_unref (settings); +} + +static void +custom_item_activated_cb (GtkAppChooserButton *button, + const gchar *item, + gpointer user_data) +{ + gchar *content_type; + AutorunDialogData *data = user_data; + + content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (button)); + + if (g_strcmp0 (item, CUSTOM_ITEM_ASK) == 0) { + gsd_autorun_set_preferences (content_type, + FALSE, FALSE, FALSE); + data->selected_open_folder = FALSE; + data->selected_ignore = FALSE; + } else if (g_strcmp0 (item, CUSTOM_ITEM_OPEN_FOLDER) == 0) { + gsd_autorun_set_preferences (content_type, + FALSE, FALSE, TRUE); + data->selected_open_folder = TRUE; + data->selected_ignore = FALSE; + } else if (g_strcmp0 (item, CUSTOM_ITEM_DO_NOTHING) == 0) { + gsd_autorun_set_preferences (content_type, + FALSE, TRUE, FALSE); + data->selected_open_folder = FALSE; + data->selected_ignore = TRUE; + } + + g_free (content_type); +} + +static void +combo_box_changed_cb (GtkComboBox *combo_box, + gpointer user_data) +{ + GAppInfo *info; + AutorunDialogData *data = user_data; + + info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box)); + + if (info == NULL) + return; + + g_clear_object (&data->selected_app); + data->selected_app = info; +} + +static void +prepare_combo_box (GtkWidget *combo_box, + AutorunDialogData *data) +{ + GtkAppChooserButton *app_chooser = GTK_APP_CHOOSER_BUTTON (combo_box); + GIcon *icon; + gboolean pref_ask; + gboolean pref_start_app; + gboolean pref_ignore; + gboolean pref_open_folder; + GAppInfo *info; + gchar *content_type; + + content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (app_chooser)); + + /* fetch preferences for this content type */ + gsd_autorun_get_preferences (content_type, + &pref_start_app, &pref_ignore, &pref_open_folder); + pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder; + + info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box)); + + /* append the separator only if we have >= 1 apps in the chooser */ + if (info != NULL) { + gtk_app_chooser_button_append_separator (app_chooser); + g_object_unref (info); + } + + icon = g_themed_icon_new (GTK_STOCK_DIALOG_QUESTION); + gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_ASK, + _("Ask what to do"), + icon); + g_object_unref (icon); + + icon = g_themed_icon_new (GTK_STOCK_CLOSE); + gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING, + _("Do Nothing"), + icon); + g_object_unref (icon); + + icon = g_themed_icon_new ("folder-open"); + gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER, + _("Open Folder"), + icon); + g_object_unref (icon); + + gtk_app_chooser_button_set_show_dialog_item (app_chooser, TRUE); + + if (pref_ask) { + gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_ASK); + } else if (pref_ignore) { + gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING); + } else if (pref_open_folder) { + gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER); + } + + g_signal_connect (app_chooser, "changed", + G_CALLBACK (combo_box_changed_cb), data); + g_signal_connect (app_chooser, "custom-item-activated", + G_CALLBACK (custom_item_activated_cb), data); + + g_free (content_type); +} + +static gboolean +is_shift_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_ignored (); + + if (status == Success) { + ret = state.mods & ShiftMask; + } + + return ret; +} + +enum { + AUTORUN_DIALOG_RESPONSE_EJECT = 0 +}; + +static void +gsd_autorun_launch_for_mount (GMount *mount, GAppInfo *app_info) +{ + GFile *root; + GdkAppLaunchContext *launch_context; + GError *error; + gboolean result; + GList *list; + gchar *uri_scheme; + gchar *uri; + + root = g_mount_get_root (mount); + list = g_list_append (NULL, root); + + launch_context = gdk_app_launch_context_new (); + + error = NULL; + result = g_app_info_launch (app_info, + list, + G_APP_LAUNCH_CONTEXT (launch_context), + &error); + + g_object_unref (launch_context); + + if (!result) { + if (error->domain == G_IO_ERROR && + error->code == G_IO_ERROR_NOT_SUPPORTED) { + uri = g_file_get_uri (root); + uri_scheme = g_uri_parse_scheme (uri); + + /* FIXME: Present user a dialog to choose another app when the last one failed to handle a file */ + g_warning ("Cannot open location: %s\n", error->message); + + g_free (uri_scheme); + g_free (uri); + } else { + g_warning ("Cannot open app: %s\n", error->message); + } + g_error_free (error); + } + + g_list_free (list); + g_object_unref (root); +} + +static void autorun_dialog_mount_unmounted (GMount *mount, AutorunDialogData *data); + +static void +autorun_dialog_destroy (AutorunDialogData *data) +{ + g_signal_handlers_disconnect_by_func (G_OBJECT (data->mount), + G_CALLBACK (autorun_dialog_mount_unmounted), + data); + + gtk_widget_destroy (GTK_WIDGET (data->dialog)); + if (data->selected_app != NULL) { + g_object_unref (data->selected_app); + } + g_object_unref (data->mount); + g_free (data->x_content_type); + g_free (data); +} + +static void +autorun_dialog_mount_unmounted (GMount *mount, AutorunDialogData *data) +{ + /* remove the dialog if the media is unmounted */ + autorun_dialog_destroy (data); +} + +static void +unmount_mount_callback (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error; + char *primary; + gboolean unmounted; + gboolean should_eject; + GtkWidget *dialog; + + + should_eject = user_data != NULL; + + error = NULL; + if (should_eject) { + unmounted = g_mount_eject_with_operation_finish (G_MOUNT (source_object), + res, &error); + } else { + unmounted = g_mount_unmount_with_operation_finish (G_MOUNT (source_object), + res, &error); + } + + if (! unmounted) { + if (error->code != G_IO_ERROR_FAILED_HANDLED) { + if (should_eject) { + primary = g_strdup_printf (_("Unable to eject %p"), source_object); + } else { + primary = g_strdup_printf (_("Unable to unmount %p"), source_object); + } + + dialog = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "%s", + primary); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", + error->message); + + gtk_widget_show (GTK_WIDGET (dialog)); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + g_free (primary); + } + } + + if (error != NULL) { + g_error_free (error); + } +} + +static void +do_unmount (GMount *mount, gboolean should_eject, GtkWindow *window) +{ + GMountOperation *mount_op; + + mount_op = gtk_mount_operation_new (window); + if (should_eject) { + g_mount_eject_with_operation (mount, + 0, + mount_op, + NULL, + unmount_mount_callback, + (gpointer) 1); + } else { + g_mount_unmount_with_operation (mount, + 0, + mount_op, + NULL, + unmount_mount_callback, + (gpointer) 0); + } + g_object_unref (mount_op); +} + +static void +autorun_dialog_response (GtkDialog *dialog, gint response, AutorunDialogData *data) +{ + switch (response) { + case AUTORUN_DIALOG_RESPONSE_EJECT: + do_unmount (data->mount, data->should_eject, GTK_WINDOW (dialog)); + break; + + case GTK_RESPONSE_NONE: + /* window was closed */ + break; + case GTK_RESPONSE_CANCEL: + break; + case GTK_RESPONSE_OK: + /* do the selected action */ + + if (data->remember) { + /* make sure we don't ask again */ + gsd_autorun_set_preferences (data->x_content_type, TRUE, data->selected_ignore, data->selected_open_folder); + if (!data->selected_ignore && !data->selected_open_folder && data->selected_app != NULL) { + g_app_info_set_as_default_for_type (data->selected_app, + data->x_content_type, + NULL); + } + } else { + /* make sure we do ask again */ + gsd_autorun_set_preferences (data->x_content_type, FALSE, FALSE, FALSE); + } + + if (!data->selected_ignore && !data->selected_open_folder && data->selected_app != NULL) { + gsd_autorun_launch_for_mount (data->mount, data->selected_app); + } else if (!data->selected_ignore && data->selected_open_folder) { + if (data->open_window_func != NULL) + data->open_window_func (data->mount, data->user_data); + } + break; + } + + autorun_dialog_destroy (data); +} + +static void +autorun_always_toggled (GtkToggleButton *togglebutton, AutorunDialogData *data) +{ + data->remember = gtk_toggle_button_get_active (togglebutton); +} + +static gboolean +combo_box_enter_ok (GtkWidget *togglebutton, GdkEventKey *event, GtkDialog *dialog) +{ + if (event->keyval == GDK_KEY_KP_Enter || event->keyval == GDK_KEY_Return) { + gtk_dialog_response (dialog, GTK_RESPONSE_OK); + return TRUE; + } + return FALSE; +} + +/* returns TRUE if a folder window should be opened */ +static gboolean +do_autorun_for_content_type (GMount *mount, + const char *x_content_type, + GsdAutorunOpenWindow open_window_func, + gpointer user_data) +{ + AutorunDialogData *data; + GtkWidget *dialog; + GtkWidget *hbox; + GtkWidget *vbox; + GtkWidget *label; + GtkWidget *combo_box; + GtkWidget *always_check_button; + GtkWidget *eject_button; + GtkWidget *image; + char *markup; + char *content_description; + char *mount_name; + GIcon *icon; + GdkPixbuf *pixbuf; + int icon_size; + gboolean user_forced_dialog; + gboolean pref_ask; + gboolean pref_start_app; + gboolean pref_ignore; + gboolean pref_open_folder; + char *media_greeting; + gboolean ret; + + ret = FALSE; + mount_name = NULL; + + if (g_content_type_is_a (x_content_type, "x-content/win32-software")) { + /* don't pop up the dialog anyway if the content type says + * windows software. + */ + goto out; + } + + user_forced_dialog = is_shift_pressed (); + + gsd_autorun_get_preferences (x_content_type, &pref_start_app, &pref_ignore, &pref_open_folder); + pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder; + + if (user_forced_dialog) { + goto show_dialog; + } + + if (!pref_ask && !pref_ignore && !pref_open_folder) { + GAppInfo *app_info; + app_info = g_app_info_get_default_for_type (x_content_type, FALSE); + if (app_info != NULL) { + gsd_autorun_launch_for_mount (mount, app_info); + } + goto out; + } + + if (pref_open_folder) { + ret = TRUE; + goto out; + } + + if (pref_ignore) { + goto out; + } + +show_dialog: + + mount_name = g_mount_get_name (mount); + + dialog = gtk_dialog_new (); + + hbox = gtk_hbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 12); + + icon = g_mount_get_icon (mount); + icon_size = get_icon_size_for_stock_size (GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); + pixbuf = render_icon (icon, icon_size); + gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); + gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 0); + /* also use the icon on the dialog */ + gtk_window_set_title (GTK_WINDOW (dialog), mount_name); + gtk_window_set_icon (GTK_WINDOW (dialog), pixbuf); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); + g_object_unref (icon); + if (pixbuf) { + g_object_unref (pixbuf); + } + vbox = gtk_vbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); + + label = gtk_label_new (NULL); + + + /* Customize greeting for well-known x-content types */ + if (strcmp (x_content_type, "x-content/audio-cdda") == 0) { + media_greeting = _("You have just inserted an Audio CD."); + } else if (strcmp (x_content_type, "x-content/audio-dvd") == 0) { + media_greeting = _("You have just inserted an Audio DVD."); + } else if (strcmp (x_content_type, "x-content/video-dvd") == 0) { + media_greeting = _("You have just inserted a Video DVD."); + } else if (strcmp (x_content_type, "x-content/video-vcd") == 0) { + media_greeting = _("You have just inserted a Video CD."); + } else if (strcmp (x_content_type, "x-content/video-svcd") == 0) { + media_greeting = _("You have just inserted a Super Video CD."); + } else if (strcmp (x_content_type, "x-content/blank-cd") == 0) { + media_greeting = _("You have just inserted a blank CD."); + } else if (strcmp (x_content_type, "x-content/blank-dvd") == 0) { + media_greeting = _("You have just inserted a blank DVD."); + } else if (strcmp (x_content_type, "x-content/blank-cd") == 0) { + media_greeting = _("You have just inserted a blank Blu-Ray disc."); + } else if (strcmp (x_content_type, "x-content/blank-cd") == 0) { + media_greeting = _("You have just inserted a blank HD DVD."); + } else if (strcmp (x_content_type, "x-content/image-photocd") == 0) { + media_greeting = _("You have just inserted a Photo CD."); + } else if (strcmp (x_content_type, "x-content/image-picturecd") == 0) { + media_greeting = _("You have just inserted a Picture CD."); + } else if (strcmp (x_content_type, "x-content/image-dcf") == 0) { + media_greeting = _("You have just inserted a medium with digital photos."); + } else if (strcmp (x_content_type, "x-content/audio-player") == 0) { + media_greeting = _("You have just inserted a digital audio player."); + } else if (g_content_type_is_a (x_content_type, "x-content/software")) { + media_greeting = _("You have just inserted a medium with software intended to be automatically started."); + } else { + /* fallback to generic greeting */ + media_greeting = _("You have just inserted a medium."); + } + markup = g_strdup_printf ("%s %s", media_greeting, _("Choose what application to launch.")); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free (markup); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); + + label = gtk_label_new (NULL); + content_description = g_content_type_get_description (x_content_type); + markup = g_strdup_printf (_("Select how to open \"%s\" and whether to perform this action in the future for other media of type \"%s\"."), mount_name, content_description); + g_free (content_description); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free (markup); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); + + data = g_new0 (AutorunDialogData, 1); + data->dialog = dialog; + data->mount = g_object_ref (mount); + data->remember = !pref_ask; + data->selected_ignore = pref_ignore; + data->x_content_type = g_strdup (x_content_type); + data->selected_app = g_app_info_get_default_for_type (x_content_type, FALSE); + data->open_window_func = open_window_func; + data->user_data = user_data; + + combo_box = gtk_app_chooser_button_new (x_content_type); + prepare_combo_box (combo_box, data); + g_signal_connect (G_OBJECT (combo_box), + "key-press-event", + G_CALLBACK (combo_box_enter_ok), + dialog); + + gtk_box_pack_start (GTK_BOX (vbox), combo_box, TRUE, TRUE, 0); + + always_check_button = gtk_check_button_new_with_mnemonic (_("_Always perform this action")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (always_check_button), data->remember); + g_signal_connect (G_OBJECT (always_check_button), + "toggled", + G_CALLBACK (autorun_always_toggled), + data); + gtk_box_pack_start (GTK_BOX (vbox), always_check_button, TRUE, TRUE, 0); + + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + + if (g_mount_can_eject (mount)) { + GtkWidget *eject_image; + eject_button = gtk_button_new_with_mnemonic (_("_Eject")); + eject_image = gtk_image_new_from_icon_name ("media-eject", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image (GTK_BUTTON (eject_button), eject_image); + data->should_eject = TRUE; + } else { + eject_button = gtk_button_new_with_mnemonic (_("_Unmount")); + data->should_eject = FALSE; + } + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), eject_button, AUTORUN_DIALOG_RESPONSE_EJECT); + gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), eject_button, TRUE); + + /* show the dialog */ + gtk_widget_show_all (dialog); + + g_signal_connect (G_OBJECT (dialog), + "response", + G_CALLBACK (autorun_dialog_response), + data); + + g_signal_connect (G_OBJECT (data->mount), + "unmounted", + G_CALLBACK (autorun_dialog_mount_unmounted), + data); + +out: + g_free (mount_name); + return ret; +} + +typedef struct { + GMount *mount; + GsdAutorunOpenWindow open_window_func; + gpointer user_data; + GSettings *settings; +} AutorunData; + +static void +autorun_guessed_content_type_callback (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error; + char **guessed_content_type; + AutorunData *data = user_data; + gboolean open_folder; + + open_folder = FALSE; + + error = NULL; + guessed_content_type = g_mount_guess_content_type_finish (G_MOUNT (source_object), res, &error); + g_object_set_data_full (source_object, + "gsd-content-type-cache", + g_strdupv (guessed_content_type), + (GDestroyNotify)g_strfreev); + if (error != NULL) { + g_warning ("Unable to guess content type for mount: %s", error->message); + g_error_free (error); + } else { + if (guessed_content_type != NULL && g_strv_length (guessed_content_type) > 0) { + int n; + for (n = 0; guessed_content_type[n] != NULL; n++) { + if (do_autorun_for_content_type (data->mount, guessed_content_type[n], + data->open_window_func, data->user_data)) { + open_folder = TRUE; + } + } + g_strfreev (guessed_content_type); + } else { + if (g_settings_get_boolean (data->settings, "automount-open")) { + open_folder = TRUE; + } + } + } + + /* only open the folder once.. */ + if (open_folder && data->open_window_func != NULL) { + data->open_window_func (data->mount, data->user_data); + } + + g_object_unref (data->mount); + g_object_unref (data->settings); + g_free (data); +} + +void +gsd_autorun (GMount *mount, + GSettings *settings, + GsdAutorunOpenWindow open_window_func, + gpointer user_data) +{ + AutorunData *data; + + if (!should_autorun_mount (mount) || + g_settings_get_boolean (settings, "autorun-never")) { + return; + } + + data = g_new0 (AutorunData, 1); + data->mount = g_object_ref (mount); + data->open_window_func = open_window_func; + data->user_data = user_data; + data->settings = g_object_ref (settings); + + g_mount_guess_content_type (mount, + FALSE, + NULL, + autorun_guessed_content_type_callback, + data); +} + +static gboolean +remove_allow_volume (gpointer data) +{ + GVolume *volume = data; + + g_object_set_data (G_OBJECT (volume), "gsd-allow-autorun", NULL); + return FALSE; +} + +void +gsd_allow_autorun_for_volume (GVolume *volume) +{ + g_object_set_data (G_OBJECT (volume), "gsd-allow-autorun", GINT_TO_POINTER (1)); +} + +#define INHIBIT_AUTORUN_SECONDS 10 + +void +gsd_allow_autorun_for_volume_finish (GVolume *volume) +{ + if (g_object_get_data (G_OBJECT (volume), "gsd-allow-autorun") != NULL) { + g_timeout_add_seconds_full (0, + INHIBIT_AUTORUN_SECONDS, + remove_allow_volume, + g_object_ref (volume), + g_object_unref); + } +} + +static gboolean +should_skip_native_mount_root (GFile *root) +{ + char *path; + gboolean should_skip; + + /* skip any mounts in hidden directory hierarchies */ + path = g_file_get_path (root); + should_skip = strstr (path, "/.") != NULL; + g_free (path); + + return should_skip; +} + +static gboolean +should_autorun_mount (GMount *mount) +{ + GFile *root; + GVolume *enclosing_volume; + gboolean ignore_autorun; + + ignore_autorun = TRUE; + enclosing_volume = g_mount_get_volume (mount); + if (enclosing_volume != NULL) { + if (g_object_get_data (G_OBJECT (enclosing_volume), "gsd-allow-autorun") != NULL) { + ignore_autorun = FALSE; + g_object_set_data (G_OBJECT (enclosing_volume), "gsd-allow-autorun", NULL); + } + } + + if (ignore_autorun) { + if (enclosing_volume != NULL) { + g_object_unref (enclosing_volume); + } + return FALSE; + } + + root = g_mount_get_root (mount); + + /* only do autorun on local files or files where g_volume_should_automount() returns TRUE */ + ignore_autorun = TRUE; + if ((g_file_is_native (root) && !should_skip_native_mount_root (root)) || + (enclosing_volume != NULL && g_volume_should_automount (enclosing_volume))) { + ignore_autorun = FALSE; + } + if (enclosing_volume != NULL) { + g_object_unref (enclosing_volume); + } + g_object_unref (root); + + return !ignore_autorun; +} diff --git a/plugins/automount/gsd-autorun.h b/plugins/automount/gsd-autorun.h new file mode 100644 index 00000000..d210bf4e --- /dev/null +++ b/plugins/automount/gsd-autorun.h @@ -0,0 +1,53 @@ +/* + * gsd-automount.h:helpers for automounting hotplugged volumes + * + * Copyright (C) 2008 Red Hat, Inc. + * + * Nautilus 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 + * + * Authors: David Zeuthen + * Cosimo Cecchi + */ + +/* TODO: + * + * - unmount all the media we've automounted on shutdown + * - finish x-content / * types + * - finalize the semi-spec + * - add probing/sniffing code + * - implement missing features + * - "Open Folder when mounted" + * - Autorun spec (e.g. $ROOT/.autostart) + * + */ + +#ifndef __GSD_AUTORUN_H__ +#define __GSD_AUTORUN_H__ + +#include +#include + +typedef void (*GsdAutorunOpenWindow) (GMount *mount, + gpointer user_data); + +void gsd_autorun (GMount *mount, + GSettings *settings, + GsdAutorunOpenWindow open_window_func, + gpointer user_data); + +void gsd_allow_autorun_for_volume (GVolume *volume); +void gsd_allow_autorun_for_volume_finish (GVolume *volume); + +#endif /* __GSD_AUTORUN_H__ */ diff --git a/plugins/background/Makefile.am b/plugins/background/Makefile.am new file mode 100644 index 00000000..6ad75aae --- /dev/null +++ b/plugins/background/Makefile.am @@ -0,0 +1,80 @@ +NULL = + +plugin_name = background + +libexec_PROGRAMS = gsd-test-background + +gsd_test_background_SOURCES = \ + test-background.c \ + gsd-background-manager.h \ + gsd-background-manager.c \ + $(NULL) + +gsd_test_background_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gsd_test_background_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(BACKGROUND_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_background_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(BACKGROUND_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + libbackground.la \ + $(NULL) + +libbackground_la_SOURCES = \ + gsd-background-plugin.h \ + gsd-background-plugin.c \ + gsd-background-manager.h \ + gsd-background-manager.c \ + $(NULL) + +libbackground_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/background/libbackground \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libbackground_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(BACKGROUND_CFLAGS) \ + $(AM_CFLAGS) + +libbackground_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libbackground_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(BACKGROUND_LIBS) \ + $(NULL) + +plugin_in_files = \ + background.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/background/Makefile.in b/plugins/background/Makefile.in new file mode 100644 index 00000000..f5fef0ce --- /dev/null +++ b/plugins/background/Makefile.in @@ -0,0 +1,918 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-background$(EXEEXT) +subdir = plugins/background +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libbackground_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_libbackground_la_OBJECTS = \ + libbackground_la-gsd-background-plugin.lo \ + libbackground_la-gsd-background-manager.lo $(am__objects_1) +libbackground_la_OBJECTS = $(am_libbackground_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libbackground_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libbackground_la_CFLAGS) $(CFLAGS) \ + $(libbackground_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_test_background_OBJECTS = \ + gsd_test_background-test-background.$(OBJEXT) \ + gsd_test_background-gsd-background-manager.$(OBJEXT) \ + $(am__objects_1) +gsd_test_background_OBJECTS = $(am_gsd_test_background_OBJECTS) +gsd_test_background_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_test_background_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_background_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libbackground_la_SOURCES) $(gsd_test_background_SOURCES) +DIST_SOURCES = $(libbackground_la_SOURCES) \ + $(gsd_test_background_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +plugin_name = background +gsd_test_background_SOURCES = \ + test-background.c \ + gsd-background-manager.h \ + gsd-background-manager.c \ + $(NULL) + +gsd_test_background_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gsd_test_background_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(BACKGROUND_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_background_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(BACKGROUND_LIBS) \ + $(NULL) + +plugin_LTLIBRARIES = \ + libbackground.la \ + $(NULL) + +libbackground_la_SOURCES = \ + gsd-background-plugin.h \ + gsd-background-plugin.c \ + gsd-background-manager.h \ + gsd-background-manager.c \ + $(NULL) + +libbackground_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/background/libbackground \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libbackground_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(BACKGROUND_CFLAGS) \ + $(AM_CFLAGS) + +libbackground_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libbackground_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(BACKGROUND_LIBS) \ + $(NULL) + +plugin_in_files = \ + background.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/background/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/background/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libbackground.la: $(libbackground_la_OBJECTS) $(libbackground_la_DEPENDENCIES) $(EXTRA_libbackground_la_DEPENDENCIES) + $(AM_V_CCLD)$(libbackground_la_LINK) -rpath $(plugindir) $(libbackground_la_OBJECTS) $(libbackground_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-background$(EXEEXT): $(gsd_test_background_OBJECTS) $(gsd_test_background_DEPENDENCIES) $(EXTRA_gsd_test_background_DEPENDENCIES) + @rm -f gsd-test-background$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_background_LINK) $(gsd_test_background_OBJECTS) $(gsd_test_background_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_background-gsd-background-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_background-test-background.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbackground_la-gsd-background-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbackground_la-gsd-background-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libbackground_la-gsd-background-plugin.lo: gsd-background-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbackground_la_CPPFLAGS) $(CPPFLAGS) $(libbackground_la_CFLAGS) $(CFLAGS) -MT libbackground_la-gsd-background-plugin.lo -MD -MP -MF $(DEPDIR)/libbackground_la-gsd-background-plugin.Tpo -c -o libbackground_la-gsd-background-plugin.lo `test -f 'gsd-background-plugin.c' || echo '$(srcdir)/'`gsd-background-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbackground_la-gsd-background-plugin.Tpo $(DEPDIR)/libbackground_la-gsd-background-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-background-plugin.c' object='libbackground_la-gsd-background-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbackground_la_CPPFLAGS) $(CPPFLAGS) $(libbackground_la_CFLAGS) $(CFLAGS) -c -o libbackground_la-gsd-background-plugin.lo `test -f 'gsd-background-plugin.c' || echo '$(srcdir)/'`gsd-background-plugin.c + +libbackground_la-gsd-background-manager.lo: gsd-background-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbackground_la_CPPFLAGS) $(CPPFLAGS) $(libbackground_la_CFLAGS) $(CFLAGS) -MT libbackground_la-gsd-background-manager.lo -MD -MP -MF $(DEPDIR)/libbackground_la-gsd-background-manager.Tpo -c -o libbackground_la-gsd-background-manager.lo `test -f 'gsd-background-manager.c' || echo '$(srcdir)/'`gsd-background-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbackground_la-gsd-background-manager.Tpo $(DEPDIR)/libbackground_la-gsd-background-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-background-manager.c' object='libbackground_la-gsd-background-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbackground_la_CPPFLAGS) $(CPPFLAGS) $(libbackground_la_CFLAGS) $(CFLAGS) -c -o libbackground_la-gsd-background-manager.lo `test -f 'gsd-background-manager.c' || echo '$(srcdir)/'`gsd-background-manager.c + +gsd_test_background-test-background.o: test-background.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -MT gsd_test_background-test-background.o -MD -MP -MF $(DEPDIR)/gsd_test_background-test-background.Tpo -c -o gsd_test_background-test-background.o `test -f 'test-background.c' || echo '$(srcdir)/'`test-background.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_background-test-background.Tpo $(DEPDIR)/gsd_test_background-test-background.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-background.c' object='gsd_test_background-test-background.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -c -o gsd_test_background-test-background.o `test -f 'test-background.c' || echo '$(srcdir)/'`test-background.c + +gsd_test_background-test-background.obj: test-background.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -MT gsd_test_background-test-background.obj -MD -MP -MF $(DEPDIR)/gsd_test_background-test-background.Tpo -c -o gsd_test_background-test-background.obj `if test -f 'test-background.c'; then $(CYGPATH_W) 'test-background.c'; else $(CYGPATH_W) '$(srcdir)/test-background.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_background-test-background.Tpo $(DEPDIR)/gsd_test_background-test-background.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-background.c' object='gsd_test_background-test-background.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -c -o gsd_test_background-test-background.obj `if test -f 'test-background.c'; then $(CYGPATH_W) 'test-background.c'; else $(CYGPATH_W) '$(srcdir)/test-background.c'; fi` + +gsd_test_background-gsd-background-manager.o: gsd-background-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -MT gsd_test_background-gsd-background-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_background-gsd-background-manager.Tpo -c -o gsd_test_background-gsd-background-manager.o `test -f 'gsd-background-manager.c' || echo '$(srcdir)/'`gsd-background-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_background-gsd-background-manager.Tpo $(DEPDIR)/gsd_test_background-gsd-background-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-background-manager.c' object='gsd_test_background-gsd-background-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -c -o gsd_test_background-gsd-background-manager.o `test -f 'gsd-background-manager.c' || echo '$(srcdir)/'`gsd-background-manager.c + +gsd_test_background-gsd-background-manager.obj: gsd-background-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -MT gsd_test_background-gsd-background-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_background-gsd-background-manager.Tpo -c -o gsd_test_background-gsd-background-manager.obj `if test -f 'gsd-background-manager.c'; then $(CYGPATH_W) 'gsd-background-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-background-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_background-gsd-background-manager.Tpo $(DEPDIR)/gsd_test_background-gsd-background-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-background-manager.c' object='gsd_test_background-gsd-background-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_background_CPPFLAGS) $(CPPFLAGS) $(gsd_test_background_CFLAGS) $(CFLAGS) -c -o gsd_test_background-gsd-background-manager.obj `if test -f 'gsd-background-manager.c'; then $(CYGPATH_W) 'gsd-background-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-background-manager.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/background/background.gnome-settings-plugin.in b/plugins/background/background.gnome-settings-plugin.in new file mode 100644 index 00000000..180694cd --- /dev/null +++ b/plugins/background/background.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=background +IAge=0 +_Name=Background +_Description=Background plugin +Authors= +Copyright=Copyright © 2007 +Website= diff --git a/plugins/background/gsd-background-manager.c b/plugins/background/gsd-background-manager.c new file mode 100644 index 00000000..576e58ef --- /dev/null +++ b/plugins/background/gsd-background-manager.c @@ -0,0 +1,630 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann + * Copyright 2007 Red Hat, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-background-manager.h" + +#define GSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerPrivate)) + +struct GsdBackgroundManagerPrivate +{ + GSettings *settings; + GnomeBG *bg; + + GnomeBGCrossfade *fade; + + GDBusProxy *proxy; + guint proxy_signal_id; +}; + +static void gsd_background_manager_class_init (GsdBackgroundManagerClass *klass); +static void gsd_background_manager_init (GsdBackgroundManager *background_manager); +static void gsd_background_manager_finalize (GObject *object); + +static void setup_bg (GsdBackgroundManager *manager); +static void connect_screen_signals (GsdBackgroundManager *manager); + +G_DEFINE_TYPE (GsdBackgroundManager, gsd_background_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static gboolean +dont_draw_background (GsdBackgroundManager *manager) +{ + return !g_settings_get_boolean (manager->priv->settings, + "draw-background"); +} + +static gboolean +nautilus_is_drawing_background (GsdBackgroundManager *manager) +{ + Atom window_id_atom; + Window nautilus_xid; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char *data; + Atom wmclass_atom; + gboolean running; + gint error; + gboolean show_desktop_icons; + + show_desktop_icons = g_settings_get_boolean (manager->priv->settings, + "show-desktop-icons"); + if (! show_desktop_icons) { + return FALSE; + } + + window_id_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "NAUTILUS_DESKTOP_WINDOW_ID", True); + + if (window_id_atom == None) { + return FALSE; + } + + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + GDK_ROOT_WINDOW (), + window_id_atom, + 0, + 1, + False, + XA_WINDOW, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data); + + if (data != NULL) { + nautilus_xid = *(Window *) data; + XFree (data); + } else { + return FALSE; + } + + if (actual_type != XA_WINDOW) { + return FALSE; + } + if (actual_format != 32) { + return FALSE; + } + + wmclass_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "WM_CLASS", False); + + gdk_error_trap_push (); + + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + nautilus_xid, + wmclass_atom, + 0, + 24, + False, + XA_STRING, + &actual_type, + &actual_format, + &nitems, + &bytes_after, + &data); + + error = gdk_error_trap_pop (); + + if (error == BadWindow) { + return FALSE; + } + + if (actual_type == XA_STRING && + nitems == 24 && + bytes_after == 0 && + actual_format == 8 && + data != NULL && + !strcmp ((char *)data, "desktop_window") && + !strcmp ((char *)data + strlen ((char *)data) + 1, "Nautilus")) { + running = TRUE; + } else { + running = FALSE; + } + + if (data != NULL) { + XFree (data); + } + + return running; +} + +static void +on_crossfade_finished (GsdBackgroundManager *manager) +{ + g_object_unref (manager->priv->fade); + manager->priv->fade = NULL; +} + +static void +draw_background (GsdBackgroundManager *manager, + gboolean use_crossfade) +{ + GdkDisplay *display; + int n_screens; + int i; + + + if (nautilus_is_drawing_background (manager) || + dont_draw_background (manager)) { + return; + } + + gnome_settings_profile_start (NULL); + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (i = 0; i < n_screens; ++i) { + GdkScreen *screen; + GdkWindow *root_window; + cairo_surface_t *surface; + + screen = gdk_display_get_screen (display, i); + + root_window = gdk_screen_get_root_window (screen); + + surface = gnome_bg_create_surface (manager->priv->bg, + root_window, + gdk_screen_get_width (screen), + gdk_screen_get_height (screen), + TRUE); + + if (use_crossfade) { + + if (manager->priv->fade != NULL) { + g_object_unref (manager->priv->fade); + } + + manager->priv->fade = gnome_bg_set_surface_as_root_with_crossfade (screen, surface); + g_signal_connect_swapped (manager->priv->fade, "finished", + G_CALLBACK (on_crossfade_finished), + manager); + } else { + gnome_bg_set_surface_as_root (screen, surface); + } + + cairo_surface_destroy (surface); + } + + gnome_settings_profile_end (NULL); +} + +static void +on_bg_transitioned (GnomeBG *bg, + GsdBackgroundManager *manager) +{ + draw_background (manager, FALSE); +} + +static gboolean +settings_change_event_cb (GSettings *settings, + gpointer keys, + gint n_keys, + GsdBackgroundManager *manager) +{ + gnome_bg_load_from_preferences (manager->priv->bg, + manager->priv->settings); + return FALSE; +} + +static void +on_screen_size_changed (GdkScreen *screen, + GsdBackgroundManager *manager) +{ + draw_background (manager, FALSE); +} + +static void +watch_bg_preferences (GsdBackgroundManager *manager) +{ + g_signal_connect (manager->priv->settings, + "change-event", + G_CALLBACK (settings_change_event_cb), + manager); +} + +static void +on_bg_changed (GnomeBG *bg, + GsdBackgroundManager *manager) +{ + draw_background (manager, TRUE); +} + +static void +setup_bg (GsdBackgroundManager *manager) +{ + g_return_if_fail (manager->priv->bg == NULL); + + manager->priv->bg = gnome_bg_new (); + + g_signal_connect (manager->priv->bg, + "changed", + G_CALLBACK (on_bg_changed), + manager); + + g_signal_connect (manager->priv->bg, + "transitioned", + G_CALLBACK (on_bg_transitioned), + manager); + + connect_screen_signals (manager); + watch_bg_preferences (manager); + gnome_bg_load_from_preferences (manager->priv->bg, + manager->priv->settings); +} + +static void +setup_bg_and_draw_background (GsdBackgroundManager *manager) +{ + setup_bg (manager); + draw_background (manager, FALSE); +} + +static void +disconnect_session_manager_listener (GsdBackgroundManager *manager) +{ + if (manager->priv->proxy && manager->priv->proxy_signal_id) { + g_signal_handler_disconnect (manager->priv->proxy, + manager->priv->proxy_signal_id); + manager->priv->proxy_signal_id = 0; + } +} + +static void +on_session_manager_signal (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdBackgroundManager *manager = GSD_BACKGROUND_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "SessionRunning") == 0) { + setup_bg_and_draw_background (manager); + disconnect_session_manager_listener (manager); + } +} + +static void +draw_background_after_session_loads (GsdBackgroundManager *manager) +{ + GError *error = NULL; + GDBusProxyFlags flags; + + flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; + manager->priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + flags, + NULL, /* GDBusInterfaceInfo */ + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager", + NULL, /* GCancellable */ + &error); + if (manager->priv->proxy == NULL) { + g_warning ("Could not listen to session manager: %s", + error->message); + g_error_free (error); + return; + } + + manager->priv->proxy_signal_id = g_signal_connect (manager->priv->proxy, + "g-signal", + G_CALLBACK (on_session_manager_signal), + manager); +} + + +static void +disconnect_screen_signals (GsdBackgroundManager *manager) +{ + GdkDisplay *display; + int i; + int n_screens; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (i = 0; i < n_screens; ++i) { + GdkScreen *screen; + screen = gdk_display_get_screen (display, i); + g_signal_handlers_disconnect_by_func (screen, + G_CALLBACK (on_screen_size_changed), + manager); + } +} + +static void +connect_screen_signals (GsdBackgroundManager *manager) +{ + GdkDisplay *display; + int i; + int n_screens; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (i = 0; i < n_screens; ++i) { + GdkScreen *screen; + screen = gdk_display_get_screen (display, i); + g_signal_connect (screen, + "monitors-changed", + G_CALLBACK (on_screen_size_changed), + manager); + g_signal_connect (screen, + "size-changed", + G_CALLBACK (on_screen_size_changed), + manager); + } +} + +static void +draw_background_changed (GSettings *settings, + const char *key, + GsdBackgroundManager *manager) +{ + if (dont_draw_background (manager) == FALSE) + setup_bg_and_draw_background (manager); +} + +static void +set_accountsservice_background (const gchar *background) +{ + GDBusProxy *proxy = NULL; + GDBusProxy *user = NULL; + GVariant *variant = NULL; + GError *error = NULL; + gchar *object_path = NULL; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.Accounts", + "/org/freedesktop/Accounts", + "org.freedesktop.Accounts", + NULL, + &error); + + if (proxy == NULL) { + g_warning ("Failed to contact accounts service: %s", error->message); + g_error_free (error); + return; + } + + variant = g_dbus_proxy_call_sync (proxy, + "FindUserByName", + g_variant_new ("(s)", g_get_user_name ()), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (variant == NULL) { + g_warning ("Could not contact accounts service to look up '%s': %s", + g_get_user_name (), error->message); + g_error_free (error); + goto bail; + } + + g_variant_get (variant, "(o)", &object_path); + user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.Accounts", + object_path, + "org.freedesktop.Accounts.User", + NULL, + &error); + g_free (object_path); + + if (user == NULL) { + g_warning ("Could not create proxy for user '%s': %s", + g_variant_get_string (variant, NULL), error->message); + g_error_free (error); + goto bail; + } + g_variant_unref (variant); + + variant = g_dbus_proxy_call_sync (user, + "SetBackgroundFile", + g_variant_new ("(s)", background ? background : ""), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (variant == NULL) { + g_warning ("Failed to set the background '%s': %s", background, error->message); + g_error_free (error); + goto bail; + } + +bail: + if (proxy != NULL) + g_object_unref (proxy); + if (variant != NULL) + g_variant_unref (variant); +} + +static void +picture_uri_changed (GSettings *settings, + const char *key, + GsdBackgroundManager *manager) +{ + const char *picture_uri = g_settings_get_string (settings, key); + GFile *picture_file = g_file_new_for_uri (picture_uri); + char *picture_path = g_file_get_path (picture_file); + set_accountsservice_background (picture_path); + g_free (picture_path); + g_object_unref (picture_file); +} + +gboolean +gsd_background_manager_start (GsdBackgroundManager *manager, + GError **error) +{ + gboolean show_desktop_icons; + + g_debug ("Starting background manager"); + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new ("org.gnome.desktop.background"); + g_signal_connect (manager->priv->settings, "changed::draw-background", + G_CALLBACK (draw_background_changed), manager); + g_signal_connect (manager->priv->settings, "changed::picture-uri", + G_CALLBACK (picture_uri_changed), manager); + + /* If this is set, nautilus will draw the background and is + * almost definitely in our session. however, it may not be + * running yet (so is_nautilus_running() will fail). so, on + * startup, just don't do anything if this key is set so we + * don't waste time setting the background only to have + * nautilus overwrite it. + */ + show_desktop_icons = g_settings_get_boolean (manager->priv->settings, + "show-desktop-icons"); + + if (!show_desktop_icons) { + setup_bg (manager); + } else { + draw_background_after_session_loads (manager); + } + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_background_manager_stop (GsdBackgroundManager *manager) +{ + GsdBackgroundManagerPrivate *p = manager->priv; + + g_debug ("Stopping background manager"); + + disconnect_screen_signals (manager); + + if (manager->priv->proxy) { + disconnect_session_manager_listener (manager); + g_object_unref (manager->priv->proxy); + } + + g_signal_handlers_disconnect_by_func (manager->priv->settings, + settings_change_event_cb, + manager); + + if (p->settings != NULL) { + g_object_unref (p->settings); + p->settings = NULL; + } + + if (p->bg != NULL) { + g_object_unref (p->bg); + p->bg = NULL; + } +} + +static GObject * +gsd_background_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdBackgroundManager *background_manager; + + background_manager = GSD_BACKGROUND_MANAGER (G_OBJECT_CLASS (gsd_background_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (background_manager); +} + +static void +gsd_background_manager_class_init (GsdBackgroundManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_background_manager_constructor; + object_class->finalize = gsd_background_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdBackgroundManagerPrivate)); +} + +static void +gsd_background_manager_init (GsdBackgroundManager *manager) +{ + manager->priv = GSD_BACKGROUND_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_background_manager_finalize (GObject *object) +{ + GsdBackgroundManager *background_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_BACKGROUND_MANAGER (object)); + + background_manager = GSD_BACKGROUND_MANAGER (object); + + g_return_if_fail (background_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_background_manager_parent_class)->finalize (object); +} + +GsdBackgroundManager * +gsd_background_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_BACKGROUND_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_BACKGROUND_MANAGER (manager_object); +} diff --git a/plugins/background/gsd-background-manager.h b/plugins/background/gsd-background-manager.h new file mode 100644 index 00000000..97efa8c2 --- /dev/null +++ b/plugins/background/gsd-background-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_BACKGROUND_MANAGER_H +#define __GSD_BACKGROUND_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_BACKGROUND_MANAGER (gsd_background_manager_get_type ()) +#define GSD_BACKGROUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManager)) +#define GSD_BACKGROUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerClass)) +#define GSD_IS_BACKGROUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_BACKGROUND_MANAGER)) +#define GSD_IS_BACKGROUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_BACKGROUND_MANAGER)) +#define GSD_BACKGROUND_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerClass)) + +typedef struct GsdBackgroundManagerPrivate GsdBackgroundManagerPrivate; + +typedef struct +{ + GObject parent; + GsdBackgroundManagerPrivate *priv; +} GsdBackgroundManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdBackgroundManagerClass; + +GType gsd_background_manager_get_type (void); + +GsdBackgroundManager * gsd_background_manager_new (void); +gboolean gsd_background_manager_start (GsdBackgroundManager *manager, + GError **error); +void gsd_background_manager_stop (GsdBackgroundManager *manager); + +G_END_DECLS + +#endif /* __GSD_BACKGROUND_MANAGER_H */ diff --git a/plugins/background/gsd-background-plugin.c b/plugins/background/gsd-background-plugin.c new file mode 100644 index 00000000..46e98bef --- /dev/null +++ b/plugins/background/gsd-background-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-background-plugin.h" +#include "gsd-background-manager.h" + +struct GsdBackgroundPluginPrivate { + GsdBackgroundManager *manager; +}; + +#define GSD_BACKGROUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_BACKGROUND_PLUGIN, GsdBackgroundPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdBackgroundPlugin, gsd_background_plugin) + +static void +gsd_background_plugin_init (GsdBackgroundPlugin *plugin) +{ + plugin->priv = GSD_BACKGROUND_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdBackgroundPlugin initializing"); + + plugin->priv->manager = gsd_background_manager_new (); +} + +static void +gsd_background_plugin_finalize (GObject *object) +{ + GsdBackgroundPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_BACKGROUND_PLUGIN (object)); + + g_debug ("GsdBackgroundPlugin finalizing"); + + plugin = GSD_BACKGROUND_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_background_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating background plugin"); + + error = NULL; + res = gsd_background_manager_start (GSD_BACKGROUND_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start background manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating background plugin"); + gsd_background_manager_stop (GSD_BACKGROUND_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_background_plugin_class_init (GsdBackgroundPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_background_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdBackgroundPluginPrivate)); +} diff --git a/plugins/background/gsd-background-plugin.h b/plugins/background/gsd-background-plugin.h new file mode 100644 index 00000000..6833433a --- /dev/null +++ b/plugins/background/gsd-background-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_BACKGROUND_PLUGIN_H__ +#define __GSD_BACKGROUND_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_BACKGROUND_PLUGIN (gsd_background_plugin_get_type ()) +#define GSD_BACKGROUND_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_BACKGROUND_PLUGIN, GsdBackgroundPlugin)) +#define GSD_BACKGROUND_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_BACKGROUND_PLUGIN, GsdBackgroundPluginClass)) +#define GSD_IS_BACKGROUND_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_BACKGROUND_PLUGIN)) +#define GSD_IS_BACKGROUND_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_BACKGROUND_PLUGIN)) +#define GSD_BACKGROUND_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_BACKGROUND_PLUGIN, GsdBackgroundPluginClass)) + +typedef struct GsdBackgroundPluginPrivate GsdBackgroundPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdBackgroundPluginPrivate *priv; +} GsdBackgroundPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdBackgroundPluginClass; + +GType gsd_background_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_BACKGROUND_PLUGIN_H__ */ diff --git a/plugins/background/test-background.c b/plugins/background/test-background.c new file mode 100644 index 00000000..c0da08b5 --- /dev/null +++ b/plugins/background/test-background.c @@ -0,0 +1,7 @@ +#define NEW gsd_background_manager_new +#define START gsd_background_manager_start +#define STOP gsd_background_manager_stop +#define MANAGER GsdBackgroundManager +#include "gsd-background-manager.h" + +#include "test-plugin.h" diff --git a/plugins/clipboard/Makefile.am b/plugins/clipboard/Makefile.am new file mode 100644 index 00000000..5f8cfde9 --- /dev/null +++ b/plugins/clipboard/Makefile.am @@ -0,0 +1,56 @@ +NULL = + +plugin_name = clipboard + +plugin_LTLIBRARIES = \ + libclipboard.la \ + $(NULL) + +libclipboard_la_SOURCES = \ + gsd-clipboard-plugin.h \ + gsd-clipboard-plugin.c \ + gsd-clipboard-manager.h \ + gsd-clipboard-manager.c \ + xutils.h \ + xutils.c \ + list.h \ + list.c \ + $(NULL) + +libclipboard_la_CPPFLAGS = \ + $(PLUGIN_CFLAGS) \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libclipboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libclipboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libclipboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_in_files = \ + clipboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/clipboard/Makefile.in b/plugins/clipboard/Makefile.in new file mode 100644 index 00000000..7059a642 --- /dev/null +++ b/plugins/clipboard/Makefile.in @@ -0,0 +1,813 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/clipboard +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libclipboard_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_libclipboard_la_OBJECTS = libclipboard_la-gsd-clipboard-plugin.lo \ + libclipboard_la-gsd-clipboard-manager.lo \ + libclipboard_la-xutils.lo libclipboard_la-list.lo \ + $(am__objects_1) +libclipboard_la_OBJECTS = $(am_libclipboard_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libclipboard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libclipboard_la_CFLAGS) $(CFLAGS) $(libclipboard_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libclipboard_la_SOURCES) +DIST_SOURCES = $(libclipboard_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +plugin_name = clipboard +plugin_LTLIBRARIES = \ + libclipboard.la \ + $(NULL) + +libclipboard_la_SOURCES = \ + gsd-clipboard-plugin.h \ + gsd-clipboard-plugin.c \ + gsd-clipboard-manager.h \ + gsd-clipboard-manager.c \ + xutils.h \ + xutils.c \ + list.h \ + list.c \ + $(NULL) + +libclipboard_la_CPPFLAGS = \ + $(PLUGIN_CFLAGS) \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libclipboard_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libclipboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libclipboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_in_files = \ + clipboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/clipboard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/clipboard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libclipboard.la: $(libclipboard_la_OBJECTS) $(libclipboard_la_DEPENDENCIES) $(EXTRA_libclipboard_la_DEPENDENCIES) + $(AM_V_CCLD)$(libclipboard_la_LINK) -rpath $(plugindir) $(libclipboard_la_OBJECTS) $(libclipboard_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclipboard_la-gsd-clipboard-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclipboard_la-gsd-clipboard-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclipboard_la-list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclipboard_la-xutils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libclipboard_la-gsd-clipboard-plugin.lo: gsd-clipboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -MT libclipboard_la-gsd-clipboard-plugin.lo -MD -MP -MF $(DEPDIR)/libclipboard_la-gsd-clipboard-plugin.Tpo -c -o libclipboard_la-gsd-clipboard-plugin.lo `test -f 'gsd-clipboard-plugin.c' || echo '$(srcdir)/'`gsd-clipboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libclipboard_la-gsd-clipboard-plugin.Tpo $(DEPDIR)/libclipboard_la-gsd-clipboard-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-clipboard-plugin.c' object='libclipboard_la-gsd-clipboard-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -c -o libclipboard_la-gsd-clipboard-plugin.lo `test -f 'gsd-clipboard-plugin.c' || echo '$(srcdir)/'`gsd-clipboard-plugin.c + +libclipboard_la-gsd-clipboard-manager.lo: gsd-clipboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -MT libclipboard_la-gsd-clipboard-manager.lo -MD -MP -MF $(DEPDIR)/libclipboard_la-gsd-clipboard-manager.Tpo -c -o libclipboard_la-gsd-clipboard-manager.lo `test -f 'gsd-clipboard-manager.c' || echo '$(srcdir)/'`gsd-clipboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libclipboard_la-gsd-clipboard-manager.Tpo $(DEPDIR)/libclipboard_la-gsd-clipboard-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-clipboard-manager.c' object='libclipboard_la-gsd-clipboard-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -c -o libclipboard_la-gsd-clipboard-manager.lo `test -f 'gsd-clipboard-manager.c' || echo '$(srcdir)/'`gsd-clipboard-manager.c + +libclipboard_la-xutils.lo: xutils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -MT libclipboard_la-xutils.lo -MD -MP -MF $(DEPDIR)/libclipboard_la-xutils.Tpo -c -o libclipboard_la-xutils.lo `test -f 'xutils.c' || echo '$(srcdir)/'`xutils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libclipboard_la-xutils.Tpo $(DEPDIR)/libclipboard_la-xutils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xutils.c' object='libclipboard_la-xutils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -c -o libclipboard_la-xutils.lo `test -f 'xutils.c' || echo '$(srcdir)/'`xutils.c + +libclipboard_la-list.lo: list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -MT libclipboard_la-list.lo -MD -MP -MF $(DEPDIR)/libclipboard_la-list.Tpo -c -o libclipboard_la-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libclipboard_la-list.Tpo $(DEPDIR)/libclipboard_la-list.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='list.c' object='libclipboard_la-list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libclipboard_la_CPPFLAGS) $(CPPFLAGS) $(libclipboard_la_CFLAGS) $(CFLAGS) -c -o libclipboard_la-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pluginDATA install-pluginLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/clipboard/clipboard.gnome-settings-plugin.in b/plugins/clipboard/clipboard.gnome-settings-plugin.in new file mode 100644 index 00000000..bb680dd7 --- /dev/null +++ b/plugins/clipboard/clipboard.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=clipboard +IAge=0 +_Name=Clipboard +_Description=Clipboard plugin +Authors=Matthias Clasen +Copyright=Copyright © 2007 Matthias Clasen +Website= diff --git a/plugins/clipboard/gsd-clipboard-manager.c b/plugins/clipboard/gsd-clipboard-manager.c new file mode 100644 index 00000000..65389d4f --- /dev/null +++ b/plugins/clipboard/gsd-clipboard-manager.c @@ -0,0 +1,1047 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 Matthias Clasen + * Copyright (C) 2007 Anders Carlsson + * Copyright (C) 2007 Rodrigo Moya + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "xutils.h" +#include "list.h" + +#include "gnome-settings-profile.h" +#include "gsd-clipboard-manager.h" + +#define GSD_CLIPBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManagerPrivate)) + +struct GsdClipboardManagerPrivate +{ + guint start_idle_id; + Display *display; + Window window; + Time timestamp; + + List *contents; + List *conversions; + + Window requestor; + Atom property; + Time time; +}; + +typedef struct +{ + unsigned char *data; + int length; + Atom target; + Atom type; + int format; + int refcount; +} TargetData; + +typedef struct +{ + Atom target; + TargetData *data; + Atom property; + Window requestor; + int offset; +} IncrConversion; + +static void gsd_clipboard_manager_class_init (GsdClipboardManagerClass *klass); +static void gsd_clipboard_manager_init (GsdClipboardManager *clipboard_manager); +static void gsd_clipboard_manager_finalize (GObject *object); + +static void clipboard_manager_watch_cb (GsdClipboardManager *manager, + Window window, + Bool is_start, + long mask, + void *cb_data); + +G_DEFINE_TYPE (GsdClipboardManager, gsd_clipboard_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +/* We need to use reference counting for the target data, since we may + * need to keep the data around after loosing the CLIPBOARD ownership + * to complete incremental transfers. + */ +static TargetData * +target_data_ref (TargetData *data) +{ + data->refcount++; + return data; +} + +static void +target_data_unref (TargetData *data) +{ + data->refcount--; + if (data->refcount == 0) { + free (data->data); + free (data); + } +} + +static void +conversion_free (IncrConversion *rdata) +{ + if (rdata->data) { + target_data_unref (rdata->data); + } + free (rdata); +} + +static void +send_selection_notify (GsdClipboardManager *manager, + Bool success) +{ + XSelectionEvent notify; + + notify.type = SelectionNotify; + notify.serial = 0; + notify.send_event = True; + notify.display = manager->priv->display; + notify.requestor = manager->priv->requestor; + notify.selection = XA_CLIPBOARD_MANAGER; + notify.target = XA_SAVE_TARGETS; + notify.property = success ? manager->priv->property : None; + notify.time = manager->priv->time; + + gdk_error_trap_push (); + + XSendEvent (manager->priv->display, + manager->priv->requestor, + False, + NoEventMask, + (XEvent *)¬ify); + XSync (manager->priv->display, False); + + gdk_error_trap_pop_ignored (); +} + +static void +finish_selection_request (GsdClipboardManager *manager, + XEvent *xev, + Bool success) +{ + XSelectionEvent notify; + + notify.type = SelectionNotify; + notify.serial = 0; + notify.send_event = True; + notify.display = xev->xselectionrequest.display; + notify.requestor = xev->xselectionrequest.requestor; + notify.selection = xev->xselectionrequest.selection; + notify.target = xev->xselectionrequest.target; + notify.property = success ? xev->xselectionrequest.property : None; + notify.time = xev->xselectionrequest.time; + + gdk_error_trap_push (); + + XSendEvent (xev->xselectionrequest.display, + xev->xselectionrequest.requestor, + False, NoEventMask, (XEvent *) ¬ify); + XSync (manager->priv->display, False); + + gdk_error_trap_pop_ignored (); +} + +static int +clipboard_bytes_per_item (int format) +{ + switch (format) { + case 8: return sizeof (char); + case 16: return sizeof (short); + case 32: return sizeof (long); + default: ; + } + + return 0; +} + +static void +save_targets (GsdClipboardManager *manager, + Atom *save_targets, + int nitems) +{ + int nout, i; + Atom *multiple; + TargetData *tdata; + + multiple = (Atom *) malloc (2 * nitems * sizeof (Atom)); + + nout = 0; + for (i = 0; i < nitems; i++) { + if (save_targets[i] != XA_TARGETS && + save_targets[i] != XA_MULTIPLE && + save_targets[i] != XA_DELETE && + save_targets[i] != XA_INSERT_PROPERTY && + save_targets[i] != XA_INSERT_SELECTION && + save_targets[i] != XA_PIXMAP) { + tdata = (TargetData *) malloc (sizeof (TargetData)); + tdata->data = NULL; + tdata->length = 0; + tdata->target = save_targets[i]; + tdata->type = None; + tdata->format = 0; + tdata->refcount = 1; + manager->priv->contents = list_prepend (manager->priv->contents, tdata); + + multiple[nout++] = save_targets[i]; + multiple[nout++] = save_targets[i]; + } + } + + XFree (save_targets); + + XChangeProperty (manager->priv->display, manager->priv->window, + XA_MULTIPLE, XA_ATOM_PAIR, + 32, PropModeReplace, (const unsigned char *) multiple, nout); + free (multiple); + + XConvertSelection (manager->priv->display, XA_CLIPBOARD, + XA_MULTIPLE, XA_MULTIPLE, + manager->priv->window, manager->priv->time); +} + +static int +find_content_target (TargetData *tdata, + Atom target) +{ + return tdata->target == target; +} + +static int +find_content_type (TargetData *tdata, + Atom type) +{ + return tdata->type == type; +} + +static int +find_conversion_requestor (IncrConversion *rdata, + XEvent *xev) +{ + return (rdata->requestor == xev->xproperty.window && + rdata->property == xev->xproperty.atom); +} + +static void +get_property (TargetData *tdata, + GsdClipboardManager *manager) +{ + Atom type; + int format; + unsigned long length; + unsigned long remaining; + unsigned char *data; + + XGetWindowProperty (manager->priv->display, + manager->priv->window, + tdata->target, + 0, + 0x1FFFFFFF, + True, + AnyPropertyType, + &type, + &format, + &length, + &remaining, + &data); + + if (type == None) { + manager->priv->contents = list_remove (manager->priv->contents, tdata); + free (tdata); + } else if (type == XA_INCR) { + tdata->type = type; + tdata->length = 0; + XFree (data); + } else { + tdata->type = type; + tdata->data = data; + tdata->length = length * clipboard_bytes_per_item (format); + tdata->format = format; + } +} + +static Bool +receive_incrementally (GsdClipboardManager *manager, + XEvent *xev) +{ + List *list; + TargetData *tdata; + Atom type; + int format; + unsigned long length, nitems, remaining; + unsigned char *data; + + if (xev->xproperty.window != manager->priv->window) + return False; + + list = list_find (manager->priv->contents, + (ListFindFunc) find_content_target, (void *) xev->xproperty.atom); + + if (!list) + return False; + + tdata = (TargetData *) list->data; + + if (tdata->type != XA_INCR) + return False; + + XGetWindowProperty (xev->xproperty.display, + xev->xproperty.window, + xev->xproperty.atom, + 0, 0x1FFFFFFF, True, AnyPropertyType, + &type, &format, &nitems, &remaining, &data); + + length = nitems * clipboard_bytes_per_item (format); + if (length == 0) { + tdata->type = type; + tdata->format = format; + + if (!list_find (manager->priv->contents, + (ListFindFunc) find_content_type, (void *)XA_INCR)) { + /* all incremental transfers done */ + send_selection_notify (manager, True); + manager->priv->requestor = None; + } + + XFree (data); + } else { + if (!tdata->data) { + tdata->data = data; + tdata->length = length; + } else { + tdata->data = realloc (tdata->data, tdata->length + length + 1); + memcpy (tdata->data + tdata->length, data, length + 1); + tdata->length += length; + XFree (data); + } + } + + return True; +} + +static Bool +send_incrementally (GsdClipboardManager *manager, + XEvent *xev) +{ + List *list; + IncrConversion *rdata; + unsigned long length; + unsigned long items; + unsigned char *data; + + list = list_find (manager->priv->conversions, + (ListFindFunc) find_conversion_requestor, xev); + if (list == NULL) + return False; + + rdata = (IncrConversion *) list->data; + + data = rdata->data->data + rdata->offset; + length = rdata->data->length - rdata->offset; + if (length > SELECTION_MAX_SIZE) + length = SELECTION_MAX_SIZE; + + rdata->offset += length; + + items = length / clipboard_bytes_per_item (rdata->data->format); + XChangeProperty (manager->priv->display, rdata->requestor, + rdata->property, rdata->data->type, + rdata->data->format, PropModeAppend, + data, items); + + if (length == 0) { + clipboard_manager_watch_cb (manager, + rdata->requestor, + False, + PropertyChangeMask, + NULL); + + manager->priv->conversions = list_remove (manager->priv->conversions, rdata); + conversion_free (rdata); + } + + return True; +} + +static void +convert_clipboard_manager (GsdClipboardManager *manager, + XEvent *xev) +{ + Atom type = None; + int format; + unsigned long nitems; + unsigned long remaining; + Atom *targets = NULL; + + if (xev->xselectionrequest.target == XA_SAVE_TARGETS) { + if (manager->priv->requestor != None || manager->priv->contents != NULL) { + /* We're in the middle of a conversion request, or own + * the CLIPBOARD already + */ + finish_selection_request (manager, xev, False); + } else { + gdk_error_trap_push (); + + clipboard_manager_watch_cb (manager, + xev->xselectionrequest.requestor, + True, + StructureNotifyMask, + NULL); + XSelectInput (manager->priv->display, + xev->xselectionrequest.requestor, + StructureNotifyMask); + XSync (manager->priv->display, False); + + if (gdk_error_trap_pop () != Success) + return; + + gdk_error_trap_push (); + + if (xev->xselectionrequest.property != None) { + XGetWindowProperty (manager->priv->display, + xev->xselectionrequest.requestor, + xev->xselectionrequest.property, + 0, 0x1FFFFFFF, False, XA_ATOM, + &type, &format, &nitems, &remaining, + (unsigned char **) &targets); + + if (gdk_error_trap_pop () != Success) { + if (targets) + XFree (targets); + + return; + } + } + + manager->priv->requestor = xev->xselectionrequest.requestor; + manager->priv->property = xev->xselectionrequest.property; + manager->priv->time = xev->xselectionrequest.time; + + if (type == None) + XConvertSelection (manager->priv->display, XA_CLIPBOARD, + XA_TARGETS, XA_TARGETS, + manager->priv->window, manager->priv->time); + else + save_targets (manager, targets, nitems); + } + } else if (xev->xselectionrequest.target == XA_TIMESTAMP) { + XChangeProperty (manager->priv->display, + xev->xselectionrequest.requestor, + xev->xselectionrequest.property, + XA_INTEGER, 32, PropModeReplace, + (unsigned char *) &manager->priv->timestamp, 1); + + finish_selection_request (manager, xev, True); + } else if (xev->xselectionrequest.target == XA_TARGETS) { + int n_targets = 0; + Atom targets[3]; + + targets[n_targets++] = XA_TARGETS; + targets[n_targets++] = XA_TIMESTAMP; + targets[n_targets++] = XA_SAVE_TARGETS; + + XChangeProperty (manager->priv->display, + xev->xselectionrequest.requestor, + xev->xselectionrequest.property, + XA_ATOM, 32, PropModeReplace, + (unsigned char *) targets, n_targets); + + finish_selection_request (manager, xev, True); + } else + finish_selection_request (manager, xev, False); +} + +static void +convert_clipboard_target (IncrConversion *rdata, + GsdClipboardManager *manager) +{ + TargetData *tdata; + Atom *targets; + int n_targets; + List *list; + unsigned long items; + XWindowAttributes atts; + + if (rdata->target == XA_TARGETS) { + n_targets = list_length (manager->priv->contents) + 2; + targets = (Atom *) malloc (n_targets * sizeof (Atom)); + + n_targets = 0; + + targets[n_targets++] = XA_TARGETS; + targets[n_targets++] = XA_MULTIPLE; + + for (list = manager->priv->contents; list; list = list->next) { + tdata = (TargetData *) list->data; + targets[n_targets++] = tdata->target; + } + + XChangeProperty (manager->priv->display, rdata->requestor, + rdata->property, + XA_ATOM, 32, PropModeReplace, + (unsigned char *) targets, n_targets); + free (targets); + } else { + /* Convert from stored CLIPBOARD data */ + list = list_find (manager->priv->contents, + (ListFindFunc) find_content_target, (void *) rdata->target); + + /* We got a target that we don't support */ + if (!list) + return; + + tdata = (TargetData *)list->data; + if (tdata->type == XA_INCR) { + /* we haven't completely received this target yet */ + rdata->property = None; + return; + } + + rdata->data = target_data_ref (tdata); + items = tdata->length / clipboard_bytes_per_item (tdata->format); + if (tdata->length <= SELECTION_MAX_SIZE) + XChangeProperty (manager->priv->display, rdata->requestor, + rdata->property, + tdata->type, tdata->format, PropModeReplace, + tdata->data, items); + else { + /* start incremental transfer */ + rdata->offset = 0; + + gdk_error_trap_push (); + + XGetWindowAttributes (manager->priv->display, rdata->requestor, &atts); + + clipboard_manager_watch_cb (manager, + rdata->requestor, + True, + PropertyChangeMask, + NULL); + + XSelectInput (manager->priv->display, rdata->requestor, + atts.your_event_mask | PropertyChangeMask); + + XChangeProperty (manager->priv->display, rdata->requestor, + rdata->property, + XA_INCR, 32, PropModeReplace, + (unsigned char *) &items, 1); + + XSync (manager->priv->display, False); + + gdk_error_trap_pop_ignored (); + } + } +} + +static void +collect_incremental (IncrConversion *rdata, + GsdClipboardManager *manager) +{ + if (rdata->offset >= 0) + manager->priv->conversions = list_prepend (manager->priv->conversions, rdata); + else { + if (rdata->data) { + target_data_unref (rdata->data); + rdata->data = NULL; + } + free (rdata); + } +} + +static void +convert_clipboard (GsdClipboardManager *manager, + XEvent *xev) +{ + List *list; + List *conversions; + IncrConversion *rdata; + Atom type; + int i; + int format; + unsigned long nitems; + unsigned long remaining; + Atom *multiple; + + conversions = NULL; + type = None; + + if (xev->xselectionrequest.target == XA_MULTIPLE) { + XGetWindowProperty (xev->xselectionrequest.display, + xev->xselectionrequest.requestor, + xev->xselectionrequest.property, + 0, 0x1FFFFFFF, False, XA_ATOM_PAIR, + &type, &format, &nitems, &remaining, + (unsigned char **) &multiple); + + if (type != XA_ATOM_PAIR || nitems == 0) { + if (multiple) + free (multiple); + return; + } + + for (i = 0; i < nitems; i += 2) { + rdata = (IncrConversion *) malloc (sizeof (IncrConversion)); + rdata->requestor = xev->xselectionrequest.requestor; + rdata->target = multiple[i]; + rdata->property = multiple[i+1]; + rdata->data = NULL; + rdata->offset = -1; + conversions = list_prepend (conversions, rdata); + } + } else { + multiple = NULL; + + rdata = (IncrConversion *) malloc (sizeof (IncrConversion)); + rdata->requestor = xev->xselectionrequest.requestor; + rdata->target = xev->xselectionrequest.target; + rdata->property = xev->xselectionrequest.property; + rdata->data = NULL; + rdata->offset = -1; + conversions = list_prepend (conversions, rdata); + } + + list_foreach (conversions, (Callback) convert_clipboard_target, manager); + + if (conversions->next == NULL && + ((IncrConversion *) conversions->data)->property == None) { + finish_selection_request (manager, xev, False); + } else { + if (multiple) { + i = 0; + for (list = conversions; list; list = list->next) { + rdata = (IncrConversion *)list->data; + multiple[i++] = rdata->target; + multiple[i++] = rdata->property; + } + XChangeProperty (xev->xselectionrequest.display, + xev->xselectionrequest.requestor, + xev->xselectionrequest.property, + XA_ATOM_PAIR, 32, PropModeReplace, + (unsigned char *) multiple, nitems); + } + finish_selection_request (manager, xev, True); + } + + list_foreach (conversions, (Callback) collect_incremental, manager); + list_free (conversions); + + if (multiple) + free (multiple); +} + +static Bool +clipboard_manager_process_event (GsdClipboardManager *manager, + XEvent *xev) +{ + Atom type; + int format; + unsigned long nitems; + unsigned long remaining; + Atom *targets; + + targets = NULL; + + switch (xev->xany.type) { + case DestroyNotify: + if (xev->xdestroywindow.window == manager->priv->requestor) { + list_foreach (manager->priv->contents, (Callback)target_data_unref, NULL); + list_free (manager->priv->contents); + manager->priv->contents = NULL; + + clipboard_manager_watch_cb (manager, + manager->priv->requestor, + False, + 0, + NULL); + manager->priv->requestor = None; + } + break; + case PropertyNotify: + if (xev->xproperty.state == PropertyNewValue) { + return receive_incrementally (manager, xev); + } else { + return send_incrementally (manager, xev); + } + + case SelectionClear: + if (xev->xany.window != manager->priv->window) + return False; + + if (xev->xselectionclear.selection == XA_CLIPBOARD_MANAGER) { + /* We lost the manager selection */ + if (manager->priv->contents) { + list_foreach (manager->priv->contents, (Callback)target_data_unref, NULL); + list_free (manager->priv->contents); + manager->priv->contents = NULL; + + XSetSelectionOwner (manager->priv->display, + XA_CLIPBOARD, + None, manager->priv->time); + } + + return True; + } + if (xev->xselectionclear.selection == XA_CLIPBOARD) { + /* We lost the clipboard selection */ + list_foreach (manager->priv->contents, (Callback)target_data_unref, NULL); + list_free (manager->priv->contents); + manager->priv->contents = NULL; + clipboard_manager_watch_cb (manager, + manager->priv->requestor, + False, + 0, + NULL); + manager->priv->requestor = None; + + return True; + } + break; + + case SelectionNotify: + if (xev->xany.window != manager->priv->window) + return False; + + if (xev->xselection.selection == XA_CLIPBOARD) { + /* a CLIPBOARD conversion is done */ + if (xev->xselection.property == XA_TARGETS) { + XGetWindowProperty (xev->xselection.display, + xev->xselection.requestor, + xev->xselection.property, + 0, 0x1FFFFFFF, True, XA_ATOM, + &type, &format, &nitems, &remaining, + (unsigned char **) &targets); + + save_targets (manager, targets, nitems); + } else if (xev->xselection.property == XA_MULTIPLE) { + List *tmp; + + tmp = list_copy (manager->priv->contents); + list_foreach (tmp, (Callback) get_property, manager); + list_free (tmp); + + manager->priv->time = xev->xselection.time; + XSetSelectionOwner (manager->priv->display, XA_CLIPBOARD, + manager->priv->window, manager->priv->time); + + if (manager->priv->property != None) + XChangeProperty (manager->priv->display, + manager->priv->requestor, + manager->priv->property, + XA_ATOM, 32, PropModeReplace, + (unsigned char *)&XA_NULL, 1); + + if (!list_find (manager->priv->contents, + (ListFindFunc)find_content_type, (void *)XA_INCR)) { + /* all transfers done */ + send_selection_notify (manager, True); + clipboard_manager_watch_cb (manager, + manager->priv->requestor, + False, + 0, + NULL); + manager->priv->requestor = None; + } + } + else if (xev->xselection.property == None) { + send_selection_notify (manager, False); + clipboard_manager_watch_cb (manager, + manager->priv->requestor, + False, + 0, + NULL); + manager->priv->requestor = None; + } + + return True; + } + break; + + case SelectionRequest: + if (xev->xany.window != manager->priv->window) { + return False; + } + + if (xev->xselectionrequest.selection == XA_CLIPBOARD_MANAGER) { + convert_clipboard_manager (manager, xev); + return True; + } else if (xev->xselectionrequest.selection == XA_CLIPBOARD) { + convert_clipboard (manager, xev); + return True; + } + break; + + default: ; + } + + return False; +} + +static GdkFilterReturn +clipboard_manager_event_filter (GdkXEvent *xevent, + GdkEvent *event, + GsdClipboardManager *manager) +{ + if (clipboard_manager_process_event (manager, (XEvent *)xevent)) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } +} + +static void +clipboard_manager_watch_cb (GsdClipboardManager *manager, + Window window, + Bool is_start, + long mask, + void *cb_data) +{ + GdkWindow *gdkwin; + GdkDisplay *display; + + display = gdk_display_get_default (); + gdkwin = gdk_x11_window_lookup_for_display (display, window); + + if (is_start) { + if (gdkwin == NULL) { + gdkwin = gdk_x11_window_foreign_new_for_display (display, window); + } else { + g_object_ref (gdkwin); + } + + gdk_window_add_filter (gdkwin, + (GdkFilterFunc)clipboard_manager_event_filter, + manager); + } else { + if (gdkwin == NULL) { + return; + } + gdk_window_remove_filter (gdkwin, + (GdkFilterFunc)clipboard_manager_event_filter, + manager); + g_object_unref (gdkwin); + } +} + +static gboolean +start_clipboard_idle_cb (GsdClipboardManager *manager) +{ + XClientMessageEvent xev; + + + gnome_settings_profile_start (NULL); + + init_atoms (manager->priv->display); + + /* check if there is a clipboard manager running */ + if (XGetSelectionOwner (manager->priv->display, XA_CLIPBOARD_MANAGER)) { + g_warning ("Clipboard manager is already running."); + return FALSE; + } + + manager->priv->contents = NULL; + manager->priv->conversions = NULL; + manager->priv->requestor = None; + + manager->priv->window = XCreateSimpleWindow (manager->priv->display, + DefaultRootWindow (manager->priv->display), + 0, 0, 10, 10, 0, + WhitePixel (manager->priv->display, + DefaultScreen (manager->priv->display)), + WhitePixel (manager->priv->display, + DefaultScreen (manager->priv->display))); + clipboard_manager_watch_cb (manager, + manager->priv->window, + True, + PropertyChangeMask, + NULL); + XSelectInput (manager->priv->display, + manager->priv->window, + PropertyChangeMask); + manager->priv->timestamp = get_server_time (manager->priv->display, manager->priv->window); + + XSetSelectionOwner (manager->priv->display, + XA_CLIPBOARD_MANAGER, + manager->priv->window, + manager->priv->timestamp); + + /* Check to see if we managed to claim the selection. If not, + * we treat it as if we got it then immediately lost it + */ + if (XGetSelectionOwner (manager->priv->display, XA_CLIPBOARD_MANAGER) == manager->priv->window) { + xev.type = ClientMessage; + xev.window = DefaultRootWindow (manager->priv->display); + xev.message_type = XA_MANAGER; + xev.format = 32; + xev.data.l[0] = manager->priv->timestamp; + xev.data.l[1] = XA_CLIPBOARD_MANAGER; + xev.data.l[2] = manager->priv->window; + xev.data.l[3] = 0; /* manager specific data */ + xev.data.l[4] = 0; /* manager specific data */ + + XSendEvent (manager->priv->display, + DefaultRootWindow (manager->priv->display), + False, + StructureNotifyMask, + (XEvent *)&xev); + } else { + clipboard_manager_watch_cb (manager, + manager->priv->window, + False, + 0, + NULL); + /* FIXME: manager->priv->terminate (manager->priv->cb_data); */ + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_clipboard_manager_start (GsdClipboardManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_clipboard_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_clipboard_manager_stop (GsdClipboardManager *manager) +{ + g_debug ("Stopping clipboard manager"); + + if (manager->priv->window != None) { + clipboard_manager_watch_cb (manager, + manager->priv->window, + FALSE, + 0, + NULL); + XDestroyWindow (manager->priv->display, manager->priv->window); + manager->priv->window = None; + } + + if (manager->priv->conversions != NULL) { + list_foreach (manager->priv->conversions, (Callback) conversion_free, NULL); + list_free (manager->priv->conversions); + manager->priv->conversions = NULL; + } + + if (manager->priv->contents != NULL) { + list_foreach (manager->priv->contents, (Callback) target_data_unref, NULL); + list_free (manager->priv->contents); + manager->priv->contents = NULL; + } +} + +static GObject * +gsd_clipboard_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdClipboardManager *clipboard_manager; + + clipboard_manager = GSD_CLIPBOARD_MANAGER (G_OBJECT_CLASS (gsd_clipboard_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (clipboard_manager); +} + +static void +gsd_clipboard_manager_class_init (GsdClipboardManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_clipboard_manager_constructor; + object_class->finalize = gsd_clipboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdClipboardManagerPrivate)); +} + +static void +gsd_clipboard_manager_init (GsdClipboardManager *manager) +{ + manager->priv = GSD_CLIPBOARD_MANAGER_GET_PRIVATE (manager); + + manager->priv->display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + +} + +static void +gsd_clipboard_manager_finalize (GObject *object) +{ + GsdClipboardManager *clipboard_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_CLIPBOARD_MANAGER (object)); + + clipboard_manager = GSD_CLIPBOARD_MANAGER (object); + + g_return_if_fail (clipboard_manager->priv != NULL); + + if (clipboard_manager->priv->start_idle_id !=0) + g_source_remove (clipboard_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_clipboard_manager_parent_class)->finalize (object); +} + +GsdClipboardManager * +gsd_clipboard_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_CLIPBOARD_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_CLIPBOARD_MANAGER (manager_object); +} diff --git a/plugins/clipboard/gsd-clipboard-manager.h b/plugins/clipboard/gsd-clipboard-manager.h new file mode 100644 index 00000000..fc45c7f0 --- /dev/null +++ b/plugins/clipboard/gsd-clipboard-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_CLIPBOARD_MANAGER_H +#define __GSD_CLIPBOARD_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_CLIPBOARD_MANAGER (gsd_clipboard_manager_get_type ()) +#define GSD_CLIPBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManager)) +#define GSD_CLIPBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManagerClass)) +#define GSD_IS_CLIPBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CLIPBOARD_MANAGER)) +#define GSD_IS_CLIPBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CLIPBOARD_MANAGER)) +#define GSD_CLIPBOARD_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManagerClass)) + +typedef struct GsdClipboardManagerPrivate GsdClipboardManagerPrivate; + +typedef struct +{ + GObject parent; + GsdClipboardManagerPrivate *priv; +} GsdClipboardManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdClipboardManagerClass; + +GType gsd_clipboard_manager_get_type (void); + +GsdClipboardManager * gsd_clipboard_manager_new (void); +gboolean gsd_clipboard_manager_start (GsdClipboardManager *manager, + GError **error); +void gsd_clipboard_manager_stop (GsdClipboardManager *manager); + +G_END_DECLS + +#endif /* __GSD_CLIPBOARD_MANAGER_H */ diff --git a/plugins/clipboard/gsd-clipboard-plugin.c b/plugins/clipboard/gsd-clipboard-plugin.c new file mode 100644 index 00000000..9b3b05cc --- /dev/null +++ b/plugins/clipboard/gsd-clipboard-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-clipboard-plugin.h" +#include "gsd-clipboard-manager.h" + +struct GsdClipboardPluginPrivate { + GsdClipboardManager *manager; +}; + +#define GSD_CLIPBOARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_CLIPBOARD_PLUGIN, GsdClipboardPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdClipboardPlugin, gsd_clipboard_plugin) + +static void +gsd_clipboard_plugin_init (GsdClipboardPlugin *plugin) +{ + plugin->priv = GSD_CLIPBOARD_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdClipboardPlugin initializing"); + + plugin->priv->manager = gsd_clipboard_manager_new (); +} + +static void +gsd_clipboard_plugin_finalize (GObject *object) +{ + GsdClipboardPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_CLIPBOARD_PLUGIN (object)); + + g_debug ("GsdClipboardPlugin finalizing"); + + plugin = GSD_CLIPBOARD_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_clipboard_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating clipboard plugin"); + + error = NULL; + res = gsd_clipboard_manager_start (GSD_CLIPBOARD_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start clipboard manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating clipboard plugin"); + gsd_clipboard_manager_stop (GSD_CLIPBOARD_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_clipboard_plugin_class_init (GsdClipboardPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_clipboard_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdClipboardPluginPrivate)); +} diff --git a/plugins/clipboard/gsd-clipboard-plugin.h b/plugins/clipboard/gsd-clipboard-plugin.h new file mode 100644 index 00000000..2d9c40d4 --- /dev/null +++ b/plugins/clipboard/gsd-clipboard-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_CLIPBOARD_PLUGIN_H__ +#define __GSD_CLIPBOARD_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_CLIPBOARD_PLUGIN (gsd_clipboard_plugin_get_type ()) +#define GSD_CLIPBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CLIPBOARD_PLUGIN, GsdClipboardPlugin)) +#define GSD_CLIPBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CLIPBOARD_PLUGIN, GsdClipboardPluginClass)) +#define GSD_IS_CLIPBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CLIPBOARD_PLUGIN)) +#define GSD_IS_CLIPBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CLIPBOARD_PLUGIN)) +#define GSD_CLIPBOARD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CLIPBOARD_PLUGIN, GsdClipboardPluginClass)) + +typedef struct GsdClipboardPluginPrivate GsdClipboardPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdClipboardPluginPrivate *priv; +} GsdClipboardPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdClipboardPluginClass; + +GType gsd_clipboard_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_CLIPBOARD_PLUGIN_H__ */ diff --git a/plugins/clipboard/list.c b/plugins/clipboard/list.c new file mode 100644 index 00000000..477eead7 --- /dev/null +++ b/plugins/clipboard/list.c @@ -0,0 +1,150 @@ +/* + * Copyright © 2004 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Matthias Clasen, Red Hat, Inc. + */ + +#include +#include + + +void +list_foreach (List *list, + Callback func, + void *user_data) +{ + while (list) + { + func (list->data, user_data); + + list = list->next; + } +} + +List * +list_prepend (List *list, + void *data) +{ + List *link; + + link = (List *) malloc (sizeof (List)); + link->next = list; + link->data = data; + + return link; +} + +void +list_free (List *list) +{ + while (list) + { + List *next = list->next; + + free (list); + + list = next; + } +} + +List * +list_find (List *list, + ListFindFunc func, + void *user_data) +{ + List *tmp; + + for (tmp = list; tmp; tmp = tmp->next) + { + if ((*func) (tmp->data, user_data)) + break; + } + + return tmp; +} + +List * +list_remove (List *list, + void *data) +{ + List *tmp, *prev; + + prev = NULL; + for (tmp = list; tmp; tmp = tmp->next) + { + if (tmp->data == data) + { + if (prev) + prev->next = tmp->next; + else + list = tmp->next; + + free (tmp); + break; + } + + prev = tmp; + } + + return list; +} + +int +list_length (List *list) +{ + List *tmp; + int length; + + length = 0; + for (tmp = list; tmp; tmp = tmp->next) + length++; + + return length; +} + +List * +list_copy (List *list) +{ + List *new_list = NULL; + + if (list) + { + List *last; + + new_list = (List *) malloc (sizeof (List)); + new_list->data = list->data; + new_list->next = NULL; + + last = new_list; + list = list->next; + + while (list) + { + last->next = (List *) malloc (sizeof (List)); + last = last->next; + last->data = list->data; + list = list->next; + } + + last->next = NULL; + } + + return new_list; +} diff --git a/plugins/clipboard/list.h b/plugins/clipboard/list.h new file mode 100644 index 00000000..158b7793 --- /dev/null +++ b/plugins/clipboard/list.h @@ -0,0 +1,57 @@ +/* + * Copyright © 2004 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Matthias Clasen, Red Hat, Inc. + */ +#ifndef LIST_H +#define LIST_H + + +typedef struct _List List; +typedef void (*Callback) (void *data, + void *user_data); + + +struct _List +{ + void *data; + + List *next; +}; + +typedef int (*ListFindFunc) (void *data, + void *user_data); + +void list_foreach (List *list, + Callback func, + void *user_data); +List *list_prepend (List *list, + void *data); +void list_free (List *list); +List *list_find (List *list, + ListFindFunc func, + void *user_data); +List *list_remove (List *list, + void *data); +int list_length (List *list); + +List *list_copy (List *list); + +#endif /* LIST_H */ diff --git a/plugins/clipboard/xutils.c b/plugins/clipboard/xutils.c new file mode 100644 index 00000000..4e48b98f --- /dev/null +++ b/plugins/clipboard/xutils.c @@ -0,0 +1,117 @@ +/* + * Copyright © 2004 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Matthias Clasen, Red Hat, Inc. + */ + +#include + +#include "xutils.h" + +Atom XA_ATOM_PAIR; +Atom XA_CLIPBOARD_MANAGER; +Atom XA_CLIPBOARD; +Atom XA_DELETE; +Atom XA_INCR; +Atom XA_INSERT_PROPERTY; +Atom XA_INSERT_SELECTION; +Atom XA_MANAGER; +Atom XA_MULTIPLE; +Atom XA_NULL; +Atom XA_SAVE_TARGETS; +Atom XA_TARGETS; +Atom XA_TIMESTAMP; + +unsigned long SELECTION_MAX_SIZE = 0; + + +void +init_atoms (Display *display) +{ + unsigned long max_request_size; + + if (SELECTION_MAX_SIZE > 0) + return; + + XA_ATOM_PAIR = XInternAtom (display, "ATOM_PAIR", False); + XA_CLIPBOARD_MANAGER = XInternAtom (display, "CLIPBOARD_MANAGER", False); + XA_CLIPBOARD = XInternAtom (display, "CLIPBOARD", False); + XA_DELETE = XInternAtom (display, "DELETE", False); + XA_INCR = XInternAtom (display, "INCR", False); + XA_INSERT_PROPERTY = XInternAtom (display, "INSERT_PROPERTY", False); + XA_INSERT_SELECTION = XInternAtom (display, "INSERT_SELECTION", False); + XA_MANAGER = XInternAtom (display, "MANAGER", False); + XA_MULTIPLE = XInternAtom (display, "MULTIPLE", False); + XA_NULL = XInternAtom (display, "NULL", False); + XA_SAVE_TARGETS = XInternAtom (display, "SAVE_TARGETS", False); + XA_TARGETS = XInternAtom (display, "TARGETS", False); + XA_TIMESTAMP = XInternAtom (display, "TIMESTAMP", False); + + max_request_size = XExtendedMaxRequestSize (display); + if (max_request_size == 0) + max_request_size = XMaxRequestSize (display); + + SELECTION_MAX_SIZE = max_request_size - 100; + if (SELECTION_MAX_SIZE > 262144) + SELECTION_MAX_SIZE = 262144; +} + +typedef struct +{ + Window window; + Atom timestamp_prop_atom; +} TimeStampInfo; + +static Bool +timestamp_predicate (Display *display, + XEvent *xevent, + XPointer arg) +{ + TimeStampInfo *info = (TimeStampInfo *)arg; + + if (xevent->type == PropertyNotify && + xevent->xproperty.window == info->window && + xevent->xproperty.atom == info->timestamp_prop_atom) + return True; + + return False; +} + +Time +get_server_time (Display *display, + Window window) +{ + unsigned char c = 'a'; + XEvent xevent; + TimeStampInfo info; + + info.timestamp_prop_atom = XInternAtom (display, "_TIMESTAMP_PROP", False); + info.window = window; + + XChangeProperty (display, window, + info.timestamp_prop_atom, info.timestamp_prop_atom, + 8, PropModeReplace, &c, 1); + + XIfEvent (display, &xevent, + timestamp_predicate, (XPointer)&info); + + return xevent.xproperty.time; +} + diff --git a/plugins/clipboard/xutils.h b/plugins/clipboard/xutils.h new file mode 100644 index 00000000..143fe443 --- /dev/null +++ b/plugins/clipboard/xutils.h @@ -0,0 +1,50 @@ +/* + * Copyright © 2004 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Matthias Clasen, Red Hat, Inc. + */ +#ifndef X_UTILS_H +#define X_UTILS_H + +#include + + +extern Atom XA_ATOM_PAIR; +extern Atom XA_CLIPBOARD_MANAGER; +extern Atom XA_CLIPBOARD; +extern Atom XA_DELETE; +extern Atom XA_INCR; +extern Atom XA_INSERT_PROPERTY; +extern Atom XA_INSERT_SELECTION; +extern Atom XA_MANAGER; +extern Atom XA_MULTIPLE; +extern Atom XA_NULL; +extern Atom XA_SAVE_TARGETS; +extern Atom XA_TARGETS; +extern Atom XA_TIMESTAMP; + +extern unsigned long SELECTION_MAX_SIZE; + +void init_atoms (Display *display); + +Time get_server_time (Display *display, + Window window); + +#endif /* X_UTILS_H */ diff --git a/plugins/color/Makefile.am b/plugins/color/Makefile.am new file mode 100644 index 00000000..dbb325f6 --- /dev/null +++ b/plugins/color/Makefile.am @@ -0,0 +1,86 @@ +plugin_name = color + +plugin_LTLIBRARIES = \ + libcolor.la + +libcolor_la_SOURCES = \ + gcm-profile-store.c \ + gcm-profile-store.h \ + gcm-dmi.c \ + gcm-dmi.h \ + gcm-edid.c \ + gcm-edid.h \ + gsd-color-manager.c \ + gsd-color-manager.h \ + gsd-color-plugin.c \ + gsd-color-plugin.h + +libcolor_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DBINDIR=\"$(bindir)\" \ + $(AM_CPPFLAGS) + +libcolor_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(COLOR_CFLAGS) \ + $(LCMS_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +libcolor_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libcolor_la_LIBADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(COLOR_LIBS) \ + $(LCMS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(LIBNOTIFY_LIBS) + +check_PROGRAMS = \ + gcm-self-test + +gcm_self_test_CPPFLAGS = \ + -DTESTDATADIR=\""$(top_srcdir)/plugins/color/test-data"\" \ + $(AM_CPPFLAGS) + +gcm_self_test_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(COLOR_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gcm_self_test_SOURCES = \ + gcm-dmi.c \ + gcm-dmi.h \ + gcm-edid.c \ + gcm-edid.h \ + gcm-self-test.c + +gcm_self_test_LDADD = \ + $(COLOR_LIBS) \ + $(LCMS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + -lm + +TESTS = gcm-self-test + +plugin_in_files = \ + color.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + test-data/Lenovo-T61-Internal.bin \ + test-data/LG-L225W-External.bin + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/color/Makefile.in b/plugins/color/Makefile.in new file mode 100644 index 00000000..05075772 --- /dev/null +++ b/plugins/color/Makefile.in @@ -0,0 +1,1015 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = gcm-self-test$(EXEEXT) +TESTS = gcm-self-test$(EXEEXT) +subdir = plugins/color +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcolor_la_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libcolor_la_OBJECTS = libcolor_la-gcm-profile-store.lo \ + libcolor_la-gcm-dmi.lo libcolor_la-gcm-edid.lo \ + libcolor_la-gsd-color-manager.lo \ + libcolor_la-gsd-color-plugin.lo +libcolor_la_OBJECTS = $(am_libcolor_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcolor_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libcolor_la_CFLAGS) \ + $(CFLAGS) $(libcolor_la_LDFLAGS) $(LDFLAGS) -o $@ +am_gcm_self_test_OBJECTS = gcm_self_test-gcm-dmi.$(OBJEXT) \ + gcm_self_test-gcm-edid.$(OBJEXT) \ + gcm_self_test-gcm-self-test.$(OBJEXT) +gcm_self_test_OBJECTS = $(am_gcm_self_test_OBJECTS) +gcm_self_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gcm_self_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(gcm_self_test_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcolor_la_SOURCES) $(gcm_self_test_SOURCES) +DIST_SOURCES = $(libcolor_la_SOURCES) $(gcm_self_test_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = $(am__tty_colors_dummy) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = color +plugin_LTLIBRARIES = \ + libcolor.la + +libcolor_la_SOURCES = \ + gcm-profile-store.c \ + gcm-profile-store.h \ + gcm-dmi.c \ + gcm-dmi.h \ + gcm-edid.c \ + gcm-edid.h \ + gsd-color-manager.c \ + gsd-color-manager.h \ + gsd-color-plugin.c \ + gsd-color-plugin.h + +libcolor_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DBINDIR=\"$(bindir)\" \ + $(AM_CPPFLAGS) + +libcolor_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(COLOR_CFLAGS) \ + $(LCMS_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +libcolor_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libcolor_la_LIBADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(COLOR_LIBS) \ + $(LCMS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(LIBNOTIFY_LIBS) + +gcm_self_test_CPPFLAGS = \ + -DTESTDATADIR=\""$(top_srcdir)/plugins/color/test-data"\" \ + $(AM_CPPFLAGS) + +gcm_self_test_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(COLOR_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gcm_self_test_SOURCES = \ + gcm-dmi.c \ + gcm-dmi.h \ + gcm-edid.c \ + gcm-edid.h \ + gcm-self-test.c + +gcm_self_test_LDADD = \ + $(COLOR_LIBS) \ + $(LCMS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + -lm + +plugin_in_files = \ + color.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) \ + test-data/Lenovo-T61-Internal.bin \ + test-data/LG-L225W-External.bin + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/color/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/color/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libcolor.la: $(libcolor_la_OBJECTS) $(libcolor_la_DEPENDENCIES) $(EXTRA_libcolor_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcolor_la_LINK) -rpath $(plugindir) $(libcolor_la_OBJECTS) $(libcolor_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gcm-self-test$(EXEEXT): $(gcm_self_test_OBJECTS) $(gcm_self_test_DEPENDENCIES) $(EXTRA_gcm_self_test_DEPENDENCIES) + @rm -f gcm-self-test$(EXEEXT) + $(AM_V_CCLD)$(gcm_self_test_LINK) $(gcm_self_test_OBJECTS) $(gcm_self_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcm_self_test-gcm-dmi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcm_self_test-gcm-edid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcm_self_test-gcm-self-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcolor_la-gcm-dmi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcolor_la-gcm-edid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcolor_la-gcm-profile-store.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcolor_la-gsd-color-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcolor_la-gsd-color-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libcolor_la-gcm-profile-store.lo: gcm-profile-store.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -MT libcolor_la-gcm-profile-store.lo -MD -MP -MF $(DEPDIR)/libcolor_la-gcm-profile-store.Tpo -c -o libcolor_la-gcm-profile-store.lo `test -f 'gcm-profile-store.c' || echo '$(srcdir)/'`gcm-profile-store.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcolor_la-gcm-profile-store.Tpo $(DEPDIR)/libcolor_la-gcm-profile-store.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-profile-store.c' object='libcolor_la-gcm-profile-store.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -c -o libcolor_la-gcm-profile-store.lo `test -f 'gcm-profile-store.c' || echo '$(srcdir)/'`gcm-profile-store.c + +libcolor_la-gcm-dmi.lo: gcm-dmi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -MT libcolor_la-gcm-dmi.lo -MD -MP -MF $(DEPDIR)/libcolor_la-gcm-dmi.Tpo -c -o libcolor_la-gcm-dmi.lo `test -f 'gcm-dmi.c' || echo '$(srcdir)/'`gcm-dmi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcolor_la-gcm-dmi.Tpo $(DEPDIR)/libcolor_la-gcm-dmi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-dmi.c' object='libcolor_la-gcm-dmi.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -c -o libcolor_la-gcm-dmi.lo `test -f 'gcm-dmi.c' || echo '$(srcdir)/'`gcm-dmi.c + +libcolor_la-gcm-edid.lo: gcm-edid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -MT libcolor_la-gcm-edid.lo -MD -MP -MF $(DEPDIR)/libcolor_la-gcm-edid.Tpo -c -o libcolor_la-gcm-edid.lo `test -f 'gcm-edid.c' || echo '$(srcdir)/'`gcm-edid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcolor_la-gcm-edid.Tpo $(DEPDIR)/libcolor_la-gcm-edid.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-edid.c' object='libcolor_la-gcm-edid.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -c -o libcolor_la-gcm-edid.lo `test -f 'gcm-edid.c' || echo '$(srcdir)/'`gcm-edid.c + +libcolor_la-gsd-color-manager.lo: gsd-color-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -MT libcolor_la-gsd-color-manager.lo -MD -MP -MF $(DEPDIR)/libcolor_la-gsd-color-manager.Tpo -c -o libcolor_la-gsd-color-manager.lo `test -f 'gsd-color-manager.c' || echo '$(srcdir)/'`gsd-color-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcolor_la-gsd-color-manager.Tpo $(DEPDIR)/libcolor_la-gsd-color-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-color-manager.c' object='libcolor_la-gsd-color-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -c -o libcolor_la-gsd-color-manager.lo `test -f 'gsd-color-manager.c' || echo '$(srcdir)/'`gsd-color-manager.c + +libcolor_la-gsd-color-plugin.lo: gsd-color-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -MT libcolor_la-gsd-color-plugin.lo -MD -MP -MF $(DEPDIR)/libcolor_la-gsd-color-plugin.Tpo -c -o libcolor_la-gsd-color-plugin.lo `test -f 'gsd-color-plugin.c' || echo '$(srcdir)/'`gsd-color-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcolor_la-gsd-color-plugin.Tpo $(DEPDIR)/libcolor_la-gsd-color-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-color-plugin.c' object='libcolor_la-gsd-color-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcolor_la_CPPFLAGS) $(CPPFLAGS) $(libcolor_la_CFLAGS) $(CFLAGS) -c -o libcolor_la-gsd-color-plugin.lo `test -f 'gsd-color-plugin.c' || echo '$(srcdir)/'`gsd-color-plugin.c + +gcm_self_test-gcm-dmi.o: gcm-dmi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -MT gcm_self_test-gcm-dmi.o -MD -MP -MF $(DEPDIR)/gcm_self_test-gcm-dmi.Tpo -c -o gcm_self_test-gcm-dmi.o `test -f 'gcm-dmi.c' || echo '$(srcdir)/'`gcm-dmi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gcm_self_test-gcm-dmi.Tpo $(DEPDIR)/gcm_self_test-gcm-dmi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-dmi.c' object='gcm_self_test-gcm-dmi.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -c -o gcm_self_test-gcm-dmi.o `test -f 'gcm-dmi.c' || echo '$(srcdir)/'`gcm-dmi.c + +gcm_self_test-gcm-dmi.obj: gcm-dmi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -MT gcm_self_test-gcm-dmi.obj -MD -MP -MF $(DEPDIR)/gcm_self_test-gcm-dmi.Tpo -c -o gcm_self_test-gcm-dmi.obj `if test -f 'gcm-dmi.c'; then $(CYGPATH_W) 'gcm-dmi.c'; else $(CYGPATH_W) '$(srcdir)/gcm-dmi.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gcm_self_test-gcm-dmi.Tpo $(DEPDIR)/gcm_self_test-gcm-dmi.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-dmi.c' object='gcm_self_test-gcm-dmi.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -c -o gcm_self_test-gcm-dmi.obj `if test -f 'gcm-dmi.c'; then $(CYGPATH_W) 'gcm-dmi.c'; else $(CYGPATH_W) '$(srcdir)/gcm-dmi.c'; fi` + +gcm_self_test-gcm-edid.o: gcm-edid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -MT gcm_self_test-gcm-edid.o -MD -MP -MF $(DEPDIR)/gcm_self_test-gcm-edid.Tpo -c -o gcm_self_test-gcm-edid.o `test -f 'gcm-edid.c' || echo '$(srcdir)/'`gcm-edid.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gcm_self_test-gcm-edid.Tpo $(DEPDIR)/gcm_self_test-gcm-edid.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-edid.c' object='gcm_self_test-gcm-edid.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -c -o gcm_self_test-gcm-edid.o `test -f 'gcm-edid.c' || echo '$(srcdir)/'`gcm-edid.c + +gcm_self_test-gcm-edid.obj: gcm-edid.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -MT gcm_self_test-gcm-edid.obj -MD -MP -MF $(DEPDIR)/gcm_self_test-gcm-edid.Tpo -c -o gcm_self_test-gcm-edid.obj `if test -f 'gcm-edid.c'; then $(CYGPATH_W) 'gcm-edid.c'; else $(CYGPATH_W) '$(srcdir)/gcm-edid.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gcm_self_test-gcm-edid.Tpo $(DEPDIR)/gcm_self_test-gcm-edid.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-edid.c' object='gcm_self_test-gcm-edid.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -c -o gcm_self_test-gcm-edid.obj `if test -f 'gcm-edid.c'; then $(CYGPATH_W) 'gcm-edid.c'; else $(CYGPATH_W) '$(srcdir)/gcm-edid.c'; fi` + +gcm_self_test-gcm-self-test.o: gcm-self-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -MT gcm_self_test-gcm-self-test.o -MD -MP -MF $(DEPDIR)/gcm_self_test-gcm-self-test.Tpo -c -o gcm_self_test-gcm-self-test.o `test -f 'gcm-self-test.c' || echo '$(srcdir)/'`gcm-self-test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gcm_self_test-gcm-self-test.Tpo $(DEPDIR)/gcm_self_test-gcm-self-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-self-test.c' object='gcm_self_test-gcm-self-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -c -o gcm_self_test-gcm-self-test.o `test -f 'gcm-self-test.c' || echo '$(srcdir)/'`gcm-self-test.c + +gcm_self_test-gcm-self-test.obj: gcm-self-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -MT gcm_self_test-gcm-self-test.obj -MD -MP -MF $(DEPDIR)/gcm_self_test-gcm-self-test.Tpo -c -o gcm_self_test-gcm-self-test.obj `if test -f 'gcm-self-test.c'; then $(CYGPATH_W) 'gcm-self-test.c'; else $(CYGPATH_W) '$(srcdir)/gcm-self-test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gcm_self_test-gcm-self-test.Tpo $(DEPDIR)/gcm_self_test-gcm-self-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gcm-self-test.c' object='gcm_self_test-gcm-self-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gcm_self_test_CPPFLAGS) $(CPPFLAGS) $(gcm_self_test_CFLAGS) $(CFLAGS) -c -o gcm_self_test-gcm-self-test.obj `if test -f 'gcm-self-test.c'; then $(CYGPATH_W) 'gcm-self-test.c'; else $(CYGPATH_W) '$(srcdir)/gcm-self-test.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-pluginLTLIBRARIES cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/color/color.gnome-settings-plugin.in b/plugins/color/color.gnome-settings-plugin.in new file mode 100644 index 00000000..7f961d48 --- /dev/null +++ b/plugins/color/color.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=color +IAge=0 +_Name=Color +_Description=Color plugin +Authors=Richard Hughes +Copyright=Copyright © 2011 Richard Hughes +Website= diff --git a/plugins/color/gcm-dmi.c b/plugins/color/gcm-dmi.c new file mode 100644 index 00000000..9177f89f --- /dev/null +++ b/plugins/color/gcm-dmi.c @@ -0,0 +1,177 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2009-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "gcm-dmi.h" + +static void gcm_dmi_finalize (GObject *object); + +#define GCM_DMI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCM_TYPE_DMI, GcmDmiPrivate)) + +struct _GcmDmiPrivate +{ + gchar *name; + gchar *version; + gchar *vendor; +}; + +static gpointer gcm_dmi_object = NULL; + +G_DEFINE_TYPE (GcmDmi, gcm_dmi, G_TYPE_OBJECT) + +static gchar * +gcm_dmi_get_from_filename (const gchar *filename) +{ + gboolean ret; + GError *error = NULL; + gchar *data = NULL; + + /* get the contents */ + ret = g_file_get_contents (filename, &data, NULL, &error); + if (!ret) { + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) + g_warning ("failed to get contents of %s: %s", filename, error->message); + g_error_free (error); + } + + /* process the random chars and trailing spaces */ + if (data != NULL) { + g_strdelimit (data, "\t_", ' '); + g_strdelimit (data, "\n\r", '\0'); + g_strchomp (data); + } + + /* don't return an empty string */ + if (data != NULL && data[0] == '\0') { + g_free (data); + data = NULL; + } + + return data; +} + +static gchar * +gcm_dmi_get_from_filenames (const gchar * const * filenames) +{ + guint i; + gchar *tmp = NULL; + + /* try each one in preference order */ + for (i = 0; filenames[i] != NULL; i++) { + tmp = gcm_dmi_get_from_filename (filenames[i]); + if (tmp != NULL) + break; + } + return tmp; +} + +const gchar * +gcm_dmi_get_name (GcmDmi *dmi) +{ + g_return_val_if_fail (GCM_IS_DMI (dmi), NULL); + return dmi->priv->name; +} + +const gchar * +gcm_dmi_get_version (GcmDmi *dmi) +{ + g_return_val_if_fail (GCM_IS_DMI (dmi), NULL); + return dmi->priv->version; +} + +const gchar * +gcm_dmi_get_vendor (GcmDmi *dmi) +{ + g_return_val_if_fail (GCM_IS_DMI (dmi), NULL); + return dmi->priv->vendor; +} + +static void +gcm_dmi_class_init (GcmDmiClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gcm_dmi_finalize; + g_type_class_add_private (klass, sizeof (GcmDmiPrivate)); +} + +static void +gcm_dmi_init (GcmDmi *dmi) +{ +#if defined(__linux__) + const gchar *sysfs_name[] = { + "/sys/class/dmi/id/product_name", + "/sys/class/dmi/id/board_name", + NULL}; + const gchar *sysfs_version[] = { + "/sys/class/dmi/id/product_version", + "/sys/class/dmi/id/chassis_version", + "/sys/class/dmi/id/board_version", + NULL}; + const gchar *sysfs_vendor[] = { + "/sys/class/dmi/id/sys_vendor", + "/sys/class/dmi/id/chassis_vendor", + "/sys/class/dmi/id/board_vendor", + NULL}; +#else +#warning Please add dmi support for your OS + const gchar *sysfs_name[] = { NULL }; + const gchar *sysfs_version[] = { NULL }; + const gchar *sysfs_vendor[] = { NULL }; +#endif + + dmi->priv = GCM_DMI_GET_PRIVATE (dmi); + + /* get all the possible data now */ + dmi->priv->name = gcm_dmi_get_from_filenames (sysfs_name); + dmi->priv->version = gcm_dmi_get_from_filenames (sysfs_version); + dmi->priv->vendor = gcm_dmi_get_from_filenames (sysfs_vendor); +} + +static void +gcm_dmi_finalize (GObject *object) +{ + GcmDmi *dmi = GCM_DMI (object); + + g_free (dmi->priv->name); + g_free (dmi->priv->version); + g_free (dmi->priv->vendor); + + G_OBJECT_CLASS (gcm_dmi_parent_class)->finalize (object); +} + +GcmDmi * +gcm_dmi_new (void) +{ + if (gcm_dmi_object != NULL) { + g_object_ref (gcm_dmi_object); + } else { + gcm_dmi_object = g_object_new (GCM_TYPE_DMI, NULL); + g_object_add_weak_pointer (gcm_dmi_object, &gcm_dmi_object); + } + return GCM_DMI (gcm_dmi_object); +} diff --git a/plugins/color/gcm-dmi.h b/plugins/color/gcm-dmi.h new file mode 100644 index 00000000..5aeb5b72 --- /dev/null +++ b/plugins/color/gcm-dmi.h @@ -0,0 +1,60 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2009-2010 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GCM_DMI_H +#define __GCM_DMI_H + +#include + +G_BEGIN_DECLS + +#define GCM_TYPE_DMI (gcm_dmi_get_type ()) +#define GCM_DMI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GCM_TYPE_DMI, GcmDmi)) +#define GCM_DMI_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GCM_TYPE_DMI, GcmDmiClass)) +#define GCM_IS_DMI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GCM_TYPE_DMI)) +#define GCM_IS_DMI_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GCM_TYPE_DMI)) +#define GCM_DMI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GCM_TYPE_DMI, GcmDmiClass)) + +typedef struct _GcmDmiPrivate GcmDmiPrivate; +typedef struct _GcmDmi GcmDmi; +typedef struct _GcmDmiClass GcmDmiClass; + +struct _GcmDmi +{ + GObject parent; + GcmDmiPrivate *priv; +}; + +struct _GcmDmiClass +{ + GObjectClass parent_class; +}; + +GType gcm_dmi_get_type (void); +GcmDmi *gcm_dmi_new (void); +const gchar *gcm_dmi_get_name (GcmDmi *dmi); +const gchar *gcm_dmi_get_version (GcmDmi *dmi); +const gchar *gcm_dmi_get_vendor (GcmDmi *dmi); + +G_END_DECLS + +#endif /* __GCM_DMI_H */ + diff --git a/plugins/color/gcm-edid.c b/plugins/color/gcm-edid.c new file mode 100644 index 00000000..4f03aa8c --- /dev/null +++ b/plugins/color/gcm-edid.c @@ -0,0 +1,457 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Soren Sandmann + * Copyright (C) 2009-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include "gcm-edid.h" + +static void gcm_edid_finalize (GObject *object); + +#define GCM_EDID_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCM_TYPE_EDID, GcmEdidPrivate)) + +struct _GcmEdidPrivate +{ + gchar *monitor_name; + gchar *vendor_name; + gchar *serial_number; + gchar *eisa_id; + gchar *checksum; + gchar *pnp_id; + guint width; + guint height; + gfloat gamma; + CdColorYxy *red; + CdColorYxy *green; + CdColorYxy *blue; + CdColorYxy *white; + GnomePnpIds *pnp_ids; +}; + +G_DEFINE_TYPE (GcmEdid, gcm_edid, G_TYPE_OBJECT) + +#define GCM_EDID_OFFSET_PNPID 0x08 +#define GCM_EDID_OFFSET_SERIAL 0x0c +#define GCM_EDID_OFFSET_SIZE 0x15 +#define GCM_EDID_OFFSET_GAMMA 0x17 +#define GCM_EDID_OFFSET_DATA_BLOCKS 0x36 +#define GCM_EDID_OFFSET_LAST_BLOCK 0x6c +#define GCM_EDID_OFFSET_EXTENSION_BLOCK_COUNT 0x7e + +#define GCM_DESCRIPTOR_DISPLAY_PRODUCT_NAME 0xfc +#define GCM_DESCRIPTOR_DISPLAY_PRODUCT_SERIAL_NUMBER 0xff +#define GCM_DESCRIPTOR_COLOR_MANAGEMENT_DATA 0xf9 +#define GCM_DESCRIPTOR_ALPHANUMERIC_DATA_STRING 0xfe +#define GCM_DESCRIPTOR_COLOR_POINT 0xfb + +GQuark +gcm_edid_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gcm_edid_error"); + return quark; +} + +const gchar * +gcm_edid_get_monitor_name (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->monitor_name; +} + +const gchar * +gcm_edid_get_vendor_name (GcmEdid *edid) +{ + GcmEdidPrivate *priv = edid->priv; + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + + if (priv->vendor_name == NULL) + priv->vendor_name = gnome_pnp_ids_get_pnp_id (priv->pnp_ids, priv->pnp_id); + return priv->vendor_name; +} + +const gchar * +gcm_edid_get_serial_number (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->serial_number; +} + +const gchar * +gcm_edid_get_eisa_id (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->eisa_id; +} + +const gchar * +gcm_edid_get_checksum (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->checksum; +} + +const gchar * +gcm_edid_get_pnp_id (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->pnp_id; +} + +guint +gcm_edid_get_width (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), 0); + return edid->priv->width; +} + +guint +gcm_edid_get_height (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), 0); + return edid->priv->height; +} + +gfloat +gcm_edid_get_gamma (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), 0.0f); + return edid->priv->gamma; +} + +const CdColorYxy * +gcm_edid_get_red (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->red; +} + +const CdColorYxy * +gcm_edid_get_green (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->green; +} + +const CdColorYxy * +gcm_edid_get_blue (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->blue; +} + +const CdColorYxy * +gcm_edid_get_white (GcmEdid *edid) +{ + g_return_val_if_fail (GCM_IS_EDID (edid), NULL); + return edid->priv->white; +} + +void +gcm_edid_reset (GcmEdid *edid) +{ + GcmEdidPrivate *priv = edid->priv; + + g_return_if_fail (GCM_IS_EDID (edid)); + + /* free old data */ + g_free (priv->monitor_name); + g_free (priv->vendor_name); + g_free (priv->serial_number); + g_free (priv->eisa_id); + g_free (priv->checksum); + + /* do not deallocate, just blank */ + priv->pnp_id[0] = '\0'; + + /* set to default values */ + priv->monitor_name = NULL; + priv->vendor_name = NULL; + priv->serial_number = NULL; + priv->eisa_id = NULL; + priv->checksum = NULL; + priv->width = 0; + priv->height = 0; + priv->gamma = 0.0f; +} + +static gint +gcm_edid_get_bit (gint in, gint bit) +{ + return (in & (1 << bit)) >> bit; +} + +/** + * gcm_edid_get_bits: + **/ +static gint +gcm_edid_get_bits (gint in, gint begin, gint end) +{ + gint mask = (1 << (end - begin + 1)) - 1; + + return (in >> begin) & mask; +} + +/** + * gcm_edid_decode_fraction: + **/ +static gdouble +gcm_edid_decode_fraction (gint high, gint low) +{ + gdouble result = 0.0; + gint i; + + high = (high << 2) | low; + for (i = 0; i < 10; ++i) + result += gcm_edid_get_bit (high, i) * pow (2, i - 10); + return result; +} + +static gchar * +gcm_edid_parse_string (const guint8 *data) +{ + gchar *text; + guint i; + guint replaced = 0; + + /* this is always 12 bytes, but we can't guarantee it's null + * terminated or not junk. */ + text = g_strndup ((const gchar *) data, 12); + + /* remove insane newline chars */ + g_strdelimit (text, "\n\r", '\0'); + + /* remove spaces */ + g_strchomp (text); + + /* nothing left? */ + if (text[0] == '\0') { + g_free (text); + text = NULL; + goto out; + } + + /* ensure string is printable */ + for (i = 0; text[i] != '\0'; i++) { + if (!g_ascii_isprint (text[i])) { + text[i] = '-'; + replaced++; + } + } + + /* if the string is junk, ignore the string */ + if (replaced > 4) { + g_free (text); + text = NULL; + goto out; + } +out: + return text; +} + +gboolean +gcm_edid_parse (GcmEdid *edid, const guint8 *data, gsize length, GError **error) +{ + gboolean ret = TRUE; + guint i; + GcmEdidPrivate *priv = edid->priv; + guint32 serial; + gchar *tmp; + + /* check header */ + if (length < 128) { + g_set_error_literal (error, + GCM_EDID_ERROR, + GCM_EDID_ERROR_FAILED_TO_PARSE, + "EDID length is too small"); + ret = FALSE; + goto out; + } + if (data[0] != 0x00 || data[1] != 0xff) { + g_set_error_literal (error, + GCM_EDID_ERROR, + GCM_EDID_ERROR_FAILED_TO_PARSE, + "Failed to parse EDID header"); + ret = FALSE; + goto out; + } + + /* free old data */ + gcm_edid_reset (edid); + + /* decode the PNP ID from three 5 bit words packed into 2 bytes + * /--08--\/--09--\ + * 7654321076543210 + * |\---/\---/\---/ + * R C1 C2 C3 */ + priv->pnp_id[0] = 'A' + ((data[GCM_EDID_OFFSET_PNPID+0] & 0x7c) / 4) - 1; + priv->pnp_id[1] = 'A' + ((data[GCM_EDID_OFFSET_PNPID+0] & 0x3) * 8) + ((data[GCM_EDID_OFFSET_PNPID+1] & 0xe0) / 32) - 1; + priv->pnp_id[2] = 'A' + (data[GCM_EDID_OFFSET_PNPID+1] & 0x1f) - 1; + + /* maybe there isn't a ASCII serial number descriptor, so use this instead */ + serial = (guint32) data[GCM_EDID_OFFSET_SERIAL+0]; + serial += (guint32) data[GCM_EDID_OFFSET_SERIAL+1] * 0x100; + serial += (guint32) data[GCM_EDID_OFFSET_SERIAL+2] * 0x10000; + serial += (guint32) data[GCM_EDID_OFFSET_SERIAL+3] * 0x1000000; + if (serial > 0) + priv->serial_number = g_strdup_printf ("%" G_GUINT32_FORMAT, serial); + + /* get the size */ + priv->width = data[GCM_EDID_OFFSET_SIZE+0]; + priv->height = data[GCM_EDID_OFFSET_SIZE+1]; + + /* we don't care about aspect */ + if (priv->width == 0 || priv->height == 0) { + priv->width = 0; + priv->height = 0; + } + + /* get gamma */ + if (data[GCM_EDID_OFFSET_GAMMA] == 0xff) { + priv->gamma = 1.0f; + } else { + priv->gamma = ((gfloat) data[GCM_EDID_OFFSET_GAMMA] / 100) + 1; + } + + /* get color red */ + priv->red->x = gcm_edid_decode_fraction (data[0x1b], gcm_edid_get_bits (data[0x19], 6, 7)); + priv->red->y = gcm_edid_decode_fraction (data[0x1c], gcm_edid_get_bits (data[0x19], 5, 4)); + + /* get color green */ + priv->green->x = gcm_edid_decode_fraction (data[0x1d], gcm_edid_get_bits (data[0x19], 2, 3)); + priv->green->y = gcm_edid_decode_fraction (data[0x1e], gcm_edid_get_bits (data[0x19], 0, 1)); + + /* get color blue */ + priv->blue->x = gcm_edid_decode_fraction (data[0x1f], gcm_edid_get_bits (data[0x1a], 6, 7)); + priv->blue->y = gcm_edid_decode_fraction (data[0x20], gcm_edid_get_bits (data[0x1a], 4, 5)); + + /* get color white */ + priv->white->x = gcm_edid_decode_fraction (data[0x21], gcm_edid_get_bits (data[0x1a], 2, 3)); + priv->white->y = gcm_edid_decode_fraction (data[0x22], gcm_edid_get_bits (data[0x1a], 0, 1)); + + /* parse EDID data */ + for (i = GCM_EDID_OFFSET_DATA_BLOCKS; + i <= GCM_EDID_OFFSET_LAST_BLOCK; + i += 18) { + /* ignore pixel clock data */ + if (data[i] != 0) + continue; + if (data[i+2] != 0) + continue; + + /* any useful blocks? */ + if (data[i+3] == GCM_DESCRIPTOR_DISPLAY_PRODUCT_NAME) { + tmp = gcm_edid_parse_string (&data[i+5]); + if (tmp != NULL) { + g_free (priv->monitor_name); + priv->monitor_name = tmp; + } + } else if (data[i+3] == GCM_DESCRIPTOR_DISPLAY_PRODUCT_SERIAL_NUMBER) { + tmp = gcm_edid_parse_string (&data[i+5]); + if (tmp != NULL) { + g_free (priv->serial_number); + priv->serial_number = tmp; + } + } else if (data[i+3] == GCM_DESCRIPTOR_COLOR_MANAGEMENT_DATA) { + g_warning ("failing to parse color management data"); + } else if (data[i+3] == GCM_DESCRIPTOR_ALPHANUMERIC_DATA_STRING) { + tmp = gcm_edid_parse_string (&data[i+5]); + if (tmp != NULL) { + g_free (priv->eisa_id); + priv->eisa_id = tmp; + } + } else if (data[i+3] == GCM_DESCRIPTOR_COLOR_POINT) { + if (data[i+3+9] != 0xff) { + /* extended EDID block(1) which contains + * a better gamma value */ + priv->gamma = ((gfloat) data[i+3+9] / 100) + 1; + } + if (data[i+3+14] != 0xff) { + /* extended EDID block(2) which contains + * a better gamma value */ + priv->gamma = ((gfloat) data[i+3+9] / 100) + 1; + } + } + } + + /* calculate checksum */ + priv->checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5, data, length); +out: + return ret; +} + +static void +gcm_edid_class_init (GcmEdidClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gcm_edid_finalize; + g_type_class_add_private (klass, sizeof (GcmEdidPrivate)); +} + +static void +gcm_edid_init (GcmEdid *edid) +{ + edid->priv = GCM_EDID_GET_PRIVATE (edid); + edid->priv->pnp_ids = gnome_pnp_ids_new (); + edid->priv->pnp_id = g_new0 (gchar, 4); + edid->priv->red = cd_color_yxy_new (); + edid->priv->green = cd_color_yxy_new (); + edid->priv->blue = cd_color_yxy_new (); + edid->priv->white = cd_color_yxy_new (); +} + +static void +gcm_edid_finalize (GObject *object) +{ + GcmEdid *edid = GCM_EDID (object); + GcmEdidPrivate *priv = edid->priv; + + g_free (priv->monitor_name); + g_free (priv->vendor_name); + g_free (priv->serial_number); + g_free (priv->eisa_id); + g_free (priv->checksum); + g_free (priv->pnp_id); + cd_color_yxy_free (priv->white); + cd_color_yxy_free (priv->red); + cd_color_yxy_free (priv->green); + cd_color_yxy_free (priv->blue); + g_object_unref (priv->pnp_ids); + + G_OBJECT_CLASS (gcm_edid_parent_class)->finalize (object); +} + +GcmEdid * +gcm_edid_new (void) +{ + GcmEdid *edid; + edid = g_object_new (GCM_TYPE_EDID, NULL); + return GCM_EDID (edid); +} + diff --git a/plugins/color/gcm-edid.h b/plugins/color/gcm-edid.h new file mode 100644 index 00000000..5eff73c9 --- /dev/null +++ b/plugins/color/gcm-edid.h @@ -0,0 +1,83 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2009-2010 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GCM_EDID_H +#define __GCM_EDID_H + +#include +#include + +G_BEGIN_DECLS + +#define GCM_TYPE_EDID (gcm_edid_get_type ()) +#define GCM_EDID(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GCM_TYPE_EDID, GcmEdid)) +#define GCM_EDID_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GCM_TYPE_EDID, GcmEdidClass)) +#define GCM_IS_EDID(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GCM_TYPE_EDID)) +#define GCM_IS_EDID_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GCM_TYPE_EDID)) +#define GCM_EDID_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GCM_TYPE_EDID, GcmEdidClass)) +#define GCM_EDID_ERROR (gcm_edid_error_quark ()) + +typedef struct _GcmEdidPrivate GcmEdidPrivate; +typedef struct _GcmEdid GcmEdid; +typedef struct _GcmEdidClass GcmEdidClass; + +struct _GcmEdid +{ + GObject parent; + GcmEdidPrivate *priv; +}; + +struct _GcmEdidClass +{ + GObjectClass parent_class; +}; + +enum +{ + GCM_EDID_ERROR_FAILED_TO_PARSE +}; + +GType gcm_edid_get_type (void); +GQuark gcm_edid_error_quark (void); +GcmEdid *gcm_edid_new (void); +void gcm_edid_reset (GcmEdid *edid); +gboolean gcm_edid_parse (GcmEdid *edid, + const guint8 *data, + gsize length, + GError **error); +const gchar *gcm_edid_get_monitor_name (GcmEdid *edid); +const gchar *gcm_edid_get_vendor_name (GcmEdid *edid); +const gchar *gcm_edid_get_serial_number (GcmEdid *edid); +const gchar *gcm_edid_get_eisa_id (GcmEdid *edid); +const gchar *gcm_edid_get_checksum (GcmEdid *edid); +const gchar *gcm_edid_get_pnp_id (GcmEdid *edid); +guint gcm_edid_get_width (GcmEdid *edid); +guint gcm_edid_get_height (GcmEdid *edid); +gfloat gcm_edid_get_gamma (GcmEdid *edid); +const CdColorYxy *gcm_edid_get_red (GcmEdid *edid); +const CdColorYxy *gcm_edid_get_green (GcmEdid *edid); +const CdColorYxy *gcm_edid_get_blue (GcmEdid *edid); +const CdColorYxy *gcm_edid_get_white (GcmEdid *edid); + +G_END_DECLS + +#endif /* __GCM_EDID_H */ + diff --git a/plugins/color/gcm-profile-store.c b/plugins/color/gcm-profile-store.c new file mode 100644 index 00000000..ee819253 --- /dev/null +++ b/plugins/color/gcm-profile-store.c @@ -0,0 +1,514 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2009-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include + +#include "gcm-profile-store.h" + +static void gcm_profile_store_finalize (GObject *object); + +#define GCM_PROFILE_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCM_TYPE_PROFILE_STORE, GcmProfileStorePrivate)) + +struct _GcmProfileStorePrivate +{ + GPtrArray *filename_array; + GPtrArray *directory_array; + GCancellable *cancellable; +}; + +enum { + SIGNAL_ADDED, + SIGNAL_REMOVED, + SIGNAL_CHANGED, + SIGNAL_LAST +}; + +static guint signals[SIGNAL_LAST] = { 0 }; + +G_DEFINE_TYPE (GcmProfileStore, gcm_profile_store, G_TYPE_OBJECT) + +static void gcm_profile_store_search_path (GcmProfileStore *profile_store, const gchar *path, guint depth); +static void gcm_profile_store_process_child (GcmProfileStore *profile_store, const gchar *path, GFileInfo *info); + +#define GCM_PROFILE_STORE_MAX_RECURSION_LEVELS 2 + +typedef struct { + gchar *path; + GFileMonitor *monitor; + guint depth; +} GcmProfileStoreDirHelper; + +static void +gcm_profile_store_helper_free (GcmProfileStoreDirHelper *helper) +{ + g_free (helper->path); + if (helper->monitor != NULL) + g_object_unref (helper->monitor); + g_free (helper); +} + +static const gchar * +gcm_profile_store_find_filename (GcmProfileStore *profile_store, const gchar *filename) +{ + const gchar *tmp; + guint i; + GPtrArray *array = profile_store->priv->filename_array; + + for (i=0; ilen; i++) { + tmp = g_ptr_array_index (array, i); + if (g_strcmp0 (filename, tmp) == 0) + return tmp; + } + return NULL; +} + +static GcmProfileStoreDirHelper * +gcm_profile_store_find_directory (GcmProfileStore *profile_store, const gchar *path) +{ + GcmProfileStoreDirHelper *tmp; + guint i; + GPtrArray *array = profile_store->priv->directory_array; + + for (i=0; ilen; i++) { + tmp = g_ptr_array_index (array, i); + if (g_strcmp0 (path, tmp->path) == 0) + return tmp; + } + return NULL; +} + +static gboolean +gcm_profile_store_remove_profile (GcmProfileStore *profile_store, + const gchar *filename) +{ + gboolean ret = FALSE; + const gchar *tmp; + gchar *filename_dup = NULL; + + GcmProfileStorePrivate *priv = profile_store->priv; + + /* find exact pointer */ + tmp = gcm_profile_store_find_filename (profile_store, filename); + if (tmp == NULL) + goto out; + + /* dup so we can emit the signal */ + filename_dup = g_strdup (tmp); + ret = g_ptr_array_remove (priv->filename_array, (gpointer)tmp); + if (!ret) { + g_warning ("failed to remove %s", filename); + goto out; + } + + /* emit a signal */ + g_debug ("emit removed: %s", filename_dup); + g_signal_emit (profile_store, signals[SIGNAL_REMOVED], 0, filename_dup); +out: + g_free (filename_dup); + return ret; +} + +static void +gcm_profile_store_add_profile (GcmProfileStore *profile_store, const gchar *filename) +{ + GcmProfileStorePrivate *priv = profile_store->priv; + + /* add to list */ + g_ptr_array_add (priv->filename_array, g_strdup (filename)); + + /* emit a signal */ + g_debug ("emit add: %s", filename); + g_signal_emit (profile_store, signals[SIGNAL_ADDED], 0, filename); +} + +static void +gcm_profile_store_created_query_info_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GFileInfo *info; + GError *error = NULL; + gchar *path; + GFile *file = G_FILE (source_object); + GFile *parent; + GcmProfileStore *profile_store = GCM_PROFILE_STORE (user_data); + + info = g_file_query_info_finish (file, res, &error); + if (info == NULL) { + g_warning ("failed to get info about deleted file: %s", + error->message); + g_error_free (error); + return; + } + parent = g_file_get_parent (file); + path = g_file_get_path (parent); + gcm_profile_store_process_child (profile_store, + path, + info); + g_free (path); + g_object_unref (info); + g_object_unref (parent); +} + +static void +gcm_profile_store_remove_from_prefix (GcmProfileStore *profile_store, + const gchar *prefix) +{ + guint i; + const gchar *path; + GcmProfileStorePrivate *priv = profile_store->priv; + + for (i = 0; i < priv->filename_array->len; i++) { + path = g_ptr_array_index (priv->filename_array, i); + if (g_str_has_prefix (path, prefix)) { + g_debug ("auto-removed %s as path removed", path); + gcm_profile_store_remove_profile (profile_store, path); + } + } +} + +static void +gcm_profile_store_file_monitor_changed_cb (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + GcmProfileStore *profile_store) +{ + gchar *path = NULL; + gchar *parent_path = NULL; + const gchar *tmp; + GcmProfileStoreDirHelper *helper; + + /* profile was deleted */ + if (event_type == G_FILE_MONITOR_EVENT_DELETED) { + + /* we can either have two things here, a directory or a + * file. We can't call g_file_query_info_async() as the + * inode doesn't exist anymore */ + path = g_file_get_path (file); + tmp = gcm_profile_store_find_filename (profile_store, path); + if (tmp != NULL) { + /* is a file */ + gcm_profile_store_remove_profile (profile_store, path); + goto out; + } + + /* is a directory, urgh. Remove all profiles there. */ + gcm_profile_store_remove_from_prefix (profile_store, path); + helper = gcm_profile_store_find_directory (profile_store, path); + if (helper != NULL) { + g_ptr_array_remove (profile_store->priv->directory_array, + helper); + } + goto out; + } + + /* only care about created objects */ + if (event_type == G_FILE_MONITOR_EVENT_CREATED) { + g_file_query_info_async (file, + G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_STANDARD_TYPE, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + G_PRIORITY_LOW, + NULL, + gcm_profile_store_created_query_info_cb, + profile_store); + goto out; + } +out: + g_free (path); + g_free (parent_path); +} + +static void +gcm_profile_store_process_child (GcmProfileStore *profile_store, + const gchar *path, + GFileInfo *info) +{ + gchar *full_path = NULL; + const gchar *name; + GcmProfileStoreDirHelper *helper; + + /* check we're not in a loop */ + helper = gcm_profile_store_find_directory (profile_store, path); + if (helper == NULL) + goto out; + if (helper->depth > GCM_PROFILE_STORE_MAX_RECURSION_LEVELS) { + g_warning ("recursing more than %i levels deep is insane", + GCM_PROFILE_STORE_MAX_RECURSION_LEVELS); + goto out; + } + + /* make the compete path */ + name = g_file_info_get_name (info); + full_path = g_build_filename (path, name, NULL); + + /* if a directory */ + if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) { + gcm_profile_store_search_path (profile_store, + full_path, + helper->depth + 1); + goto out; + } + + /* ignore temp files */ + if (g_strrstr (full_path, ".goutputstream") != NULL) { + g_debug ("ignoring gvfs temporary file"); + goto out; + } + + /* is a file */ + gcm_profile_store_add_profile (profile_store, full_path); +out: + g_free (full_path); +} + +static void +gcm_profile_store_next_files_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GList *files; + GList *f; + GError *error = NULL; + GFileInfo *info; + GFile *file; + gchar *path; + GFileEnumerator *enumerator = G_FILE_ENUMERATOR (source_object); + GcmProfileStore *profile_store = GCM_PROFILE_STORE (user_data); + + files = g_file_enumerator_next_files_finish (enumerator, + res, + &error); + if (files == NULL) { + /* special value, meaning "no more files to process" */ + return; + } + if (error != NULL) { + g_warning ("failed to get data about enumerated directory: %s", + error->message); + g_error_free (error); + return; + } + + /* get each file */ + file = g_file_enumerator_get_container (enumerator); + path = g_file_get_path (file); + for (f = files; f != NULL; f = f->next) { + info = G_FILE_INFO (f->data); + gcm_profile_store_process_child (profile_store, path, info); + } + + /* continue to get the rest of the data in chunks */ + g_file_enumerator_next_files_async (enumerator, + 5, + G_PRIORITY_LOW, + profile_store->priv->cancellable, + gcm_profile_store_next_files_cb, + user_data); + + g_free (path); + g_list_foreach (files, (GFunc) g_object_unref, NULL); + g_list_free (files); +} + +static void +gcm_profile_store_enumerate_children_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GFileEnumerator *enumerator; + GcmProfileStore *profile_store = GCM_PROFILE_STORE (user_data); + + enumerator = g_file_enumerate_children_finish (G_FILE (source_object), + res, + &error); + if (enumerator == NULL) { + GcmProfileStoreDirHelper *helper; + gchar *path = NULL; + + path = g_file_get_path (G_FILE (source_object)); + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) + g_debug ("failed to enumerate directory %s: %s", + path, error->message); + else + g_warning ("failed to enumerate directory %s: %s", + path, error->message); + helper = gcm_profile_store_find_directory (profile_store, path); + if (helper) + g_ptr_array_remove (profile_store->priv->directory_array, helper); + g_error_free (error); + g_free (path); + return; + } + + /* get the first chunk of data */ + g_file_enumerator_next_files_async (enumerator, + 5, + G_PRIORITY_LOW, + profile_store->priv->cancellable, + gcm_profile_store_next_files_cb, + user_data); + g_object_unref (enumerator); +} + +static void +gcm_profile_store_search_path (GcmProfileStore *profile_store, const gchar *path, guint depth) +{ + GFile *file = NULL; + GError *error = NULL; + GcmProfileStoreDirHelper *helper; + + file = g_file_new_for_path (path); + + /* add an inotify watch if not already added */ + helper = gcm_profile_store_find_directory (profile_store, path); + if (helper == NULL) { + helper = g_new0 (GcmProfileStoreDirHelper, 1); + helper->depth = depth; + helper->path = g_strdup (path); + helper->monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, &error); + if (helper->monitor == NULL) { + g_debug ("failed to monitor path: %s", error->message); + g_error_free (error); + gcm_profile_store_helper_free (helper); + goto out; + } + g_signal_connect (helper->monitor, "changed", + G_CALLBACK(gcm_profile_store_file_monitor_changed_cb), + profile_store); + g_ptr_array_add (profile_store->priv->directory_array, helper); + } + + /* get contents of directory */ + g_file_enumerate_children_async (file, + G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_STANDARD_TYPE, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + G_PRIORITY_LOW, + profile_store->priv->cancellable, + gcm_profile_store_enumerate_children_cb, + profile_store); +out: + g_object_unref (file); +} + +static gboolean +gcm_profile_store_mkdir_with_parents (const gchar *filename, + GCancellable *cancellable, + GError **error) +{ + gboolean ret; + GFile *file; + + /* ensure destination exists */ + file = g_file_new_for_path (filename); + ret = g_file_make_directory_with_parents (file, cancellable, error); + g_object_unref (file); + + return ret; +} + +gboolean +gcm_profile_store_search (GcmProfileStore *profile_store) +{ + gchar *path; + gboolean ret; + GError *error = NULL; + + /* get Linux per-user profiles */ + path = g_build_filename (g_get_user_data_dir (), "icc", NULL); + ret = gcm_profile_store_mkdir_with_parents (path, + profile_store->priv->cancellable, + &error); + if (!ret && + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) { + g_warning ("failed to create directory on startup: %s", error->message); + } else { + gcm_profile_store_search_path (profile_store, path, 0); + } + g_free (path); + g_clear_error (&error); + + /* get per-user profiles from obsolete location */ + path = g_build_filename (g_get_home_dir (), ".color", "icc", NULL); + gcm_profile_store_search_path (profile_store, path, 0); + g_free (path); + return TRUE; +} + +static void +gcm_profile_store_class_init (GcmProfileStoreClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gcm_profile_store_finalize; + + signals[SIGNAL_ADDED] = + g_signal_new ("added", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GcmProfileStoreClass, added), + NULL, NULL, g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); + signals[SIGNAL_REMOVED] = + g_signal_new ("removed", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GcmProfileStoreClass, removed), + NULL, NULL, g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); + + g_type_class_add_private (klass, sizeof (GcmProfileStorePrivate)); +} + +static void +gcm_profile_store_init (GcmProfileStore *profile_store) +{ + profile_store->priv = GCM_PROFILE_STORE_GET_PRIVATE (profile_store); + profile_store->priv->cancellable = g_cancellable_new (); + profile_store->priv->filename_array = g_ptr_array_new_with_free_func (g_free); + profile_store->priv->directory_array = g_ptr_array_new_with_free_func ((GDestroyNotify) gcm_profile_store_helper_free); +} + +static void +gcm_profile_store_finalize (GObject *object) +{ + GcmProfileStore *profile_store = GCM_PROFILE_STORE (object); + GcmProfileStorePrivate *priv = profile_store->priv; + + g_cancellable_cancel (profile_store->priv->cancellable); + g_object_unref (profile_store->priv->cancellable); + g_ptr_array_unref (priv->filename_array); + g_ptr_array_unref (priv->directory_array); + + G_OBJECT_CLASS (gcm_profile_store_parent_class)->finalize (object); +} + +GcmProfileStore * +gcm_profile_store_new (void) +{ + GcmProfileStore *profile_store; + profile_store = g_object_new (GCM_TYPE_PROFILE_STORE, NULL); + return GCM_PROFILE_STORE (profile_store); +} + diff --git a/plugins/color/gcm-profile-store.h b/plugins/color/gcm-profile-store.h new file mode 100644 index 00000000..095bcf01 --- /dev/null +++ b/plugins/color/gcm-profile-store.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2009-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GCM_PROFILE_STORE_H +#define __GCM_PROFILE_STORE_H + +#include + +G_BEGIN_DECLS + +#define GCM_TYPE_PROFILE_STORE (gcm_profile_store_get_type ()) +#define GCM_PROFILE_STORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GCM_TYPE_PROFILE_STORE, GcmProfileStore)) +#define GCM_PROFILE_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GCM_TYPE_PROFILE_STORE, GcmProfileStoreClass)) +#define GCM_IS_PROFILE_STORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GCM_TYPE_PROFILE_STORE)) +#define GCM_IS_PROFILE_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GCM_TYPE_PROFILE_STORE)) +#define GCM_PROFILE_STORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GCM_TYPE_PROFILE_STORE, GcmProfileStoreClass)) + +typedef struct _GcmProfileStorePrivate GcmProfileStorePrivate; +typedef struct _GcmProfileStore GcmProfileStore; +typedef struct _GcmProfileStoreClass GcmProfileStoreClass; + +struct _GcmProfileStore +{ + GObject parent; + GcmProfileStorePrivate *priv; +}; + +struct _GcmProfileStoreClass +{ + GObjectClass parent_class; + void (* added) (const gchar *filename); + void (* removed) (const gchar *filename); +}; + +GType gcm_profile_store_get_type (void); +GcmProfileStore *gcm_profile_store_new (void); +gboolean gcm_profile_store_search (GcmProfileStore *profile_store); + +G_END_DECLS + +#endif /* __GCM_PROFILE_STORE_H */ diff --git a/plugins/color/gcm-self-test.c b/plugins/color/gcm-self-test.c new file mode 100644 index 00000000..aa3345ec --- /dev/null +++ b/plugins/color/gcm-self-test.c @@ -0,0 +1,111 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "gcm-edid.h" +#include "gcm-dmi.h" + +static void +gcm_test_dmi_func (void) +{ + GcmDmi *dmi; + + dmi = gcm_dmi_new (); + g_assert (dmi != NULL); + g_assert (gcm_dmi_get_name (dmi) != NULL); + g_assert (gcm_dmi_get_vendor (dmi) != NULL); + g_object_unref (dmi); +} + +static void +gcm_test_edid_func (void) +{ + GcmEdid *edid; + gchar *data; + gboolean ret; + GError *error = NULL; + gsize length = 0; + + edid = gcm_edid_new (); + g_assert (edid != NULL); + + /* LG 21" LCD panel */ + ret = g_file_get_contents (TESTDATADIR "/LG-L225W-External.bin", + &data, &length, &error); + g_assert_no_error (error); + g_assert (ret); + ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error); + g_assert_no_error (error); + g_assert (ret); + + g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, "L225W"); + g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, "Goldstar Company Ltd"); + g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, "34398"); + g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, NULL); + g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, "0bb44865bb29984a4bae620656c31368"); + g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, "GSM"); + g_assert_cmpint (gcm_edid_get_height (edid), ==, 30); + g_assert_cmpint (gcm_edid_get_width (edid), ==, 47); + g_assert_cmpfloat (gcm_edid_get_gamma (edid), >=, 2.2f - 0.01); + g_assert_cmpfloat (gcm_edid_get_gamma (edid), <, 2.2f + 0.01); + g_free (data); + + /* Lenovo T61 internal Panel */ + ret = g_file_get_contents (TESTDATADIR "/Lenovo-T61-Internal.bin", + &data, &length, &error); + g_assert_no_error (error); + g_assert (ret); + ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error); + g_assert_no_error (error); + g_assert (ret); + + g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, NULL); + g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, "IBM France"); + g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, NULL); + g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, "LTN154P2-L05"); + g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, "e1865128c7cd5e5ed49ecfc8102f6f9c"); + g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, "IBM"); + g_assert_cmpint (gcm_edid_get_height (edid), ==, 21); + g_assert_cmpint (gcm_edid_get_width (edid), ==, 33); + g_assert_cmpfloat (gcm_edid_get_gamma (edid), >=, 2.2f - 0.01); + g_assert_cmpfloat (gcm_edid_get_gamma (edid), <, 2.2f + 0.01); + g_free (data); + + g_object_unref (edid); +} + +int +main (int argc, char **argv) +{ + gtk_init (&argc, &argv); + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/color/dmi", gcm_test_dmi_func); + g_test_add_func ("/color/edid", gcm_test_edid_func); + + return g_test_run (); +} + diff --git a/plugins/color/gsd-color-manager.c b/plugins/color/gsd-color-manager.c new file mode 100644 index 00000000..22d5c0df --- /dev/null +++ b/plugins/color/gsd-color-manager.c @@ -0,0 +1,2358 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * + * 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 +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-color-manager.h" +#include "gcm-profile-store.h" +#include "gcm-dmi.h" +#include "gcm-edid.h" + +#define GSD_COLOR_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_COLOR_MANAGER, GsdColorManagerPrivate)) + +#define GCM_SESSION_NOTIFY_TIMEOUT 30000 /* ms */ +#define GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD "recalibrate-printer-threshold" +#define GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD "recalibrate-display-threshold" + +struct GsdColorManagerPrivate +{ + GnomeSettingsSession *session; + CdClient *client; + GSettings *settings; + GcmProfileStore *profile_store; + GcmDmi *dmi; + GnomeRRScreen *x11_screen; + GHashTable *edid_cache; + GdkWindow *gdk_window; + GnomeSettingsSessionState session_state; + GHashTable *device_assign_hash; +}; + +enum { + PROP_0, +}; + +static void gsd_color_manager_class_init (GsdColorManagerClass *klass); +static void gsd_color_manager_init (GsdColorManager *color_manager); +static void gsd_color_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdColorManager, gsd_color_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +/* see http://www.oyranos.org/wiki/index.php?title=ICC_Profiles_in_X_Specification_0.3 */ +#define GCM_ICC_PROFILE_IN_X_VERSION_MAJOR 0 +#define GCM_ICC_PROFILE_IN_X_VERSION_MINOR 3 + +typedef struct { + guint32 red; + guint32 green; + guint32 blue; +} GnomeRROutputClutItem; + +GQuark +gsd_color_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_color_manager_error"); + return quark; +} + +static GcmEdid * +gcm_session_get_output_edid (GsdColorManager *manager, GnomeRROutput *output, GError **error) +{ + const guint8 *data; + gsize size; + GcmEdid *edid = NULL; + gboolean ret; + + /* can we find it in the cache */ + edid = g_hash_table_lookup (manager->priv->edid_cache, + gnome_rr_output_get_name (output)); + if (edid != NULL) { + g_object_ref (edid); + goto out; + } + + /* parse edid */ + data = gnome_rr_output_get_edid_data (output, &size); + if (data == NULL || size == 0) { + g_set_error_literal (error, + GNOME_RR_ERROR, + GNOME_RR_ERROR_UNKNOWN, + "unable to get EDID for output"); + goto out; + } + edid = gcm_edid_new (); + ret = gcm_edid_parse (edid, data, size, error); + if (!ret) { + g_object_unref (edid); + edid = NULL; + goto out; + } + + /* add to cache */ + g_hash_table_insert (manager->priv->edid_cache, + g_strdup (gnome_rr_output_get_name (output)), + g_object_ref (edid)); +out: + return edid; +} + +static gboolean +gcm_session_screen_set_icc_profile (GsdColorManager *manager, + const gchar *filename, + GError **error) +{ + gboolean ret; + gchar *data = NULL; + gsize length; + guint version_data; + GsdColorManagerPrivate *priv = manager->priv; + + g_return_val_if_fail (filename != NULL, FALSE); + + g_debug ("setting root window ICC profile atom from %s", filename); + + /* get contents of file */ + ret = g_file_get_contents (filename, &data, &length, error); + if (!ret) + goto out; + + /* set profile property */ + gdk_property_change (priv->gdk_window, + gdk_atom_intern_static_string ("_ICC_PROFILE"), + gdk_atom_intern_static_string ("CARDINAL"), + 8, + GDK_PROP_MODE_REPLACE, + (const guchar *) data, length); + + /* set version property */ + version_data = GCM_ICC_PROFILE_IN_X_VERSION_MAJOR * 100 + + GCM_ICC_PROFILE_IN_X_VERSION_MINOR * 1; + gdk_property_change (priv->gdk_window, + gdk_atom_intern_static_string ("_ICC_PROFILE_IN_X_VERSION"), + gdk_atom_intern_static_string ("CARDINAL"), + 8, + GDK_PROP_MODE_REPLACE, + (const guchar *) &version_data, 1); +out: + g_free (data); + return ret; +} + +static gchar * +gcm_session_get_output_id (GsdColorManager *manager, GnomeRROutput *output) +{ + const gchar *name; + const gchar *serial; + const gchar *vendor; + GcmEdid *edid = NULL; + GString *device_id; + GError *error = NULL; + + /* all output devices are prefixed with this */ + device_id = g_string_new ("xrandr"); + + /* get the output EDID if possible */ + edid = gcm_session_get_output_edid (manager, output, &error); + if (edid == NULL) { + g_debug ("no edid for %s [%s], falling back to connection name", + gnome_rr_output_get_name (output), + error->message); + g_error_free (error); + g_string_append_printf (device_id, + "-%s", + gnome_rr_output_get_name (output)); + goto out; + } + + /* check EDID data is okay to use */ + vendor = gcm_edid_get_vendor_name (edid); + name = gcm_edid_get_monitor_name (edid); + serial = gcm_edid_get_serial_number (edid); + if (vendor == NULL && name == NULL && serial == NULL) { + g_debug ("edid invalid for %s, falling back to connection name", + gnome_rr_output_get_name (output)); + g_string_append_printf (device_id, + "-%s", + gnome_rr_output_get_name (output)); + goto out; + } + + /* use EDID data */ + if (vendor != NULL) + g_string_append_printf (device_id, "-%s", vendor); + if (name != NULL) + g_string_append_printf (device_id, "-%s", name); + if (serial != NULL) + g_string_append_printf (device_id, "-%s", serial); +out: + if (edid != NULL) + g_object_unref (edid); + return g_string_free (device_id, FALSE); +} + +static GnomeRROutput * +gcm_session_get_output_by_edid_checksum (GnomeRRScreen *screen, + const gchar *edid_md5, + GError **error) +{ + const guint8 *data; + gchar *checksum; + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + gsize size; + guint i; + + outputs = gnome_rr_screen_list_outputs (screen); + if (outputs == NULL) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "Failed to get outputs"); + goto out; + } + + /* find the output */ + for (i = 0; outputs[i] != NULL && output == NULL; i++) { + + /* get edid */ + data = gnome_rr_output_get_edid_data (outputs[i], &size); + if (data == NULL || size < 0x6c) + continue; + checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5, data, 0x6c); + if (g_strcmp0 (checksum, edid_md5) == 0) + output = outputs[i]; + g_free (checksum); + } + if (output == NULL) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "no connected output with that edid hash"); + } +out: + return output; +} + +typedef struct { + GsdColorManager *manager; + CdProfile *profile; + CdDevice *device; + guint32 output_id; +} GcmSessionAsyncHelper; + +static void +gcm_session_async_helper_free (GcmSessionAsyncHelper *helper) +{ + if (helper->manager != NULL) + g_object_unref (helper->manager); + if (helper->profile != NULL) + g_object_unref (helper->profile); + if (helper->device != NULL) + g_object_unref (helper->device); + g_free (helper); +} + +static void +gcm_session_profile_assign_add_profile_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdDevice *device = CD_DEVICE (object); + gboolean ret; + GError *error = NULL; + GcmSessionAsyncHelper *helper = (GcmSessionAsyncHelper *) user_data; + + /* add the profile to the device */ + ret = cd_device_add_profile_finish (device, + res, + &error); + if (!ret) { + /* this will fail if the profile is already added */ + g_debug ("failed to assign auto-edid profile to device %s: %s", + cd_device_get_id (device), + error->message); + g_error_free (error); + goto out; + } + + /* phew! */ + g_debug ("successfully assigned %s to %s", + cd_profile_get_object_path (helper->profile), + cd_device_get_object_path (device)); +out: + gcm_session_async_helper_free (helper); +} + +static void +gcm_session_profile_assign_device_connect_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdDevice *device = CD_DEVICE (object); + gboolean ret; + GError *error = NULL; + GcmSessionAsyncHelper *helper = (GcmSessionAsyncHelper *) user_data; + + /* get properties */ + ret = cd_device_connect_finish (device, res, &error); + if (!ret) { + g_warning ("cannot connect to device: %s", + error->message); + g_error_free (error); + gcm_session_async_helper_free (helper); + goto out; + } + + /* add the profile to the device */ + cd_device_add_profile (device, + CD_DEVICE_RELATION_SOFT, + helper->profile, + NULL, + gcm_session_profile_assign_add_profile_cb, + helper); +out: + return; +} + +static void +gcm_session_profile_assign_find_device_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdClient *client = CD_CLIENT (object); + CdDevice *device = NULL; + GcmSessionAsyncHelper *helper = (GcmSessionAsyncHelper *) user_data; + GError *error = NULL; + + device = cd_client_find_device_finish (client, + res, + &error); + if (device == NULL) { + g_warning ("not found device which should have been added: %s", + error->message); + g_error_free (error); + gcm_session_async_helper_free (helper); + goto out; + } + + /* get properties */ + cd_device_connect (device, + NULL, + gcm_session_profile_assign_device_connect_cb, + helper); +out: + if (device != NULL) + g_object_unref (device); +} + +static void +gcm_session_profile_assign_profile_connect_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdProfile *profile = CD_PROFILE (object); + const gchar *edid_md5; + gboolean ret; + gchar *device_id = NULL; + GcmSessionAsyncHelper *helper; + GError *error = NULL; + GHashTable *metadata = NULL; + GnomeRROutput *output = NULL; + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + + /* get properties */ + ret = cd_profile_connect_finish (profile, res, &error); + if (!ret) { + g_warning ("cannot connect to profile: %s", + error->message); + g_error_free (error); + goto out; + } + + /* does the profile have EDID metadata? */ + metadata = cd_profile_get_metadata (profile); + edid_md5 = g_hash_table_lookup (metadata, + CD_PROFILE_METADATA_EDID_MD5); + if (edid_md5 == NULL) + goto out; + + /* get the GnomeRROutput for the edid */ + output = gcm_session_get_output_by_edid_checksum (manager->priv->x11_screen, + edid_md5, + &error); + if (output == NULL) { + g_debug ("edid hash %s ignored: %s", + edid_md5, + error->message); + g_error_free (error); + goto out; + } + + /* get the CdDevice for this ID */ + helper = g_new0 (GcmSessionAsyncHelper, 1); + helper->manager = g_object_ref (manager); + helper->profile = g_object_ref (profile); + device_id = gcm_session_get_output_id (manager, output); + cd_client_find_device (manager->priv->client, + device_id, + NULL, + gcm_session_profile_assign_find_device_cb, + helper); +out: + g_free (device_id); + if (metadata != NULL) + g_hash_table_unref (metadata); +} + +static void +gcm_session_profile_added_assign_cb (CdClient *client, + CdProfile *profile, + GsdColorManager *manager) +{ + cd_profile_connect (profile, + NULL, + gcm_session_profile_assign_profile_connect_cb, + manager); +} + +static cmsBool +_cmsWriteTagTextAscii (cmsHPROFILE lcms_profile, + cmsTagSignature sig, + const gchar *text) +{ + cmsBool ret; + cmsMLU *mlu = cmsMLUalloc (0, 1); + cmsMLUsetASCII (mlu, "EN", "us", text); + ret = cmsWriteTag (lcms_profile, sig, mlu); + cmsMLUfree (mlu); + return ret; +} + +static gboolean +gcm_utils_mkdir_for_filename (const gchar *filename, GError **error) +{ + gboolean ret = FALSE; + GFile *file; + GFile *parent_dir = NULL; + + /* get parent directory */ + file = g_file_new_for_path (filename); + parent_dir = g_file_get_parent (file); + if (parent_dir == NULL) { + g_set_error (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "could not get parent dir %s", + filename); + goto out; + } + + /* ensure desination does not already exist */ + ret = g_file_query_exists (parent_dir, NULL); + if (ret) + goto out; + ret = g_file_make_directory_with_parents (parent_dir, NULL, error); + if (!ret) + goto out; +out: + if (file != NULL) + g_object_unref (file); + if (parent_dir != NULL) + g_object_unref (parent_dir); + return ret; +} + +#ifdef HAVE_NEW_LCMS +static wchar_t * +utf8_to_wchar_t (const char *src) +{ + size_t len; + size_t converted; + wchar_t *buf = NULL; + + len = mbstowcs (NULL, src, 0); + if (len == (size_t) -1) { + g_warning ("Invalid UTF-8 in string %s", src); + goto out; + } + len += 1; + buf = g_malloc (sizeof (wchar_t) * len); + converted = mbstowcs (buf, src, len - 1); + g_assert (converted != -1); + buf[converted] = '\0'; +out: + return buf; +} + +static cmsBool +_cmsDictAddEntryAscii (cmsHANDLE dict, + const gchar *key, + const gchar *value) +{ + cmsBool ret = FALSE; + wchar_t *mb_key = NULL; + wchar_t *mb_value = NULL; + + mb_key = utf8_to_wchar_t (key); + if (mb_key == NULL) + goto out; + mb_value = utf8_to_wchar_t (value); + if (mb_value == NULL) + goto out; + ret = cmsDictAddEntry (dict, mb_key, mb_value, NULL, NULL); +out: + g_free (mb_key); + g_free (mb_value); + return ret; +} +#endif /* HAVE_NEW_LCMS */ + +static gboolean +gcm_apply_create_icc_profile_for_edid (GsdColorManager *manager, + GcmEdid *edid, + const gchar *filename, + GError **error) +{ + const CdColorYxy *tmp; + cmsCIExyYTRIPLE chroma; + cmsCIExyY white_point; + cmsHPROFILE lcms_profile = NULL; + cmsToneCurve *transfer_curve[3] = { NULL, NULL, NULL }; + const gchar *data; + gboolean ret = FALSE; + gchar *str; + gfloat edid_gamma; + gfloat localgamma; +#ifdef HAVE_NEW_LCMS + cmsHANDLE dict = NULL; +#endif + GsdColorManagerPrivate *priv = manager->priv; + + /* ensure the per-user directory exists */ + ret = gcm_utils_mkdir_for_filename (filename, error); + if (!ret) + goto out; + + /* copy color data from our structures */ + tmp = gcm_edid_get_red (edid); + chroma.Red.x = tmp->x; + chroma.Red.y = tmp->y; + tmp = gcm_edid_get_green (edid); + chroma.Green.x = tmp->x; + chroma.Green.y = tmp->y; + tmp = gcm_edid_get_blue (edid); + chroma.Blue.x = tmp->x; + chroma.Blue.y = tmp->y; + tmp = gcm_edid_get_white (edid); + white_point.x = tmp->x; + white_point.y = tmp->y; + white_point.Y = 1.0; + + /* estimate the transfer function for the gamma */ + localgamma = gcm_edid_get_gamma (edid); + transfer_curve[0] = transfer_curve[1] = transfer_curve[2] = cmsBuildGamma (NULL, localgamma); + + /* create our generated profile */ + lcms_profile = cmsCreateRGBProfile (&white_point, &chroma, transfer_curve); + if (lcms_profile == NULL) { + g_set_error (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to create profile"); + goto out; + } + + cmsSetColorSpace (lcms_profile, cmsSigRgbData); + cmsSetPCS (lcms_profile, cmsSigXYZData); + cmsSetHeaderRenderingIntent (lcms_profile, INTENT_PERCEPTUAL); + cmsSetDeviceClass (lcms_profile, cmsSigDisplayClass); + + /* copyright */ + ret = _cmsWriteTagTextAscii (lcms_profile, + cmsSigCopyrightTag, + /* deliberately not translated */ + "This profile is free of known copyright restrictions."); + if (!ret) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to write copyright"); + goto out; + } + + /* set model */ + data = gcm_edid_get_monitor_name (edid); + if (data == NULL) + data = gcm_dmi_get_name (priv->dmi); + if (data == NULL) + data = "Unknown monitor"; + ret = _cmsWriteTagTextAscii (lcms_profile, + cmsSigDeviceModelDescTag, + data); + if (!ret) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to write model"); + goto out; + } + + /* write title */ + ret = _cmsWriteTagTextAscii (lcms_profile, + cmsSigProfileDescriptionTag, + data); + if (!ret) { + g_set_error_literal (error, GSD_COLOR_MANAGER_ERROR, GSD_COLOR_MANAGER_ERROR_FAILED, "failed to write description"); + goto out; + } + + /* get manufacturer */ + data = gcm_edid_get_vendor_name (edid); + if (data == NULL) + data = gcm_dmi_get_vendor (priv->dmi); + if (data == NULL) + data = "Unknown vendor"; + ret = _cmsWriteTagTextAscii (lcms_profile, + cmsSigDeviceMfgDescTag, + data); + if (!ret) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to write manufacturer"); + goto out; + } + +#ifdef HAVE_NEW_LCMS + /* just create a new dict */ + dict = cmsDictAlloc (NULL); + + /* set the framework creator metadata */ + _cmsDictAddEntryAscii (dict, + CD_PROFILE_METADATA_CMF_PRODUCT, + PACKAGE_NAME); + _cmsDictAddEntryAscii (dict, + CD_PROFILE_METADATA_CMF_BINARY, + PACKAGE_NAME); + _cmsDictAddEntryAscii (dict, + CD_PROFILE_METADATA_CMF_VERSION, + PACKAGE_VERSION); + + /* set the data source so we don't ever prompt the user to + * recalibrate (as the EDID data won't have changed) */ + _cmsDictAddEntryAscii (dict, + CD_PROFILE_METADATA_DATA_SOURCE, + CD_PROFILE_METADATA_DATA_SOURCE_EDID); + + /* set 'ICC meta Tag for Monitor Profiles' data */ + _cmsDictAddEntryAscii (dict, "EDID_md5", gcm_edid_get_checksum (edid)); + data = gcm_edid_get_monitor_name (edid); + if (data != NULL) + _cmsDictAddEntryAscii (dict, "EDID_model", data); + data = gcm_edid_get_serial_number (edid); + if (data != NULL) + _cmsDictAddEntryAscii (dict, "EDID_serial", data); + data = gcm_edid_get_pnp_id (edid); + if (data != NULL) + _cmsDictAddEntryAscii (dict, "EDID_mnft", data); + data = gcm_edid_get_vendor_name (edid); + if (data != NULL) + _cmsDictAddEntryAscii (dict, "EDID_manufacturer", data); + edid_gamma = gcm_edid_get_gamma (edid); + if (edid_gamma > 0.0 && edid_gamma < 10.0) { + str = g_strdup_printf ("%f", edid_gamma); + _cmsDictAddEntryAscii (dict, "EDID_gamma", str); + g_free (str); + } + + /* also add the primaries */ + str = g_strdup_printf ("%f", chroma.Red.x); + _cmsDictAddEntryAscii (dict, "EDID_red_x", str); + g_free (str); + str = g_strdup_printf ("%f", chroma.Red.y); + _cmsDictAddEntryAscii (dict, "EDID_red_y", str); + g_free (str); + str = g_strdup_printf ("%f", chroma.Green.x); + _cmsDictAddEntryAscii (dict, "EDID_green_x", str); + g_free (str); + str = g_strdup_printf ("%f", chroma.Green.y); + _cmsDictAddEntryAscii (dict, "EDID_green_y", str); + g_free (str); + str = g_strdup_printf ("%f", chroma.Blue.x); + _cmsDictAddEntryAscii (dict, "EDID_blue_x", str); + g_free (str); + str = g_strdup_printf ("%f", chroma.Blue.y); + _cmsDictAddEntryAscii (dict, "EDID_blue_y", str); + g_free (str); + + /* write new tag */ + ret = cmsWriteTag (lcms_profile, cmsSigMetaTag, dict); + if (!ret) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to write profile metadata"); + goto out; + } +#endif /* HAVE_NEW_LCMS */ + + /* write profile id */ + ret = cmsMD5computeID (lcms_profile); + if (!ret) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to write profile id"); + goto out; + } + + /* save, TODO: get error */ + cmsSaveProfileToFile (lcms_profile, filename); + ret = TRUE; +out: +#ifdef HAVE_NEW_LCMS + if (dict != NULL) + cmsDictFree (dict); +#endif + if (*transfer_curve != NULL) + cmsFreeToneCurve (*transfer_curve); + return ret; +} + +static GPtrArray * +gcm_session_generate_vcgt (CdProfile *profile, guint size) +{ + GnomeRROutputClutItem *tmp; + GPtrArray *array = NULL; + const cmsToneCurve **vcgt; + cmsFloat32Number in; + guint i; + const gchar *filename; + cmsHPROFILE lcms_profile = NULL; + + /* invalid size */ + if (size == 0) + goto out; + + /* not an actual profile */ + filename = cd_profile_get_filename (profile); + if (filename == NULL) + goto out; + + /* open file */ + lcms_profile = cmsOpenProfileFromFile (filename, "r"); + if (lcms_profile == NULL) + goto out; + + /* get tone curves from profile */ + vcgt = cmsReadTag (lcms_profile, cmsSigVcgtTag); + if (vcgt == NULL || vcgt[0] == NULL) { + g_debug ("profile does not have any VCGT data"); + goto out; + } + + /* create array */ + array = g_ptr_array_new_with_free_func (g_free); + for (i = 0; i < size; i++) { + in = (gdouble) i / (gdouble) (size - 1); + tmp = g_new0 (GnomeRROutputClutItem, 1); + tmp->red = cmsEvalToneCurveFloat(vcgt[0], in) * (gdouble) 0xffff; + tmp->green = cmsEvalToneCurveFloat(vcgt[1], in) * (gdouble) 0xffff; + tmp->blue = cmsEvalToneCurveFloat(vcgt[2], in) * (gdouble) 0xffff; + g_ptr_array_add (array, tmp); + } +out: + if (lcms_profile != NULL) + cmsCloseProfile (lcms_profile); + return array; +} + +static guint +gnome_rr_output_get_gamma_size (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + gint len = 0; + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) + return 0; + gnome_rr_crtc_get_gamma (crtc, + &len, + NULL, NULL, NULL); + return (guint) len; +} + +static gboolean +gcm_session_output_set_gamma (GnomeRROutput *output, + GPtrArray *array, + GError **error) +{ + gboolean ret = TRUE; + guint16 *red = NULL; + guint16 *green = NULL; + guint16 *blue = NULL; + guint i; + GnomeRROutputClutItem *data; + GnomeRRCrtc *crtc; + + /* no length? */ + if (array->len == 0) { + ret = FALSE; + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "no data in the CLUT array"); + goto out; + } + + /* convert to a type X understands */ + red = g_new (guint16, array->len); + green = g_new (guint16, array->len); + blue = g_new (guint16, array->len); + for (i = 0; i < array->len; i++) { + data = g_ptr_array_index (array, i); + red[i] = data->red; + green[i] = data->green; + blue[i] = data->blue; + } + + /* send to LUT */ + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + ret = FALSE; + g_set_error (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to get ctrc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + gnome_rr_crtc_set_gamma (crtc, array->len, + red, green, blue); +out: + g_free (red); + g_free (green); + g_free (blue); + return ret; +} + +static gboolean +gcm_session_device_set_gamma (GnomeRROutput *output, + CdProfile *profile, + GError **error) +{ + gboolean ret = FALSE; + guint size; + GPtrArray *clut = NULL; + + /* create a lookup table */ + size = gnome_rr_output_get_gamma_size (output); + if (size == 0) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "gamma size is zero"); + goto out; + } + clut = gcm_session_generate_vcgt (profile, size); + if (clut == NULL) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to generate vcgt"); + goto out; + } + + /* apply the vcgt to this output */ + ret = gcm_session_output_set_gamma (output, clut, error); + if (!ret) + goto out; +out: + if (clut != NULL) + g_ptr_array_unref (clut); + return ret; +} + +static gboolean +gcm_session_device_reset_gamma (GnomeRROutput *output, + GError **error) +{ + gboolean ret; + guint i; + guint size; + guint32 value; + GPtrArray *clut; + GnomeRROutputClutItem *data; + + /* create a linear ramp */ + g_debug ("falling back to dummy ramp"); + clut = g_ptr_array_new_with_free_func (g_free); + size = gnome_rr_output_get_gamma_size (output); + if (size == 0) { + ret = FALSE; + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "gamma size is zero"); + goto out; + } + for (i = 0; i < size; i++) { + value = (i * 0xffff) / (size - 1); + data = g_new0 (GnomeRROutputClutItem, 1); + data->red = value; + data->green = value; + data->blue = value; + g_ptr_array_add (clut, data); + } + + /* apply the vcgt to this output */ + ret = gcm_session_output_set_gamma (output, clut, error); + if (!ret) + goto out; +out: + g_ptr_array_unref (clut); + return ret; +} + +static GnomeRROutput * +gcm_session_get_x11_output_by_id (GsdColorManager *manager, + const gchar *device_id, + GError **error) +{ + gchar *output_id; + GnomeRROutput *output = NULL; + GnomeRROutput **outputs = NULL; + guint i; + GsdColorManagerPrivate *priv = manager->priv; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (priv->x11_screen); + if (outputs == NULL) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "Failed to get outputs"); + goto out; + } + for (i = 0; outputs[i] != NULL && output == NULL; i++) { + if (!gnome_rr_output_is_connected (outputs[i])) + continue; + output_id = gcm_session_get_output_id (manager, outputs[i]); + if (g_strcmp0 (output_id, device_id) == 0) + output = outputs[i]; + g_free (output_id); + } + if (output == NULL) { + g_set_error (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "Failed to find output %s", + device_id); + } +out: + return output; +} + +/* this function is more complicated than it should be, due to the + * fact that XOrg sometimes assigns no primary devices when using + * "xrandr --auto" or when the version of RANDR is < 1.3 */ +static gboolean +gcm_session_use_output_profile_for_screen (GsdColorManager *manager, + GnomeRROutput *output) +{ + gboolean has_laptop = FALSE; + gboolean has_primary = FALSE; + GnomeRROutput **outputs; + GnomeRROutput *connected = NULL; + guint i; + + /* do we have any screens marked as primary */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL || outputs[0] == NULL) { + g_warning ("failed to get outputs"); + return FALSE; + } + for (i = 0; outputs[i] != NULL; i++) { + if (!gnome_rr_output_is_connected (outputs[i])) + continue; + if (connected == NULL) + connected = outputs[i]; + if (gnome_rr_output_get_is_primary (outputs[i])) + has_primary = TRUE; + if (gnome_rr_output_is_laptop (outputs[i])) + has_laptop = TRUE; + } + + /* we have an assigned primary device, are we that? */ + if (has_primary) + return gnome_rr_output_get_is_primary (output); + + /* choosing the internal panel is probably sane */ + if (has_laptop) + return gnome_rr_output_is_laptop (output); + + /* we have to choose one, so go for the first connected device */ + if (connected != NULL) + return gnome_rr_output_get_id (connected) == gnome_rr_output_get_id (output); + + return FALSE; +} + +/* TODO: remove when we can dep on a released version of colord */ +#ifndef CD_PROFILE_METADATA_SCREEN_BRIGHTNESS +#define CD_PROFILE_METADATA_SCREEN_BRIGHTNESS "SCREEN_brightness" +#endif + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_INTERFACE_POWER_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_DBUS_PATH_POWER "/org/gnome/SettingsDaemon/Power" + +static void +gcm_session_set_output_percentage_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GDBusConnection *connection = G_DBUS_CONNECTION (source_object); + GError *error = NULL; + GVariant *retval; + retval = g_dbus_connection_call_finish (connection, + res, + &error); + if (retval == NULL) { + g_warning ("failed to set output brightness: %s", + error->message); + g_error_free (error); + return; + } + g_variant_unref (retval); +} + +static void +gcm_session_set_output_percentage (guint percentage) +{ + GDBusConnection *connection; + + /* get a ref to the existing bus connection */ + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + if (connection == NULL) + return; + g_dbus_connection_call (connection, + GSD_DBUS_SERVICE, + GSD_DBUS_PATH_POWER, + GSD_DBUS_INTERFACE_POWER_SCREEN, + "SetPercentage", + g_variant_new ("(u)", percentage), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gcm_session_set_output_percentage_cb, NULL); + g_object_unref (connection); +} + +static void +gcm_session_device_assign_profile_connect_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdProfile *profile = CD_PROFILE (object); + const gchar *brightness_profile; + const gchar *filename; + gboolean ret; + GError *error = NULL; + GnomeRROutput *output; + guint brightness_percentage; + GcmSessionAsyncHelper *helper = (GcmSessionAsyncHelper *) user_data; + GsdColorManager *manager = GSD_COLOR_MANAGER (helper->manager); + + /* get properties */ + ret = cd_profile_connect_finish (profile, res, &error); + if (!ret) { + g_warning ("failed to connect to profile: %s", + error->message); + g_error_free (error); + goto out; + } + + /* get the filename */ + filename = cd_profile_get_filename (profile); + g_assert (filename != NULL); + + /* get the output (can't save in helper as GnomeRROutput isn't + * a GObject, just a pointer */ + output = gnome_rr_screen_get_output_by_id (manager->priv->x11_screen, + helper->output_id); + if (output == NULL) + goto out; + + /* if output is a laptop screen and the profile has a + * calibration brightness then set this new brightness */ + brightness_profile = cd_profile_get_metadata_item (profile, + CD_PROFILE_METADATA_SCREEN_BRIGHTNESS); + if (gnome_rr_output_is_laptop (output) && + brightness_profile != NULL) { + /* the percentage is stored in the profile metadata as + * a string, not ideal, but it's all we have... */ + brightness_percentage = atoi (brightness_profile); + gcm_session_set_output_percentage (brightness_percentage); + } + + /* set the _ICC_PROFILE atom */ + ret = gcm_session_use_output_profile_for_screen (manager, output); + if (ret) { + ret = gcm_session_screen_set_icc_profile (manager, + filename, + &error); + if (!ret) { + g_warning ("failed to set screen _ICC_PROFILE: %s", + error->message); + g_clear_error (&error); + } + } + + /* create a vcgt for this icc file */ + ret = cd_profile_get_has_vcgt (profile); + if (ret) { + ret = gcm_session_device_set_gamma (output, + profile, + &error); + if (!ret) { + g_warning ("failed to set %s gamma tables: %s", + cd_device_get_id (helper->device), + error->message); + g_error_free (error); + goto out; + } + } else { + ret = gcm_session_device_reset_gamma (output, + &error); + if (!ret) { + g_warning ("failed to reset %s gamma tables: %s", + cd_device_get_id (helper->device), + error->message); + g_error_free (error); + goto out; + } + } +out: + gcm_session_async_helper_free (helper); +} + +static void +gcm_session_device_assign_connect_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdDeviceKind kind; + CdProfile *profile = NULL; + gboolean ret; + gchar *autogen_filename = NULL; + gchar *autogen_path = NULL; + GcmEdid *edid = NULL; + GnomeRROutput *output = NULL; + GError *error = NULL; + const gchar *xrandr_id; + GcmSessionAsyncHelper *helper; + CdDevice *device = CD_DEVICE (object); + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + GsdColorManagerPrivate *priv = manager->priv; + + /* remove from assign array */ + g_hash_table_remove (manager->priv->device_assign_hash, + cd_device_get_object_path (device)); + + /* get properties */ + ret = cd_device_connect_finish (device, res, &error); + if (!ret) { + g_warning ("failed to connect to device: %s", + error->message); + g_error_free (error); + goto out; + } + + /* check we care */ + kind = cd_device_get_kind (device); + if (kind != CD_DEVICE_KIND_DISPLAY) + goto out; + + g_debug ("need to assign display device %s", + cd_device_get_id (device)); + + /* get the GnomeRROutput for the device id */ + xrandr_id = cd_device_get_id (device); + output = gcm_session_get_x11_output_by_id (manager, + xrandr_id, + &error); + if (output == NULL) { + g_warning ("no %s device found: %s", + cd_device_get_id (device), + error->message); + g_error_free (error); + goto out; + } + + /* create profile from device edid if it exists */ + edid = gcm_session_get_output_edid (manager, output, &error); + if (edid == NULL) { + g_warning ("unable to get EDID for %s: %s", + cd_device_get_id (device), + error->message); + g_clear_error (&error); + + } else { + autogen_filename = g_strdup_printf ("edid-%s.icc", + gcm_edid_get_checksum (edid)); + autogen_path = g_build_filename (g_get_user_data_dir (), + "icc", autogen_filename, NULL); + if (g_file_test (autogen_path, G_FILE_TEST_EXISTS)) { + g_debug ("auto-profile edid %s exists", autogen_path); + } else { + g_debug ("auto-profile edid does not exist, creating as %s", + autogen_path); + ret = gcm_apply_create_icc_profile_for_edid (manager, + edid, + autogen_path, + &error); + if (!ret) { + g_warning ("failed to create profile from EDID data: %s", + error->message); + g_clear_error (&error); + } + } + } + + /* get the default profile for the device */ + profile = cd_device_get_default_profile (device); + if (profile == NULL) { + g_debug ("%s has no default profile to set", + cd_device_get_id (device)); + + /* the default output? */ + if (gnome_rr_output_get_is_primary (output)) { + gdk_property_delete (priv->gdk_window, + gdk_atom_intern_static_string ("_ICC_PROFILE")); + gdk_property_delete (priv->gdk_window, + gdk_atom_intern_static_string ("_ICC_PROFILE_IN_X_VERSION")); + } + + /* reset, as we want linear profiles for profiling */ + ret = gcm_session_device_reset_gamma (output, + &error); + if (!ret) { + g_warning ("failed to reset %s gamma tables: %s", + cd_device_get_id (device), + error->message); + g_error_free (error); + goto out; + } + goto out; + } + + /* get properties */ + helper = g_new0 (GcmSessionAsyncHelper, 1); + helper->output_id = gnome_rr_output_get_id (output); + helper->manager = g_object_ref (manager); + helper->device = g_object_ref (device); + cd_profile_connect (profile, + NULL, + gcm_session_device_assign_profile_connect_cb, + helper); +out: + g_free (autogen_filename); + g_free (autogen_path); + if (edid != NULL) + g_object_unref (edid); + if (profile != NULL) + g_object_unref (profile); +} + +static void +gcm_session_device_assign (GsdColorManager *manager, CdDevice *device) +{ + const gchar *key; + gpointer found; + + /* are we already assigning this device */ + key = cd_device_get_object_path (device); + found = g_hash_table_lookup (manager->priv->device_assign_hash, key); + if (found != NULL) { + g_debug ("assign for %s already in progress", key); + return; + } + g_hash_table_insert (manager->priv->device_assign_hash, + g_strdup (key), + GINT_TO_POINTER (TRUE)); + cd_device_connect (device, + NULL, + gcm_session_device_assign_connect_cb, + manager); +} + +static void +gcm_session_device_added_assign_cb (CdClient *client, + CdDevice *device, + GsdColorManager *manager) +{ + gcm_session_device_assign (manager, device); +} + +static void +gcm_session_device_changed_assign_cb (CdClient *client, + CdDevice *device, + GsdColorManager *manager) +{ + g_debug ("%s changed", cd_device_get_object_path (device)); + gcm_session_device_assign (manager, device); +} + +static void +gcm_session_create_device_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdDevice *device; + GError *error = NULL; + + device = cd_client_create_device_finish (CD_CLIENT (object), + res, + &error); + if (device == NULL) { + if (error->domain != CD_CLIENT_ERROR || + error->code != CD_CLIENT_ERROR_ALREADY_EXISTS) { + g_warning ("failed to create device: %s", + error->message); + } + g_error_free (error); + return; + } + g_object_unref (device); +} + +static void +gcm_session_add_x11_output (GsdColorManager *manager, GnomeRROutput *output) +{ + const gchar *model = NULL; + const gchar *serial = NULL; + const gchar *vendor = NULL; + gboolean ret; + gchar *device_id = NULL; + GcmEdid *edid; + GError *error = NULL; + GHashTable *device_props = NULL; + GsdColorManagerPrivate *priv = manager->priv; + + /* try to get edid */ + edid = gcm_session_get_output_edid (manager, output, &error); + if (edid == NULL) { + g_warning ("failed to get edid: %s", + error->message); + g_clear_error (&error); + } + + /* prefer DMI data for the internal output */ + ret = gnome_rr_output_is_laptop (output); + if (ret) { + model = gcm_dmi_get_name (priv->dmi); + vendor = gcm_dmi_get_vendor (priv->dmi); + } + + /* use EDID data if we have it */ + if (edid != NULL) { + if (model == NULL) + model = gcm_edid_get_monitor_name (edid); + if (vendor == NULL) + vendor = gcm_edid_get_vendor_name (edid); + if (serial == NULL) + serial = gcm_edid_get_serial_number (edid); + } + + /* ensure mandatory fields are set */ + if (model == NULL) + model = gnome_rr_output_get_name (output); + if (vendor == NULL) + vendor = "unknown"; + if (serial == NULL) + serial = "unknown"; + + device_id = gcm_session_get_output_id (manager, output); + g_debug ("output %s added", device_id); + device_props = g_hash_table_new_full (g_str_hash, g_str_equal, + NULL, NULL); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_KIND, + (gpointer) cd_device_kind_to_string (CD_DEVICE_KIND_DISPLAY)); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_MODE, + (gpointer) cd_device_mode_to_string (CD_DEVICE_MODE_PHYSICAL)); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_COLORSPACE, + (gpointer) cd_colorspace_to_string (CD_COLORSPACE_RGB)); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_VENDOR, + (gpointer) vendor); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_MODEL, + (gpointer) model); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_SERIAL, + (gpointer) serial); + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_METADATA_XRANDR_NAME, + (gpointer) gnome_rr_output_get_name (output)); +#if CD_CHECK_VERSION(0,1,25) + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_METADATA_OUTPUT_PRIORITY, + gnome_rr_output_get_is_primary (output) ? + (gpointer) CD_DEVICE_METADATA_OUTPUT_PRIORITY_PRIMARY : + (gpointer) CD_DEVICE_METADATA_OUTPUT_PRIORITY_SECONDARY); +#endif +#if CD_CHECK_VERSION(0,1,27) + /* set this so we can call the device a 'Laptop Screen' in the + * control center main panel */ + if (gnome_rr_output_is_laptop (output)) { + g_hash_table_insert (device_props, + (gpointer) CD_DEVICE_PROPERTY_EMBEDDED, + NULL); + } +#endif + cd_client_create_device (priv->client, + device_id, + CD_OBJECT_SCOPE_TEMP, + device_props, + NULL, + gcm_session_create_device_cb, + manager); + g_free (device_id); + if (device_props != NULL) + g_hash_table_unref (device_props); + if (edid != NULL) + g_object_unref (edid); +} + + +static void +gnome_rr_screen_output_added_cb (GnomeRRScreen *screen, + GnomeRROutput *output, + GsdColorManager *manager) +{ + gcm_session_add_x11_output (manager, output); +} + +static void +gcm_session_screen_removed_delete_device_cb (GObject *object, GAsyncResult *res, gpointer user_data) +{ + gboolean ret; + GError *error = NULL; + + /* deleted device */ + ret = cd_client_delete_device_finish (CD_CLIENT (object), + res, + &error); + if (!ret) { + g_warning ("failed to delete device: %s", + error->message); + g_error_free (error); + } +} + +static void +gcm_session_screen_removed_find_device_cb (GObject *object, GAsyncResult *res, gpointer user_data) +{ + GError *error = NULL; + CdDevice *device; + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + + device = cd_client_find_device_finish (manager->priv->client, + res, + &error); + if (device == NULL) { + g_warning ("failed to find device: %s", + error->message); + g_error_free (error); + return; + } + g_debug ("output %s found, and will be removed", + cd_device_get_object_path (device)); + cd_client_delete_device (manager->priv->client, + device, + NULL, + gcm_session_screen_removed_delete_device_cb, + manager); + g_object_unref (device); +} + +static void +gnome_rr_screen_output_removed_cb (GnomeRRScreen *screen, + GnomeRROutput *output, + GsdColorManager *manager) +{ + g_debug ("output %s removed", + gnome_rr_output_get_name (output)); + g_hash_table_remove (manager->priv->edid_cache, + gnome_rr_output_get_name (output)); + cd_client_find_device_by_property (manager->priv->client, + CD_DEVICE_METADATA_XRANDR_NAME, + gnome_rr_output_get_name (output), + NULL, + gcm_session_screen_removed_find_device_cb, + manager); +} + +static void +gcm_session_get_devices_cb (GObject *object, GAsyncResult *res, gpointer user_data) +{ + CdDevice *device; + GError *error = NULL; + GPtrArray *array; + guint i; + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + + array = cd_client_get_devices_finish (CD_CLIENT (object), res, &error); + if (array == NULL) { + g_warning ("failed to get devices: %s", + error->message); + g_error_free (error); + goto out; + } + for (i = 0; i < array->len; i++) { + device = g_ptr_array_index (array, i); + gcm_session_device_assign (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); +} + +static void +gcm_session_profile_gamma_find_device_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdClient *client = CD_CLIENT (object); + CdDevice *device = NULL; + GError *error = NULL; + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + + device = cd_client_find_device_by_property_finish (client, + res, + &error); + if (device == NULL) { + g_warning ("could not find device: %s", + error->message); + g_error_free (error); + goto out; + } + + /* get properties */ + cd_device_connect (device, + NULL, + gcm_session_device_assign_connect_cb, + manager); +out: + if (device != NULL) + g_object_unref (device); +} + +/* We have to reset the gamma tables each time as if the primary output + * has changed then different crtcs are going to be used. + * See https://bugzilla.gnome.org/show_bug.cgi?id=660164 for an example */ +static void +gnome_rr_screen_output_changed_cb (GnomeRRScreen *screen, + GsdColorManager *manager) +{ + GnomeRROutput **outputs; + GsdColorManagerPrivate *priv = manager->priv; + guint i; + + /* get X11 outputs */ + outputs = gnome_rr_screen_list_outputs (priv->x11_screen); + if (outputs == NULL) { + g_warning ("failed to get outputs"); + return; + } + for (i = 0; outputs[i] != NULL; i++) { + if (!gnome_rr_output_is_connected (outputs[i])) + continue; + + /* get CdDevice for this output */ + cd_client_find_device_by_property (manager->priv->client, + CD_DEVICE_METADATA_XRANDR_NAME, + gnome_rr_output_get_name (outputs[i]), + NULL, + gcm_session_profile_gamma_find_device_cb, + manager); + } + +} + +static void +gcm_session_client_connect_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + gboolean ret; + GError *error = NULL; + GnomeRROutput **outputs; + guint i; + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + GsdColorManagerPrivate *priv = manager->priv; + + /* connected */ + g_debug ("connected to colord"); + ret = cd_client_connect_finish (manager->priv->client, res, &error); + if (!ret) { + g_warning ("failed to connect to colord: %s", error->message); + g_error_free (error); + return; + } + +#if CD_CHECK_VERSION(0,1,12) + /* is there an available colord instance? */ + ret = cd_client_get_has_server (manager->priv->client); + if (!ret) { + g_warning ("There is no colord server available"); + goto out; + } +#endif + + /* add profiles */ + gcm_profile_store_search (priv->profile_store); + + /* add screens */ + gnome_rr_screen_refresh (priv->x11_screen, &error); + if (error != NULL) { + g_warning ("failed to refresh: %s", error->message); + g_error_free (error); + goto out; + } + + /* get X11 outputs */ + outputs = gnome_rr_screen_list_outputs (priv->x11_screen); + if (outputs == NULL) { + g_warning ("failed to get outputs"); + goto out; + } + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i])) + gcm_session_add_x11_output (manager, outputs[i]); + } + + /* only connect when colord is awake */ + g_signal_connect (priv->x11_screen, "output-connected", + G_CALLBACK (gnome_rr_screen_output_added_cb), + manager); + g_signal_connect (priv->x11_screen, "output-disconnected", + G_CALLBACK (gnome_rr_screen_output_removed_cb), + manager); + g_signal_connect (priv->x11_screen, "changed", + G_CALLBACK (gnome_rr_screen_output_changed_cb), + manager); + + g_signal_connect (priv->client, "profile-added", + G_CALLBACK (gcm_session_profile_added_assign_cb), + manager); + g_signal_connect (priv->client, "device-added", + G_CALLBACK (gcm_session_device_added_assign_cb), + manager); + g_signal_connect (priv->client, "device-changed", + G_CALLBACK (gcm_session_device_changed_assign_cb), + manager); + + /* set for each device that already exist */ + cd_client_get_devices (priv->client, NULL, + gcm_session_get_devices_cb, + manager); +out: + return; +} + +gboolean +gsd_color_manager_start (GsdColorManager *manager, + GError **error) +{ + GsdColorManagerPrivate *priv = manager->priv; + gboolean ret = FALSE; + + g_debug ("Starting color manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (priv->x11_screen == NULL) + goto out; + + cd_client_connect (priv->client, + NULL, + gcm_session_client_connect_cb, + manager); + + /* success */ + ret = TRUE; +out: + gnome_settings_profile_end (NULL); + return ret; +} + +void +gsd_color_manager_stop (GsdColorManager *manager) +{ + g_debug ("Stopping color manager"); + + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->client); + g_clear_object (&manager->priv->profile_store); + g_clear_object (&manager->priv->dmi); + g_clear_object (&manager->priv->session); + g_clear_pointer (&manager->priv->edid_cache, g_hash_table_destroy); + g_clear_pointer (&manager->priv->device_assign_hash, g_hash_table_destroy); + g_clear_object (&manager->priv->x11_screen); +} + +static void +gcm_session_exec_control_center (GsdColorManager *manager) +{ + gboolean ret; + GError *error = NULL; + GAppInfo *app_info; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + app_info = g_app_info_create_from_commandline (BINDIR "/gnome-control-center color", + "gnome-control-center", + G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION, + &error); + if (app_info == NULL) { + g_warning ("failed to create application info: %s", + error->message); + g_error_free (error); + goto out; + } + + /* launch gnome-control-center */ + ret = g_app_info_launch (app_info, + NULL, + G_APP_LAUNCH_CONTEXT (launch_context), + &error); + if (!ret) { + g_warning ("failed to launch gnome-control-center: %s", + error->message); + g_error_free (error); + goto out; + } +out: + g_object_unref (launch_context); + if (app_info != NULL) + g_object_unref (app_info); +} + +static void +gcm_session_notify_cb (NotifyNotification *notification, + gchar *action, + gpointer user_data) +{ + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + + if (g_strcmp0 (action, "recalibrate") == 0) { + notify_notification_close (notification, NULL); + gcm_session_exec_control_center (manager); + } +} + +static void +closed_cb (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static gboolean +gcm_session_notify_recalibrate (GsdColorManager *manager, + const gchar *title, + const gchar *message, + CdDeviceKind kind) +{ + gboolean ret; + GError *error = NULL; + NotifyNotification *notification; + GsdColorManagerPrivate *priv = manager->priv; + + /* show a bubble */ + notification = notify_notification_new (title, message, "preferences-color"); + notify_notification_set_timeout (notification, GCM_SESSION_NOTIFY_TIMEOUT); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW); + notify_notification_set_app_name (notification, _("Color")); + + /* TRANSLATORS: button: this is to open GCM */ + notify_notification_add_action (notification, + "recalibrate", + _("Recalibrate now"), + gcm_session_notify_cb, + priv, NULL); + + g_signal_connect (notification, "closed", G_CALLBACK (closed_cb), NULL); + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("failed to show notification: %s", + error->message); + g_error_free (error); + } + return ret; +} + +static gchar * +gcm_session_device_get_title (CdDevice *device) +{ + const gchar *vendor; + const gchar *model; + + model = cd_device_get_model (device); + vendor = cd_device_get_vendor (device); + if (model != NULL && vendor != NULL) + return g_strdup_printf ("%s - %s", vendor, model); + if (vendor != NULL) + return g_strdup (vendor); + if (model != NULL) + return g_strdup (model); + return g_strdup (cd_device_get_id (device)); +} + +static void +gcm_session_notify_device (GsdColorManager *manager, CdDevice *device) +{ + CdDeviceKind kind; + const gchar *title; + gchar *device_title = NULL; + gchar *message; + guint threshold; + glong since; + GsdColorManagerPrivate *priv = manager->priv; + + /* TRANSLATORS: this is when the device has not been recalibrated in a while */ + title = _("Recalibration required"); + device_title = gcm_session_device_get_title (device); + + /* check we care */ + kind = cd_device_get_kind (device); + if (kind == CD_DEVICE_KIND_DISPLAY) { + + /* get from GSettings */ + threshold = g_settings_get_uint (priv->settings, + GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD); + + /* TRANSLATORS: this is when the display has not been recalibrated in a while */ + message = g_strdup_printf (_("The display '%s' should be recalibrated soon."), + device_title); + } else { + + /* get from GSettings */ + threshold = g_settings_get_uint (priv->settings, + GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD); + + /* TRANSLATORS: this is when the printer has not been recalibrated in a while */ + message = g_strdup_printf (_("The printer '%s' should be recalibrated soon."), + device_title); + } + + /* check if we need to notify */ + since = (g_get_real_time () - cd_device_get_modified (device)) / G_USEC_PER_SEC; + if (threshold > since) + gcm_session_notify_recalibrate (manager, title, message, kind); + g_free (device_title); + g_free (message); +} + +static void +gcm_session_profile_connect_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + const gchar *filename; + gboolean ret; + gchar *basename = NULL; + const gchar *data_source; + GError *error = NULL; + CdProfile *profile = CD_PROFILE (object); + GcmSessionAsyncHelper *helper = (GcmSessionAsyncHelper *) user_data; + GsdColorManager *manager = GSD_COLOR_MANAGER (helper->manager); + + ret = cd_profile_connect_finish (profile, + res, + &error); + if (!ret) { + g_warning ("failed to connect to profile: %s", + error->message); + g_error_free (error); + goto out; + } + + /* ensure it's a profile generated by us */ + data_source = cd_profile_get_metadata_item (profile, + CD_PROFILE_METADATA_DATA_SOURCE); + if (data_source == NULL) { + + /* existing profiles from gnome-color-manager < 3.1 + * won't have the extra metadata values added */ + filename = cd_profile_get_filename (profile); + if (filename == NULL) + goto out; + basename = g_path_get_basename (filename); + if (!g_str_has_prefix (basename, "GCM")) { + g_debug ("not a GCM profile for %s: %s", + cd_device_get_id (helper->device), filename); + goto out; + } + + /* ensure it's been created from a calibration, rather than from + * auto-EDID */ + } else if (g_strcmp0 (data_source, + CD_PROFILE_METADATA_DATA_SOURCE_CALIB) != 0) { + g_debug ("not a calib profile for %s", + cd_device_get_id (helper->device)); + goto out; + } + + /* handle device */ + gcm_session_notify_device (manager, helper->device); +out: + gcm_session_async_helper_free (helper); + g_free (basename); +} + +static void +gcm_session_device_connect_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + gboolean ret; + GError *error = NULL; + CdDeviceKind kind; + CdProfile *profile = NULL; + CdDevice *device = CD_DEVICE (object); + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + GcmSessionAsyncHelper *helper; + + ret = cd_device_connect_finish (device, + res, + &error); + if (!ret) { + g_warning ("failed to connect to device: %s", + error->message); + g_error_free (error); + goto out; + } + + /* check we care */ + kind = cd_device_get_kind (device); + if (kind != CD_DEVICE_KIND_DISPLAY && + kind != CD_DEVICE_KIND_PRINTER) + goto out; + + /* ensure we have a profile */ + profile = cd_device_get_default_profile (device); + if (profile == NULL) { + g_debug ("no profile set for %s", cd_device_get_id (device)); + goto out; + } + + /* connect to the profile */ + helper = g_new0 (GcmSessionAsyncHelper, 1); + helper->manager = g_object_ref (manager); + helper->device = g_object_ref (device); + cd_profile_connect (profile, + NULL, + gcm_session_profile_connect_cb, + helper); +out: + if (profile != NULL) + g_object_unref (profile); +} + +static void +gcm_session_device_added_notify_cb (CdClient *client, + CdDevice *device, + GsdColorManager *manager) +{ + /* connect to the device to get properties */ + cd_device_connect (device, + NULL, + gcm_session_device_connect_cb, + manager); +} + +static gchar * +gcm_session_get_precooked_md5 (cmsHPROFILE lcms_profile) +{ + cmsUInt8Number profile_id[16]; + gboolean md5_precooked = FALSE; + guint i; + gchar *md5 = NULL; + + /* check to see if we have a pre-cooked MD5 */ + cmsGetHeaderProfileID (lcms_profile, profile_id); + for (i = 0; i < 16; i++) { + if (profile_id[i] != 0) { + md5_precooked = TRUE; + break; + } + } + if (!md5_precooked) + goto out; + + /* convert to a hex string */ + md5 = g_new0 (gchar, 32 + 1); + for (i = 0; i < 16; i++) + g_snprintf (md5 + i*2, 3, "%02x", profile_id[i]); +out: + return md5; +} + +static gchar * +gcm_session_get_md5_for_filename (const gchar *filename, + GError **error) +{ + gboolean ret; + gchar *checksum = NULL; + gchar *data = NULL; + gsize length; + cmsHPROFILE lcms_profile = NULL; + + /* get the internal profile id, if it exists */ + lcms_profile = cmsOpenProfileFromFile (filename, "r"); + if (lcms_profile == NULL) { + g_set_error_literal (error, + GSD_COLOR_MANAGER_ERROR, + GSD_COLOR_MANAGER_ERROR_FAILED, + "failed to load: not an ICC profile"); + goto out; + } + checksum = gcm_session_get_precooked_md5 (lcms_profile); + if (checksum != NULL) + goto out; + + /* generate checksum */ + ret = g_file_get_contents (filename, &data, &length, error); + if (!ret) + goto out; + checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5, + (const guchar *) data, + length); +out: + g_free (data); + if (lcms_profile != NULL) + cmsCloseProfile (lcms_profile); + return checksum; +} + +static void +gcm_session_create_profile_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + CdProfile *profile; + GError *error = NULL; + CdClient *client = CD_CLIENT (object); + + profile = cd_client_create_profile_finish (client, res, &error); + if (profile == NULL) { + if (error->domain != CD_CLIENT_ERROR || + error->code != CD_CLIENT_ERROR_ALREADY_EXISTS) + g_warning ("%s", error->message); + g_error_free (error); + return; + } + g_object_unref (profile); +} + +static void +gcm_session_profile_store_added_cb (GcmProfileStore *profile_store, + const gchar *filename, + GsdColorManager *manager) +{ + gchar *checksum = NULL; + gchar *profile_id = NULL; + GError *error = NULL; + GHashTable *profile_props = NULL; + GsdColorManagerPrivate *priv = manager->priv; + + g_debug ("profile %s added", filename); + + /* generate ID */ + checksum = gcm_session_get_md5_for_filename (filename, &error); + if (checksum == NULL) { + g_debug ("failed to get profile checksum for %s: %s", + filename, error->message); + g_error_free (error); + goto out; + } + profile_id = g_strdup_printf ("icc-%s", checksum); + profile_props = g_hash_table_new_full (g_str_hash, g_str_equal, + NULL, NULL); + g_hash_table_insert (profile_props, + CD_PROFILE_PROPERTY_FILENAME, + (gpointer) filename); + g_hash_table_insert (profile_props, + CD_PROFILE_METADATA_FILE_CHECKSUM, + (gpointer) checksum); + cd_client_create_profile (priv->client, + profile_id, + CD_OBJECT_SCOPE_TEMP, + profile_props, + NULL, + gcm_session_create_profile_cb, + manager); +out: + g_free (checksum); + g_free (profile_id); + if (profile_props != NULL) + g_hash_table_unref (profile_props); +} + +static void +gcm_session_delete_profile_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + gboolean ret; + GError *error = NULL; + CdClient *client = CD_CLIENT (object); + + ret = cd_client_delete_profile_finish (client, res, &error); + if (!ret) { + g_warning ("%s", error->message); + g_error_free (error); + } +} + +static void +gcm_session_find_profile_by_filename_cb (GObject *object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + CdProfile *profile; + CdClient *client = CD_CLIENT (object); + GsdColorManager *manager = GSD_COLOR_MANAGER (user_data); + + profile = cd_client_find_profile_by_filename_finish (client, res, &error); + if (profile == NULL) { + g_warning ("%s", error->message); + g_error_free (error); + goto out; + } + + /* remove it from colord */ + cd_client_delete_profile (manager->priv->client, + profile, + NULL, + gcm_session_delete_profile_cb, + manager); +out: + if (profile != NULL) + g_object_unref (profile); +} + +static void +gcm_session_profile_store_removed_cb (GcmProfileStore *profile_store, + const gchar *filename, + GsdColorManager *manager) +{ + /* find the ID for the filename */ + g_debug ("filename %s removed", filename); + cd_client_find_profile_by_filename (manager->priv->client, + filename, + NULL, + gcm_session_find_profile_by_filename_cb, + manager); +} + +static void +gcm_session_sensor_added_cb (CdClient *client, + CdSensor *sensor, + GsdColorManager *manager) +{ + ca_context_play (ca_gtk_context_get (), 0, + CA_PROP_EVENT_ID, "device-added", + /* TRANSLATORS: this is the application name */ + CA_PROP_APPLICATION_NAME, _("GNOME Settings Daemon Color Plugin"), + /* TRANSLATORS: this is a sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Color calibration device added"), NULL); + + /* open up the color prefs window */ + gcm_session_exec_control_center (manager); +} + +static void +gcm_session_sensor_removed_cb (CdClient *client, + CdSensor *sensor, + GsdColorManager *manager) +{ + ca_context_play (ca_gtk_context_get (), 0, + CA_PROP_EVENT_ID, "device-removed", + /* TRANSLATORS: this is the application name */ + CA_PROP_APPLICATION_NAME, _("GNOME Settings Daemon Color Plugin"), + /* TRANSLATORS: this is a sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Color calibration device removed"), NULL); +} + +static void +gcm_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdColorManager *manager) +{ + GnomeSettingsSessionState state_new; + GsdColorManagerPrivate *priv = manager->priv; + + /* not yet connected to the daemon */ + if (!cd_client_get_connected (priv->client)) + return; + + /* When doing the fast-user-switch into a new account, load the + * new users chosen profiles. + * + * If this is the first time the GnomeSettingsSession has been + * loaded, then we'll get a change from unknown to active + * and we want to avoid reprobing the devices for that. + */ + state_new = gnome_settings_session_get_state (session); + if (priv->session_state != GNOME_SETTINGS_SESSION_STATE_UNKNOWN && + state_new == GNOME_SETTINGS_SESSION_STATE_ACTIVE) { + g_debug ("Done switch to new account, reload devices"); + cd_client_get_devices (manager->priv->client, NULL, + gcm_session_get_devices_cb, + manager); + } + priv->session_state = state_new; +} + +static void +gsd_color_manager_class_init (GsdColorManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_color_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdColorManagerPrivate)); +} + +static void +gsd_color_manager_init (GsdColorManager *manager) +{ + GsdColorManagerPrivate *priv; + priv = manager->priv = GSD_COLOR_MANAGER_GET_PRIVATE (manager); + + /* track the active session */ + priv->session = gnome_settings_session_new (); + priv->session_state = gnome_settings_session_get_state (priv->session); + g_signal_connect (priv->session, "notify::state", + G_CALLBACK (gcm_session_active_changed_cb), + manager); + + /* set the _ICC_PROFILE atoms on the root screen */ + priv->gdk_window = gdk_screen_get_root_window (gdk_screen_get_default ()); + + /* parsing the EDID is expensive */ + priv->edid_cache = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + g_object_unref); + + /* we don't want to assign devices multiple times at startup */ + priv->device_assign_hash = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + NULL); + + /* use DMI data for internal panels */ + priv->dmi = gcm_dmi_new (); + + priv->settings = g_settings_new ("org.gnome.settings-daemon.plugins.color"); + priv->client = cd_client_new (); + g_signal_connect (priv->client, "device-added", + G_CALLBACK (gcm_session_device_added_notify_cb), + manager); + g_signal_connect (priv->client, "sensor-added", + G_CALLBACK (gcm_session_sensor_added_cb), + manager); + g_signal_connect (priv->client, "sensor-removed", + G_CALLBACK (gcm_session_sensor_removed_cb), + manager); + + /* have access to all user profiles */ + priv->profile_store = gcm_profile_store_new (); + g_signal_connect (priv->profile_store, "added", + G_CALLBACK (gcm_session_profile_store_added_cb), + manager); + g_signal_connect (priv->profile_store, "removed", + G_CALLBACK (gcm_session_profile_store_removed_cb), + manager); +} + +static void +gsd_color_manager_finalize (GObject *object) +{ + GsdColorManager *manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_COLOR_MANAGER (object)); + + manager = GSD_COLOR_MANAGER (object); + + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->client); + g_clear_object (&manager->priv->profile_store); + g_clear_object (&manager->priv->dmi); + g_clear_object (&manager->priv->session); + g_clear_pointer (&manager->priv->edid_cache, g_hash_table_destroy); + g_clear_pointer (&manager->priv->device_assign_hash, g_hash_table_destroy); + g_clear_object (&manager->priv->x11_screen); + + G_OBJECT_CLASS (gsd_color_manager_parent_class)->finalize (object); +} + +GsdColorManager * +gsd_color_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_COLOR_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_COLOR_MANAGER (manager_object); +} diff --git a/plugins/color/gsd-color-manager.h b/plugins/color/gsd-color-manager.h new file mode 100644 index 00000000..27321a72 --- /dev/null +++ b/plugins/color/gsd-color-manager.h @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * + * 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_COLOR_MANAGER_H +#define __GSD_COLOR_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_COLOR_MANAGER (gsd_color_manager_get_type ()) +#define GSD_COLOR_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_COLOR_MANAGER, GsdColorManager)) +#define GSD_COLOR_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_COLOR_MANAGER, GsdColorManagerClass)) +#define GSD_IS_COLOR_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_COLOR_MANAGER)) +#define GSD_IS_COLOR_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_COLOR_MANAGER)) +#define GSD_COLOR_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_COLOR_MANAGER, GsdColorManagerClass)) +#define GSD_COLOR_MANAGER_ERROR (gsd_color_manager_error_quark ()) + +typedef struct GsdColorManagerPrivate GsdColorManagerPrivate; + +typedef struct +{ + GObject parent; + GsdColorManagerPrivate *priv; +} GsdColorManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdColorManagerClass; + +enum +{ + GSD_COLOR_MANAGER_ERROR_FAILED +}; + +GType gsd_color_manager_get_type (void); +GQuark gsd_color_manager_error_quark (void); + +GsdColorManager * gsd_color_manager_new (void); +gboolean gsd_color_manager_start (GsdColorManager *manager, + GError **error); +void gsd_color_manager_stop (GsdColorManager *manager); + +G_END_DECLS + +#endif /* __GSD_COLOR_MANAGER_H */ diff --git a/plugins/color/gsd-color-plugin.c b/plugins/color/gsd-color-plugin.c new file mode 100644 index 00000000..8c115460 --- /dev/null +++ b/plugins/color/gsd-color-plugin.c @@ -0,0 +1,105 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-color-plugin.h" +#include "gsd-color-manager.h" + +struct GsdColorPluginPrivate { + GsdColorManager *manager; +}; + +#define GSD_COLOR_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_COLOR_PLUGIN, GsdColorPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdColorPlugin, gsd_color_plugin) + +static void +gsd_color_plugin_init (GsdColorPlugin *plugin) +{ + plugin->priv = GSD_COLOR_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdColorPlugin initializing"); + + plugin->priv->manager = gsd_color_manager_new (); +} + +static void +gsd_color_plugin_finalize (GObject *object) +{ + GsdColorPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_COLOR_PLUGIN (object)); + + g_debug ("GsdColorPlugin finalizing"); + + plugin = GSD_COLOR_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_color_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating color plugin"); + + error = NULL; + res = gsd_color_manager_start (GSD_COLOR_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start color manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating color plugin"); + gsd_color_manager_stop (GSD_COLOR_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_color_plugin_class_init (GsdColorPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_color_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdColorPluginPrivate)); +} diff --git a/plugins/color/gsd-color-plugin.h b/plugins/color/gsd-color-plugin.h new file mode 100644 index 00000000..3b0a919c --- /dev/null +++ b/plugins/color/gsd-color-plugin.h @@ -0,0 +1,60 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * + * 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, 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_COLOR_PLUGIN_H__ +#define __GSD_COLOR_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_COLOR_PLUGIN (gsd_color_plugin_get_type ()) +#define GSD_COLOR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_COLOR_PLUGIN, GsdColorPlugin)) +#define GSD_COLOR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_COLOR_PLUGIN, GsdColorPluginClass)) +#define GSD_IS_COLOR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_COLOR_PLUGIN)) +#define GSD_IS_COLOR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_COLOR_PLUGIN)) +#define GSD_COLOR_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_COLOR_PLUGIN, GsdColorPluginClass)) + +typedef struct GsdColorPluginPrivate GsdColorPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdColorPluginPrivate *priv; +} GsdColorPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdColorPluginClass; + +GType gsd_color_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_COLOR_PLUGIN_H__ */ diff --git a/plugins/color/test-data/LG-L225W-External.bin b/plugins/color/test-data/LG-L225W-External.bin new file mode 100644 index 00000000..f08310aa Binary files /dev/null and b/plugins/color/test-data/LG-L225W-External.bin differ diff --git a/plugins/color/test-data/Lenovo-T61-Internal.bin b/plugins/color/test-data/Lenovo-T61-Internal.bin new file mode 100644 index 00000000..45aec9d5 Binary files /dev/null and b/plugins/color/test-data/Lenovo-T61-Internal.bin differ diff --git a/plugins/common/Makefile.am b/plugins/common/Makefile.am new file mode 100644 index 00000000..7e50db4e --- /dev/null +++ b/plugins/common/Makefile.am @@ -0,0 +1,44 @@ +plugin_name = common + +noinst_LTLIBRARIES = libcommon.la + +libcommon_la_SOURCES = \ + gsd-keygrab.c \ + gsd-keygrab.h \ + gsd-input-helper.c \ + gsd-input-helper.h \ + gsd-power-helper.c \ + gsd-power-helper.h + +libcommon_la_CPPFLAGS = \ + $(AM_CPPFLAGS) + +libcommon_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(COMMON_CFLAGS) \ + $(AM_CFLAGS) + +libcommon_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libcommon_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(COMMON_LIBS) + +libexec_PROGRAMS = gsd-test-input-helper + +gsd_test_input_helper_SOURCES = test-input-helper.c +gsd_test_input_helper_LDADD = libcommon.la +gsd_test_input_helper_CFLAGS = $(libcommon_la_CFLAGS) + +noinst_PROGRAMS = test-egg-key-parsing + +test_egg_key_parsing_SOURCES = test-egg-key-parsing.c +test_egg_key_parsing_LDADD = libcommon.la $(COMMON_LIBS) +test_egg_key_parsing_CFLAGS = $(libcommon_la_CFLAGS) + +scriptsdir = $(datadir)/gnome-settings-daemon-@GSD_API_VERSION@ +scripts_DATA = input-device-example.sh + +EXTRA_DIST = $(scripts_DATA) test-plugin.h diff --git a/plugins/common/Makefile.in b/plugins/common/Makefile.in new file mode 100644 index 00000000..13c0f65c --- /dev/null +++ b/plugins/common/Makefile.in @@ -0,0 +1,873 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-input-helper$(EXEEXT) +noinst_PROGRAMS = test-egg-key-parsing$(EXEEXT) +subdir = plugins/common +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcommon_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libcommon_la_OBJECTS = libcommon_la-gsd-keygrab.lo \ + libcommon_la-gsd-input-helper.lo \ + libcommon_la-gsd-power-helper.lo +libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcommon_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libcommon_la_CFLAGS) \ + $(CFLAGS) $(libcommon_la_LDFLAGS) $(LDFLAGS) -o $@ +am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(scriptsdir)" +PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS) +am_gsd_test_input_helper_OBJECTS = \ + gsd_test_input_helper-test-input-helper.$(OBJEXT) +gsd_test_input_helper_OBJECTS = $(am_gsd_test_input_helper_OBJECTS) +gsd_test_input_helper_DEPENDENCIES = libcommon.la +gsd_test_input_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_input_helper_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_egg_key_parsing_OBJECTS = \ + test_egg_key_parsing-test-egg-key-parsing.$(OBJEXT) +test_egg_key_parsing_OBJECTS = $(am_test_egg_key_parsing_OBJECTS) +test_egg_key_parsing_DEPENDENCIES = libcommon.la $(am__DEPENDENCIES_1) +test_egg_key_parsing_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_egg_key_parsing_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcommon_la_SOURCES) $(gsd_test_input_helper_SOURCES) \ + $(test_egg_key_parsing_SOURCES) +DIST_SOURCES = $(libcommon_la_SOURCES) \ + $(gsd_test_input_helper_SOURCES) \ + $(test_egg_key_parsing_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +DATA = $(scripts_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = common +noinst_LTLIBRARIES = libcommon.la +libcommon_la_SOURCES = \ + gsd-keygrab.c \ + gsd-keygrab.h \ + gsd-input-helper.c \ + gsd-input-helper.h \ + gsd-power-helper.c \ + gsd-power-helper.h + +libcommon_la_CPPFLAGS = \ + $(AM_CPPFLAGS) + +libcommon_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(COMMON_CFLAGS) \ + $(AM_CFLAGS) + +libcommon_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libcommon_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(COMMON_LIBS) + +gsd_test_input_helper_SOURCES = test-input-helper.c +gsd_test_input_helper_LDADD = libcommon.la +gsd_test_input_helper_CFLAGS = $(libcommon_la_CFLAGS) +test_egg_key_parsing_SOURCES = test-egg-key-parsing.c +test_egg_key_parsing_LDADD = libcommon.la $(COMMON_LIBS) +test_egg_key_parsing_CFLAGS = $(libcommon_la_CFLAGS) +scriptsdir = $(datadir)/gnome-settings-daemon-@GSD_API_VERSION@ +scripts_DATA = input-device-example.sh +EXTRA_DIST = $(scripts_DATA) test-plugin.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/common/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/common/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) $(EXTRA_libcommon_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcommon_la_LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-input-helper$(EXEEXT): $(gsd_test_input_helper_OBJECTS) $(gsd_test_input_helper_DEPENDENCIES) $(EXTRA_gsd_test_input_helper_DEPENDENCIES) + @rm -f gsd-test-input-helper$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_input_helper_LINK) $(gsd_test_input_helper_OBJECTS) $(gsd_test_input_helper_LDADD) $(LIBS) +test-egg-key-parsing$(EXEEXT): $(test_egg_key_parsing_OBJECTS) $(test_egg_key_parsing_DEPENDENCIES) $(EXTRA_test_egg_key_parsing_DEPENDENCIES) + @rm -f test-egg-key-parsing$(EXEEXT) + $(AM_V_CCLD)$(test_egg_key_parsing_LINK) $(test_egg_key_parsing_OBJECTS) $(test_egg_key_parsing_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_input_helper-test-input-helper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcommon_la-gsd-input-helper.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcommon_la-gsd-keygrab.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcommon_la-gsd-power-helper.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libcommon_la-gsd-keygrab.lo: gsd-keygrab.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_la_CPPFLAGS) $(CPPFLAGS) $(libcommon_la_CFLAGS) $(CFLAGS) -MT libcommon_la-gsd-keygrab.lo -MD -MP -MF $(DEPDIR)/libcommon_la-gsd-keygrab.Tpo -c -o libcommon_la-gsd-keygrab.lo `test -f 'gsd-keygrab.c' || echo '$(srcdir)/'`gsd-keygrab.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcommon_la-gsd-keygrab.Tpo $(DEPDIR)/libcommon_la-gsd-keygrab.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keygrab.c' object='libcommon_la-gsd-keygrab.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_la_CPPFLAGS) $(CPPFLAGS) $(libcommon_la_CFLAGS) $(CFLAGS) -c -o libcommon_la-gsd-keygrab.lo `test -f 'gsd-keygrab.c' || echo '$(srcdir)/'`gsd-keygrab.c + +libcommon_la-gsd-input-helper.lo: gsd-input-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_la_CPPFLAGS) $(CPPFLAGS) $(libcommon_la_CFLAGS) $(CFLAGS) -MT libcommon_la-gsd-input-helper.lo -MD -MP -MF $(DEPDIR)/libcommon_la-gsd-input-helper.Tpo -c -o libcommon_la-gsd-input-helper.lo `test -f 'gsd-input-helper.c' || echo '$(srcdir)/'`gsd-input-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcommon_la-gsd-input-helper.Tpo $(DEPDIR)/libcommon_la-gsd-input-helper.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-input-helper.c' object='libcommon_la-gsd-input-helper.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_la_CPPFLAGS) $(CPPFLAGS) $(libcommon_la_CFLAGS) $(CFLAGS) -c -o libcommon_la-gsd-input-helper.lo `test -f 'gsd-input-helper.c' || echo '$(srcdir)/'`gsd-input-helper.c + +libcommon_la-gsd-power-helper.lo: gsd-power-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_la_CPPFLAGS) $(CPPFLAGS) $(libcommon_la_CFLAGS) $(CFLAGS) -MT libcommon_la-gsd-power-helper.lo -MD -MP -MF $(DEPDIR)/libcommon_la-gsd-power-helper.Tpo -c -o libcommon_la-gsd-power-helper.lo `test -f 'gsd-power-helper.c' || echo '$(srcdir)/'`gsd-power-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcommon_la-gsd-power-helper.Tpo $(DEPDIR)/libcommon_la-gsd-power-helper.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-power-helper.c' object='libcommon_la-gsd-power-helper.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_la_CPPFLAGS) $(CPPFLAGS) $(libcommon_la_CFLAGS) $(CFLAGS) -c -o libcommon_la-gsd-power-helper.lo `test -f 'gsd-power-helper.c' || echo '$(srcdir)/'`gsd-power-helper.c + +gsd_test_input_helper-test-input-helper.o: test-input-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_input_helper_CFLAGS) $(CFLAGS) -MT gsd_test_input_helper-test-input-helper.o -MD -MP -MF $(DEPDIR)/gsd_test_input_helper-test-input-helper.Tpo -c -o gsd_test_input_helper-test-input-helper.o `test -f 'test-input-helper.c' || echo '$(srcdir)/'`test-input-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_input_helper-test-input-helper.Tpo $(DEPDIR)/gsd_test_input_helper-test-input-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-input-helper.c' object='gsd_test_input_helper-test-input-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_input_helper_CFLAGS) $(CFLAGS) -c -o gsd_test_input_helper-test-input-helper.o `test -f 'test-input-helper.c' || echo '$(srcdir)/'`test-input-helper.c + +gsd_test_input_helper-test-input-helper.obj: test-input-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_input_helper_CFLAGS) $(CFLAGS) -MT gsd_test_input_helper-test-input-helper.obj -MD -MP -MF $(DEPDIR)/gsd_test_input_helper-test-input-helper.Tpo -c -o gsd_test_input_helper-test-input-helper.obj `if test -f 'test-input-helper.c'; then $(CYGPATH_W) 'test-input-helper.c'; else $(CYGPATH_W) '$(srcdir)/test-input-helper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_input_helper-test-input-helper.Tpo $(DEPDIR)/gsd_test_input_helper-test-input-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-input-helper.c' object='gsd_test_input_helper-test-input-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_input_helper_CFLAGS) $(CFLAGS) -c -o gsd_test_input_helper-test-input-helper.obj `if test -f 'test-input-helper.c'; then $(CYGPATH_W) 'test-input-helper.c'; else $(CYGPATH_W) '$(srcdir)/test-input-helper.c'; fi` + +test_egg_key_parsing-test-egg-key-parsing.o: test-egg-key-parsing.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_egg_key_parsing_CFLAGS) $(CFLAGS) -MT test_egg_key_parsing-test-egg-key-parsing.o -MD -MP -MF $(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Tpo -c -o test_egg_key_parsing-test-egg-key-parsing.o `test -f 'test-egg-key-parsing.c' || echo '$(srcdir)/'`test-egg-key-parsing.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Tpo $(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-egg-key-parsing.c' object='test_egg_key_parsing-test-egg-key-parsing.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_egg_key_parsing_CFLAGS) $(CFLAGS) -c -o test_egg_key_parsing-test-egg-key-parsing.o `test -f 'test-egg-key-parsing.c' || echo '$(srcdir)/'`test-egg-key-parsing.c + +test_egg_key_parsing-test-egg-key-parsing.obj: test-egg-key-parsing.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_egg_key_parsing_CFLAGS) $(CFLAGS) -MT test_egg_key_parsing-test-egg-key-parsing.obj -MD -MP -MF $(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Tpo -c -o test_egg_key_parsing-test-egg-key-parsing.obj `if test -f 'test-egg-key-parsing.c'; then $(CYGPATH_W) 'test-egg-key-parsing.c'; else $(CYGPATH_W) '$(srcdir)/test-egg-key-parsing.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Tpo $(DEPDIR)/test_egg_key_parsing-test-egg-key-parsing.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-egg-key-parsing.c' object='test_egg_key_parsing-test-egg-key-parsing.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_egg_key_parsing_CFLAGS) $(CFLAGS) -c -o test_egg_key_parsing-test-egg-key-parsing.obj `if test -f 'test-egg-key-parsing.c'; then $(CYGPATH_W) 'test-egg-key-parsing.c'; else $(CYGPATH_W) '$(srcdir)/test-egg-key-parsing.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-scriptsDATA: $(scripts_DATA) + @$(NORMAL_INSTALL) + @list='$(scripts_DATA)'; test -n "$(scriptsdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(scriptsdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(scriptsdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(scriptsdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(scriptsdir)" || exit $$?; \ + done + +uninstall-scriptsDATA: + @$(NORMAL_UNINSTALL) + @list='$(scripts_DATA)'; test -n "$(scriptsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(scriptsdir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(scriptsdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-scriptsDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-scriptsDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libexecPROGRAMS install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-scriptsDATA install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libexecPROGRAMS \ + uninstall-scriptsDATA + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/common/gsd-input-helper.c b/plugins/common/gsd-input-helper.c new file mode 100644 index 00000000..c15e135a --- /dev/null +++ b/plugins/common/gsd-input-helper.c @@ -0,0 +1,532 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Bastien Nocera + * + * 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 +#include + +#include +#include +#include + +#include "gsd-input-helper.h" + +#define INPUT_DEVICES_SCHEMA "org.gnome.settings-daemon.peripherals.input-devices" +#define KEY_HOTPLUG_COMMAND "hotplug-command" + +typedef gboolean (* InfoIdentifyFunc) (XDeviceInfo *device_info); +typedef gboolean (* DeviceIdentifyFunc) (XDevice *xdevice); + +gboolean +device_set_property (XDevice *xdevice, + const char *device_name, + PropertyHelper *property) +{ + int rc, i; + Atom prop; + Atom realtype; + int realformat; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + property->name, False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, 0, property->nitems, False, + AnyPropertyType, &realtype, &realformat, &nitems, + &bytes_after, &data); + + if (rc != Success || + realtype != property->type || + realformat != property->format || + nitems < property->nitems) { + gdk_error_trap_pop_ignored (); + g_warning ("Error reading property \"%s\" for \"%s\"", property->name, device_name); + return FALSE; + } + + for (i = 0; i < nitems; i++) { + switch (property->format) { + case 8: + data[i] = property->data.c[i]; + break; + case 32: + ((long*)data)[i] = property->data.i[i]; + break; + } + } + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, realtype, realformat, + PropModeReplace, data, nitems); + + XFree (data); + + if (gdk_error_trap_pop ()) { + g_warning ("Error in setting \"%s\" for \"%s\"", property->name, device_name); + return FALSE; + } + + return TRUE; +} + +static gboolean +supports_xinput_devices_with_opcode (int *opcode) +{ + gint op_code, event, error; + gboolean retval; + + retval = XQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "XInputExtension", + &op_code, + &event, + &error); + if (opcode) + *opcode = op_code; + + return retval; +} + +gboolean +supports_xinput_devices (void) +{ + return supports_xinput_devices_with_opcode (NULL); +} + +gboolean +supports_xinput2_devices (int *opcode) +{ + int major, minor; + + if (supports_xinput_devices_with_opcode (opcode) == FALSE) + return FALSE; + + gdk_error_trap_push (); + + major = 2; + minor = 0; + + if (XIQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor) != Success) { + gdk_error_trap_pop_ignored (); + /* try for 2.2, maybe gtk has already announced 2.2 support */ + gdk_error_trap_push (); + major = 2; + minor = 2; + if (XIQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor) != Success) { + gdk_error_trap_pop_ignored (); + return FALSE; + } + } + gdk_error_trap_pop_ignored (); + + if ((major * 1000 + minor) < (2000)) + return FALSE; + + return TRUE; +} + +gboolean +device_is_touchpad (XDevice *xdevice) +{ + Atom realtype, prop; + int realformat; + unsigned long nitems, bytes_after; + unsigned char *data; + + /* we don't check on the type being XI_TOUCHPAD here, + * but having a "Synaptics Off" property should be enough */ + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Off", False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, 0, 1, False, + XA_INTEGER, &realtype, &realformat, &nitems, + &bytes_after, &data) == Success) && (realtype != None)) { + gdk_error_trap_pop_ignored (); + XFree (data); + return TRUE; + } + gdk_error_trap_pop_ignored (); + + return FALSE; +} + +gboolean +device_info_is_touchpad (XDeviceInfo *device_info) +{ + return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TOUCHPAD, False)); +} + +gboolean +device_info_is_touchscreen (XDeviceInfo *device_info) +{ + return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TOUCHSCREEN, False)); +} + +gboolean +device_info_is_mouse (XDeviceInfo *device_info) +{ + return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_MOUSE, False)); +} + +static gboolean +device_type_is_present (InfoIdentifyFunc info_func, + DeviceIdentifyFunc device_func) +{ + XDeviceInfo *device_info; + gint n_devices; + guint i; + gboolean retval; + + if (supports_xinput_devices () == FALSE) + return TRUE; + + retval = FALSE; + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return FALSE; + + for (i = 0; i < n_devices; i++) { + XDevice *device; + + /* Check with the device info first */ + retval = (info_func) (&device_info[i]); + if (retval == FALSE) + continue; + + /* If we only have an info func, we're done checking */ + if (device_func == NULL) + break; + + gdk_error_trap_push (); + device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device_info[i].id); + if (gdk_error_trap_pop () || (device == NULL)) + continue; + + retval = (device_func) (device); + if (retval) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device); + break; + } + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device); + } + XFreeDeviceList (device_info); + + return retval; +} + +gboolean +touchscreen_is_present (void) +{ + return device_type_is_present (device_info_is_touchscreen, + NULL); +} + +gboolean +touchpad_is_present (void) +{ + return device_type_is_present (device_info_is_touchpad, + device_is_touchpad); +} + +gboolean +mouse_is_present (void) +{ + return device_type_is_present (device_info_is_mouse, + NULL); +} + +char * +xdevice_get_device_node (int deviceid) +{ + Atom prop; + Atom act_type; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + char *ret; + + gdk_display_sync (gdk_display_get_default ()); + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Device Node", False); + if (!prop) + return NULL; + + gdk_error_trap_push (); + + if (!XIGetProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + deviceid, prop, 0, 1000, False, + AnyPropertyType, &act_type, &act_format, + &nitems, &bytes_after, &data) == Success) { + gdk_error_trap_pop_ignored (); + return NULL; + } + if (gdk_error_trap_pop ()) + goto out; + + if (nitems == 0) + goto out; + + if (act_type != XA_STRING) + goto out; + + /* Unknown string format */ + if (act_format != 8) + goto out; + + ret = g_strdup ((char *) data); + + XFree (data); + return ret; + +out: + XFree (data); + return NULL; +} + +#define TOOL_ID_FORMAT_SIZE 32 +static int +get_id_for_index (guchar *data, + guint idx) +{ + guchar *ptr; + int id; + + ptr = data; + ptr += TOOL_ID_FORMAT_SIZE / 8 * idx; + + id = *((int32_t*)ptr); + id = id & 0xfffff; + + return id; +} + + +#define STYLUS_DEVICE_ID 0x02 +#define ERASER_DEVICE_ID 0x0A + +int +xdevice_get_last_tool_id (int deviceid) +{ + Atom prop; + Atom act_type; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + int id; + + id = -1; + + gdk_display_sync (gdk_display_get_default ()); + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), WACOM_SERIAL_IDS_PROP, False); + if (!prop) + return -1; + + data = NULL; + + gdk_error_trap_push (); + + if (XIGetProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + deviceid, prop, 0, 1000, False, + AnyPropertyType, &act_type, &act_format, + &nitems, &bytes_after, &data) != Success) { + gdk_error_trap_pop_ignored (); + goto out; + } + + if (gdk_error_trap_pop ()) + goto out; + + if (nitems != 4 && nitems != 5) + goto out; + + if (act_type != XA_INTEGER) + goto out; + + if (act_format != TOOL_ID_FORMAT_SIZE) + goto out; + + /* item 0 = tablet ID + * item 1 = old device serial number (== last tool in proximity) + * item 2 = old hardware serial number (including tool ID) + * item 3 = current serial number (0 if no tool in proximity) + * item 4 = current tool ID (since Feb 2012) + * + * Get the current tool ID first, if available, then the old one */ + id = 0x0; + if (nitems == 5) + id = get_id_for_index (data, 4); + if (id == 0x0) + id = get_id_for_index (data, 2); + + /* That means that no tool was set down yet */ + if (id == STYLUS_DEVICE_ID || + id == ERASER_DEVICE_ID) + id = 0x0; + +out: + if (data != NULL) + XFree (data); + return id; +} + +gboolean +set_device_enabled (int device_id, + gboolean enabled) +{ + Atom prop; + guchar value; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Device Enabled", False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + + value = enabled ? 1 : 0; + XIChangeProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + device_id, prop, XA_INTEGER, 8, PropModeReplace, &value, 1); + + if (gdk_error_trap_pop ()) + return FALSE; + + return TRUE; +} + +static const char * +custom_command_to_string (CustomCommand command) +{ + switch (command) { + case COMMAND_DEVICE_ADDED: + return "added"; + case COMMAND_DEVICE_REMOVED: + return "removed"; + case COMMAND_DEVICE_PRESENT: + return "present"; + default: + g_assert_not_reached (); + } +} + +/* Run a custom command on device presence events. Parameters passed into + * the custom command are: + * command -t [added|removed|present] -i + * Type 'added' and 'removed' signal 'device added' and 'device removed', + * respectively. Type 'present' signals 'device present at + * gnome-settings-daemon init'. + * + * The script is expected to run synchronously, and an exit value + * of "1" means that no other settings will be applied to this + * particular device. + * + * More options may be added in the future. + * + * This function returns TRUE if we should not apply any more settings + * to the device. + */ +gboolean +run_custom_command (GdkDevice *device, + CustomCommand command) +{ + GSettings *settings; + char *cmd; + char *argv[7]; + int exit_status; + gboolean rc; + int id; + + settings = g_settings_new (INPUT_DEVICES_SCHEMA); + cmd = g_settings_get_string (settings, KEY_HOTPLUG_COMMAND); + g_object_unref (settings); + + if (!cmd || cmd[0] == '\0') { + g_free (cmd); + return FALSE; + } + + /* Easter egg! */ + g_object_get (device, "device-id", &id, NULL); + + argv[0] = cmd; + argv[1] = "-t"; + argv[2] = (char *) custom_command_to_string (command); + argv[3] = "-i"; + argv[4] = g_strdup_printf ("%d", id); + argv[5] = g_strdup_printf ("%s", gdk_device_get_name (device)); + argv[6] = NULL; + + rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL, &exit_status, NULL); + + if (rc == FALSE) + g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd); + + g_free (argv[0]); + g_free (argv[4]); + g_free (argv[5]); + + return (exit_status == 0); +} + +GList * +get_disabled_devices (GdkDeviceManager *manager) +{ + XDeviceInfo *device_info; + gint n_devices; + guint i; + GList *ret; + + ret = NULL; + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return ret; + + for (i = 0; i < n_devices; i++) { + GdkDevice *device; + + /* Ignore core devices */ + if (device_info[i].use == IsXKeyboard || + device_info[i].use == IsXPointer) + continue; + + /* Check whether the device is actually available */ + device = gdk_x11_device_manager_lookup (manager, device_info[i].id); + if (device != NULL) + continue; + + ret = g_list_prepend (ret, GINT_TO_POINTER (device_info[i].id)); + } + + XFreeDeviceList (device_info); + + return ret; +} diff --git a/plugins/common/gsd-input-helper.h b/plugins/common/gsd-input-helper.h new file mode 100644 index 00000000..fb898b0d --- /dev/null +++ b/plugins/common/gsd-input-helper.h @@ -0,0 +1,83 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Bastien Nocera + * + * 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_INPUT_HELPER_H +#define __GSD_INPUT_HELPER_H + +G_BEGIN_DECLS + +#include + +#include +#include + +#define WACOM_SERIAL_IDS_PROP "Wacom Serial IDs" + +typedef enum { + COMMAND_DEVICE_ADDED, + COMMAND_DEVICE_REMOVED, + COMMAND_DEVICE_PRESENT +} CustomCommand; + +/* Generic property setting code. Fill up the struct property with the property + * data and pass it into device_set_property together with the device to be + * changed. Note: doesn't cater for non-zero offsets yet, but we don't have + * any settings that require that. + */ +typedef struct { + const char *name; /* property name */ + gint nitems; /* number of items in data */ + gint format; /* CARD8 or CARD32 sized-items */ + gint type; /* Atom representing data type */ + union { + const gchar *c; /* 8 bit data */ + const gint *i; /* 32 bit data */ + } data; +} PropertyHelper; + +gboolean supports_xinput_devices (void); +gboolean supports_xinput2_devices (int *opcode); + +gboolean set_device_enabled (int device_id, + gboolean enabled); + +gboolean device_is_touchpad (XDevice *xdevice); + +gboolean device_info_is_touchpad (XDeviceInfo *device_info); +gboolean device_info_is_touchscreen (XDeviceInfo *device_info); +gboolean device_info_is_mouse (XDeviceInfo *device_info); + +gboolean touchpad_is_present (void); +gboolean touchscreen_is_present (void); +gboolean mouse_is_present (void); + +gboolean device_set_property (XDevice *xdevice, + const char *device_name, + PropertyHelper *property); + +gboolean run_custom_command (GdkDevice *device, + CustomCommand command); + +GList * get_disabled_devices (GdkDeviceManager *manager); +char * xdevice_get_device_node (int deviceid); +int xdevice_get_last_tool_id (int deviceid); + +G_END_DECLS + +#endif /* __GSD_INPUT_HELPER_H */ diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c new file mode 100644 index 00000000..aefc9bae --- /dev/null +++ b/plugins/common/gsd-keygrab.c @@ -0,0 +1,455 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * Copyright (C) 2008 Jens Granseuer + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include "gsd-keygrab.h" + +/* these are the mods whose combinations are ignored by the keygrabbing code */ +static GdkModifierType gsd_ignored_mods = 0; + +/* these are the ones we actually use for global keys, we always only check + * for these set */ +static GdkModifierType gsd_used_mods = 0; + +/* Taken from a comment in XF86keysym.h */ +#define XF86KEYS_RANGE_MIN 0x10080001 +#define XF86KEYS_RANGE_MAX 0x1008FFFF + +#define FKEYS_RANGE_MIN GDK_KEY_F1 +#define FKEYS_RANGE_MAX GDK_KEY_R15 + +#define IN_RANGE(x, min, max) (x >= min && x <= max) + +static void +setup_modifiers (void) +{ + if (gsd_used_mods == 0 || gsd_ignored_mods == 0) { + GdkModifierType dynmods; + + /* default modifiers */ + gsd_ignored_mods = \ + 0x2000 /*Xkb modifier*/ | GDK_LOCK_MASK | GDK_HYPER_MASK; + gsd_used_mods = \ + GDK_SHIFT_MASK | GDK_CONTROL_MASK |\ + GDK_MOD1_MASK | GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK |\ + GDK_MOD5_MASK | GDK_SUPER_MASK | GDK_META_MASK; + + /* NumLock can be assigned to varying keys so we need to + * resolve and ignore it specially */ + dynmods = XkbKeysymToModifiers (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_KEY_Num_Lock); + + gsd_ignored_mods |= dynmods; + gsd_used_mods &= ~dynmods; + } +} + +static void +grab_key_real (guint keycode, + GdkWindow *root, + gboolean grab, + gboolean synchronous, + XIGrabModifiers *mods, + int num_mods) +{ + XIEventMask evmask; + unsigned char mask[(XI_LASTEVENT + 7)/8]; + + memset (mask, 0, sizeof (mask)); + XISetMask (mask, XI_KeyPress); + XISetMask (mask, XI_KeyRelease); + + evmask.deviceid = XIAllMasterDevices; + evmask.mask_len = sizeof (mask); + evmask.mask = mask; + + if (grab) { + XIGrabKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XIAllMasterDevices, + keycode, + GDK_WINDOW_XID (root), + GrabModeAsync, + synchronous ? GrabModeSync : GrabModeAsync, + False, + &evmask, + num_mods, + mods); + } else { + XIUngrabKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XIAllMasterDevices, + keycode, + GDK_WINDOW_XID (root), + num_mods, + mods); + } +} + +/* Grab the key. In order to ignore GSD_IGNORED_MODS we need to grab + * all combinations of the ignored modifiers and those actually used + * for the binding (if any). + * + * inspired by all_combinations from gnome-panel/gnome-panel/global-keys.c + * + * This may generate X errors. The correct way to use this is like: + * + * gdk_error_trap_push (); + * + * grab_key_unsafe (key, grab, screens); + * + * gdk_flush (); + * if (gdk_error_trap_pop ()) + * g_warning ("Grab failed, another application may already have access to key '%u'", + * key->keycode); + * + * This is not done in the function itself, to allow doing multiple grab_key + * operations with one flush only. + */ +#define N_BITS 32 +static void +grab_key_internal (Key *key, + gboolean grab, + GsdKeygrabFlags flags, + GSList *screens) +{ + int indexes[N_BITS]; /* indexes of bits we need to flip */ + int i; + int bit; + int bits_set_cnt; + int uppervalue; + guint mask, modifiers; + GArray *all_mods; + GSList *l; + + setup_modifiers (); + + mask = gsd_ignored_mods & ~key->state & GDK_MODIFIER_MASK; + + /* XGrabKey requires real modifiers, not virtual ones */ + modifiers = key->state; + gdk_keymap_map_virtual_modifiers (gdk_keymap_get_default (), &modifiers); + modifiers &= ~(GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK); + + /* If key doesn't have a usable modifier, we don't want + * to grab it, since the user might lose a useful key. + * + * The exception is the XFree86 keys and the Function keys + * (which are useful to grab without a modifier). + */ + if (!(flags & GSD_KEYGRAB_ALLOW_UNMODIFIED) && + (modifiers & gsd_used_mods) == 0 && + !IN_RANGE(key->keysym, XF86KEYS_RANGE_MIN, XF86KEYS_RANGE_MAX) && + !IN_RANGE(key->keysym, FKEYS_RANGE_MIN, FKEYS_RANGE_MAX) && + key->keysym != GDK_KEY_Pause && + key->keysym != GDK_KEY_Print && + key->keysym != GDK_KEY_Menu) { + GString *keycodes; + + keycodes = g_string_new (""); + if (key->keycodes != NULL) { + guint *c; + + for (c = key->keycodes; *c; ++c) { + g_string_printf (keycodes, " %u", *c); + } + } + g_warning ("Key 0x%x (keycodes: %s) with state 0x%x (resolved to 0x%x) " + " has no usable modifiers (usable modifiers are 0x%x)", + key->keysym, keycodes->str, key->state, modifiers, gsd_used_mods); + g_string_free (keycodes, TRUE); + + return; + } + + bit = 0; + /* store the indexes of all set bits in mask in the array */ + for (i = 0; mask; ++i, mask >>= 1) { + if (mask & 0x1) { + indexes[bit++] = i; + } + } + + bits_set_cnt = bit; + + all_mods = g_array_new (FALSE, TRUE, sizeof(XIGrabModifiers)); + uppervalue = 1 << bits_set_cnt; + /* store all possible modifier combinations for our mask into all_mods */ + for (i = 0; i < uppervalue; ++i) { + int j; + int result = 0; + XIGrabModifiers *mod; + + /* map bits in the counter to those in the mask */ + for (j = 0; j < bits_set_cnt; ++j) { + if (i & (1 << j)) { + result |= (1 << indexes[j]); + } + } + + /* Grow the array by one, to fit our new XIGrabModifiers item */ + g_array_set_size (all_mods, all_mods->len + 1); + mod = &g_array_index (all_mods, XIGrabModifiers, all_mods->len - 1); + mod->modifiers = result | modifiers; + } + + /* Capture the actual keycodes with the modifier array */ + for (l = screens; l; l = l->next) { + GdkScreen *screen = l->data; + guint *code; + + for (code = key->keycodes; *code; ++code) { + grab_key_real (*code, + gdk_screen_get_root_window (screen), + grab, + flags & GSD_KEYGRAB_SYNCHRONOUS, + (XIGrabModifiers *) all_mods->data, + all_mods->len); + } + } + g_array_free (all_mods, TRUE); +} + +void +grab_key_unsafe (Key *key, + GsdKeygrabFlags flags, + GSList *screens) +{ + grab_key_internal (key, TRUE, flags, screens); +} + +void +ungrab_key_unsafe (Key *key, + GSList *screens) +{ + grab_key_internal (key, FALSE, 0, screens); +} + +static gboolean +have_xkb (Display *dpy) +{ + static int have_xkb = -1; + + if (have_xkb == -1) { + int opcode, error_base, major, minor, xkb_event_base; + + have_xkb = XkbQueryExtension (dpy, + &opcode, + &xkb_event_base, + &error_base, + &major, + &minor) + && XkbUseExtension (dpy, &major, &minor); + } + + return have_xkb; +} + +gboolean +key_uses_keycode (const Key *key, guint keycode) +{ + if (key->keycodes != NULL) { + guint *c; + + for (c = key->keycodes; *c; ++c) { + if (*c == keycode) + return TRUE; + } + } + return FALSE; +} + +/* Adapted from _gdk_x11_device_xi2_translate_state() + * in gtk+/gdk/x11/gdkdevice-xi2.c */ +static guint +device_xi2_translate_state (XIModifierState *mods_state, + XIGroupState *group_state) +{ + guint state; + gint group; + + state = (guint) mods_state->base | mods_state->latched | mods_state->locked; + + group = group_state->base | group_state->latched | group_state->locked; + /* FIXME: do we need the XKB complications for this ? */ + group = CLAMP(group, 0, 3); + state |= group << 13; + + return state; +} + +gboolean +match_xi2_key (Key *key, XIDeviceEvent *event) +{ + guint keyval; + GdkModifierType consumed; + gint group; + guint keycode, state; + + if (key == NULL) + return FALSE; + + setup_modifiers (); + + state = device_xi2_translate_state (&event->mods, &event->group); + + if (have_xkb (event->display)) + group = XkbGroupForCoreState (state); + else + group = (state & GDK_KEY_Mode_switch) ? 1 : 0; + + keycode = event->detail; + + /* Check if we find a keysym that matches our current state */ + if (gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (), keycode, + state, group, + &keyval, NULL, NULL, &consumed)) { + guint lower, upper; + guint mask; + + /* HACK: we don't want to use SysRq as a keybinding, so we avoid + * its translation from Alt+Print. */ + if (keyval == GDK_KEY_Sys_Req && + (state & GDK_MOD1_MASK) != 0) { + consumed = 0; + keyval = GDK_KEY_Print; + } + + /* The Key structure contains virtual modifiers, whereas + * the XEvent will be using the real modifier, so translate those */ + mask = key->state; + gdk_keymap_map_virtual_modifiers (gdk_keymap_get_default (), &mask); + mask &= ~(GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK); + + gdk_keyval_convert_case (keyval, &lower, &upper); + + /* If we are checking against the lower version of the + * keysym, we might need the Shift state for matching, + * so remove it from the consumed modifiers */ + if (lower == key->keysym) + consumed &= ~GDK_SHIFT_MASK; + + return ((lower == key->keysym || upper == key->keysym) + && (state & ~consumed & gsd_used_mods) == mask); + } + + /* The key we passed doesn't have a keysym, so try with just the keycode */ + return (key != NULL + && key->state == (state & gsd_used_mods) + && key_uses_keycode (key, keycode)); +} + +Key * +parse_key (const char *str) +{ + Key *key; + + if (str == NULL || + *str == '\0' || + g_str_equal (str, "disabled")) { + return NULL; + } + + key = g_new0 (Key, 1); + gtk_accelerator_parse_with_keycode (str, &key->keysym, &key->keycodes, &key->state); + if (key->keysym == 0 && + key->keycodes == NULL && + key->state == 0) { + g_free (key); + return NULL; + } + + return key; +} + +void +free_key (Key *key) +{ + if (key == NULL) + return; + g_free (key->keycodes); + g_free (key); +} + +static void +grab_button_real (int deviceid, + gboolean grab, + GdkWindow *root) +{ + XIGrabModifiers mods; + + mods.modifiers = XIAnyModifier; + + if (grab) { + XIEventMask evmask; + unsigned char mask[(XI_LASTEVENT + 7)/8]; + + memset (mask, 0, sizeof (mask)); + XISetMask (mask, XI_ButtonRelease); + XISetMask (mask, XI_ButtonPress); + + evmask.deviceid = deviceid; + evmask.mask_len = sizeof (mask); + evmask.mask = mask; + + XIGrabButton (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + deviceid, + XIAnyButton, + GDK_WINDOW_XID (root), + None, + GrabModeAsync, + GrabModeAsync, + False, + &evmask, + 1, + &mods); + } else { + XIUngrabButton (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + deviceid, + XIAnyButton, + GDK_WINDOW_XID (root), + 1, &mods); + } +} + +void +grab_button (int deviceid, + gboolean grab, + GSList *screens) +{ + GSList *l; + + for (l = screens; l; l = l->next) { + GdkScreen *screen = l->data; + + grab_button_real (deviceid, + grab, + gdk_screen_get_root_window (screen)); + } +} diff --git a/plugins/common/gsd-keygrab.h b/plugins/common/gsd-keygrab.h new file mode 100644 index 00000000..6ec8847a --- /dev/null +++ b/plugins/common/gsd-keygrab.h @@ -0,0 +1,63 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Jens Granseuer + * + * 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_COMMON_KEYGRAB_H +#define __GSD_COMMON_KEYGRAB_H + +G_BEGIN_DECLS + +#include +#include +#include + +typedef struct { + guint keysym; + guint state; + guint *keycodes; +} Key; + +typedef enum { + GSD_KEYGRAB_NORMAL = 0, + GSD_KEYGRAB_ALLOW_UNMODIFIED = 1 << 0, + GSD_KEYGRAB_SYNCHRONOUS = 1 << 1 +} GsdKeygrabFlags; + +void grab_key_unsafe (Key *key, + GsdKeygrabFlags flags, + GSList *screens); + +void ungrab_key_unsafe (Key *key, + GSList *screens); + +gboolean match_xi2_key (Key *key, + XIDeviceEvent *event); + +gboolean key_uses_keycode (const Key *key, + guint keycode); + +Key * parse_key (const char *str); +void free_key (Key *key); + +void grab_button (int deviceid, + gboolean grab, + GSList *screens); + +G_END_DECLS + +#endif /* __GSD_COMMON_KEYGRAB_H */ diff --git a/plugins/common/gsd-power-helper.c b/plugins/common/gsd-power-helper.c new file mode 100644 index 00000000..27d0eda1 --- /dev/null +++ b/plugins/common/gsd-power-helper.c @@ -0,0 +1,203 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Bastien Nocera + * + * 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 "gsd-power-helper.h" + +#define SYSTEMD_DBUS_NAME "org.freedesktop.login1" +#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1" +#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager" + +#define CONSOLEKIT_DBUS_NAME "org.freedesktop.ConsoleKit" +#define CONSOLEKIT_DBUS_PATH_MANAGER "/org/freedesktop/ConsoleKit/Manager" +#define CONSOLEKIT_DBUS_INTERFACE_MANAGER "org.freedesktop.ConsoleKit.Manager" + +#ifdef HAVE_SYSTEMD +static void +systemd_stop (void) +{ + GDBusConnection *bus; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + g_dbus_connection_call (bus, + SYSTEMD_DBUS_NAME, + SYSTEMD_DBUS_PATH, + SYSTEMD_DBUS_INTERFACE, + "PowerOff", + g_variant_new ("(b)", FALSE), + NULL, 0, G_MAXINT, NULL, NULL, NULL); + g_object_unref (bus); +} + +static void +systemd_suspend (void) +{ + GDBusConnection *bus; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + g_dbus_connection_call (bus, + SYSTEMD_DBUS_NAME, + SYSTEMD_DBUS_PATH, + SYSTEMD_DBUS_INTERFACE, + "Suspend", + g_variant_new ("(b)", TRUE), + NULL, 0, G_MAXINT, NULL, NULL, NULL); + g_object_unref (bus); +} + +static void +systemd_hibernate (void) +{ + GDBusConnection *bus; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + g_dbus_connection_call (bus, + SYSTEMD_DBUS_NAME, + SYSTEMD_DBUS_PATH, + SYSTEMD_DBUS_INTERFACE, + "Hibernate", + g_variant_new ("(b)", TRUE), + NULL, 0, G_MAXINT, NULL, NULL, NULL); + g_object_unref (bus); +} + +#else /* HAVE_SYSTEMD */ + +static void +consolekit_stop_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't stop using ConsoleKit: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +consolekit_stop (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* power down the machine in a safe way */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + CONSOLEKIT_DBUS_NAME, + CONSOLEKIT_DBUS_PATH_MANAGER, + CONSOLEKIT_DBUS_INTERFACE_MANAGER, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to ConsoleKit: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Stop", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + consolekit_stop_cb, NULL); + g_object_unref (proxy); +} +static void +upower_sleep_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't sleep using UPower: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +upower_suspend (GDBusProxy *upower_proxy) +{ + g_dbus_proxy_call (upower_proxy, + "Suspend", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + upower_sleep_cb, NULL); +} + +static void +upower_hibernate (GDBusProxy *upower_proxy) +{ + g_dbus_proxy_call (upower_proxy, + "Hibernate", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + upower_sleep_cb, NULL); +} +#endif /* HAVE_SYSTEMD */ + +void +gsd_power_suspend (GDBusProxy *upower_proxy) +{ +#ifdef HAVE_SYSTEMD + systemd_suspend (); +#else + upower_suspend (upower_proxy); +#endif +} + +void +gsd_power_poweroff (void) +{ +#ifdef HAVE_SYSTEMD + systemd_stop (); +#else + consolekit_stop (); +#endif +} + +void +gsd_power_hibernate (GDBusProxy *upower_proxy) +{ +#ifdef HAVE_SYSTEMD + systemd_hibernate (); +#else + upower_hibernate (upower_proxy); +#endif +} diff --git a/plugins/common/gsd-power-helper.h b/plugins/common/gsd-power-helper.h new file mode 100644 index 00000000..e3be14f0 --- /dev/null +++ b/plugins/common/gsd-power-helper.h @@ -0,0 +1,35 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Bastien Nocera + * + * 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_POWER_HELPER_H +#define __GSD_POWER_HELPER_H + +#include + +G_BEGIN_DECLS + +#include + +void gsd_power_suspend (GDBusProxy *upower_proxy); +void gsd_power_hibernate (GDBusProxy *upower_proxy); +void gsd_power_poweroff (void); + +G_END_DECLS + +#endif /* __GSD_POWER_HELPER_H */ diff --git a/plugins/common/input-device-example.sh b/plugins/common/input-device-example.sh new file mode 100644 index 00000000..67a68ed2 --- /dev/null +++ b/plugins/common/input-device-example.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# +# This script is an example hotplug script for use with the various +# input devices plugins. +# +# The script is called with the arguments: +# -t [added|present|removed] +# added ... device was just plugged in +# present.. device was present at gnome-settings-daemon startup +# removed.. device was just removed +# -i +# device ID being the XInput device ID +# The name of the device +# +# The script should return 0 if the device is to be +# ignored from future configuration. +# +# Set the script to be used with: +# gsettings set org.gnome.settings-daemon.peripherals.input-devices hotplug-command /path/to/script/input-devices.sh +# + +args=`getopt "t:i:" $*` + +set -- $args + +while [ $# -gt 0 ] +do + case $1 in + -t) + shift; + type="$1" + ;; + -i) + shift; + id="$1" + ;; + --) + shift; + device="$@" + break; + ;; + *) + echo "Unknown option $1"; + exit 1 + ;; + esac + shift +done + +retval=0 + +case $type in + added) + echo "Device '$device' (ID=$id) was added" + ;; + present) + echo "Device '$device' (ID=$id) was already present at startup" + ;; + removed) + echo "Device '$device' (ID=$id) was removed" + ;; + *) + echo "Unknown operation" + retval=1 + ;; +esac + +# All further processing will be disabled if $retval == 0 +exit $retval diff --git a/plugins/common/test-egg-key-parsing.c b/plugins/common/test-egg-key-parsing.c new file mode 100644 index 00000000..d1b8dd8e --- /dev/null +++ b/plugins/common/test-egg-key-parsing.c @@ -0,0 +1,21 @@ +#include + +#define KEY "XF86AudioMute" + +int main (int argc, char **argv) +{ + guint gdk_accel_key; + guint *gdk_accel_codes; + GdkModifierType gdk_mods; + + gtk_init (&argc, &argv); + + g_message ("gdk_keyval_from_name ('%s') == %d", KEY, gdk_keyval_from_name(KEY)); + + gtk_accelerator_parse_with_keycode (KEY, &gdk_accel_key, &gdk_accel_codes, &gdk_mods); + g_message ("gtk_accelerator_parse_full ('%s') returned keyval '%d' keycode[0]: '%d' mods: 0x%x", + KEY, gdk_accel_key, gdk_accel_codes ? gdk_accel_codes[0] : 0, gdk_mods); + g_free (gdk_accel_codes); + + return 0; +} diff --git a/plugins/common/test-input-helper.c b/plugins/common/test-input-helper.c new file mode 100644 index 00000000..4a9cccfc --- /dev/null +++ b/plugins/common/test-input-helper.c @@ -0,0 +1,123 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Bastien Nocera + * + * 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 +#include +#include + +#include +#include + +#include "gsd-input-helper.h" + +static void +print_disabled_devices (void) +{ + GList *devices, *l; + GdkDeviceManager *manager; + + manager = gdk_display_get_device_manager (gdk_display_get_default ()); + + devices = get_disabled_devices (manager); + g_print ("Disabled devices:\t\t\t"); + if (devices == NULL) { + g_print ("no\n"); + return; + } + + for (l = devices; l != NULL; l = l->next) { + g_print ("%d ", GPOINTER_TO_INT (l->data)); + } + g_list_free (devices); + g_print ("\n"); +} + +int main (int argc, char **argv) +{ + gboolean supports_xinput; + gboolean has_touchpad, has_touchscreen; + XDeviceInfo *device_info; + gint n_devices, opcode; + guint i; + + gtk_init (&argc, &argv); + + supports_xinput = supports_xinput_devices (); + if (supports_xinput) { + g_print ("Supports XInput:\t\t\tyes\n"); + } else { + g_print ("Supports XInput:\t\t\tno\n"); + return 0; + } + supports_xinput = supports_xinput2_devices (&opcode); + if (supports_xinput) { + g_print ("Supports XInput2:\t\t\tyes (opcode: %d)\n", opcode); + } else { + g_print ("Supports XInput2:\t\t\tno\n"); + return 0; + } + + has_touchpad = touchpad_is_present (); + g_print ("Has touchpad:\t\t\t\t%s\n", has_touchpad ? "yes" : "no"); + + has_touchscreen = touchscreen_is_present (); + g_print ("Has touchscreen:\t\t\t%s\n", has_touchscreen ? "yes" : "no"); + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) { + g_warning ("Has no input devices"); + return 1; + } + + print_disabled_devices (); + + for (i = 0; i < n_devices; i++) { + XDevice *device; + + if (device_info_is_touchscreen (&device_info[i])) { + g_print ("Device %d is touchscreen:\t\t%s\n", (int) device_info[i].id, "yes"); + continue; + } + + gdk_error_trap_push (); + device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device_info[i].id); + if (gdk_error_trap_pop () || (device == NULL)) + continue; + + if (device_is_touchpad (device)) + g_print ("Device %d is touchpad:\t\t%s\n", (int) device_info[i].id, "yes"); + else { + int tool_id; + + tool_id = xdevice_get_last_tool_id (device_info[i].id); + if (tool_id >= 0x0) + g_print ("Device %d is touchpad/touchscreen:\t%s (tool ID: 0x%x)\n", (int) device_info[i].id, "no", tool_id); + else + g_print ("Device %d is touchpad/touchscreen:\t%s\n", (int) device_info[i].id, "no"); + } + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device); + } + XFreeDeviceList (device_info); + + return 0; +} diff --git a/plugins/common/test-plugin.h b/plugins/common/test-plugin.h new file mode 100644 index 00000000..f0100de5 --- /dev/null +++ b/plugins/common/test-plugin.h @@ -0,0 +1,90 @@ +/** + * Create a test app for your plugin quickly. + * + * #define NEW gsd_media_keys_manager_new + * #define START gsd_media_keys_manager_start + * #define MANAGER GsdMediaKeysManager + * #include "gsd-media-keys-manager.h" + * + * #include "test-plugin.h" + */ + +#include "config.h" + +#include + +#include +#include +#include + +#ifndef SCHEMA_NAME +#define SCHEMA_NAME PLUGIN_NAME +#endif + +#ifndef PLUGIN_NAME +#error Include PLUGIN_CFLAGS in the test application s CFLAGS +#endif /* !PLUGIN_NAME */ + +static MANAGER *manager = NULL; + +static gboolean +has_settings (void) +{ + const gchar * const * list; + guint i; + + list = g_settings_list_schemas (); + for (i = 0; list[i] != NULL; i++) { + if (g_str_equal (list[i], "org.gnome.settings-daemon.plugins." SCHEMA_NAME)) + return TRUE; + } + return FALSE; +} + +int +main (int argc, char **argv) +{ + GError *error; + GSettings *settings; + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + notify_init ("gnome-settings-daemon"); + + g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + + error = NULL; + if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) { + fprintf (stderr, "%s\n", error->message); + g_error_free (error); + exit (1); + } + + if (has_settings () == FALSE) { + fprintf (stderr, "The schemas for plugin '%s' aren't available, check your installation.\n", SCHEMA_NAME); + exit (1); + } + + settings = g_settings_new ("org.gnome.settings-daemon.plugins." SCHEMA_NAME); + if (g_settings_get_boolean (settings, "active") != FALSE) { + fprintf (stderr, "Plugin '%s' is not disabled. You need to disable it before launching the test application.\n", SCHEMA_NAME); + fprintf (stderr, "To deactivate:\n"); + fprintf (stderr, "\tgsettings set org.gnome.settings-daemon.plugins." SCHEMA_NAME " active false\n"); + fprintf (stderr, "To reactivate:\n"); + fprintf (stderr, "\tgsettings set org.gnome.settings-daemon.plugins." SCHEMA_NAME " active true\n"); + exit (1); + } + + manager = NEW (); + + error = NULL; + START (manager, &error); + + gtk_main (); + + STOP (manager); + g_object_unref (manager); + + return 0; +} diff --git a/plugins/cursor/Makefile.am b/plugins/cursor/Makefile.am new file mode 100644 index 00000000..2787d5db --- /dev/null +++ b/plugins/cursor/Makefile.am @@ -0,0 +1,47 @@ +plugin_name = cursor + +plugin_LTLIBRARIES = \ + libcursor.la + +libcursor_la_SOURCES = \ + gsd-cursor-manager.c \ + gsd-cursor-manager.h \ + gsd-cursor-plugin.c \ + gsd-cursor-plugin.h + +libcursor_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libcursor_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(CURSOR_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libcursor_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libcursor_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(CURSOR_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + cursor.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ + diff --git a/plugins/cursor/Makefile.in b/plugins/cursor/Makefile.in new file mode 100644 index 00000000..17038851 --- /dev/null +++ b/plugins/cursor/Makefile.in @@ -0,0 +1,785 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/cursor +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcursor_la_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libcursor_la_OBJECTS = libcursor_la-gsd-cursor-manager.lo \ + libcursor_la-gsd-cursor-plugin.lo +libcursor_la_OBJECTS = $(am_libcursor_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcursor_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libcursor_la_CFLAGS) \ + $(CFLAGS) $(libcursor_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcursor_la_SOURCES) +DIST_SOURCES = $(libcursor_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = cursor +plugin_LTLIBRARIES = \ + libcursor.la + +libcursor_la_SOURCES = \ + gsd-cursor-manager.c \ + gsd-cursor-manager.h \ + gsd-cursor-plugin.c \ + gsd-cursor-plugin.h + +libcursor_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libcursor_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(CURSOR_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libcursor_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libcursor_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(CURSOR_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + cursor.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/cursor/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/cursor/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libcursor.la: $(libcursor_la_OBJECTS) $(libcursor_la_DEPENDENCIES) $(EXTRA_libcursor_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcursor_la_LINK) -rpath $(plugindir) $(libcursor_la_OBJECTS) $(libcursor_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcursor_la-gsd-cursor-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcursor_la-gsd-cursor-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libcursor_la-gsd-cursor-manager.lo: gsd-cursor-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcursor_la_CPPFLAGS) $(CPPFLAGS) $(libcursor_la_CFLAGS) $(CFLAGS) -MT libcursor_la-gsd-cursor-manager.lo -MD -MP -MF $(DEPDIR)/libcursor_la-gsd-cursor-manager.Tpo -c -o libcursor_la-gsd-cursor-manager.lo `test -f 'gsd-cursor-manager.c' || echo '$(srcdir)/'`gsd-cursor-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcursor_la-gsd-cursor-manager.Tpo $(DEPDIR)/libcursor_la-gsd-cursor-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-cursor-manager.c' object='libcursor_la-gsd-cursor-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcursor_la_CPPFLAGS) $(CPPFLAGS) $(libcursor_la_CFLAGS) $(CFLAGS) -c -o libcursor_la-gsd-cursor-manager.lo `test -f 'gsd-cursor-manager.c' || echo '$(srcdir)/'`gsd-cursor-manager.c + +libcursor_la-gsd-cursor-plugin.lo: gsd-cursor-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcursor_la_CPPFLAGS) $(CPPFLAGS) $(libcursor_la_CFLAGS) $(CFLAGS) -MT libcursor_la-gsd-cursor-plugin.lo -MD -MP -MF $(DEPDIR)/libcursor_la-gsd-cursor-plugin.Tpo -c -o libcursor_la-gsd-cursor-plugin.lo `test -f 'gsd-cursor-plugin.c' || echo '$(srcdir)/'`gsd-cursor-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcursor_la-gsd-cursor-plugin.Tpo $(DEPDIR)/libcursor_la-gsd-cursor-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-cursor-plugin.c' object='libcursor_la-gsd-cursor-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcursor_la_CPPFLAGS) $(CPPFLAGS) $(libcursor_la_CFLAGS) $(CFLAGS) -c -o libcursor_la-gsd-cursor-plugin.lo `test -f 'gsd-cursor-plugin.c' || echo '$(srcdir)/'`gsd-cursor-plugin.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pluginDATA install-pluginLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/cursor/cursor.gnome-settings-plugin.in b/plugins/cursor/cursor.gnome-settings-plugin.in new file mode 100644 index 00000000..2d9c96ca --- /dev/null +++ b/plugins/cursor/cursor.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=cursor +IAge=0 +_Name=Cursor +_Description=Show/hide cursor on tablet devices +Authors=Bastien Nocera +Copyright=Copyright © 2011 Red Hat, Inc. +Website= diff --git a/plugins/cursor/gsd-cursor-manager.c b/plugins/cursor/gsd-cursor-manager.c new file mode 100644 index 00000000..d3ed2afa --- /dev/null +++ b/plugins/cursor/gsd-cursor-manager.c @@ -0,0 +1,393 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-cursor-manager.h" +#include "gsd-input-helper.h" + +#define XFIXES_CURSOR_HIDING_MAJOR 4 + +#define GSD_CURSOR_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_CURSOR_MANAGER, GsdCursorManagerPrivate)) + +struct GsdCursorManagerPrivate +{ + guint start_idle_id; + guint added_id; + guint removed_id; + gboolean cursor_shown; +}; + +enum { + PROP_0, +}; + +static void gsd_cursor_manager_class_init (GsdCursorManagerClass *klass); +static void gsd_cursor_manager_init (GsdCursorManager *cursor_manager); +static void gsd_cursor_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdCursorManager, gsd_cursor_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static gboolean +device_is_xtest (XDevice *xdevice) +{ + Atom realtype, prop; + int realformat; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "XTEST Device", False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, 0, 1, False, + XA_INTEGER, &realtype, &realformat, &nitems, + &bytes_after, &data) == Success) && (realtype != None)) { + gdk_error_trap_pop_ignored (); + XFree (data); + return TRUE; + } + gdk_error_trap_pop_ignored (); + + return FALSE; +} + +static void +set_cursor_visibility (GsdCursorManager *manager, + gboolean visible) +{ + Display *xdisplay; + GdkDisplay *display; + guint n_screens; + guint i; + + g_debug ("Attempting to %s the cursor", visible ? "show" : "hide"); + + display = gdk_display_get_default (); + xdisplay = GDK_DISPLAY_XDISPLAY (display); + + n_screens = gdk_display_get_n_screens (display); + + gdk_error_trap_push (); + + for (i = 0; i < n_screens; i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + + if (visible) + XFixesShowCursor (xdisplay, GDK_WINDOW_XID (gdk_screen_get_root_window (screen))); + else + XFixesHideCursor (xdisplay, GDK_WINDOW_XID (gdk_screen_get_root_window (screen))); + } + if (gdk_error_trap_pop ()) { + g_warning ("An error occurred trying to %s the cursor", + visible ? "show" : "hide"); + } + + manager->priv->cursor_shown = visible; +} + +static gboolean +device_info_is_ps2_mouse (XDeviceInfo *info) +{ + return (g_strcmp0 (info->name, "ImPS/2 Generic Wheel Mouse") == 0); +} + +static void +update_cursor_for_current (GsdCursorManager *manager) +{ + XDeviceInfo *device_info; + guint num_mice; + int n_devices; + guint i; + + /* List all the pointer devices + * ignore the touchscreens + * ignore the XTest devices + * see if there's anything left */ + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return; + + num_mice = 0; + + for (i = 0; i < n_devices; i++) { + XDevice *device; + + if (device_info[i].use != IsXExtensionPointer) + continue; + + if (device_info_is_touchscreen (&device_info[i])) + continue; + + if (device_info_is_ps2_mouse (&device_info[i])) + continue; + + gdk_error_trap_push (); + device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device_info[i].id); + if (gdk_error_trap_pop () || (device == NULL)) + continue; + + if (device_is_xtest (device)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device); + continue; + } + + g_debug ("Counting '%s' as mouse", device_info[i].name); + + num_mice++; + } + XFreeDeviceList (device_info); + + g_debug ("Found %d devices that aren't touchscreens or fake devices", num_mice); + + if (num_mice > 0) { + g_debug ("Mice are present"); + + if (manager->priv->cursor_shown == FALSE) { + set_cursor_visibility (manager, TRUE); + } + } else { + g_debug ("No mice present"); + if (manager->priv->cursor_shown != FALSE) { + set_cursor_visibility (manager, FALSE); + } + } +} + +static void +devices_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdCursorManager *manager) +{ + update_cursor_for_current (manager); +} + +static void +devices_removed_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdCursorManager *manager) +{ + /* If devices are removed, then it's unlikely + * a mouse appeared */ + if (manager->priv->cursor_shown == FALSE) + return; + + update_cursor_for_current (manager); +} + +static gboolean +supports_xfixes (void) +{ + gint op_code, event, error; + + return XQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "XFIXES", + &op_code, + &event, + &error); +} + +static gboolean +supports_cursor_xfixes (void) +{ + int major = XFIXES_CURSOR_HIDING_MAJOR; + int minor = 0; + + gdk_error_trap_push (); + + if (!supports_xfixes ()) { + gdk_error_trap_pop_ignored (); + return FALSE; + } + + if (!XFixesQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor)) { + gdk_error_trap_pop_ignored (); + return FALSE; + } + gdk_error_trap_pop_ignored (); + + if (major >= XFIXES_CURSOR_HIDING_MAJOR) + return TRUE; + + return FALSE; +} + +static gboolean +gsd_cursor_manager_idle_cb (GsdCursorManager *manager) +{ + GdkDeviceManager *device_manager; + + gnome_settings_profile_start (NULL); + + if (supports_cursor_xfixes () == FALSE) { + g_debug ("XFixes cursor extension not available, will not hide the cursor"); + return FALSE; + } + + if (supports_xinput_devices () == FALSE) { + g_debug ("XInput support not available, will not hide the cursor"); + return FALSE; + } + + /* We assume that the touchscreen is builtin and + * won't be appearing in the middle of the session... */ + if (touchscreen_is_present () == FALSE) { + g_debug ("Did not find a touchscreen, will not hide the cursor"); + gnome_settings_profile_end (NULL); + return FALSE; + } + + update_cursor_for_current (manager); + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + manager->priv->added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (devices_added_cb), manager); + manager->priv->removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", + G_CALLBACK (devices_removed_cb), manager); + + gnome_settings_profile_end (NULL); + + return FALSE; +} + +gboolean +gsd_cursor_manager_start (GsdCursorManager *manager, + GError **error) +{ + g_debug ("Starting cursor manager"); + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_cursor_manager_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_cursor_manager_stop (GsdCursorManager *manager) +{ + GdkDeviceManager *device_manager; + + g_debug ("Stopping cursor manager"); + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + + if (manager->priv->added_id > 0) { + g_signal_handler_disconnect (G_OBJECT (device_manager), manager->priv->added_id); + manager->priv->added_id = 0; + } + + if (manager->priv->removed_id > 0) { + g_signal_handler_disconnect (G_OBJECT (device_manager), manager->priv->removed_id); + manager->priv->removed_id = 0; + } + + if (manager->priv->cursor_shown == FALSE) { + set_cursor_visibility (manager, TRUE); + } +} + +static GObject * +gsd_cursor_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdCursorManager *cursor_manager; + + cursor_manager = GSD_CURSOR_MANAGER (G_OBJECT_CLASS (gsd_cursor_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (cursor_manager); +} + +static void +gsd_cursor_manager_class_init (GsdCursorManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_cursor_manager_constructor; + object_class->finalize = gsd_cursor_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdCursorManagerPrivate)); +} + +static void +gsd_cursor_manager_init (GsdCursorManager *manager) +{ + manager->priv = GSD_CURSOR_MANAGER_GET_PRIVATE (manager); + manager->priv->cursor_shown = TRUE; + +} + +static void +gsd_cursor_manager_finalize (GObject *object) +{ + GsdCursorManager *cursor_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_CURSOR_MANAGER (object)); + + cursor_manager = GSD_CURSOR_MANAGER (object); + + g_return_if_fail (cursor_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_cursor_manager_parent_class)->finalize (object); +} + +GsdCursorManager * +gsd_cursor_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_CURSOR_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_CURSOR_MANAGER (manager_object); +} diff --git a/plugins/cursor/gsd-cursor-manager.h b/plugins/cursor/gsd-cursor-manager.h new file mode 100644 index 00000000..9bfed2d6 --- /dev/null +++ b/plugins/cursor/gsd-cursor-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_CURSOR_MANAGER_H +#define __GSD_CURSOR_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_CURSOR_MANAGER (gsd_cursor_manager_get_type ()) +#define GSD_CURSOR_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CURSOR_MANAGER, GsdCursorManager)) +#define GSD_CURSOR_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CURSOR_MANAGER, GsdCursorManagerClass)) +#define GSD_IS_CURSOR_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CURSOR_MANAGER)) +#define GSD_IS_CURSOR_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CURSOR_MANAGER)) +#define GSD_CURSOR_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CURSOR_MANAGER, GsdCursorManagerClass)) + +typedef struct GsdCursorManagerPrivate GsdCursorManagerPrivate; + +typedef struct +{ + GObject parent; + GsdCursorManagerPrivate *priv; +} GsdCursorManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdCursorManagerClass; + +GType gsd_cursor_manager_get_type (void); + +GsdCursorManager * gsd_cursor_manager_new (void); +gboolean gsd_cursor_manager_start (GsdCursorManager *manager, + GError **error); +void gsd_cursor_manager_stop (GsdCursorManager *manager); + +G_END_DECLS + +#endif /* __GSD_CURSOR_MANAGER_H */ diff --git a/plugins/cursor/gsd-cursor-plugin.c b/plugins/cursor/gsd-cursor-plugin.c new file mode 100644 index 00000000..b903dcf1 --- /dev/null +++ b/plugins/cursor/gsd-cursor-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-cursor-plugin.h" +#include "gsd-cursor-manager.h" + +struct GsdCursorPluginPrivate { + GsdCursorManager *manager; +}; + +#define GSD_CURSOR_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_CURSOR_PLUGIN, GsdCursorPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdCursorPlugin, gsd_cursor_plugin) + +static void +gsd_cursor_plugin_init (GsdCursorPlugin *plugin) +{ + plugin->priv = GSD_CURSOR_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdCursorPlugin initializing"); + + plugin->priv->manager = gsd_cursor_manager_new (); +} + +static void +gsd_cursor_plugin_finalize (GObject *object) +{ + GsdCursorPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_CURSOR_PLUGIN (object)); + + g_debug ("GsdCursorPlugin finalizing"); + + plugin = GSD_CURSOR_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_cursor_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating cursor plugin"); + + error = NULL; + res = gsd_cursor_manager_start (GSD_CURSOR_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start cursor manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating cursor plugin"); + gsd_cursor_manager_stop (GSD_CURSOR_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_cursor_plugin_class_init (GsdCursorPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_cursor_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdCursorPluginPrivate)); +} diff --git a/plugins/cursor/gsd-cursor-plugin.h b/plugins/cursor/gsd-cursor-plugin.h new file mode 100644 index 00000000..e2729da9 --- /dev/null +++ b/plugins/cursor/gsd-cursor-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_CURSOR_PLUGIN_H__ +#define __GSD_CURSOR_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_CURSOR_PLUGIN (gsd_cursor_plugin_get_type ()) +#define GSD_CURSOR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CURSOR_PLUGIN, GsdCursorPlugin)) +#define GSD_CURSOR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CURSOR_PLUGIN, GsdCursorPluginClass)) +#define GSD_IS_CURSOR_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CURSOR_PLUGIN)) +#define GSD_IS_CURSOR_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CURSOR_PLUGIN)) +#define GSD_CURSOR_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CURSOR_PLUGIN, GsdCursorPluginClass)) + +typedef struct GsdCursorPluginPrivate GsdCursorPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdCursorPluginPrivate *priv; +} GsdCursorPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdCursorPluginClass; + +GType gsd_cursor_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_CURSOR_PLUGIN_H__ */ diff --git a/plugins/dummy/Makefile.am b/plugins/dummy/Makefile.am new file mode 100644 index 00000000..9d93b988 --- /dev/null +++ b/plugins/dummy/Makefile.am @@ -0,0 +1,47 @@ +plugin_name = dummy + +plugin_LTLIBRARIES = \ + libdummy.la + +libdummy_la_SOURCES = \ + gsd-dummy-manager.c \ + gsd-dummy-manager.h \ + gsd-dummy-plugin.c \ + gsd-dummy-plugin.h + +libdummy_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libdummy_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libdummy_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libdummy_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + dummy.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# override to _not_ install the test plugin +# do not copy into your plugin +install-pluginDATA: +install-pluginLTLIBRARIES: diff --git a/plugins/dummy/Makefile.in b/plugins/dummy/Makefile.in new file mode 100644 index 00000000..d8f1212d --- /dev/null +++ b/plugins/dummy/Makefile.in @@ -0,0 +1,755 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/dummy +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libdummy_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libdummy_la_OBJECTS = libdummy_la-gsd-dummy-manager.lo \ + libdummy_la-gsd-dummy-plugin.lo +libdummy_la_OBJECTS = $(am_libdummy_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libdummy_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdummy_la_CFLAGS) \ + $(CFLAGS) $(libdummy_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libdummy_la_SOURCES) +DIST_SOURCES = $(libdummy_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = dummy +plugin_LTLIBRARIES = \ + libdummy.la + +libdummy_la_SOURCES = \ + gsd-dummy-manager.c \ + gsd-dummy-manager.h \ + gsd-dummy-plugin.c \ + gsd-dummy-plugin.h + +libdummy_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libdummy_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libdummy_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libdummy_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + dummy.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/dummy/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/dummy/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libdummy.la: $(libdummy_la_OBJECTS) $(libdummy_la_DEPENDENCIES) $(EXTRA_libdummy_la_DEPENDENCIES) + $(AM_V_CCLD)$(libdummy_la_LINK) -rpath $(plugindir) $(libdummy_la_OBJECTS) $(libdummy_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_la-gsd-dummy-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_la-gsd-dummy-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libdummy_la-gsd-dummy-manager.lo: gsd-dummy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdummy_la_CPPFLAGS) $(CPPFLAGS) $(libdummy_la_CFLAGS) $(CFLAGS) -MT libdummy_la-gsd-dummy-manager.lo -MD -MP -MF $(DEPDIR)/libdummy_la-gsd-dummy-manager.Tpo -c -o libdummy_la-gsd-dummy-manager.lo `test -f 'gsd-dummy-manager.c' || echo '$(srcdir)/'`gsd-dummy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdummy_la-gsd-dummy-manager.Tpo $(DEPDIR)/libdummy_la-gsd-dummy-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-dummy-manager.c' object='libdummy_la-gsd-dummy-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdummy_la_CPPFLAGS) $(CPPFLAGS) $(libdummy_la_CFLAGS) $(CFLAGS) -c -o libdummy_la-gsd-dummy-manager.lo `test -f 'gsd-dummy-manager.c' || echo '$(srcdir)/'`gsd-dummy-manager.c + +libdummy_la-gsd-dummy-plugin.lo: gsd-dummy-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdummy_la_CPPFLAGS) $(CPPFLAGS) $(libdummy_la_CFLAGS) $(CFLAGS) -MT libdummy_la-gsd-dummy-plugin.lo -MD -MP -MF $(DEPDIR)/libdummy_la-gsd-dummy-plugin.Tpo -c -o libdummy_la-gsd-dummy-plugin.lo `test -f 'gsd-dummy-plugin.c' || echo '$(srcdir)/'`gsd-dummy-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdummy_la-gsd-dummy-plugin.Tpo $(DEPDIR)/libdummy_la-gsd-dummy-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-dummy-plugin.c' object='libdummy_la-gsd-dummy-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdummy_la_CPPFLAGS) $(CPPFLAGS) $(libdummy_la_CFLAGS) $(CFLAGS) -c -o libdummy_la-gsd-dummy-plugin.lo `test -f 'gsd-dummy-plugin.c' || echo '$(srcdir)/'`gsd-dummy-plugin.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pluginDATA install-pluginLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# override to _not_ install the test plugin +# do not copy into your plugin +install-pluginDATA: +install-pluginLTLIBRARIES: + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/dummy/dummy.gnome-settings-plugin.in b/plugins/dummy/dummy.gnome-settings-plugin.in new file mode 100644 index 00000000..3632a8c7 --- /dev/null +++ b/plugins/dummy/dummy.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=dummy +IAge=0 +_Name=Dummy +_Description=Dummy plugin +Authors=AUTHOR +Copyright=Copyright © 2007 AUTHOR +Website= diff --git a/plugins/dummy/gsd-dummy-manager.c b/plugins/dummy/gsd-dummy-manager.c new file mode 100644 index 00000000..89d4776d --- /dev/null +++ b/plugins/dummy/gsd-dummy-manager.c @@ -0,0 +1,171 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-dummy-manager.h" + +#define GSD_DUMMY_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_DUMMY_MANAGER, GsdDummyManagerPrivate)) + +struct GsdDummyManagerPrivate +{ + gboolean padding; +}; + +enum { + PROP_0, +}; + +static void gsd_dummy_manager_class_init (GsdDummyManagerClass *klass); +static void gsd_dummy_manager_init (GsdDummyManager *dummy_manager); +static void gsd_dummy_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdDummyManager, gsd_dummy_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +gboolean +gsd_dummy_manager_start (GsdDummyManager *manager, + GError **error) +{ + g_debug ("Starting dummy manager"); + gnome_settings_profile_start (NULL); + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_dummy_manager_stop (GsdDummyManager *manager) +{ + g_debug ("Stopping dummy manager"); +} + +static void +gsd_dummy_manager_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_dummy_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gsd_dummy_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdDummyManager *dummy_manager; + + dummy_manager = GSD_DUMMY_MANAGER (G_OBJECT_CLASS (gsd_dummy_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (dummy_manager); +} + +static void +gsd_dummy_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_dummy_manager_parent_class)->dispose (object); +} + +static void +gsd_dummy_manager_class_init (GsdDummyManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gsd_dummy_manager_get_property; + object_class->set_property = gsd_dummy_manager_set_property; + object_class->constructor = gsd_dummy_manager_constructor; + object_class->dispose = gsd_dummy_manager_dispose; + object_class->finalize = gsd_dummy_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdDummyManagerPrivate)); +} + +static void +gsd_dummy_manager_init (GsdDummyManager *manager) +{ + manager->priv = GSD_DUMMY_MANAGER_GET_PRIVATE (manager); + +} + +static void +gsd_dummy_manager_finalize (GObject *object) +{ + GsdDummyManager *dummy_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_DUMMY_MANAGER (object)); + + dummy_manager = GSD_DUMMY_MANAGER (object); + + g_return_if_fail (dummy_manager->priv != NULL); + + G_OBJECT_CLASS (gsd_dummy_manager_parent_class)->finalize (object); +} + +GsdDummyManager * +gsd_dummy_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_DUMMY_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_DUMMY_MANAGER (manager_object); +} diff --git a/plugins/dummy/gsd-dummy-manager.h b/plugins/dummy/gsd-dummy-manager.h new file mode 100644 index 00000000..3633862e --- /dev/null +++ b/plugins/dummy/gsd-dummy-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_DUMMY_MANAGER_H +#define __GSD_DUMMY_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_DUMMY_MANAGER (gsd_dummy_manager_get_type ()) +#define GSD_DUMMY_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_DUMMY_MANAGER, GsdDummyManager)) +#define GSD_DUMMY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_DUMMY_MANAGER, GsdDummyManagerClass)) +#define GSD_IS_DUMMY_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_DUMMY_MANAGER)) +#define GSD_IS_DUMMY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_DUMMY_MANAGER)) +#define GSD_DUMMY_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_DUMMY_MANAGER, GsdDummyManagerClass)) + +typedef struct GsdDummyManagerPrivate GsdDummyManagerPrivate; + +typedef struct +{ + GObject parent; + GsdDummyManagerPrivate *priv; +} GsdDummyManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdDummyManagerClass; + +GType gsd_dummy_manager_get_type (void); + +GsdDummyManager * gsd_dummy_manager_new (void); +gboolean gsd_dummy_manager_start (GsdDummyManager *manager, + GError **error); +void gsd_dummy_manager_stop (GsdDummyManager *manager); + +G_END_DECLS + +#endif /* __GSD_DUMMY_MANAGER_H */ diff --git a/plugins/dummy/gsd-dummy-plugin.c b/plugins/dummy/gsd-dummy-plugin.c new file mode 100644 index 00000000..78342d7d --- /dev/null +++ b/plugins/dummy/gsd-dummy-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-dummy-plugin.h" +#include "gsd-dummy-manager.h" + +struct GsdDummyPluginPrivate { + GsdDummyManager *manager; +}; + +#define GSD_DUMMY_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_DUMMY_PLUGIN, GsdDummyPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdDummyPlugin, gsd_dummy_plugin) + +static void +gsd_dummy_plugin_init (GsdDummyPlugin *plugin) +{ + plugin->priv = GSD_DUMMY_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdDummyPlugin initializing"); + + plugin->priv->manager = gsd_dummy_manager_new (); +} + +static void +gsd_dummy_plugin_finalize (GObject *object) +{ + GsdDummyPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_DUMMY_PLUGIN (object)); + + g_debug ("GsdDummyPlugin finalizing"); + + plugin = GSD_DUMMY_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_dummy_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating dummy plugin"); + + error = NULL; + res = gsd_dummy_manager_start (GSD_DUMMY_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start dummy manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating dummy plugin"); + gsd_dummy_manager_stop (GSD_DUMMY_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_dummy_plugin_class_init (GsdDummyPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_dummy_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdDummyPluginPrivate)); +} diff --git a/plugins/dummy/gsd-dummy-plugin.h b/plugins/dummy/gsd-dummy-plugin.h new file mode 100644 index 00000000..718da39c --- /dev/null +++ b/plugins/dummy/gsd-dummy-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_DUMMY_PLUGIN_H__ +#define __GSD_DUMMY_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_DUMMY_PLUGIN (gsd_dummy_plugin_get_type ()) +#define GSD_DUMMY_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_DUMMY_PLUGIN, GsdDummyPlugin)) +#define GSD_DUMMY_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_DUMMY_PLUGIN, GsdDummyPluginClass)) +#define GSD_IS_DUMMY_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_DUMMY_PLUGIN)) +#define GSD_IS_DUMMY_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_DUMMY_PLUGIN)) +#define GSD_DUMMY_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_DUMMY_PLUGIN, GsdDummyPluginClass)) + +typedef struct GsdDummyPluginPrivate GsdDummyPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdDummyPluginPrivate *priv; +} GsdDummyPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdDummyPluginClass; + +GType gsd_dummy_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_DUMMY_PLUGIN_H__ */ diff --git a/plugins/housekeeping/Makefile.am b/plugins/housekeeping/Makefile.am new file mode 100644 index 00000000..7fa500b5 --- /dev/null +++ b/plugins/housekeeping/Makefile.am @@ -0,0 +1,68 @@ +plugin_name = housekeeping + +COMMON_FILES = \ + gsd-disk-space.c \ + gsd-disk-space.h \ + gsd-ldsm-dialog.c \ + gsd-ldsm-dialog.h \ + gsd-disk-space-helper.h \ + gsd-disk-space-helper.c + +noinst_PROGRAMS = gsd-disk-space-test gsd-empty-trash-test + +gsd_disk_space_test_SOURCES = \ + gsd-disk-space-test.c \ + $(COMMON_FILES) +gsd_disk_space_test_LDADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS) +gsd_disk_space_test_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GIOUNIX_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +gsd_empty_trash_test_SOURCES = \ + gsd-empty-trash-test.c \ + $(COMMON_FILES) +gsd_empty_trash_test_LDADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS) +gsd_empty_trash_test_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GIOUNIX_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +plugin_LTLIBRARIES = libhousekeeping.la + +libhousekeeping_la_SOURCES = \ + $(COMMON_FILES) \ + gsd-housekeeping-manager.c \ + gsd-housekeeping-manager.h \ + gsd-housekeeping-plugin.c \ + gsd-housekeeping-plugin.h + +libhousekeeping_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libhousekeeping_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GIOUNIX_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +libhousekeeping_la_LDFLAGS = $(GSD_PLUGIN_LDFLAGS) + +libhousekeeping_la_LIBADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS) + +plugin_in_files = housekeeping.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = $(plugin_in_files) + +CLEANFILES = $(plugin_DATA) + +DISTCLEANFILES = (plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/housekeeping/Makefile.in b/plugins/housekeeping/Makefile.in new file mode 100644 index 00000000..7827ff27 --- /dev/null +++ b/plugins/housekeeping/Makefile.in @@ -0,0 +1,995 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = gsd-disk-space-test$(EXEEXT) \ + gsd-empty-trash-test$(EXEEXT) +subdir = plugins/housekeeping +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libhousekeeping_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = libhousekeeping_la-gsd-disk-space.lo \ + libhousekeeping_la-gsd-ldsm-dialog.lo \ + libhousekeeping_la-gsd-disk-space-helper.lo +am_libhousekeeping_la_OBJECTS = $(am__objects_1) \ + libhousekeeping_la-gsd-housekeeping-manager.lo \ + libhousekeeping_la-gsd-housekeeping-plugin.lo +libhousekeeping_la_OBJECTS = $(am_libhousekeeping_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libhousekeeping_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libhousekeeping_la_CFLAGS) $(CFLAGS) \ + $(libhousekeeping_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(noinst_PROGRAMS) +am__objects_2 = gsd_disk_space_test-gsd-disk-space.$(OBJEXT) \ + gsd_disk_space_test-gsd-ldsm-dialog.$(OBJEXT) \ + gsd_disk_space_test-gsd-disk-space-helper.$(OBJEXT) +am_gsd_disk_space_test_OBJECTS = \ + gsd_disk_space_test-gsd-disk-space-test.$(OBJEXT) \ + $(am__objects_2) +gsd_disk_space_test_OBJECTS = $(am_gsd_disk_space_test_OBJECTS) +gsd_disk_space_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_disk_space_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_disk_space_test_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__objects_3 = gsd_empty_trash_test-gsd-disk-space.$(OBJEXT) \ + gsd_empty_trash_test-gsd-ldsm-dialog.$(OBJEXT) \ + gsd_empty_trash_test-gsd-disk-space-helper.$(OBJEXT) +am_gsd_empty_trash_test_OBJECTS = \ + gsd_empty_trash_test-gsd-empty-trash-test.$(OBJEXT) \ + $(am__objects_3) +gsd_empty_trash_test_OBJECTS = $(am_gsd_empty_trash_test_OBJECTS) +gsd_empty_trash_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_empty_trash_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libhousekeeping_la_SOURCES) $(gsd_disk_space_test_SOURCES) \ + $(gsd_empty_trash_test_SOURCES) +DIST_SOURCES = $(libhousekeeping_la_SOURCES) \ + $(gsd_disk_space_test_SOURCES) $(gsd_empty_trash_test_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = housekeeping +COMMON_FILES = \ + gsd-disk-space.c \ + gsd-disk-space.h \ + gsd-ldsm-dialog.c \ + gsd-ldsm-dialog.h \ + gsd-disk-space-helper.h \ + gsd-disk-space-helper.c + +gsd_disk_space_test_SOURCES = \ + gsd-disk-space-test.c \ + $(COMMON_FILES) + +gsd_disk_space_test_LDADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS) +gsd_disk_space_test_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GIOUNIX_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +gsd_empty_trash_test_SOURCES = \ + gsd-empty-trash-test.c \ + $(COMMON_FILES) + +gsd_empty_trash_test_LDADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS) +gsd_empty_trash_test_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GIOUNIX_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +plugin_LTLIBRARIES = libhousekeeping.la +libhousekeeping_la_SOURCES = \ + $(COMMON_FILES) \ + gsd-housekeeping-manager.c \ + gsd-housekeeping-manager.h \ + gsd-housekeeping-plugin.c \ + gsd-housekeeping-plugin.h + +libhousekeeping_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libhousekeeping_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GIOUNIX_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + $(AM_CFLAGS) + +libhousekeeping_la_LDFLAGS = $(GSD_PLUGIN_LDFLAGS) +libhousekeeping_la_LIBADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS) +plugin_in_files = housekeeping.gnome-settings-plugin.in +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = $(plugin_in_files) +CLEANFILES = $(plugin_DATA) +DISTCLEANFILES = (plugin_DATA) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/housekeeping/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/housekeeping/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libhousekeeping.la: $(libhousekeeping_la_OBJECTS) $(libhousekeeping_la_DEPENDENCIES) $(EXTRA_libhousekeeping_la_DEPENDENCIES) + $(AM_V_CCLD)$(libhousekeeping_la_LINK) -rpath $(plugindir) $(libhousekeeping_la_OBJECTS) $(libhousekeeping_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-disk-space-test$(EXEEXT): $(gsd_disk_space_test_OBJECTS) $(gsd_disk_space_test_DEPENDENCIES) $(EXTRA_gsd_disk_space_test_DEPENDENCIES) + @rm -f gsd-disk-space-test$(EXEEXT) + $(AM_V_CCLD)$(gsd_disk_space_test_LINK) $(gsd_disk_space_test_OBJECTS) $(gsd_disk_space_test_LDADD) $(LIBS) +gsd-empty-trash-test$(EXEEXT): $(gsd_empty_trash_test_OBJECTS) $(gsd_empty_trash_test_DEPENDENCIES) $(EXTRA_gsd_empty_trash_test_DEPENDENCIES) + @rm -f gsd-empty-trash-test$(EXEEXT) + $(AM_V_CCLD)$(gsd_empty_trash_test_LINK) $(gsd_empty_trash_test_OBJECTS) $(gsd_empty_trash_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhousekeeping_la-gsd-disk-space-helper.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhousekeeping_la-gsd-disk-space.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhousekeeping_la-gsd-housekeeping-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhousekeeping_la-gsd-housekeeping-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhousekeeping_la-gsd-ldsm-dialog.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libhousekeeping_la-gsd-disk-space.lo: gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -MT libhousekeeping_la-gsd-disk-space.lo -MD -MP -MF $(DEPDIR)/libhousekeeping_la-gsd-disk-space.Tpo -c -o libhousekeeping_la-gsd-disk-space.lo `test -f 'gsd-disk-space.c' || echo '$(srcdir)/'`gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhousekeeping_la-gsd-disk-space.Tpo $(DEPDIR)/libhousekeeping_la-gsd-disk-space.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space.c' object='libhousekeeping_la-gsd-disk-space.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -c -o libhousekeeping_la-gsd-disk-space.lo `test -f 'gsd-disk-space.c' || echo '$(srcdir)/'`gsd-disk-space.c + +libhousekeeping_la-gsd-ldsm-dialog.lo: gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -MT libhousekeeping_la-gsd-ldsm-dialog.lo -MD -MP -MF $(DEPDIR)/libhousekeeping_la-gsd-ldsm-dialog.Tpo -c -o libhousekeeping_la-gsd-ldsm-dialog.lo `test -f 'gsd-ldsm-dialog.c' || echo '$(srcdir)/'`gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhousekeeping_la-gsd-ldsm-dialog.Tpo $(DEPDIR)/libhousekeeping_la-gsd-ldsm-dialog.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-ldsm-dialog.c' object='libhousekeeping_la-gsd-ldsm-dialog.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -c -o libhousekeeping_la-gsd-ldsm-dialog.lo `test -f 'gsd-ldsm-dialog.c' || echo '$(srcdir)/'`gsd-ldsm-dialog.c + +libhousekeeping_la-gsd-disk-space-helper.lo: gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -MT libhousekeeping_la-gsd-disk-space-helper.lo -MD -MP -MF $(DEPDIR)/libhousekeeping_la-gsd-disk-space-helper.Tpo -c -o libhousekeeping_la-gsd-disk-space-helper.lo `test -f 'gsd-disk-space-helper.c' || echo '$(srcdir)/'`gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhousekeeping_la-gsd-disk-space-helper.Tpo $(DEPDIR)/libhousekeeping_la-gsd-disk-space-helper.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-helper.c' object='libhousekeeping_la-gsd-disk-space-helper.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -c -o libhousekeeping_la-gsd-disk-space-helper.lo `test -f 'gsd-disk-space-helper.c' || echo '$(srcdir)/'`gsd-disk-space-helper.c + +libhousekeeping_la-gsd-housekeeping-manager.lo: gsd-housekeeping-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -MT libhousekeeping_la-gsd-housekeeping-manager.lo -MD -MP -MF $(DEPDIR)/libhousekeeping_la-gsd-housekeeping-manager.Tpo -c -o libhousekeeping_la-gsd-housekeeping-manager.lo `test -f 'gsd-housekeeping-manager.c' || echo '$(srcdir)/'`gsd-housekeeping-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhousekeeping_la-gsd-housekeeping-manager.Tpo $(DEPDIR)/libhousekeeping_la-gsd-housekeeping-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-housekeeping-manager.c' object='libhousekeeping_la-gsd-housekeeping-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -c -o libhousekeeping_la-gsd-housekeeping-manager.lo `test -f 'gsd-housekeeping-manager.c' || echo '$(srcdir)/'`gsd-housekeeping-manager.c + +libhousekeeping_la-gsd-housekeeping-plugin.lo: gsd-housekeeping-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -MT libhousekeeping_la-gsd-housekeeping-plugin.lo -MD -MP -MF $(DEPDIR)/libhousekeeping_la-gsd-housekeeping-plugin.Tpo -c -o libhousekeeping_la-gsd-housekeeping-plugin.lo `test -f 'gsd-housekeeping-plugin.c' || echo '$(srcdir)/'`gsd-housekeeping-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhousekeeping_la-gsd-housekeeping-plugin.Tpo $(DEPDIR)/libhousekeeping_la-gsd-housekeeping-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-housekeeping-plugin.c' object='libhousekeeping_la-gsd-housekeeping-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhousekeeping_la_CPPFLAGS) $(CPPFLAGS) $(libhousekeeping_la_CFLAGS) $(CFLAGS) -c -o libhousekeeping_la-gsd-housekeeping-plugin.lo `test -f 'gsd-housekeeping-plugin.c' || echo '$(srcdir)/'`gsd-housekeeping-plugin.c + +gsd_disk_space_test-gsd-disk-space-test.o: gsd-disk-space-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-disk-space-test.o -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Tpo -c -o gsd_disk_space_test-gsd-disk-space-test.o `test -f 'gsd-disk-space-test.c' || echo '$(srcdir)/'`gsd-disk-space-test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-test.c' object='gsd_disk_space_test-gsd-disk-space-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-disk-space-test.o `test -f 'gsd-disk-space-test.c' || echo '$(srcdir)/'`gsd-disk-space-test.c + +gsd_disk_space_test-gsd-disk-space-test.obj: gsd-disk-space-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-disk-space-test.obj -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Tpo -c -o gsd_disk_space_test-gsd-disk-space-test.obj `if test -f 'gsd-disk-space-test.c'; then $(CYGPATH_W) 'gsd-disk-space-test.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space-test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-test.c' object='gsd_disk_space_test-gsd-disk-space-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-disk-space-test.obj `if test -f 'gsd-disk-space-test.c'; then $(CYGPATH_W) 'gsd-disk-space-test.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space-test.c'; fi` + +gsd_disk_space_test-gsd-disk-space.o: gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-disk-space.o -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Tpo -c -o gsd_disk_space_test-gsd-disk-space.o `test -f 'gsd-disk-space.c' || echo '$(srcdir)/'`gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space.c' object='gsd_disk_space_test-gsd-disk-space.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-disk-space.o `test -f 'gsd-disk-space.c' || echo '$(srcdir)/'`gsd-disk-space.c + +gsd_disk_space_test-gsd-disk-space.obj: gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-disk-space.obj -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Tpo -c -o gsd_disk_space_test-gsd-disk-space.obj `if test -f 'gsd-disk-space.c'; then $(CYGPATH_W) 'gsd-disk-space.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-disk-space.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space.c' object='gsd_disk_space_test-gsd-disk-space.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-disk-space.obj `if test -f 'gsd-disk-space.c'; then $(CYGPATH_W) 'gsd-disk-space.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space.c'; fi` + +gsd_disk_space_test-gsd-ldsm-dialog.o: gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-ldsm-dialog.o -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Tpo -c -o gsd_disk_space_test-gsd-ldsm-dialog.o `test -f 'gsd-ldsm-dialog.c' || echo '$(srcdir)/'`gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-ldsm-dialog.c' object='gsd_disk_space_test-gsd-ldsm-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-ldsm-dialog.o `test -f 'gsd-ldsm-dialog.c' || echo '$(srcdir)/'`gsd-ldsm-dialog.c + +gsd_disk_space_test-gsd-ldsm-dialog.obj: gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-ldsm-dialog.obj -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Tpo -c -o gsd_disk_space_test-gsd-ldsm-dialog.obj `if test -f 'gsd-ldsm-dialog.c'; then $(CYGPATH_W) 'gsd-ldsm-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-ldsm-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-ldsm-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-ldsm-dialog.c' object='gsd_disk_space_test-gsd-ldsm-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-ldsm-dialog.obj `if test -f 'gsd-ldsm-dialog.c'; then $(CYGPATH_W) 'gsd-ldsm-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-ldsm-dialog.c'; fi` + +gsd_disk_space_test-gsd-disk-space-helper.o: gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-disk-space-helper.o -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Tpo -c -o gsd_disk_space_test-gsd-disk-space-helper.o `test -f 'gsd-disk-space-helper.c' || echo '$(srcdir)/'`gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-helper.c' object='gsd_disk_space_test-gsd-disk-space-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-disk-space-helper.o `test -f 'gsd-disk-space-helper.c' || echo '$(srcdir)/'`gsd-disk-space-helper.c + +gsd_disk_space_test-gsd-disk-space-helper.obj: gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -MT gsd_disk_space_test-gsd-disk-space-helper.obj -MD -MP -MF $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Tpo -c -o gsd_disk_space_test-gsd-disk-space-helper.obj `if test -f 'gsd-disk-space-helper.c'; then $(CYGPATH_W) 'gsd-disk-space-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space-helper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Tpo $(DEPDIR)/gsd_disk_space_test-gsd-disk-space-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-helper.c' object='gsd_disk_space_test-gsd-disk-space-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_disk_space_test_CFLAGS) $(CFLAGS) -c -o gsd_disk_space_test-gsd-disk-space-helper.obj `if test -f 'gsd-disk-space-helper.c'; then $(CYGPATH_W) 'gsd-disk-space-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space-helper.c'; fi` + +gsd_empty_trash_test-gsd-empty-trash-test.o: gsd-empty-trash-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-empty-trash-test.o -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Tpo -c -o gsd_empty_trash_test-gsd-empty-trash-test.o `test -f 'gsd-empty-trash-test.c' || echo '$(srcdir)/'`gsd-empty-trash-test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-empty-trash-test.c' object='gsd_empty_trash_test-gsd-empty-trash-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-empty-trash-test.o `test -f 'gsd-empty-trash-test.c' || echo '$(srcdir)/'`gsd-empty-trash-test.c + +gsd_empty_trash_test-gsd-empty-trash-test.obj: gsd-empty-trash-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-empty-trash-test.obj -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Tpo -c -o gsd_empty_trash_test-gsd-empty-trash-test.obj `if test -f 'gsd-empty-trash-test.c'; then $(CYGPATH_W) 'gsd-empty-trash-test.c'; else $(CYGPATH_W) '$(srcdir)/gsd-empty-trash-test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-empty-trash-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-empty-trash-test.c' object='gsd_empty_trash_test-gsd-empty-trash-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-empty-trash-test.obj `if test -f 'gsd-empty-trash-test.c'; then $(CYGPATH_W) 'gsd-empty-trash-test.c'; else $(CYGPATH_W) '$(srcdir)/gsd-empty-trash-test.c'; fi` + +gsd_empty_trash_test-gsd-disk-space.o: gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-disk-space.o -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Tpo -c -o gsd_empty_trash_test-gsd-disk-space.o `test -f 'gsd-disk-space.c' || echo '$(srcdir)/'`gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space.c' object='gsd_empty_trash_test-gsd-disk-space.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-disk-space.o `test -f 'gsd-disk-space.c' || echo '$(srcdir)/'`gsd-disk-space.c + +gsd_empty_trash_test-gsd-disk-space.obj: gsd-disk-space.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-disk-space.obj -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Tpo -c -o gsd_empty_trash_test-gsd-disk-space.obj `if test -f 'gsd-disk-space.c'; then $(CYGPATH_W) 'gsd-disk-space.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space.c' object='gsd_empty_trash_test-gsd-disk-space.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-disk-space.obj `if test -f 'gsd-disk-space.c'; then $(CYGPATH_W) 'gsd-disk-space.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space.c'; fi` + +gsd_empty_trash_test-gsd-ldsm-dialog.o: gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-ldsm-dialog.o -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Tpo -c -o gsd_empty_trash_test-gsd-ldsm-dialog.o `test -f 'gsd-ldsm-dialog.c' || echo '$(srcdir)/'`gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-ldsm-dialog.c' object='gsd_empty_trash_test-gsd-ldsm-dialog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-ldsm-dialog.o `test -f 'gsd-ldsm-dialog.c' || echo '$(srcdir)/'`gsd-ldsm-dialog.c + +gsd_empty_trash_test-gsd-ldsm-dialog.obj: gsd-ldsm-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-ldsm-dialog.obj -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Tpo -c -o gsd_empty_trash_test-gsd-ldsm-dialog.obj `if test -f 'gsd-ldsm-dialog.c'; then $(CYGPATH_W) 'gsd-ldsm-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-ldsm-dialog.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-ldsm-dialog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-ldsm-dialog.c' object='gsd_empty_trash_test-gsd-ldsm-dialog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-ldsm-dialog.obj `if test -f 'gsd-ldsm-dialog.c'; then $(CYGPATH_W) 'gsd-ldsm-dialog.c'; else $(CYGPATH_W) '$(srcdir)/gsd-ldsm-dialog.c'; fi` + +gsd_empty_trash_test-gsd-disk-space-helper.o: gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-disk-space-helper.o -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Tpo -c -o gsd_empty_trash_test-gsd-disk-space-helper.o `test -f 'gsd-disk-space-helper.c' || echo '$(srcdir)/'`gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-helper.c' object='gsd_empty_trash_test-gsd-disk-space-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-disk-space-helper.o `test -f 'gsd-disk-space-helper.c' || echo '$(srcdir)/'`gsd-disk-space-helper.c + +gsd_empty_trash_test-gsd-disk-space-helper.obj: gsd-disk-space-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -MT gsd_empty_trash_test-gsd-disk-space-helper.obj -MD -MP -MF $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Tpo -c -o gsd_empty_trash_test-gsd-disk-space-helper.obj `if test -f 'gsd-disk-space-helper.c'; then $(CYGPATH_W) 'gsd-disk-space-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space-helper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Tpo $(DEPDIR)/gsd_empty_trash_test-gsd-disk-space-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-disk-space-helper.c' object='gsd_empty_trash_test-gsd-disk-space-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_empty_trash_test_CFLAGS) $(CFLAGS) -c -o gsd_empty_trash_test-gsd-disk-space-helper.obj `if test -f 'gsd-disk-space-helper.c'; then $(CYGPATH_W) 'gsd-disk-space-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-disk-space-helper.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pluginDATA install-pluginLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/housekeeping/gsd-disk-space-helper.c b/plugins/housekeeping/gsd-disk-space-helper.c new file mode 100644 index 00000000..19873374 --- /dev/null +++ b/plugins/housekeeping/gsd-disk-space-helper.c @@ -0,0 +1,124 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * vim: set et sw=8 ts=8: + * + * Copyright (c) 2008, Novell, Inc. + * Copyright (c) 2012, Red Hat, Inc. + * + * Authors: Vincent Untz + * Bastien Nocera + * + * 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 +#include + +#include "gsd-disk-space-helper.h" + +gboolean +gsd_should_ignore_unix_mount (GUnixMountEntry *mount) +{ + const char *fs, *device; + guint i; + + /* This is borrowed from GLib and used as a way to determine + * which mounts we should ignore by default. GLib doesn't + * expose this in a way that allows it to be used for this + * purpose + */ + + /* We also ignore network filesystems */ + + const gchar *ignore_fs[] = { + "adfs", + "afs", + "auto", + "autofs", + "autofs4", + "cifs", + "cxfs", + "devfs", + "devpts", + "ecryptfs", + "fdescfs", + "gfs", + "gfs2", + "kernfs", + "linprocfs", + "linsysfs", + "lustre", + "lustre_lite", + "ncpfs", + "nfs", + "nfs4", + "nfsd", + "ocfs2", + "proc", + "procfs", + "ptyfs", + "rpc_pipefs", + "selinuxfs", + "smbfs", + "sysfs", + "tmpfs", + "usbfs", + "zfs", + NULL + }; + const gchar *ignore_devices[] = { + "none", + "sunrpc", + "devpts", + "nfsd", + "/dev/loop", + "/dev/vn", + NULL + }; + + fs = g_unix_mount_get_fs_type (mount); + device = g_unix_mount_get_device_path (mount); + + for (i = 0; ignore_fs[i] != NULL; i++) + if (g_str_equal (ignore_fs[i], fs)) + return TRUE; + + for (i = 0; ignore_devices[i] != NULL; i++) + if (g_str_equal (ignore_devices[i], device)) + return TRUE; + + return FALSE; +} + +gboolean +gsd_is_removable_mount (GUnixMountEntry *mount) +{ + const char *mount_path; + char *path; + + mount_path = g_unix_mount_get_mount_path (mount); + if (mount_path == NULL) + return FALSE; + + path = g_strdup_printf ("/run/media/%s", g_get_user_name ()); + if (g_str_has_prefix (mount_path, path)) { + g_free (path); + return TRUE; + } + g_free (path); + return FALSE; +} diff --git a/plugins/housekeeping/gsd-disk-space-helper.h b/plugins/housekeeping/gsd-disk-space-helper.h new file mode 100644 index 00000000..b558a8c6 --- /dev/null +++ b/plugins/housekeeping/gsd-disk-space-helper.h @@ -0,0 +1,39 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * vim: set et sw=8 ts=8: + * + * Copyright (c) 2008, Novell, Inc. + * Copyright (c) 2012, Red Hat, Inc. + * + * Authors: Vincent Untz + * Bastien Nocera + * + * 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_DISK_SPACE_HELPER_H +#define __GSD_DISK_SPACE_HELPER_H + +#include +#include + +G_BEGIN_DECLS + +gboolean gsd_should_ignore_unix_mount (GUnixMountEntry *mount); +gboolean gsd_is_removable_mount (GUnixMountEntry *mount); + +G_END_DECLS + +#endif /* __GSD_DISK_SPACE_HELPER_H */ diff --git a/plugins/housekeeping/gsd-disk-space-test.c b/plugins/housekeeping/gsd-disk-space-test.c new file mode 100644 index 00000000..fe3718d8 --- /dev/null +++ b/plugins/housekeeping/gsd-disk-space-test.c @@ -0,0 +1,49 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * vim: set et sw=8 ts=8: + * + * Copyright (c) 2008, Novell, Inc. + * + * Authors: Vincent Untz + * + * 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 +#include +#include "gsd-disk-space.h" + +int +main (int argc, + char **argv) +{ + GMainLoop *loop; + + gtk_init (&argc, &argv); + notify_init ("gsd-disk-space-test"); + + loop = g_main_loop_new (NULL, FALSE); + + gsd_ldsm_setup (TRUE); + + g_main_loop_run (loop); + + gsd_ldsm_clean (); + g_main_loop_unref (loop); + + return 0; +} + diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c new file mode 100644 index 00000000..cc4a7ee4 --- /dev/null +++ b/plugins/housekeeping/gsd-disk-space.c @@ -0,0 +1,822 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * vim: set et sw=8 ts=8: + * + * Copyright (c) 2008, Novell, Inc. + * + * Authors: Vincent Untz + * + * 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "gsd-disk-space.h" +#include "gsd-ldsm-dialog.h" +#include "gsd-disk-space-helper.h" + +#define GIGABYTE 1024 * 1024 * 1024 + +#define CHECK_EVERY_X_SECONDS 60 + +#define DISK_SPACE_ANALYZER "baobab" + +#define SETTINGS_HOUSEKEEPING_DIR "org.gnome.settings-daemon.plugins.housekeeping" +#define SETTINGS_FREE_PC_NOTIFY_KEY "free-percent-notify" +#define SETTINGS_FREE_PC_NOTIFY_AGAIN_KEY "free-percent-notify-again" +#define SETTINGS_FREE_SIZE_NO_NOTIFY "free-size-gb-no-notify" +#define SETTINGS_MIN_NOTIFY_PERIOD "min-notify-period" +#define SETTINGS_IGNORE_PATHS "ignore-paths" + +typedef struct +{ + GUnixMountEntry *mount; + struct statvfs buf; + time_t notify_time; +} LdsmMountInfo; + +static GHashTable *ldsm_notified_hash = NULL; +static unsigned int ldsm_timeout_id = 0; +static GUnixMountMonitor *ldsm_monitor = NULL; +static double free_percent_notify = 0.05; +static double free_percent_notify_again = 0.01; +static unsigned int free_size_gb_no_notify = 2; +static unsigned int min_notify_period = 10; +static GSList *ignore_paths = NULL; +static GSettings *settings = NULL; +static GsdLdsmDialog *dialog = NULL; +static NotifyNotification *notification = NULL; + +static guint64 *time_read; + +static gchar* +ldsm_get_fs_id_for_path (const gchar *path) +{ + GFile *file; + GFileInfo *fileinfo; + gchar *attr_id_fs; + + file = g_file_new_for_path (path); + fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_ID_FILESYSTEM, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, NULL); + if (fileinfo) { + attr_id_fs = g_strdup (g_file_info_get_attribute_string (fileinfo, G_FILE_ATTRIBUTE_ID_FILESYSTEM)); + g_object_unref (fileinfo); + } else { + attr_id_fs = NULL; + } + + g_object_unref (file); + + return attr_id_fs; +} + +static gboolean +ldsm_mount_has_trash (LdsmMountInfo *mount) +{ + const gchar *user_data_dir; + gchar *user_data_attr_id_fs; + gchar *path_attr_id_fs; + gboolean mount_uses_user_trash = FALSE; + gchar *trash_files_dir; + gboolean has_trash = FALSE; + GDir *dir; + const gchar *path; + + user_data_dir = g_get_user_data_dir (); + user_data_attr_id_fs = ldsm_get_fs_id_for_path (user_data_dir); + + path = g_unix_mount_get_mount_path (mount->mount); + path_attr_id_fs = ldsm_get_fs_id_for_path (path); + + if (g_strcmp0 (user_data_attr_id_fs, path_attr_id_fs) == 0) { + /* The volume that is low on space is on the same volume as our home + * directory. This means the trash is at $XDG_DATA_HOME/Trash, + * not at the root of the volume which is full. + */ + mount_uses_user_trash = TRUE; + } + + g_free (user_data_attr_id_fs); + g_free (path_attr_id_fs); + + /* I can't think of a better way to find out if a volume has any trash. Any suggestions? */ + if (mount_uses_user_trash) { + trash_files_dir = g_build_filename (g_get_user_data_dir (), "Trash", "files", NULL); + } else { + gchar *uid; + + uid = g_strdup_printf ("%d", getuid ()); + trash_files_dir = g_build_filename (path, ".Trash", uid, "files", NULL); + if (!g_file_test (trash_files_dir, G_FILE_TEST_IS_DIR)) { + gchar *trash_dir; + + g_free (trash_files_dir); + trash_dir = g_strdup_printf (".Trash-%s", uid); + trash_files_dir = g_build_filename (path, trash_dir, "files", NULL); + g_free (trash_dir); + if (!g_file_test (trash_files_dir, G_FILE_TEST_IS_DIR)) { + g_free (trash_files_dir); + g_free (uid); + return has_trash; + } + } + g_free (uid); + } + + dir = g_dir_open (trash_files_dir, 0, NULL); + if (dir) { + if (g_dir_read_name (dir)) + has_trash = TRUE; + g_dir_close (dir); + } + + g_free (trash_files_dir); + + return has_trash; +} + +static void +ldsm_analyze_path (const gchar *path) +{ + const gchar *argv[] = { DISK_SPACE_ANALYZER, path, NULL }; + + g_spawn_async (NULL, (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL); +} + +static gboolean +server_has_actions (void) +{ + gboolean has; + GList *caps; + GList *l; + + caps = notify_get_server_caps (); + if (caps == NULL) { + fprintf (stderr, "Failed to receive server caps.\n"); + return FALSE; + } + + l = g_list_find_custom (caps, "actions", (GCompareFunc)strcmp); + has = l != NULL; + + g_list_foreach (caps, (GFunc) g_free, NULL); + g_list_free (caps); + + return has; +} + +static void +ignore_callback (NotifyNotification *n, + const char *action) +{ + g_assert (action != NULL); + g_assert (strcmp (action, "ignore") == 0); + + /* Do nothing */ + + notify_notification_close (n, NULL); +} + +static void +examine_callback (NotifyNotification *n, + const char *action, + const char *path) +{ + g_assert (action != NULL); + g_assert (strcmp (action, "examine") == 0); + + ldsm_analyze_path (path); + + notify_notification_close (n, NULL); +} + +static void +nautilus_empty_trash_cb (GObject *object, + GAsyncResult *res, + gpointer _unused) +{ + GDBusProxy *proxy = G_DBUS_PROXY (object); + GError *error = NULL; + + g_dbus_proxy_call_finish (proxy, res, &error); + + if (error != NULL) { + g_warning ("Unable to call EmptyTrash() on the Nautilus DBus interface: %s", + error->message); + g_error_free (error); + } + + /* clean up the proxy object */ + g_object_unref (proxy); +} + +static void +nautilus_proxy_ready_cb (GObject *object, + GAsyncResult *res, + gpointer _unused) +{ + GDBusProxy *proxy = NULL; + GError *error = NULL; + + proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + + if (proxy == NULL) { + g_warning ("Unable to create a proxy object for the Nautilus DBus interface: %s", + error->message); + g_error_free (error); + + return; + } + + g_dbus_proxy_call (proxy, + "EmptyTrash", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + nautilus_empty_trash_cb, + NULL); +} + +void +gsd_ldsm_show_empty_trash (void) +{ + /* prepare the Nautilus proxy object */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.Nautilus", + "/org/gnome/Nautilus", + "org.gnome.Nautilus.FileOperations", + NULL, + nautilus_proxy_ready_cb, + NULL); +} + +static void +empty_trash_callback (NotifyNotification *n, + const char *action) +{ + g_assert (action != NULL); + g_assert (strcmp (action, "empty-trash") == 0); + + gsd_ldsm_show_empty_trash (); + + notify_notification_close (n, NULL); +} + +static void +on_notification_closed (NotifyNotification *n) +{ + g_object_unref (notification); + notification = NULL; +} + +static gboolean +ldsm_notify_for_mount (LdsmMountInfo *mount, + gboolean multiple_volumes, + gboolean other_usable_volumes) +{ + gchar *name, *program; + gint64 free_space; + gint response; + gboolean has_trash; + gboolean has_disk_analyzer; + gboolean retval = TRUE; + gchar *path; + + /* Don't show a notice if one is already displayed */ + if (dialog != NULL || notification != NULL) + return retval; + + name = g_unix_mount_guess_name (mount->mount); + free_space = (gint64) mount->buf.f_frsize * (gint64) mount->buf.f_bavail; + has_trash = ldsm_mount_has_trash (mount); + path = g_strdup (g_unix_mount_get_mount_path (mount->mount)); + + program = g_find_program_in_path (DISK_SPACE_ANALYZER); + has_disk_analyzer = (program != NULL); + g_free (program); + + if (server_has_actions ()) { + char *free_space_str; + char *summary; + char *body; + + free_space_str = g_format_size (free_space); + + if (multiple_volumes) { + summary = g_strdup_printf (_("Low Disk Space on \"%s\""), name); + if (has_trash) { + body = g_strdup_printf (_("The volume \"%s\" has only %s disk space remaining. You may free up some space by emptying the trash."), + name, + free_space_str); + } else { + body = g_strdup_printf (_("The volume \"%s\" has only %s disk space remaining."), + name, + free_space_str); + } + } else { + summary = g_strdup (_("Low Disk Space")); + if (has_trash) { + body = g_strdup_printf (_("This computer has only %s disk space remaining. You may free up some space by emptying the trash."), + free_space_str); + } else { + body = g_strdup_printf (_("This computer has only %s disk space remaining."), + free_space_str); + } + } + g_free (free_space_str); + + notification = notify_notification_new (summary, body, "drive-harddisk-symbolic"); + g_free (summary); + g_free (body); + + g_signal_connect (notification, + "closed", + G_CALLBACK (on_notification_closed), + NULL); + + notify_notification_set_app_name (notification, _("Disk space")); + notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT); + if (has_disk_analyzer) { + notify_notification_add_action (notification, + "examine", + _("Examine"), + (NotifyActionCallback) examine_callback, + g_strdup (path), + g_free); + } + if (has_trash) { + notify_notification_add_action (notification, + "empty-trash", + _("Empty Trash"), + (NotifyActionCallback) empty_trash_callback, + NULL, + NULL); + } + notify_notification_add_action (notification, + "ignore", + _("Ignore"), + (NotifyActionCallback) ignore_callback, + NULL, + NULL); + notify_notification_set_category (notification, "device"); + + if (!notify_notification_show (notification, NULL)) { + g_warning ("failed to send disk space notification\n"); + } + + } else { + dialog = gsd_ldsm_dialog_new (other_usable_volumes, + multiple_volumes, + has_disk_analyzer, + has_trash, + free_space, + name, + path); + + g_object_ref (G_OBJECT (dialog)); + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + dialog = NULL; + + switch (response) { + case GTK_RESPONSE_CANCEL: + retval = FALSE; + break; + case GSD_LDSM_DIALOG_RESPONSE_ANALYZE: + retval = FALSE; + ldsm_analyze_path (path); + break; + case GSD_LDSM_DIALOG_RESPONSE_EMPTY_TRASH: + retval = TRUE; + gsd_ldsm_show_empty_trash (); + break; + case GTK_RESPONSE_NONE: + case GTK_RESPONSE_DELETE_EVENT: + retval = TRUE; + break; + default: + g_assert_not_reached (); + } + } + + g_free (name); + g_free (path); + + return retval; +} + +static gboolean +ldsm_mount_has_space (LdsmMountInfo *mount) +{ + gdouble free_space; + + free_space = (double) mount->buf.f_bavail / (double) mount->buf.f_blocks; + /* enough free space, nothing to do */ + if (free_space > free_percent_notify) + return TRUE; + + if (((gint64) mount->buf.f_frsize * (gint64) mount->buf.f_bavail) > ((gint64) free_size_gb_no_notify * GIGABYTE)) + return TRUE; + + /* If we got here, then this volume is low on space */ + return FALSE; +} + +static gboolean +ldsm_mount_is_virtual (LdsmMountInfo *mount) +{ + if (mount->buf.f_blocks == 0) { + /* Filesystems with zero blocks are virtual */ + return TRUE; + } + + return FALSE; +} + +static gint +ldsm_ignore_path_compare (gconstpointer a, + gconstpointer b) +{ + return g_strcmp0 ((const gchar *)a, (const gchar *)b); +} + +static gboolean +ldsm_mount_is_user_ignore (const gchar *path) +{ + if (g_slist_find_custom (ignore_paths, path, (GCompareFunc) ldsm_ignore_path_compare) != NULL) + return TRUE; + else + return FALSE; +} + + +static void +ldsm_free_mount_info (gpointer data) +{ + LdsmMountInfo *mount = data; + + g_return_if_fail (mount != NULL); + + g_unix_mount_free (mount->mount); + g_free (mount); +} + +static void +ldsm_maybe_warn_mounts (GList *mounts, + gboolean multiple_volumes, + gboolean other_usable_volumes) +{ + GList *l; + gboolean done = FALSE; + + for (l = mounts; l != NULL; l = l->next) { + LdsmMountInfo *mount_info = l->data; + LdsmMountInfo *previous_mount_info; + gdouble free_space; + gdouble previous_free_space; + time_t curr_time; + const gchar *path; + gboolean show_notify; + + if (done) { + /* Don't show any more dialogs if the user took action with the last one. The user action + * might free up space on multiple volumes, making the next dialog redundant. + */ + ldsm_free_mount_info (mount_info); + continue; + } + + path = g_unix_mount_get_mount_path (mount_info->mount); + + previous_mount_info = g_hash_table_lookup (ldsm_notified_hash, path); + if (previous_mount_info != NULL) + previous_free_space = (gdouble) previous_mount_info->buf.f_bavail / (gdouble) previous_mount_info->buf.f_blocks; + + free_space = (gdouble) mount_info->buf.f_bavail / (gdouble) mount_info->buf.f_blocks; + + if (previous_mount_info == NULL) { + /* We haven't notified for this mount yet */ + show_notify = TRUE; + mount_info->notify_time = time (NULL); + g_hash_table_replace (ldsm_notified_hash, g_strdup (path), mount_info); + } else if ((previous_free_space - free_space) > free_percent_notify_again) { + /* We've notified for this mount before and free space has decreased sufficiently since last time to notify again */ + curr_time = time (NULL); + if (difftime (curr_time, previous_mount_info->notify_time) > (gdouble)(min_notify_period * 60)) { + show_notify = TRUE; + mount_info->notify_time = curr_time; + } else { + /* It's too soon to show the dialog again. However, we still replace the LdsmMountInfo + * struct in the hash table, but give it the notfiy time from the previous dialog. + * This will stop the notification from reappearing unnecessarily as soon as the timeout expires. + */ + show_notify = FALSE; + mount_info->notify_time = previous_mount_info->notify_time; + } + g_hash_table_replace (ldsm_notified_hash, g_strdup (path), mount_info); + } else { + /* We've notified for this mount before, but the free space hasn't decreased sufficiently to notify again */ + ldsm_free_mount_info (mount_info); + show_notify = FALSE; + } + + if (show_notify) { + if (ldsm_notify_for_mount (mount_info, multiple_volumes, other_usable_volumes)) + done = TRUE; + } + } +} + +static gboolean +ldsm_check_all_mounts (gpointer data) +{ + GList *mounts; + GList *l; + GList *check_mounts = NULL; + GList *full_mounts = NULL; + guint number_of_mounts; + guint number_of_full_mounts; + gboolean multiple_volumes = FALSE; + gboolean other_usable_volumes = FALSE; + + /* We iterate through the static mounts in /etc/fstab first, seeing if + * they're mounted by checking if the GUnixMountPoint has a corresponding GUnixMountEntry. + * Iterating through the static mounts means we automatically ignore dynamically mounted media. + */ + mounts = g_unix_mount_points_get (time_read); + + for (l = mounts; l != NULL; l = l->next) { + GUnixMountPoint *mount_point = l->data; + GUnixMountEntry *mount; + LdsmMountInfo *mount_info; + const gchar *path; + + path = g_unix_mount_point_get_mount_path (mount_point); + mount = g_unix_mount_at (path, time_read); + g_unix_mount_point_free (mount_point); + if (mount == NULL) { + /* The GUnixMountPoint is not mounted */ + continue; + } + + mount_info = g_new0 (LdsmMountInfo, 1); + mount_info->mount = mount; + + path = g_unix_mount_get_mount_path (mount); + + if (g_unix_mount_is_readonly (mount)) { + ldsm_free_mount_info (mount_info); + continue; + } + + if (ldsm_mount_is_user_ignore (g_unix_mount_get_mount_path (mount))) { + ldsm_free_mount_info (mount_info); + continue; + } + + if (gsd_should_ignore_unix_mount (mount)) { + ldsm_free_mount_info (mount_info); + continue; + } + + if (statvfs (path, &mount_info->buf) != 0) { + ldsm_free_mount_info (mount_info); + continue; + } + + if (ldsm_mount_is_virtual (mount_info)) { + ldsm_free_mount_info (mount_info); + continue; + } + + check_mounts = g_list_prepend (check_mounts, mount_info); + } + + g_list_free (mounts); + + number_of_mounts = g_list_length (check_mounts); + if (number_of_mounts > 1) + multiple_volumes = TRUE; + + for (l = check_mounts; l != NULL; l = l->next) { + LdsmMountInfo *mount_info = l->data; + + if (!ldsm_mount_has_space (mount_info)) { + full_mounts = g_list_prepend (full_mounts, mount_info); + } else { + g_hash_table_remove (ldsm_notified_hash, g_unix_mount_get_mount_path (mount_info->mount)); + ldsm_free_mount_info (mount_info); + } + } + + number_of_full_mounts = g_list_length (full_mounts); + if (number_of_mounts > number_of_full_mounts) + other_usable_volumes = TRUE; + + ldsm_maybe_warn_mounts (full_mounts, multiple_volumes, + other_usable_volumes); + + g_list_free (check_mounts); + g_list_free (full_mounts); + + return TRUE; +} + +static gboolean +ldsm_is_hash_item_not_in_mounts (gpointer key, + gpointer value, + gpointer user_data) +{ + GList *l; + + for (l = (GList *) user_data; l != NULL; l = l->next) { + GUnixMountEntry *mount = l->data; + const char *path; + + path = g_unix_mount_get_mount_path (mount); + + if (strcmp (path, key) == 0) + return FALSE; + } + + return TRUE; +} + +static void +ldsm_mounts_changed (GObject *monitor, + gpointer data) +{ + GList *mounts; + + /* remove the saved data for mounts that got removed */ + mounts = g_unix_mounts_get (time_read); + g_hash_table_foreach_remove (ldsm_notified_hash, + ldsm_is_hash_item_not_in_mounts, mounts); + g_list_free_full (mounts, (GDestroyNotify) g_unix_mount_free); + + /* check the status now, for the new mounts */ + ldsm_check_all_mounts (NULL); + + /* and reset the timeout */ + if (ldsm_timeout_id) + g_source_remove (ldsm_timeout_id); + ldsm_timeout_id = g_timeout_add_seconds (CHECK_EVERY_X_SECONDS, + ldsm_check_all_mounts, NULL); +} + +static gboolean +ldsm_is_hash_item_in_ignore_paths (gpointer key, + gpointer value, + gpointer user_data) +{ + return ldsm_mount_is_user_ignore (key); +} + +static void +gsd_ldsm_get_config (void) +{ + gchar **settings_list; + + free_percent_notify = g_settings_get_double (settings, SETTINGS_FREE_PC_NOTIFY_KEY); + if (free_percent_notify >= 1 || free_percent_notify < 0) { + g_warning ("Invalid configuration of free_percent_notify: %f\n" \ + "Using sensible default", free_percent_notify); + free_percent_notify = 0.05; + } + + free_percent_notify_again = g_settings_get_double (settings, SETTINGS_FREE_PC_NOTIFY_AGAIN_KEY); + if (free_percent_notify_again >= 1 || free_percent_notify_again < 0) { + g_warning ("Invalid configuration of free_percent_notify_again: %f\n" \ + "Using sensible default\n", free_percent_notify_again); + free_percent_notify_again = 0.01; + } + + free_size_gb_no_notify = g_settings_get_int (settings, SETTINGS_FREE_SIZE_NO_NOTIFY); + min_notify_period = g_settings_get_int (settings, SETTINGS_MIN_NOTIFY_PERIOD); + + if (ignore_paths != NULL) { + g_slist_foreach (ignore_paths, (GFunc) g_free, NULL); + g_slist_free (ignore_paths); + ignore_paths = NULL; + } + + settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS); + if (settings_list != NULL) { + gint i; + + for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { + if (settings_list[i] != NULL) + ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i])); + } + + /* Make sure we dont leave stale entries in ldsm_notified_hash */ + g_hash_table_foreach_remove (ldsm_notified_hash, + ldsm_is_hash_item_in_ignore_paths, NULL); + + g_strfreev (settings_list); + } +} + +static void +gsd_ldsm_update_config (GSettings *settings, + const gchar *key, + gpointer user_data) +{ + gsd_ldsm_get_config (); +} + +void +gsd_ldsm_setup (gboolean check_now) +{ + if (ldsm_notified_hash || ldsm_timeout_id || ldsm_monitor) { + g_warning ("Low disk space monitor already initialized."); + return; + } + + ldsm_notified_hash = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, + ldsm_free_mount_info); + + settings = g_settings_new (SETTINGS_HOUSEKEEPING_DIR); + gsd_ldsm_get_config (); + g_signal_connect (G_OBJECT (settings), "changed", + G_CALLBACK (gsd_ldsm_update_config), NULL); + + ldsm_monitor = g_unix_mount_monitor_new (); + g_unix_mount_monitor_set_rate_limit (ldsm_monitor, 1000); + g_signal_connect (ldsm_monitor, "mounts-changed", + G_CALLBACK (ldsm_mounts_changed), NULL); + + if (check_now) + ldsm_check_all_mounts (NULL); + + ldsm_timeout_id = g_timeout_add_seconds (CHECK_EVERY_X_SECONDS, + ldsm_check_all_mounts, NULL); +} + +void +gsd_ldsm_clean (void) +{ + if (ldsm_timeout_id) + g_source_remove (ldsm_timeout_id); + ldsm_timeout_id = 0; + + if (ldsm_notified_hash) + g_hash_table_destroy (ldsm_notified_hash); + ldsm_notified_hash = NULL; + + if (ldsm_monitor) + g_object_unref (ldsm_monitor); + ldsm_monitor = NULL; + + if (settings != NULL) { + g_object_unref (settings); + } + + if (dialog) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + dialog = NULL; + } + + if (notification != NULL) { + notify_notification_close (notification, NULL); + notification = NULL; + } + + if (ignore_paths) { + g_slist_foreach (ignore_paths, (GFunc) g_free, NULL); + g_slist_free (ignore_paths); + } +} + diff --git a/plugins/housekeeping/gsd-disk-space.h b/plugins/housekeeping/gsd-disk-space.h new file mode 100644 index 00000000..363b73ae --- /dev/null +++ b/plugins/housekeeping/gsd-disk-space.h @@ -0,0 +1,39 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * vim: set et sw=8 ts=8: + * + * Copyright (c) 2008, Novell, Inc. + * + * Authors: Vincent Untz + * + * 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_DISK_SPACE_H +#define __GSD_DISK_SPACE_H + +#include + +G_BEGIN_DECLS + +void gsd_ldsm_setup (gboolean check_now); +void gsd_ldsm_clean (void); + +/* for the test */ +void gsd_ldsm_show_empty_trash (void); + +G_END_DECLS + +#endif /* __GSD_DISK_SPACE_H */ diff --git a/plugins/housekeeping/gsd-empty-trash-test.c b/plugins/housekeeping/gsd-empty-trash-test.c new file mode 100644 index 00000000..6abf29fb --- /dev/null +++ b/plugins/housekeeping/gsd-empty-trash-test.c @@ -0,0 +1,45 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * vim: set et sw=8 ts=8: + * + * Copyright (c) 2011, Red Hat, Inc. + * + * Authors: Cosimo Cecchi + * + * 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 +#include "gsd-disk-space.h" + +int +main (int argc, + char **argv) +{ + GMainLoop *loop; + + gtk_init (&argc, &argv); + + loop = g_main_loop_new (NULL, FALSE); + + gsd_ldsm_show_empty_trash (); + g_main_loop_run (loop); + + g_main_loop_unref (loop); + + return 0; +} + diff --git a/plugins/housekeeping/gsd-housekeeping-manager.c b/plugins/housekeeping/gsd-housekeeping-manager.c new file mode 100644 index 00000000..84f6312b --- /dev/null +++ b/plugins/housekeeping/gsd-housekeeping-manager.c @@ -0,0 +1,359 @@ +/* + * Copyright (C) 2008 Michael J. Chudobiak + * + * 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 +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-housekeeping-manager.h" +#include "gsd-disk-space.h" + + +/* General */ +#define INTERVAL_ONCE_A_DAY 24*60*60 +#define INTERVAL_TWO_MINUTES 2*60 + +/* Thumbnail cleaner */ +#define THUMB_PREFIX "org.gnome.desktop.thumbnail-cache" + +#define THUMB_AGE_KEY "maximum-age" +#define THUMB_SIZE_KEY "maximum-size" + +struct GsdHousekeepingManagerPrivate { + GSettings *settings; + guint long_term_cb; + guint short_term_cb; +}; + + +#define GSD_HOUSEKEEPING_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManagerPrivate)) + +static void gsd_housekeeping_manager_class_init (GsdHousekeepingManagerClass *klass); +static void gsd_housekeeping_manager_init (GsdHousekeepingManager *housekeeping_manager); + +G_DEFINE_TYPE (GsdHousekeepingManager, gsd_housekeeping_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + + +typedef struct { + glong now; + glong max_age; + goffset total_size; + goffset max_size; +} PurgeData; + + +typedef struct { + time_t mtime; + char *path; + glong size; +} ThumbData; + + +static void +thumb_data_free (gpointer data) +{ + ThumbData *info = data; + + if (info) { + g_free (info->path); + g_free (info); + } +} + +static GList * +read_dir_for_purge (const char *path, GList *files) +{ + GFile *read_path; + GFileEnumerator *enum_dir; + + read_path = g_file_new_for_path (path); + enum_dir = g_file_enumerate_children (read_path, + G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_TIME_MODIFIED "," + G_FILE_ATTRIBUTE_STANDARD_SIZE, + G_FILE_QUERY_INFO_NONE, + NULL, + NULL); + + if (enum_dir != NULL) { + GFileInfo *info; + while ((info = g_file_enumerator_next_file (enum_dir, NULL, NULL)) != NULL) { + const char *name; + name = g_file_info_get_name (info); + + if (strlen (name) == 36 && strcmp (name + 32, ".png") == 0) { + ThumbData *td; + GFile *entry; + char *entry_path; + GTimeVal mod_time; + + entry = g_file_get_child (read_path, name); + entry_path = g_file_get_path (entry); + g_object_unref (entry); + + g_file_info_get_modification_time (info, &mod_time); + + td = g_new0 (ThumbData, 1); + td->path = entry_path; + td->mtime = mod_time.tv_sec; + td->size = g_file_info_get_size (info); + + files = g_list_prepend (files, td); + } + g_object_unref (info); + } + g_object_unref (enum_dir); + } + g_object_unref (read_path); + + return files; +} + +static void +purge_old_thumbnails (ThumbData *info, PurgeData *purge_data) +{ + if ((purge_data->now - info->mtime) > purge_data->max_age) { + g_unlink (info->path); + info->size = 0; + } else { + purge_data->total_size += info->size; + } +} + +static int +sort_file_mtime (ThumbData *file1, ThumbData *file2) +{ + return file1->mtime - file2->mtime; +} + +static char ** +get_thumbnail_dirs (void) +{ + GPtrArray *array; + char *path; + + array = g_ptr_array_new (); + + /* check new XDG cache */ + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails", + "normal", + NULL); + g_ptr_array_add (array, path); + + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails", + "large", + NULL); + g_ptr_array_add (array, path); + + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails", + "fail", + "gnome-thumbnail-factory", + NULL); + g_ptr_array_add (array, path); + + /* cleanup obsolete locations too */ + path = g_build_filename (g_get_home_dir (), + ".thumbnails", + "normal", + NULL); + g_ptr_array_add (array, path); + + path = g_build_filename (g_get_home_dir (), + ".thumbnails", + "large", + NULL); + g_ptr_array_add (array, path); + + path = g_build_filename (g_get_home_dir (), + ".thumbnails", + "fail", + "gnome-thumbnail-factory", + NULL); + g_ptr_array_add (array, path); + + g_ptr_array_add (array, NULL); + + return (char **) g_ptr_array_free (array, FALSE); +} + +static void +purge_thumbnail_cache (GsdHousekeepingManager *manager) +{ + + char **paths; + GList *files; + PurgeData purge_data; + GTimeVal current_time; + guint i; + + g_debug ("housekeeping: checking thumbnail cache size and freshness"); + + paths = get_thumbnail_dirs (); + files = NULL; + for (i = 0; paths[i] != NULL; i++) + files = read_dir_for_purge (paths[i], files); + g_strfreev (paths); + + g_get_current_time (¤t_time); + + purge_data.now = current_time.tv_sec; + purge_data.max_age = g_settings_get_int (manager->priv->settings, THUMB_AGE_KEY) * 24 * 60 * 60; + purge_data.max_size = g_settings_get_int (manager->priv->settings, THUMB_SIZE_KEY) * 1024 * 1024; + purge_data.total_size = 0; + + if (purge_data.max_age >= 0) + g_list_foreach (files, (GFunc) purge_old_thumbnails, &purge_data); + + if ((purge_data.total_size > purge_data.max_size) && (purge_data.max_size >= 0)) { + GList *scan; + files = g_list_sort (files, (GCompareFunc) sort_file_mtime); + for (scan = files; scan && (purge_data.total_size > purge_data.max_size); scan = scan->next) { + ThumbData *info = scan->data; + g_unlink (info->path); + purge_data.total_size -= info->size; + } + } + + g_list_foreach (files, (GFunc) thumb_data_free, NULL); + g_list_free (files); +} + +static gboolean +do_cleanup (GsdHousekeepingManager *manager) +{ + purge_thumbnail_cache (manager); + return TRUE; +} + +static gboolean +do_cleanup_once (GsdHousekeepingManager *manager) +{ + do_cleanup (manager); + manager->priv->short_term_cb = 0; + return FALSE; +} + +static void +do_cleanup_soon (GsdHousekeepingManager *manager) +{ + if (manager->priv->short_term_cb == 0) { + g_debug ("housekeeping: will tidy up in 2 minutes"); + manager->priv->short_term_cb = g_timeout_add_seconds (INTERVAL_TWO_MINUTES, + (GSourceFunc) do_cleanup_once, + manager); + } +} + +static void +settings_changed_callback (GSettings *settings, + const char *key, + GsdHousekeepingManager *manager) +{ + do_cleanup_soon (manager); +} + +gboolean +gsd_housekeeping_manager_start (GsdHousekeepingManager *manager, + GError **error) +{ + g_debug ("Starting housekeeping manager"); + gnome_settings_profile_start (NULL); + + gsd_ldsm_setup (FALSE); + + manager->priv->settings = g_settings_new (THUMB_PREFIX); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (settings_changed_callback), manager); + + /* Clean once, a few minutes after start-up */ + do_cleanup_soon (manager); + + /* Clean periodically, on a daily basis. */ + manager->priv->long_term_cb = g_timeout_add_seconds (INTERVAL_ONCE_A_DAY, + (GSourceFunc) do_cleanup, + manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_housekeeping_manager_stop (GsdHousekeepingManager *manager) +{ + GsdHousekeepingManagerPrivate *p = manager->priv; + + g_debug ("Stopping housekeeping manager"); + + if (p->short_term_cb) { + g_source_remove (p->short_term_cb); + p->short_term_cb = 0; + } + + if (p->long_term_cb) { + g_source_remove (p->long_term_cb); + p->long_term_cb = 0; + + /* Do a clean-up on shutdown if and only if the size or age + limits have been set to paranoid levels (zero) */ + if ((g_settings_get_int (p->settings, THUMB_AGE_KEY) == 0) || + (g_settings_get_int (p->settings, THUMB_SIZE_KEY) == 0)) { + do_cleanup (manager); + } + + g_object_unref (p->settings); + p->settings = NULL; + } + + gsd_ldsm_clean (); +} + +static void +gsd_housekeeping_manager_class_init (GsdHousekeepingManagerClass *klass) +{ + g_type_class_add_private (klass, sizeof (GsdHousekeepingManagerPrivate)); +} + +static void +gsd_housekeeping_manager_init (GsdHousekeepingManager *manager) +{ + manager->priv = GSD_HOUSEKEEPING_MANAGER_GET_PRIVATE (manager); +} + +GsdHousekeepingManager * +gsd_housekeeping_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_HOUSEKEEPING_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_HOUSEKEEPING_MANAGER (manager_object); +} diff --git a/plugins/housekeeping/gsd-housekeeping-manager.h b/plugins/housekeeping/gsd-housekeeping-manager.h new file mode 100644 index 00000000..5c9bda87 --- /dev/null +++ b/plugins/housekeeping/gsd-housekeeping-manager.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Michael J. Chudobiak + * + * 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_HOUSEKEEPING_MANAGER_H +#define __GSD_HOUSEKEEPING_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_HOUSEKEEPING_MANAGER (gsd_housekeeping_manager_get_type ()) +#define GSD_HOUSEKEEPING_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManager)) +#define GSD_HOUSEKEEPING_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManagerClass)) +#define GSD_IS_HOUSEKEEPING_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_HOUSEKEEPING_MANAGER)) +#define GSD_IS_HOUSEKEEPING_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_HOUSEKEEPING_MANAGER)) +#define GSD_HOUSEKEEPING_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManagerClass)) + +typedef struct GsdHousekeepingManagerPrivate GsdHousekeepingManagerPrivate; + +typedef struct { + GObject parent; + GsdHousekeepingManagerPrivate *priv; +} GsdHousekeepingManager; + +typedef struct { + GObjectClass parent_class; +} GsdHousekeepingManagerClass; + +GType gsd_housekeeping_manager_get_type (void); + +GsdHousekeepingManager * gsd_housekeeping_manager_new (void); +gboolean gsd_housekeeping_manager_start (GsdHousekeepingManager *manager, + GError **error); +void gsd_housekeeping_manager_stop (GsdHousekeepingManager *manager); + +G_END_DECLS + +#endif /* __GSD_HOUSEKEEPING_MANAGER_H */ diff --git a/plugins/housekeeping/gsd-housekeeping-plugin.c b/plugins/housekeeping/gsd-housekeeping-plugin.c new file mode 100644 index 00000000..5e7a9652 --- /dev/null +++ b/plugins/housekeeping/gsd-housekeeping-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Michael J. Chudobiak + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-housekeeping-plugin.h" +#include "gsd-housekeeping-manager.h" + +struct GsdHousekeepingPluginPrivate { + GsdHousekeepingManager *manager; +}; + +#define GSD_HOUSEKEEPING_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdHousekeepingPlugin, gsd_housekeeping_plugin) + +static void +gsd_housekeeping_plugin_init (GsdHousekeepingPlugin *plugin) +{ + plugin->priv = GSD_HOUSEKEEPING_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdHousekeepingPlugin initializing"); + + plugin->priv->manager = gsd_housekeeping_manager_new (); +} + +static void +gsd_housekeeping_plugin_finalize (GObject *object) +{ + GsdHousekeepingPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_HOUSEKEEPING_PLUGIN (object)); + + g_debug ("GsdHousekeepingPlugin finalizing"); + + plugin = GSD_HOUSEKEEPING_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_housekeeping_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating housekeeping plugin"); + + error = NULL; + res = gsd_housekeeping_manager_start (GSD_HOUSEKEEPING_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start housekeeping manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating housekeeping plugin"); + gsd_housekeeping_manager_stop (GSD_HOUSEKEEPING_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_housekeeping_plugin_class_init (GsdHousekeepingPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_housekeeping_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdHousekeepingPluginPrivate)); +} diff --git a/plugins/housekeeping/gsd-housekeeping-plugin.h b/plugins/housekeeping/gsd-housekeeping-plugin.h new file mode 100644 index 00000000..7c89a451 --- /dev/null +++ b/plugins/housekeeping/gsd-housekeeping-plugin.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Michael J. Chudobiak + * + * 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, 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_HOUSEKEEPING_PLUGIN_H__ +#define __GSD_HOUSEKEEPING_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_HOUSEKEEPING_PLUGIN (gsd_housekeeping_plugin_get_type ()) +#define GSD_HOUSEKEEPING_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPlugin)) +#define GSD_HOUSEKEEPING_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPluginClass)) +#define GSD_IS_HOUSEKEEPING_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_HOUSEKEEPING_PLUGIN)) +#define GSD_IS_HOUSEKEEPING_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_HOUSEKEEPING_PLUGIN)) +#define GSD_HOUSEKEEPING_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPluginClass)) + +typedef struct GsdHousekeepingPluginPrivate GsdHousekeepingPluginPrivate; + +typedef struct { + GnomeSettingsPlugin parent; + GsdHousekeepingPluginPrivate *priv; +} GsdHousekeepingPlugin; + +typedef struct { + GnomeSettingsPluginClass parent_class; +} GsdHousekeepingPluginClass; + +GType gsd_housekeeping_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_HOUSEKEEPING_PLUGIN_H__ */ diff --git a/plugins/housekeeping/gsd-ldsm-dialog.c b/plugins/housekeeping/gsd-ldsm-dialog.c new file mode 100644 index 00000000..7366eb3f --- /dev/null +++ b/plugins/housekeeping/gsd-ldsm-dialog.c @@ -0,0 +1,474 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * gsd-ldsm-dialog.c + * Copyright (C) Chris Coulson 2009 + * + * 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 +#include + +#include "gsd-ldsm-dialog.h" + +#define SETTINGS_HOUSEKEEPING_DIR "org.gnome.settings-daemon.plugins.housekeeping" + +enum +{ + PROP_0, + PROP_OTHER_USABLE_PARTITIONS, + PROP_OTHER_PARTITIONS, + PROP_HAS_TRASH, + PROP_SPACE_REMAINING, + PROP_PARTITION_NAME, + PROP_MOUNT_PATH +}; + +struct GsdLdsmDialogPrivate +{ + GtkWidget *primary_label; + GtkWidget *secondary_label; + GtkWidget *ignore_check_button; + gboolean other_usable_partitions; + gboolean other_partitions; + gboolean has_trash; + gint64 space_remaining; + gchar *partition_name; + gchar *mount_path; +}; + +#define GSD_LDSM_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_LDSM_DIALOG, GsdLdsmDialogPrivate)) + +static void gsd_ldsm_dialog_class_init (GsdLdsmDialogClass *klass); +static void gsd_ldsm_dialog_init (GsdLdsmDialog *dialog); + +G_DEFINE_TYPE (GsdLdsmDialog, gsd_ldsm_dialog, GTK_TYPE_DIALOG); + +static const gchar* +gsd_ldsm_dialog_get_checkbutton_text (GsdLdsmDialog *dialog) +{ + g_return_val_if_fail (GSD_IS_LDSM_DIALOG (dialog), NULL); + + if (dialog->priv->other_partitions) + return _("Don't show any warnings again for this file system"); + else + return _("Don't show any warnings again"); +} + +static gchar* +gsd_ldsm_dialog_get_primary_text (GsdLdsmDialog *dialog) +{ + gchar *primary_text, *free_space; + + g_return_val_if_fail (GSD_IS_LDSM_DIALOG (dialog), NULL); + + free_space = g_format_size (dialog->priv->space_remaining); + + if (dialog->priv->other_partitions) { + primary_text = g_strdup_printf (_("The volume \"%s\" has only %s disk space remaining."), + dialog->priv->partition_name, free_space); + } else { + primary_text = g_strdup_printf (_("This computer has only %s disk space remaining."), + free_space); + } + + g_free (free_space); + + return primary_text; +} + +static const gchar* +gsd_ldsm_dialog_get_secondary_text (GsdLdsmDialog *dialog) +{ + g_return_val_if_fail (GSD_IS_LDSM_DIALOG (dialog), NULL); + + if (dialog->priv->other_usable_partitions) { + if (dialog->priv->has_trash) { + return _("You can free up disk space by emptying the Trash, removing " \ + "unused programs or files, or moving files to another disk or partition."); + } else { + return _("You can free up disk space by removing unused programs or files, " \ + "or by moving files to another disk or partition."); + } + } else { + if (dialog->priv->has_trash) { + return _("You can free up disk space by emptying the Trash, removing unused " \ + "programs or files, or moving files to an external disk."); + } else { + return _("You can free up disk space by removing unused programs or files, " \ + "or by moving files to an external disk."); + } + } +} + +static gint +ignore_path_compare (gconstpointer a, + gconstpointer b) +{ + return g_strcmp0 ((const gchar *)a, (const gchar *)b); +} + +static gboolean +update_ignore_paths (GSList **ignore_paths, + const gchar *mount_path, + gboolean ignore) +{ + GSList *found; + gchar *path_to_remove; + + found = g_slist_find_custom (*ignore_paths, mount_path, (GCompareFunc) ignore_path_compare); + + if (ignore && (found == NULL)) { + *ignore_paths = g_slist_prepend (*ignore_paths, g_strdup (mount_path)); + return TRUE; + } + + if (!ignore && (found != NULL)) { + path_to_remove = found->data; + *ignore_paths = g_slist_remove (*ignore_paths, path_to_remove); + g_free (path_to_remove); + return TRUE; + } + + return FALSE; +} + +static void +ignore_check_button_toggled_cb (GtkToggleButton *button, + gpointer user_data) +{ + GsdLdsmDialog *dialog = (GsdLdsmDialog *)user_data; + GSettings *settings; + gchar **settings_list; + gboolean ignore, updated; + gint i; + GSList *ignore_paths = NULL; + + settings = g_settings_new (SETTINGS_HOUSEKEEPING_DIR); + + settings_list = g_settings_get_strv (settings, "ignore-paths"); + + for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { + if (settings_list[i] != NULL) + ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i])); + } + + ignore = gtk_toggle_button_get_active (button); + updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore); + + g_strfreev (settings_list); + + if (updated) { + GSList *l; + GPtrArray *array = g_ptr_array_new (); + + for (l = ignore_paths; l != NULL; l = l->next) + g_ptr_array_add (array, l->data); + g_ptr_array_add (array, NULL); + + if (!g_settings_set_strv (settings, "ignore-paths", (const gchar **) array->pdata)) { + g_warning ("Cannot change ignore preference - failed to commit changes"); + } + + g_ptr_array_free (array, FALSE); + } + + g_slist_foreach (ignore_paths, (GFunc) g_free, NULL); + g_slist_free (ignore_paths); + g_object_unref (settings); +} + +static void +gsd_ldsm_dialog_init (GsdLdsmDialog *dialog) +{ + GtkWidget *main_vbox, *text_vbox, *hbox; + GtkWidget *image; + + dialog->priv = GSD_LDSM_DIALOG_GET_PRIVATE (dialog); + + main_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + + /* Set up all the window stuff here */ + gtk_window_set_title (GTK_WINDOW (dialog), _("Low Disk Space")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), + GTK_STOCK_DIALOG_WARNING); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); + gtk_window_set_urgency_hint (GTK_WINDOW (dialog), TRUE); + gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE); + gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); + + /* Create the image */ + image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); + gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); + + /* Create the labels */ + dialog->priv->primary_label = gtk_label_new (NULL); + gtk_label_set_line_wrap (GTK_LABEL (dialog->priv->primary_label), TRUE); + gtk_label_set_single_line_mode (GTK_LABEL (dialog->priv->primary_label), FALSE); + gtk_misc_set_alignment (GTK_MISC (dialog->priv->primary_label), 0.0, 0.0); + + dialog->priv->secondary_label = gtk_label_new (NULL); + gtk_label_set_line_wrap (GTK_LABEL (dialog->priv->secondary_label), TRUE); + gtk_label_set_single_line_mode (GTK_LABEL (dialog->priv->secondary_label), FALSE); + gtk_misc_set_alignment (GTK_MISC (dialog->priv->secondary_label), 0.0, 0.0); + + /* Create the check button to ignore future warnings */ + dialog->priv->ignore_check_button = gtk_check_button_new (); + /* The button should be inactive if the dialog was just called. + * I suppose it could be possible for the user to manually edit the GSettings key between + * the mount being checked and the dialog appearing, but I don't think it matters + * too much */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->ignore_check_button), FALSE); + g_signal_connect (dialog->priv->ignore_check_button, "toggled", + G_CALLBACK (ignore_check_button_toggled_cb), dialog); + + /* Now set up the dialog's GtkBox's' */ + gtk_box_set_spacing (GTK_BOX (main_vbox), 14); + + hbox = gtk_hbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); + + text_vbox = gtk_vbox_new (FALSE, 12); + + gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->primary_label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->secondary_label, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (text_vbox), dialog->priv->ignore_check_button, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), text_vbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0); + + /* Set up the action area */ + gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 6); + gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 5); + + gtk_widget_show_all (hbox); +} + +static void +gsd_ldsm_dialog_finalize (GObject *object) +{ + GsdLdsmDialog *self; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_LDSM_DIALOG (object)); + + self = GSD_LDSM_DIALOG (object); + + if (self->priv->partition_name) + g_free (self->priv->partition_name); + + if (self->priv->mount_path) + g_free (self->priv->mount_path); + + G_OBJECT_CLASS (gsd_ldsm_dialog_parent_class)->finalize (object); +} + +static void +gsd_ldsm_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +{ + GsdLdsmDialog *self; + + g_return_if_fail (GSD_IS_LDSM_DIALOG (object)); + + self = GSD_LDSM_DIALOG (object); + + switch (prop_id) + { + case PROP_OTHER_USABLE_PARTITIONS: + self->priv->other_usable_partitions = g_value_get_boolean (value); + break; + case PROP_OTHER_PARTITIONS: + self->priv->other_partitions = g_value_get_boolean (value); + break; + case PROP_HAS_TRASH: + self->priv->has_trash = g_value_get_boolean (value); + break; + case PROP_SPACE_REMAINING: + self->priv->space_remaining = g_value_get_int64 (value); + break; + case PROP_PARTITION_NAME: + self->priv->partition_name = g_value_dup_string (value); + break; + case PROP_MOUNT_PATH: + self->priv->mount_path = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_ldsm_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +{ + GsdLdsmDialog *self; + + g_return_if_fail (GSD_IS_LDSM_DIALOG (object)); + + self = GSD_LDSM_DIALOG (object); + + switch (prop_id) + { + case PROP_OTHER_USABLE_PARTITIONS: + g_value_set_boolean (value, self->priv->other_usable_partitions); + break; + case PROP_OTHER_PARTITIONS: + g_value_set_boolean (value, self->priv->other_partitions); + break; + case PROP_HAS_TRASH: + g_value_set_boolean (value, self->priv->has_trash); + break; + case PROP_SPACE_REMAINING: + g_value_set_int64 (value, self->priv->space_remaining); + break; + case PROP_PARTITION_NAME: + g_value_set_string (value, self->priv->partition_name); + break; + case PROP_MOUNT_PATH: + g_value_set_string (value, self->priv->mount_path); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_ldsm_dialog_class_init (GsdLdsmDialogClass *klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_ldsm_dialog_finalize; + object_class->set_property = gsd_ldsm_dialog_set_property; + object_class->get_property = gsd_ldsm_dialog_get_property; + + g_object_class_install_property (object_class, + PROP_OTHER_USABLE_PARTITIONS, + g_param_spec_boolean ("other-usable-partitions", + "other-usable-partitions", + "Set to TRUE if there are other usable partitions on the system", + FALSE, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_OTHER_PARTITIONS, + g_param_spec_boolean ("other-partitions", + "other-partitions", + "Set to TRUE if there are other partitions on the system", + FALSE, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_HAS_TRASH, + g_param_spec_boolean ("has-trash", + "has-trash", + "Set to TRUE if the partition has files in it's trash folder that can be deleted", + FALSE, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_SPACE_REMAINING, + g_param_spec_int64 ("space-remaining", + "space-remaining", + "Specify how much space is remaining in bytes", + G_MININT64, G_MAXINT64, 0, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_PARTITION_NAME, + g_param_spec_string ("partition-name", + "partition-name", + "Specify the name of the partition", + "Unknown", + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_MOUNT_PATH, + g_param_spec_string ("mount-path", + "mount-path", + "Specify the mount path for the partition", + "Unknown", + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (klass, sizeof (GsdLdsmDialogPrivate)); +} + +GsdLdsmDialog* +gsd_ldsm_dialog_new (gboolean other_usable_partitions, + gboolean other_partitions, + gboolean display_baobab, + gboolean display_empty_trash, + gint64 space_remaining, + const gchar *partition_name, + const gchar *mount_path) +{ + GsdLdsmDialog *dialog; + GtkWidget *button_empty_trash, *button_ignore, *button_analyze; + GtkWidget *empty_trash_image, *analyze_image, *ignore_image; + gchar *primary_text, *primary_text_markup; + const gchar *secondary_text, *checkbutton_text; + + dialog = GSD_LDSM_DIALOG (g_object_new (GSD_TYPE_LDSM_DIALOG, + "other-usable-partitions", other_usable_partitions, + "other-partitions", other_partitions, + "has-trash", display_empty_trash, + "space-remaining", space_remaining, + "partition-name", partition_name, + "mount-path", mount_path, + NULL)); + + /* Add some buttons */ + if (dialog->priv->has_trash) { + button_empty_trash = gtk_dialog_add_button (GTK_DIALOG (dialog), + _("Empty Trash"), + GSD_LDSM_DIALOG_RESPONSE_EMPTY_TRASH); + empty_trash_image = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_BUTTON); + gtk_button_set_image (GTK_BUTTON (button_empty_trash), empty_trash_image); + } + + if (display_baobab) { + button_analyze = gtk_dialog_add_button (GTK_DIALOG (dialog), + _("Examine…"), + GSD_LDSM_DIALOG_RESPONSE_ANALYZE); + analyze_image = gtk_image_new_from_icon_name ("baobab", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image (GTK_BUTTON (button_analyze), analyze_image); + } + + button_ignore = gtk_dialog_add_button (GTK_DIALOG (dialog), + _("Ignore"), + GTK_RESPONSE_CANCEL); + ignore_image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON); + gtk_button_set_image (GTK_BUTTON (button_ignore), ignore_image); + + gtk_widget_grab_default (button_ignore); + + /* Set the label text */ + primary_text = gsd_ldsm_dialog_get_primary_text (dialog); + primary_text_markup = g_markup_printf_escaped ("%s", primary_text); + gtk_label_set_markup (GTK_LABEL (dialog->priv->primary_label), primary_text_markup); + + secondary_text = gsd_ldsm_dialog_get_secondary_text (dialog); + gtk_label_set_text (GTK_LABEL (dialog->priv->secondary_label), secondary_text); + + checkbutton_text = gsd_ldsm_dialog_get_checkbutton_text (dialog); + gtk_button_set_label (GTK_BUTTON (dialog->priv->ignore_check_button), checkbutton_text); + + g_free (primary_text); + g_free (primary_text_markup); + + return dialog; +} diff --git a/plugins/housekeeping/gsd-ldsm-dialog.h b/plugins/housekeeping/gsd-ldsm-dialog.h new file mode 100644 index 00000000..365d3b6c --- /dev/null +++ b/plugins/housekeeping/gsd-ldsm-dialog.h @@ -0,0 +1,69 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * gsd-ldsm-dialog.c + * Copyright (C) Chris Coulson 2009 + * + * 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_LDSM_DIALOG_H_ +#define _GSD_LDSM_DIALOG_H_ + +#include +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_LDSM_DIALOG (gsd_ldsm_dialog_get_type ()) +#define GSD_LDSM_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_LDSM_DIALOG, GsdLdsmDialog)) +#define GSD_LDSM_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_LDSM_DIALOG, GsdLdsmDialogClass)) +#define GSD_IS_LDSM_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_LDSM_DIALOG)) +#define GSD_IS_LDSM_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_LDSM_DIALOG)) +#define GSD_LDSM_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_LDSM_DIALOG, GsdLdsmDialogClass)) + +enum +{ + GSD_LDSM_DIALOG_RESPONSE_EMPTY_TRASH = -20, + GSD_LDSM_DIALOG_RESPONSE_ANALYZE = -21 +}; + +typedef struct GsdLdsmDialogPrivate GsdLdsmDialogPrivate; +typedef struct _GsdLdsmDialogClass GsdLdsmDialogClass; +typedef struct _GsdLdsmDialog GsdLdsmDialog; + +struct _GsdLdsmDialogClass +{ + GtkDialogClass parent_class; +}; + +struct _GsdLdsmDialog +{ + GtkDialog parent_instance; + GsdLdsmDialogPrivate *priv; +}; + +GType gsd_ldsm_dialog_get_type (void) G_GNUC_CONST; + +GsdLdsmDialog * gsd_ldsm_dialog_new (gboolean other_usable_partitions, + gboolean other_partitions, + gboolean display_baobab, + gboolean display_empty_trash, + gint64 space_remaining, + const gchar *partition_name, + const gchar *mount_path); + +G_END_DECLS + +#endif /* _GSD_LDSM_DIALOG_H_ */ diff --git a/plugins/housekeeping/housekeeping.gnome-settings-plugin.in b/plugins/housekeeping/housekeeping.gnome-settings-plugin.in new file mode 100644 index 00000000..989b44c4 --- /dev/null +++ b/plugins/housekeeping/housekeeping.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=housekeeping +IAge=0 +_Name=Housekeeping +_Description=Automatically prunes thumbnail caches and other transient files, and warns about low disk space +Authors=Michael J. Chudobiak +Copyright=Copyright © 2008 Michael J. Chudobiak +Website= diff --git a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am new file mode 100644 index 00000000..959ad3a2 --- /dev/null +++ b/plugins/keyboard/Makefile.am @@ -0,0 +1,76 @@ +NULL = + +plugin_name = keyboard + +plugin_LTLIBRARIES = \ + libkeyboard.la \ + $(NULL) + +themedir = $(pkgdatadir)/icons/hicolor +size = 64x64 +context = devices + +iconsdir = $(themedir)/$(size)/$(context) +icons_DATA = \ + kbd-capslock-off.png kbd-numlock-off.png kbd-scrolllock-off.png \ + kbd-capslock-on.png kbd-numlock-on.png kbd-scrolllock-on.png + +libkeyboard_la_SOURCES = \ + gsd-keyboard-plugin.h \ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ + gsd-keyboard-xkb.h \ + gsd-keyboard-xkb.c \ + delayed-dialog.h \ + delayed-dialog.c \ + gkbd-configuration.c \ + gkbd-configuration.h \ + $(NULL) + +libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/data \ + -DDATADIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libkeyboard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(APPINDICATOR_CFLAGS) \ + $(KEYBOARD_CFLAGS) \ + $(AM_CFLAGS) + +libkeyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libkeyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(KEYBOARD_LIBS) \ + $(APPINDICATOR_LIBS) \ + $(NULL) + +plugin_in_files = \ + keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ + $(ui_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/keyboard/Makefile.in b/plugins/keyboard/Makefile.in new file mode 100644 index 00000000..7e8a71aa --- /dev/null +++ b/plugins/keyboard/Makefile.in @@ -0,0 +1,792 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/keyboard +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(iconsdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libkeyboard_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_libkeyboard_la_OBJECTS = libkeyboard_la-gsd-keyboard-plugin.lo \ + libkeyboard_la-gsd-keyboard-manager.lo \ + libkeyboard_la-gsd-keyboard-xkb.lo \ + libkeyboard_la-delayed-dialog.lo $(am__objects_1) +libkeyboard_la_OBJECTS = $(am_libkeyboard_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +libkeyboard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libkeyboard_la_CFLAGS) $(CFLAGS) $(libkeyboard_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libkeyboard_la_SOURCES) +DIST_SOURCES = $(libkeyboard_la_SOURCES) +DATA = $(icons_DATA) $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +UPOWER_CFLAGS = @UPOWER_CFLAGS@ +UPOWER_LIBS = @UPOWER_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +plugin_name = keyboard +plugin_LTLIBRARIES = \ + libkeyboard.la \ + $(NULL) + +themedir = $(pkgdatadir)/icons/hicolor +size = 64x64 +context = devices +iconsdir = $(themedir)/$(size)/$(context) +icons_DATA = \ + kbd-capslock-off.png kbd-numlock-off.png kbd-scrolllock-off.png \ + kbd-capslock-on.png kbd-numlock-on.png kbd-scrolllock-on.png + +libkeyboard_la_SOURCES = \ + gsd-keyboard-plugin.h \ + gsd-keyboard-plugin.c \ + gsd-keyboard-manager.h \ + gsd-keyboard-manager.c \ + gsd-keyboard-xkb.h \ + gsd-keyboard-xkb.c \ + delayed-dialog.h \ + delayed-dialog.c \ + $(NULL) + +libkeyboard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/data \ + -DDATADIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libkeyboard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(KEYBOARD_CFLAGS) \ + $(AM_CFLAGS) + +libkeyboard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libkeyboard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(XF86MISC_LIBS) \ + $(KEYBOARD_LIBS) \ + $(NULL) + +plugin_in_files = \ + keyboard.gnome-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(icons_DATA) \ + $(plugin_in_files) \ + $(ui_DATA) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/keyboard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/keyboard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libkeyboard.la: $(libkeyboard_la_OBJECTS) $(libkeyboard_la_DEPENDENCIES) $(EXTRA_libkeyboard_la_DEPENDENCIES) + $(AM_V_CCLD)$(libkeyboard_la_LINK) -rpath $(plugindir) $(libkeyboard_la_OBJECTS) $(libkeyboard_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-delayed-dialog.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libkeyboard_la-gsd-keyboard-plugin.lo: gsd-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-gsd-keyboard-plugin.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Tpo -c -o libkeyboard_la-gsd-keyboard-plugin.lo `test -f 'gsd-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-keyboard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Tpo $(DEPDIR)/libkeyboard_la-gsd-keyboard-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-plugin.c' object='libkeyboard_la-gsd-keyboard-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-plugin.lo `test -f 'gsd-keyboard-plugin.c' || echo '$(srcdir)/'`gsd-keyboard-plugin.c + +libkeyboard_la-gsd-keyboard-manager.lo: gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-gsd-keyboard-manager.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Tpo -c -o libkeyboard_la-gsd-keyboard-manager.lo `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Tpo $(DEPDIR)/libkeyboard_la-gsd-keyboard-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-manager.c' object='libkeyboard_la-gsd-keyboard-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-manager.lo `test -f 'gsd-keyboard-manager.c' || echo '$(srcdir)/'`gsd-keyboard-manager.c + +libkeyboard_la-gsd-keyboard-xkb.lo: gsd-keyboard-xkb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-gsd-keyboard-xkb.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Tpo -c -o libkeyboard_la-gsd-keyboard-xkb.lo `test -f 'gsd-keyboard-xkb.c' || echo '$(srcdir)/'`gsd-keyboard-xkb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Tpo $(DEPDIR)/libkeyboard_la-gsd-keyboard-xkb.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-keyboard-xkb.c' object='libkeyboard_la-gsd-keyboard-xkb.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-gsd-keyboard-xkb.lo `test -f 'gsd-keyboard-xkb.c' || echo '$(srcdir)/'`gsd-keyboard-xkb.c + +libkeyboard_la-delayed-dialog.lo: delayed-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -MT libkeyboard_la-delayed-dialog.lo -MD -MP -MF $(DEPDIR)/libkeyboard_la-delayed-dialog.Tpo -c -o libkeyboard_la-delayed-dialog.lo `test -f 'delayed-dialog.c' || echo '$(srcdir)/'`delayed-dialog.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyboard_la-delayed-dialog.Tpo $(DEPDIR)/libkeyboard_la-delayed-dialog.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='delayed-dialog.c' object='libkeyboard_la-delayed-dialog.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyboard_la_CPPFLAGS) $(CPPFLAGS) $(libkeyboard_la_CFLAGS) $(CFLAGS) -c -o libkeyboard_la-delayed-dialog.lo `test -f 'delayed-dialog.c' || echo '$(srcdir)/'`delayed-dialog.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-iconsDATA: $(icons_DATA) + @$(NORMAL_INSTALL) + test -z "$(iconsdir)" || $(MKDIR_P) "$(DESTDIR)$(iconsdir)" + @list='$(icons_DATA)'; test -n "$(iconsdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(iconsdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(iconsdir)" || exit $$?; \ + done + +uninstall-iconsDATA: + @$(NORMAL_UNINSTALL) + @list='$(icons_DATA)'; test -n "$(iconsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(iconsdir)'; $(am__uninstall_files_from_dir) +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-iconsDATA install-pluginDATA \ + install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-iconsDATA uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-iconsDATA install-info install-info-am \ + install-man install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-iconsDATA uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/keyboard/delayed-dialog.c b/plugins/keyboard/delayed-dialog.c new file mode 100644 index 00000000..af1ddd71 --- /dev/null +++ b/plugins/keyboard/delayed-dialog.c @@ -0,0 +1,128 @@ +/* + * Copyright © 2006 Novell, Inc. + * + * 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, 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 +#include + +#include +#include + +#include "delayed-dialog.h" + +static gboolean delayed_show_timeout (gpointer data); +static GdkFilterReturn message_filter (GdkXEvent *xevent, + GdkEvent *event, + gpointer data); + +static GSList *dialogs = NULL; + +/** + * gsd_delayed_show_dialog: + * @dialog: the dialog + * + * Shows the dialog as with gtk_widget_show(), unless a window manager + * hasn't been started yet, in which case it will wait up to 5 seconds + * for that to happen before showing the dialog. + **/ +void +gsd_delayed_show_dialog (GtkWidget *dialog) +{ + GdkDisplay *display = gtk_widget_get_display (dialog); + Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); + GdkScreen *screen = gtk_widget_get_screen (dialog); + char selection_name[10]; + Atom selection_atom; + + /* We can't use gdk_selection_owner_get() for this, because + * it's an unknown out-of-process window. + */ + snprintf (selection_name, sizeof (selection_name), "WM_S%d", + gdk_screen_get_number (screen)); + selection_atom = XInternAtom (xdisplay, selection_name, True); + if (selection_atom && + XGetSelectionOwner (xdisplay, selection_atom) != None) { + gtk_widget_show (dialog); + return; + } + + dialogs = g_slist_prepend (dialogs, dialog); + + gdk_window_add_filter (NULL, message_filter, NULL); + + g_timeout_add (5000, delayed_show_timeout, NULL); +} + +static gboolean +delayed_show_timeout (gpointer data) +{ + GSList *l; + + for (l = dialogs; l; l = l->next) + gtk_widget_show (l->data); + g_slist_free (dialogs); + dialogs = NULL; + + /* FIXME: There's no gdk_display_remove_client_message_filter */ + + return FALSE; +} + +static GdkFilterReturn +message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) +{ + XClientMessageEvent *evt; + char *selection_name; + int screen; + GSList *l, *next; + + if (((XEvent *)xevent)->type != ClientMessage) + return GDK_FILTER_CONTINUE; + + evt = (XClientMessageEvent *)xevent; + + if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE)) + return GDK_FILTER_CONTINUE; + + selection_name = XGetAtomName (evt->display, evt->data.l[1]); + + if (strncmp (selection_name, "WM_S", 4) != 0) { + XFree (selection_name); + return GDK_FILTER_CONTINUE; + } + + screen = atoi (selection_name + 4); + + for (l = dialogs; l; l = next) { + GtkWidget *dialog = l->data; + next = l->next; + + if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { + gtk_widget_show (dialog); + dialogs = g_slist_remove (dialogs, dialog); + } + } + + if (!dialogs) { + gdk_window_remove_filter (NULL, message_filter, NULL); + } + + XFree (selection_name); + + return GDK_FILTER_CONTINUE; +} diff --git a/plugins/keyboard/delayed-dialog.h b/plugins/keyboard/delayed-dialog.h new file mode 100644 index 00000000..d032b95a --- /dev/null +++ b/plugins/keyboard/delayed-dialog.h @@ -0,0 +1,32 @@ +/* + * Copyright © 2006 Novell, Inc. + * + * 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, 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 __DELAYED_DIALOG_H +#define __DELAYED_DIALOG_H + +#include + +G_BEGIN_DECLS + +void gsd_delayed_show_dialog (GtkWidget *dialog); + +G_END_DECLS + +#endif diff --git a/plugins/keyboard/gkbd-configuration.c b/plugins/keyboard/gkbd-configuration.c new file mode 100644 index 00000000..0d91407a --- /dev/null +++ b/plugins/keyboard/gkbd-configuration.c @@ -0,0 +1,350 @@ +/* + * Copyright (C) 2010 Canonical Ltd. + * + * Authors: Jan Arne Petersen + * + * Based on gkbd-status.c by Sergey V. Udaltsov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser 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. + */ + +#include + +#include +#include +#include + +#include +#include + +#include "gkbd-configuration.h" + +struct _GkbdConfigurationPrivate { + XklEngine *engine; + XklConfigRegistry *registry; + + GkbdDesktopConfig cfg; + GkbdIndicatorConfig ind_cfg; + GkbdKeyboardConfig kbd_cfg; + + gchar **full_group_names; + gchar **short_group_names; + + gulong state_changed_handler; + gulong config_changed_handler; +}; + +enum { + SIGNAL_CHANGED, + SIGNAL_GROUP_CHANGED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0, }; + +#define GKBD_CONFIGURATION_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), GKBD_TYPE_CONFIGURATION, GkbdConfigurationPrivate)) + +G_DEFINE_TYPE (GkbdConfiguration, gkbd_configuration, G_TYPE_OBJECT) + +/* Should be called once for all widgets */ +static void +gkbd_configuration_cfg_changed (GSettings *settings, + const char *key, + GkbdConfiguration * configuration) +{ + GkbdConfigurationPrivate *priv = configuration->priv; + + xkl_debug (100, + "General configuration changed in GSettings - reiniting...\n"); + gkbd_desktop_config_load (&priv->cfg); + gkbd_desktop_config_activate (&priv->cfg); + + g_signal_emit (configuration, + signals[SIGNAL_CHANGED], 0); +} + +/* Should be called once for all widgets */ +static void +gkbd_configuration_ind_cfg_changed (GSettings *settings, + const char *key, + GkbdConfiguration * configuration) +{ + GkbdConfigurationPrivate *priv = configuration->priv; + xkl_debug (100, + "Applet configuration changed in GSettings - reiniting...\n"); + gkbd_indicator_config_load (&priv->ind_cfg); + + gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); + gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, + &priv->kbd_cfg); + + gkbd_indicator_config_activate (&priv->ind_cfg); + + g_signal_emit (configuration, + signals[SIGNAL_CHANGED], 0); +} + +static void +gkbd_configuration_load_group_names (GkbdConfiguration * configuration, + XklConfigRec * xklrec) +{ + GkbdConfigurationPrivate *priv = configuration->priv; + + if (!gkbd_desktop_config_load_group_descriptions (&priv->cfg, + priv->registry, + (const char **) xklrec->layouts, + (const char **) xklrec->variants, + &priv->short_group_names, + &priv->full_group_names)) { + /* We just populate no short names (remain NULL) - + * full names are going to be used anyway */ + gint i, total_groups = + xkl_engine_get_num_groups (priv->engine); + xkl_debug (150, "group descriptions loaded: %d!\n", + total_groups); + priv->full_group_names = + g_new0 (char *, total_groups + 1); + + if (xkl_engine_get_features (priv->engine) & + XKLF_MULTIPLE_LAYOUTS_SUPPORTED) { + for (i = 0; priv->kbd_cfg.layouts_variants[i]; i++) { + priv->full_group_names[i] = + g_strdup ((char *) priv->kbd_cfg.layouts_variants[i]); + } + } else { + for (i = total_groups; --i >= 0;) { + priv->full_group_names[i] = + g_strdup_printf ("Group %d", i); + } + } + } +} + +/* Should be called once for all widgets */ +static void +gkbd_configuration_kbd_cfg_callback (XklEngine *engine, + GkbdConfiguration *configuration) +{ + GkbdConfigurationPrivate *priv = configuration->priv; + XklConfigRec *xklrec = xkl_config_rec_new (); + xkl_debug (100, + "XKB configuration changed on X Server - reiniting...\n"); + + gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, + xklrec); + + gkbd_indicator_config_free_image_filenames (&priv->ind_cfg); + gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, + &priv->kbd_cfg); + + g_strfreev (priv->full_group_names); + priv->full_group_names = NULL; + + g_strfreev (priv->short_group_names); + priv->short_group_names = NULL; + + gkbd_configuration_load_group_names (configuration, + xklrec); + + g_signal_emit (configuration, + signals[SIGNAL_CHANGED], + 0); + + g_object_unref (G_OBJECT (xklrec)); +} + +/* Should be called once for all applets */ +static void +gkbd_configuration_state_callback (XklEngine * engine, + XklEngineStateChange changeType, + gint group, gboolean restore, + GkbdConfiguration * configuration) +{ + xkl_debug (150, "group is now %d, restore: %d\n", group, restore); + + if (changeType == GROUP_CHANGED) { + g_signal_emit (configuration, + signals[SIGNAL_GROUP_CHANGED], 0, + group); + } +} + +static void +gkbd_configuration_init (GkbdConfiguration *configuration) +{ + GkbdConfigurationPrivate *priv; + XklConfigRec *xklrec = xkl_config_rec_new (); + + priv = GKBD_CONFIGURATION_GET_PRIVATE (configuration); + configuration->priv = priv; + + priv->engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + if (priv->engine == NULL) { + xkl_debug (0, "Libxklavier initialization error"); + return; + } + + priv->state_changed_handler = + g_signal_connect (priv->engine, "X-state-changed", + G_CALLBACK (gkbd_configuration_state_callback), + configuration); + priv->config_changed_handler = + g_signal_connect (priv->engine, "X-config-changed", + G_CALLBACK (gkbd_configuration_kbd_cfg_callback), + configuration); + + gkbd_desktop_config_init (&priv->cfg, priv->engine); + gkbd_keyboard_config_init (&priv->kbd_cfg, priv->engine); + gkbd_indicator_config_init (&priv->ind_cfg, priv->engine); + + gkbd_desktop_config_load (&priv->cfg); + gkbd_desktop_config_activate (&priv->cfg); + + priv->registry = xkl_config_registry_get_instance (priv->engine); + xkl_config_registry_load (priv->registry, + priv->cfg.load_extra_items); + + gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, + xklrec); + + gkbd_indicator_config_load (&priv->ind_cfg); + + gkbd_indicator_config_load_image_filenames (&priv->ind_cfg, + &priv->kbd_cfg); + + gkbd_indicator_config_activate (&priv->ind_cfg); + + gkbd_configuration_load_group_names (configuration, + xklrec); + g_object_unref (G_OBJECT (xklrec)); + + gkbd_desktop_config_start_listen (&priv->cfg, + G_CALLBACK (gkbd_configuration_cfg_changed), + configuration); + gkbd_indicator_config_start_listen (&priv->ind_cfg, + G_CALLBACK (gkbd_configuration_ind_cfg_changed), + configuration); + xkl_engine_start_listen (priv->engine, + XKLL_TRACK_KEYBOARD_STATE); + + xkl_debug (100, "Initiating the widget startup process for %p\n", + configuration); +} + +static void +gkbd_configuration_finalize (GObject * obj) +{ + GkbdConfiguration *configuration = GKBD_CONFIGURATION (obj); + GkbdConfigurationPrivate *priv = configuration->priv; + + xkl_debug (100, + "Starting the gnome-kbd-configuration widget shutdown process for %p\n", + configuration); + + xkl_engine_stop_listen (priv->engine, + XKLL_TRACK_KEYBOARD_STATE); + + gkbd_desktop_config_stop_listen (&priv->cfg); + gkbd_indicator_config_stop_listen (&priv->ind_cfg); + + gkbd_indicator_config_term (&priv->ind_cfg); + gkbd_keyboard_config_term (&priv->kbd_cfg); + gkbd_desktop_config_term (&priv->cfg); + + if (g_signal_handler_is_connected (priv->engine, + priv->state_changed_handler)) { + g_signal_handler_disconnect (priv->engine, + priv->state_changed_handler); + priv->state_changed_handler = 0; + } + if (g_signal_handler_is_connected (priv->engine, + priv->config_changed_handler)) { + g_signal_handler_disconnect (priv->engine, + priv->config_changed_handler); + priv->config_changed_handler = 0; + } + + g_object_unref (priv->registry); + priv->registry = NULL; + g_object_unref (priv->engine); + priv->engine = NULL; + + G_OBJECT_CLASS (gkbd_configuration_parent_class)->finalize (obj); +} + +static void +gkbd_configuration_class_init (GkbdConfigurationClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + /* Initing vtable */ + object_class->finalize = gkbd_configuration_finalize; + + /* Signals */ + signals[SIGNAL_CHANGED] = g_signal_new ("changed", + GKBD_TYPE_CONFIGURATION, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals[SIGNAL_GROUP_CHANGED] = g_signal_new ("group-changed", + GKBD_TYPE_CONFIGURATION, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, + 1, + G_TYPE_INT); + + g_type_class_add_private (klass, sizeof (GkbdConfigurationPrivate)); +} + +GkbdConfiguration * +gkbd_configuration_get (void) +{ + static gpointer instance = NULL; + + if (!instance) { + instance = g_object_new (GKBD_TYPE_CONFIGURATION, NULL); + g_object_add_weak_pointer (instance, &instance); + } else { + g_object_ref (instance); + } + + return instance; +} + +XklEngine * +gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration) +{ + return configuration->priv->engine; +} + +const char * const * +gkbd_configuration_get_group_names (GkbdConfiguration *configuration) +{ + return configuration->priv->full_group_names; +} + +const char * const * +gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration) +{ + return configuration->priv->short_group_names; +} diff --git a/plugins/keyboard/gkbd-configuration.h b/plugins/keyboard/gkbd-configuration.h new file mode 100644 index 00000000..c3fc54e3 --- /dev/null +++ b/plugins/keyboard/gkbd-configuration.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Canonical Ltd. + * + * Authors: Jan Arne Petersen + * + * Based on gkbd-status.h by Sergey V. Udaltsov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 Lesser 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. + */ + +#ifndef __GKBD_CONFIGURATION_H__ +#define __GKBD_CONFIGURATION_H__ + +#include + +#include + +G_BEGIN_DECLS + +typedef struct _GkbdConfiguration GkbdConfiguration; +typedef struct _GkbdConfigurationPrivate GkbdConfigurationPrivate; +typedef struct _GkbdConfigurationClass GkbdConfigurationClass; + +#define GKBD_TYPE_CONFIGURATION (gkbd_configuration_get_type ()) +#define GKBD_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfiguration)) +#define GKBD_INDCATOR_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) +#define GKBD_IS_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) +#define GKBD_IS_CONFIGURATION_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GKBD_TYPE_CONFIGURATION)) +#define GKBD_CONFIGURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass)) + +struct _GkbdConfiguration { + GObject parent; + + GkbdConfigurationPrivate *priv; +}; + +struct _GkbdConfigurationClass { + GObjectClass parent_class; +}; + +extern GType gkbd_configuration_get_type (void); + +extern GkbdConfiguration *gkbd_configuration_get (void); + +extern XklEngine *gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration); + +extern const char * const *gkbd_configuration_get_group_names (GkbdConfiguration *configuration); +extern const char * const *gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration); + +G_END_DECLS + +#endif diff --git a/plugins/keyboard/gsd-input-sources-switcher.c b/plugins/keyboard/gsd-input-sources-switcher.c new file mode 100644 index 00000000..cff23591 --- /dev/null +++ b/plugins/keyboard/gsd-input-sources-switcher.c @@ -0,0 +1,599 @@ +/* + * Copyright (C) 2012 Red Hat, Inc. + * + * Written by: Rui Matos + * + * 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, 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 Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include +#include +#include + +#include + +#include "gsd-enums.h" +#include "gsd-keygrab.h" + +#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" +#define KEY_CURRENT_INPUT_SOURCE "current" +#define KEY_INPUT_SOURCES "sources" + +#define GSD_KEYBOARD_DIR "org.gnome.settings-daemon.peripherals.keyboard" +#define KEY_SWITCHER "input-sources-switcher" + +static GSettings *input_sources_settings; + +static Key *the_keys = NULL; +static guint n_keys = 0; + +static guint master_keyboard_id = 0; + +static gboolean includes_caps = FALSE; + +static void +do_switch (void) +{ + GVariant *sources; + gint i, n; + + /* FIXME: this is racy with the g-s-d media-keys plugin. Instead we + should have a DBus API on g-s-d and poke it from here.*/ + sources = g_settings_get_value (input_sources_settings, KEY_INPUT_SOURCES); + + n = g_variant_n_children (sources); + if (n < 2) + goto out; + + i = g_settings_get_uint (input_sources_settings, KEY_CURRENT_INPUT_SOURCE) + 1; + if (i >= n) + i = 0; + + g_settings_set_uint (input_sources_settings, KEY_CURRENT_INPUT_SOURCE, i); + + out: + g_variant_unref (sources); +} + +static void +init_keys (void) +{ + GSettings *settings; + + settings = g_settings_new (GSD_KEYBOARD_DIR); + + switch (g_settings_get_enum (settings, KEY_SWITCHER)) + { + case GSD_INPUT_SOURCES_SWITCHER_SHIFT_L: + n_keys = 1; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_L; + the_keys[0].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_L: + n_keys = 1; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Alt_L; + the_keys[0].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_L: + n_keys = 1; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Control_L; + the_keys[0].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_SHIFT_R: + n_keys = 1; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_R; + the_keys[0].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_R: + n_keys = 2; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Alt_R; + the_keys[0].state = 0; + the_keys[1].keysym = GDK_KEY_ISO_Level3_Shift; + the_keys[1].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_R: + n_keys = 1; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Control_R; + the_keys[0].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_SHIFT_L: + n_keys = 2; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_L; + the_keys[0].state = GDK_MOD1_MASK; + the_keys[1].keysym = GDK_KEY_Alt_L; + the_keys[1].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_SHIFT_R: + n_keys = 4; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_R; + the_keys[0].state = GDK_MOD1_MASK; + the_keys[1].keysym = GDK_KEY_Alt_R; + the_keys[1].state = GDK_SHIFT_MASK; + the_keys[2].keysym = GDK_KEY_Shift_R; + the_keys[2].state = GDK_MOD5_MASK; + the_keys[3].keysym = GDK_KEY_ISO_Level3_Shift; + the_keys[3].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_SHIFT_L: + n_keys = 2; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_L; + the_keys[0].state = GDK_CONTROL_MASK; + the_keys[1].keysym = GDK_KEY_Control_L; + the_keys[1].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_SHIFT_R: + n_keys = 2; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_R; + the_keys[0].state = GDK_CONTROL_MASK; + the_keys[1].keysym = GDK_KEY_Control_R; + the_keys[1].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_SHIFT_L_SHIFT_R: + n_keys = 2; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_L; + the_keys[0].state = GDK_SHIFT_MASK; + the_keys[1].keysym = GDK_KEY_Shift_R; + the_keys[1].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_L_ALT_R: + n_keys = 4; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Alt_L; + the_keys[0].state = GDK_MOD1_MASK; + the_keys[1].keysym = GDK_KEY_Alt_R; + the_keys[1].state = GDK_MOD1_MASK; + the_keys[2].keysym = GDK_KEY_Alt_L; + the_keys[2].state = GDK_MOD5_MASK; + the_keys[3].keysym = GDK_KEY_ISO_Level3_Shift; + the_keys[3].state = GDK_MOD1_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_L_CTRL_R: + n_keys = 2; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Control_L; + the_keys[0].state = GDK_CONTROL_MASK; + the_keys[1].keysym = GDK_KEY_Control_R; + the_keys[1].state = GDK_CONTROL_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_SHIFT: + n_keys = 7; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_L; + the_keys[0].state = GDK_MOD1_MASK; + the_keys[1].keysym = GDK_KEY_Shift_L; + the_keys[1].state = GDK_MOD5_MASK; + the_keys[2].keysym = GDK_KEY_Shift_R; + the_keys[2].state = GDK_MOD1_MASK; + the_keys[3].keysym = GDK_KEY_Shift_R; + the_keys[3].state = GDK_MOD5_MASK; + the_keys[4].keysym = GDK_KEY_Alt_L; + the_keys[4].state = GDK_SHIFT_MASK; + the_keys[5].keysym = GDK_KEY_Alt_R; + the_keys[5].state = GDK_SHIFT_MASK; + the_keys[6].keysym = GDK_KEY_ISO_Level3_Shift; + the_keys[6].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_SHIFT: + n_keys = 4; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Shift_L; + the_keys[0].state = GDK_CONTROL_MASK; + the_keys[1].keysym = GDK_KEY_Shift_R; + the_keys[1].state = GDK_CONTROL_MASK; + the_keys[2].keysym = GDK_KEY_Control_L; + the_keys[2].state = GDK_SHIFT_MASK; + the_keys[3].keysym = GDK_KEY_Control_R; + the_keys[3].state = GDK_SHIFT_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_CTRL: + n_keys = 7; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Control_L; + the_keys[0].state = GDK_MOD1_MASK; + the_keys[1].keysym = GDK_KEY_Control_L; + the_keys[1].state = GDK_MOD5_MASK; + the_keys[2].keysym = GDK_KEY_Control_R; + the_keys[2].state = GDK_MOD1_MASK; + the_keys[3].keysym = GDK_KEY_Control_R; + the_keys[3].state = GDK_MOD5_MASK; + the_keys[4].keysym = GDK_KEY_Alt_L; + the_keys[4].state = GDK_CONTROL_MASK; + the_keys[5].keysym = GDK_KEY_Alt_R; + the_keys[5].state = GDK_CONTROL_MASK; + the_keys[6].keysym = GDK_KEY_ISO_Level3_Shift; + the_keys[6].state = GDK_CONTROL_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CAPS: + includes_caps = TRUE; + n_keys = 1; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Caps_Lock; + the_keys[0].state = 0; + break; + + case GSD_INPUT_SOURCES_SWITCHER_SHIFT_CAPS: + includes_caps = TRUE; + n_keys = 3; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Caps_Lock; + the_keys[0].state = GDK_SHIFT_MASK; + the_keys[1].keysym = GDK_KEY_Shift_L; + the_keys[1].state = GDK_LOCK_MASK; + the_keys[2].keysym = GDK_KEY_Shift_R; + the_keys[2].state = GDK_LOCK_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_ALT_CAPS: + includes_caps = TRUE; + n_keys = 5; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Caps_Lock; + the_keys[0].state = GDK_MOD1_MASK; + the_keys[1].keysym = GDK_KEY_Caps_Lock; + the_keys[1].state = GDK_MOD5_MASK; + the_keys[2].keysym = GDK_KEY_Alt_L; + the_keys[2].state = GDK_LOCK_MASK; + the_keys[3].keysym = GDK_KEY_Alt_R; + the_keys[3].state = GDK_LOCK_MASK; + the_keys[4].keysym = GDK_KEY_ISO_Level3_Shift; + the_keys[4].state = GDK_LOCK_MASK; + break; + + case GSD_INPUT_SOURCES_SWITCHER_CTRL_CAPS: + includes_caps = TRUE; + n_keys = 3; + the_keys = g_new0 (Key, n_keys); + + the_keys[0].keysym = GDK_KEY_Caps_Lock; + the_keys[0].state = GDK_CONTROL_MASK; + the_keys[1].keysym = GDK_KEY_Control_L; + the_keys[1].state = GDK_LOCK_MASK; + the_keys[2].keysym = GDK_KEY_Control_R; + the_keys[2].state = GDK_LOCK_MASK; + break; + } + + g_object_unref (settings); +} + +static void +free_keys (void) +{ + gint i; + + for (i = 0; i < n_keys; ++i) + g_free (the_keys[i].keycodes); + + g_free (the_keys); +} + +static gboolean +match_caps_locked (const Key *key, + XIDeviceEvent *xev) +{ + if (key->state & xev->mods.effective && + key->keysym == XkbKeycodeToKeysym (xev->display, xev->detail, 0, 0)) + return TRUE; + + return FALSE; +} + +static gboolean +match_modifier (const Key *key, + XIEvent *xiev) +{ + Key meta; + + /* When the grab is established with Caps Lock as the modifier + (i.e. key->state == GDK_LOCK_MASK) we can't use match_xi2_key() + as this modifier is black listed there, so we do the match + ourselves. */ + if (key->state == GDK_LOCK_MASK) + return match_caps_locked (key, (XIDeviceEvent *) xiev); + + meta = *key; + + switch (key->keysym) + { + case GDK_KEY_Shift_L: + case GDK_KEY_Shift_R: + if (xiev->evtype == XI_KeyRelease) + meta.state |= GDK_SHIFT_MASK; + break; + + case GDK_KEY_Control_L: + case GDK_KEY_Control_R: + if (xiev->evtype == XI_KeyRelease) + meta.state |= GDK_CONTROL_MASK; + break; + + case GDK_KEY_ISO_Level3_Shift: + if (xiev->evtype == XI_KeyRelease) + meta.state |= GDK_MOD5_MASK; + break; + + case GDK_KEY_Alt_L: + case GDK_KEY_Alt_R: + if (key->state == GDK_SHIFT_MASK) + meta.keysym = key->keysym == GDK_KEY_Alt_L ? GDK_KEY_Meta_L : GDK_KEY_Meta_R; + + if (xiev->evtype == XI_KeyRelease) + meta.state |= GDK_MOD1_MASK; + break; + } + + return match_xi2_key (&meta, (XIDeviceEvent *) xiev); +} + +static gboolean +matches_key (XIEvent *xiev) +{ + gint i; + + for (i = 0; i < n_keys; ++i) + if (match_modifier (&the_keys[i], xiev)) + return TRUE; + + return FALSE; +} + +/* Owen magic, ported to XI2 */ +static GdkFilterReturn +filter (XEvent *xevent, + GdkEvent *event, + gpointer data) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XIGrabModifiers mods; + XIEventMask evmask; + unsigned char mask[(XI_LASTEVENT + 7)/8] = { 0 }; + + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_ButtonPress && + xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + mods.modifiers = XIAnyModifier; + XISetMask (mask, XI_ButtonPress); + evmask.deviceid = XIAllMasterDevices; + evmask.mask_len = sizeof (mask); + evmask.mask = mask; + + if (xiev->evtype != XI_ButtonPress && + matches_key (xiev)) + { + if (xiev->evtype == XI_KeyPress) + { + if (includes_caps) + { + do_switch (); + XIUngrabDevice (xev->display, + master_keyboard_id, + xev->time); + XkbLockModifiers (xev->display, XkbUseCoreKbd, LockMask, 0); + } + else + { + XIAllowEvents (xev->display, + xev->deviceid, + XISyncDevice, + xev->time); + XIGrabButton (xev->display, + XIAllMasterDevices, + XIAnyButton, + xev->root, + None, + GrabModeSync, + GrabModeSync, + False, + &evmask, + 1, + &mods); + } + } + else + { + do_switch (); + XIUngrabDevice (xev->display, + master_keyboard_id, + xev->time); + XIUngrabButton (xev->display, + XIAllMasterDevices, + XIAnyButton, + xev->root, + 1, + &mods); + } + } + else + { + XIAllowEvents (xev->display, + xev->deviceid, + XIReplayDevice, + xev->time); + XIUngrabDevice (xev->display, + master_keyboard_id, + xev->time); + XIUngrabButton (xev->display, + XIAllMasterDevices, + XIAnyButton, + xev->root, + 1, + &mods); + } + + return GDK_FILTER_CONTINUE; +} + +static void +grab_key (Key *key, + GdkDisplay *display, + GSList *screens) +{ + GdkKeymapKey *keys; + gboolean has_entries; + GArray *keycodes; + gint n, i; + + has_entries = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), + key->keysym, + &keys, + &n); + if (!has_entries) + return; + + keycodes = g_array_sized_new (TRUE, TRUE, sizeof (guint), n); + for (i = 0; i < n; ++i) + g_array_append_val (keycodes, keys[i].keycode); + + key->keycodes = (guint *) g_array_free (keycodes, FALSE); + + gdk_x11_display_error_trap_push (display); + + grab_key_unsafe (key, GSD_KEYGRAB_ALLOW_UNMODIFIED | GSD_KEYGRAB_SYNCHRONOUS, screens); + + gdk_x11_display_error_trap_pop_ignored (display); + + g_free (keys); +} + +static guint +get_master_keyboard_id (GdkDisplay *display) +{ + XIDeviceInfo *info; + guint id; + int i, n; + + id = 0; + info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display), XIAllMasterDevices, &n); + for (i = 0; i < n; ++i) + if (info[i].use == XIMasterKeyboard && info[i].enabled) + { + id = info[i].deviceid; + break; + } + XIFreeDeviceInfo (info); + + return id; +} + +static void +set_input_sources_switcher (void) +{ + GdkDisplay *display; + gint n_screens; + GSList *screens, *l; + gint i; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + screens = NULL; + for (i = 0; i < n_screens; ++i) + screens = g_slist_prepend (screens, gdk_display_get_screen (display, i)); + + for (i = 0; i < n_keys; ++i) + grab_key (&the_keys[i], display, screens); + + for (l = screens; l; l = l->next) + { + GdkScreen *screen; + + screen = (GdkScreen *) l->data; + gdk_window_add_filter (gdk_screen_get_root_window (screen), + (GdkFilterFunc) filter, + screen); + } + + g_slist_free (screens); + + master_keyboard_id = get_master_keyboard_id (display); +} + +int +main (int argc, char *argv[]) +{ + gtk_init (&argc, &argv); + + init_keys (); + if (n_keys == 0) + { + g_warning ("No shortcut defined, exiting"); + return -1; + } + input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); + + set_input_sources_switcher (); + gtk_main (); + + g_object_unref (input_sources_settings); + free_keys (); + + return 0; +} diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c new file mode 100644 index 00000000..75570afb --- /dev/null +++ b/plugins/keyboard/gsd-keyboard-manager.c @@ -0,0 +1,501 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright © 2001 Ximian, Inc. + * Copyright (C) 2007 William Jon McCann + * Written by Sergey V. Oudaltsov + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-keyboard-manager.h" +#include "gsd-enums.h" + +#include "gsd-keyboard-xkb.h" + +#define GSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerPrivate)) + +#ifndef HOST_NAME_MAX +# define HOST_NAME_MAX 255 +#endif + +#define GSD_KEYBOARD_DIR "org.gnome.settings-daemon.peripherals.keyboard" + +#define KEY_REPEAT "repeat" +#define KEY_CLICK "click" +#define KEY_INTERVAL "repeat-interval" +#define KEY_DELAY "delay" +#define KEY_CLICK_VOLUME "click-volume" +#define KEY_NUMLOCK_STATE "numlock-state" + +#define KEY_BELL_VOLUME "bell-volume" +#define KEY_BELL_PITCH "bell-pitch" +#define KEY_BELL_DURATION "bell-duration" +#define KEY_BELL_MODE "bell-mode" + +#define LIBGNOMEKBD_KEYBOARD_DIR "org.gnome.libgnomekbd.keyboard" +#define LIBGNOMEKBD_KEY_LAYOUTS "layouts" + +struct GsdKeyboardManagerPrivate +{ + guint start_idle_id; + GSettings *settings; + GSettings *libgnomekbd_settings; + gboolean have_xkb; + gint xkb_event_base; + GsdNumLockState old_state; +}; + +static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass); +static void gsd_keyboard_manager_init (GsdKeyboardManager *keyboard_manager); +static void gsd_keyboard_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdKeyboardManager, gsd_keyboard_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static gboolean +xkb_set_keyboard_autorepeat_rate (guint delay, guint interval) +{ + return XkbSetAutoRepeatRate (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XkbUseCoreKbd, + delay, + interval); +} + +static void +numlock_xkb_init (GsdKeyboardManager *manager) +{ + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + gboolean have_xkb; + int opcode, error_base, major, minor; + + have_xkb = XkbQueryExtension (dpy, + &opcode, + &manager->priv->xkb_event_base, + &error_base, + &major, + &minor) + && XkbUseExtension (dpy, &major, &minor); + + if (have_xkb) { + XkbSelectEventDetails (dpy, + XkbUseCoreKbd, + XkbStateNotifyMask, + XkbModifierLockMask, + XkbModifierLockMask); + } else { + g_warning ("XKB extension not available"); + } + + manager->priv->have_xkb = have_xkb; +} + +static unsigned +numlock_NumLock_modifier_mask (void) +{ + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + return XkbKeysymToModifiers (dpy, XK_Num_Lock); +} + +static void +numlock_set_xkb_state (GsdNumLockState new_state) +{ + unsigned int num_mask; + Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + if (new_state != GSD_NUM_LOCK_STATE_ON && new_state != GSD_NUM_LOCK_STATE_OFF) + return; + num_mask = numlock_NumLock_modifier_mask (); + XkbLockModifiers (dpy, XkbUseCoreKbd, num_mask, new_state == GSD_NUM_LOCK_STATE_ON ? num_mask : 0); +} + +static GdkFilterReturn +numlock_xkb_callback (GdkXEvent *xev_, + GdkEvent *gdkev_, + gpointer user_data) +{ + XEvent *xev = (XEvent *) xev_; + XkbEvent *xkbev = (XkbEvent *) xev; + GsdKeyboardManager *manager = (GsdKeyboardManager *) user_data; + + if (xev->type != manager->priv->xkb_event_base) + return GDK_FILTER_CONTINUE; + + if (xkbev->any.xkb_type != XkbStateNotify) + return GDK_FILTER_CONTINUE; + + if (xkbev->state.changed & XkbModifierLockMask) { + unsigned num_mask = numlock_NumLock_modifier_mask (); + unsigned locked_mods = xkbev->state.locked_mods; + GsdNumLockState numlock_state; + + numlock_state = (num_mask & locked_mods) ? GSD_NUM_LOCK_STATE_ON : GSD_NUM_LOCK_STATE_OFF; + + if (numlock_state != manager->priv->old_state) { + g_settings_set_enum (manager->priv->settings, + KEY_NUMLOCK_STATE, + numlock_state); + manager->priv->old_state = numlock_state; + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +numlock_install_xkb_callback (GsdKeyboardManager *manager) +{ + if (!manager->priv->have_xkb) + return; + + gdk_window_add_filter (NULL, + numlock_xkb_callback, + manager); +} + +static guint +_gsd_settings_get_uint (GSettings *settings, + const char *key) +{ + guint value; + + g_settings_get (settings, key, "u", &value); + return value; +} + +static void +apply_settings (GSettings *settings, + const char *key, + GsdKeyboardManager *manager) +{ + XKeyboardControl kbdcontrol; + gboolean repeat; + gboolean click; + guint interval; + guint delay; + int click_volume; + int bell_volume; + int bell_pitch; + int bell_duration; + GsdBellMode bell_mode; + gboolean rnumlock; + + if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) + return; + + repeat = g_settings_get_boolean (settings, KEY_REPEAT); + click = g_settings_get_boolean (settings, KEY_CLICK); + interval = _gsd_settings_get_uint (settings, KEY_INTERVAL); + delay = _gsd_settings_get_uint (settings, KEY_DELAY); + click_volume = g_settings_get_int (settings, KEY_CLICK_VOLUME); + bell_pitch = g_settings_get_int (settings, KEY_BELL_PITCH); + bell_duration = g_settings_get_int (settings, KEY_BELL_DURATION); + + bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE); + bell_volume = (bell_mode == GSD_BELL_MODE_ON) ? 50 : 0; + + gdk_error_trap_push (); + if (repeat) { + gboolean rate_set = FALSE; + + XAutoRepeatOn (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + /* Use XKB in preference */ + rate_set = xkb_set_keyboard_autorepeat_rate (delay, interval); + + if (!rate_set) + g_warning ("Neither XKeyboard not Xfree86's keyboard extensions are available,\n" + "no way to support keyboard autorepeat rate settings"); + } else { + XAutoRepeatOff (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + } + + /* as percentage from 0..100 inclusive */ + if (click_volume < 0) { + click_volume = 0; + } else if (click_volume > 100) { + click_volume = 100; + } + kbdcontrol.key_click_percent = click ? click_volume : 0; + kbdcontrol.bell_percent = bell_volume; + kbdcontrol.bell_pitch = bell_pitch; + kbdcontrol.bell_duration = bell_duration; + XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration, + &kbdcontrol); + + if (g_strcmp0 (key, "remember-numlock-state") == 0 || key == NULL) { + rnumlock = g_settings_get_boolean (settings, "remember-numlock-state"); + + manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE); + + if (manager->priv->have_xkb && rnumlock) + numlock_set_xkb_state (manager->priv->old_state); + } + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + gdk_error_trap_pop_ignored (); +} + +void +gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager) +{ + apply_settings (manager->priv->settings, NULL, manager); +} + +static void +apply_libgnomekbd_settings (GSettings *settings, + const char *key, + GsdKeyboardManager *manager) +{ + gchar **layouts; + + layouts = g_settings_get_strv (settings, LIBGNOMEKBD_KEY_LAYOUTS); + + /* Get accounts daemon */ + GDBusProxy *proxy = NULL; + GDBusProxy *user = NULL; + GVariant *variant = NULL; + GError *error = NULL; + gchar *object_path = NULL; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.Accounts", + "/org/freedesktop/Accounts", + "org.freedesktop.Accounts", + NULL, + &error); + + if (proxy == NULL) { + g_warning ("Failed to contact accounts service: %s", error->message); + g_error_free (error); + goto bail; + } + + variant = g_dbus_proxy_call_sync (proxy, + "FindUserByName", + g_variant_new ("(s)", g_get_user_name ()), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (variant == NULL) { + g_warning ("Could not contact accounts service to look up '%s': %s", + g_get_user_name (), error->message); + g_error_free (error); + goto bail; + } + + g_variant_get (variant, "(o)", &object_path); + user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.Accounts", + object_path, + "org.freedesktop.Accounts.User", + NULL, + &error); + g_free (object_path); + + if (user == NULL) { + g_warning ("Could not create proxy for user '%s': %s", + g_variant_get_string (variant, NULL), error->message); + g_error_free (error); + goto bail; + } + g_variant_unref (variant); + + variant = g_dbus_proxy_call_sync (user, + "SetXKeyboardLayouts", + g_variant_new ("(^as)", layouts), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (variant == NULL) { + g_warning ("Failed to set the keyboard layouts: %s", error->message); + g_error_free (error); + goto bail; + } + +bail: + if (proxy != NULL) + g_object_unref (proxy); + if (variant != NULL) + g_variant_unref (variant); + g_strfreev (layouts); +} + +static gboolean +start_keyboard_idle_cb (GsdKeyboardManager *manager) +{ + gnome_settings_profile_start (NULL); + + g_debug ("Starting keyboard manager"); + + manager->priv->have_xkb = 0; + manager->priv->settings = g_settings_new (GSD_KEYBOARD_DIR); + manager->priv->libgnomekbd_settings = g_settings_new (LIBGNOMEKBD_KEYBOARD_DIR); + + /* Essential - xkb initialization should happen before */ + gsd_keyboard_xkb_init (manager); + + numlock_xkb_init (manager); + + /* apply current settings before we install the callback */ + gsd_keyboard_manager_apply_settings (manager); + + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (apply_settings), manager); + + apply_libgnomekbd_settings (manager->priv->libgnomekbd_settings, NULL, manager); + g_signal_connect (G_OBJECT (manager->priv->libgnomekbd_settings), "changed", + G_CALLBACK (apply_libgnomekbd_settings), manager); + + numlock_install_xkb_callback (manager); + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_keyboard_manager_start (GsdKeyboardManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_keyboard_manager_stop (GsdKeyboardManager *manager) +{ + GsdKeyboardManagerPrivate *p = manager->priv; + + g_debug ("Stopping keyboard manager"); + + if (p->settings != NULL) { + g_object_unref (p->settings); + p->settings = NULL; + } + + if (p->libgnomekbd_settings != NULL) { + g_object_unref (p->libgnomekbd_settings); + p->libgnomekbd_settings = NULL; + } + + if (p->have_xkb) { + gdk_window_remove_filter (NULL, + numlock_xkb_callback, + manager); + } + + gsd_keyboard_xkb_shutdown (); +} + +static GObject * +gsd_keyboard_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdKeyboardManager *keyboard_manager; + + keyboard_manager = GSD_KEYBOARD_MANAGER (G_OBJECT_CLASS (gsd_keyboard_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (keyboard_manager); +} + +static void +gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_keyboard_manager_constructor; + object_class->finalize = gsd_keyboard_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdKeyboardManagerPrivate)); +} + +static void +gsd_keyboard_manager_init (GsdKeyboardManager *manager) +{ + manager->priv = GSD_KEYBOARD_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_keyboard_manager_finalize (GObject *object) +{ + GsdKeyboardManager *keyboard_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_KEYBOARD_MANAGER (object)); + + keyboard_manager = GSD_KEYBOARD_MANAGER (object); + + g_return_if_fail (keyboard_manager->priv != NULL); + + if (keyboard_manager->priv->start_idle_id != 0) + g_source_remove (keyboard_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_keyboard_manager_parent_class)->finalize (object); +} + +GsdKeyboardManager * +gsd_keyboard_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_KEYBOARD_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_KEYBOARD_MANAGER (manager_object); +} diff --git a/plugins/keyboard/gsd-keyboard-manager.h b/plugins/keyboard/gsd-keyboard-manager.h new file mode 100644 index 00000000..434e6520 --- /dev/null +++ b/plugins/keyboard/gsd-keyboard-manager.h @@ -0,0 +1,58 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_KEYBOARD_MANAGER_H +#define __GSD_KEYBOARD_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_KEYBOARD_MANAGER (gsd_keyboard_manager_get_type ()) +#define GSD_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManager)) +#define GSD_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerClass)) +#define GSD_IS_KEYBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_KEYBOARD_MANAGER)) +#define GSD_IS_KEYBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_KEYBOARD_MANAGER)) +#define GSD_KEYBOARD_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_KEYBOARD_MANAGER, GsdKeyboardManagerClass)) + +typedef struct GsdKeyboardManagerPrivate GsdKeyboardManagerPrivate; + +typedef struct +{ + GObject parent; + GsdKeyboardManagerPrivate *priv; +} GsdKeyboardManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdKeyboardManagerClass; + +GType gsd_keyboard_manager_get_type (void); + +GsdKeyboardManager * gsd_keyboard_manager_new (void); +gboolean gsd_keyboard_manager_start (GsdKeyboardManager *manager, + GError **error); +void gsd_keyboard_manager_stop (GsdKeyboardManager *manager); +void gsd_keyboard_manager_apply_settings (GsdKeyboardManager *manager); + +G_END_DECLS + +#endif /* __GSD_KEYBOARD_MANAGER_H */ diff --git a/plugins/keyboard/gsd-keyboard-plugin.c b/plugins/keyboard/gsd-keyboard-plugin.c new file mode 100644 index 00000000..456d37d1 --- /dev/null +++ b/plugins/keyboard/gsd-keyboard-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-keyboard-plugin.h" +#include "gsd-keyboard-manager.h" + +struct GsdKeyboardPluginPrivate { + GsdKeyboardManager *manager; +}; + +#define GSD_KEYBOARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_KEYBOARD_PLUGIN, GsdKeyboardPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdKeyboardPlugin, gsd_keyboard_plugin) + +static void +gsd_keyboard_plugin_init (GsdKeyboardPlugin *plugin) +{ + plugin->priv = GSD_KEYBOARD_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdKeyboardPlugin initializing"); + + plugin->priv->manager = gsd_keyboard_manager_new (); +} + +static void +gsd_keyboard_plugin_finalize (GObject *object) +{ + GsdKeyboardPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_KEYBOARD_PLUGIN (object)); + + g_debug ("GsdKeyboardPlugin finalizing"); + + plugin = GSD_KEYBOARD_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_keyboard_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating keyboard plugin"); + + error = NULL; + res = gsd_keyboard_manager_start (GSD_KEYBOARD_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start keyboard manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating keyboard plugin"); + gsd_keyboard_manager_stop (GSD_KEYBOARD_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_keyboard_plugin_class_init (GsdKeyboardPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_keyboard_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdKeyboardPluginPrivate)); +} diff --git a/plugins/keyboard/gsd-keyboard-plugin.h b/plugins/keyboard/gsd-keyboard-plugin.h new file mode 100644 index 00000000..f69b3840 --- /dev/null +++ b/plugins/keyboard/gsd-keyboard-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_KEYBOARD_PLUGIN_H__ +#define __GSD_KEYBOARD_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_KEYBOARD_PLUGIN (gsd_keyboard_plugin_get_type ()) +#define GSD_KEYBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_KEYBOARD_PLUGIN, GsdKeyboardPlugin)) +#define GSD_KEYBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_KEYBOARD_PLUGIN, GsdKeyboardPluginClass)) +#define GSD_IS_KEYBOARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_KEYBOARD_PLUGIN)) +#define GSD_IS_KEYBOARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_KEYBOARD_PLUGIN)) +#define GSD_KEYBOARD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_KEYBOARD_PLUGIN, GsdKeyboardPluginClass)) + +typedef struct GsdKeyboardPluginPrivate GsdKeyboardPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdKeyboardPluginPrivate *priv; +} GsdKeyboardPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdKeyboardPluginClass; + +GType gsd_keyboard_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_KEYBOARD_PLUGIN_H__ */ diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c new file mode 100644 index 00000000..7c22ee84 --- /dev/null +++ b/plugins/keyboard/gsd-keyboard-xkb.c @@ -0,0 +1,851 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001 Udaltsoft + * + * Written by Sergey V. Oudaltsov + * + * 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, 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 +#include + +#include +#include +#include +#include + +#ifndef HAVE_APPINDICATOR +#include +#endif +#include +#include +#include +#include +#include + +#ifdef HAVE_APPINDICATOR +#include +#include "gkbd-configuration.h" +#endif + +#include "gsd-keyboard-xkb.h" +#include "delayed-dialog.h" +#include "gnome-settings-profile.h" + +#define SETTINGS_KEYBOARD_DIR "org.gnome.settings-daemon.plugins.keyboard" + +static GsdKeyboardManager *manager = NULL; + +static XklEngine *xkl_engine; +static XklConfigRegistry *xkl_registry = NULL; + +static GkbdDesktopConfig current_config; +static GkbdKeyboardConfig current_kbd_config; + +/* never terminated */ +static GkbdKeyboardConfig initial_sys_kbd_config; + +static gboolean inited_ok = FALSE; + +static GSettings *settings_desktop = NULL; +static GSettings *settings_keyboard = NULL; + +static PostActivationCallback pa_callback = NULL; +static void *pa_callback_user_data = NULL; + +#ifdef HAVE_APPINDICATOR +static AppIndicator *app_indicator = NULL; +static GkbdConfiguration *gkbd_configuration = NULL; +static GkbdIndicatorConfig current_ind_config; +static GSList *groups_items_group = NULL; +static size_t lang_menu_items = 0; + +static void state_callback (XklEngine * engine, + XklEngineStateChange changeType, + gint group, gboolean restore); +static void gsd_keyboard_configuration_changed (GkbdConfiguration *configuration); + +#else +static GtkStatusIcon *icon = NULL; +#endif + +static GHashTable *preview_dialogs = NULL; + +static void +activation_error (void) +{ + char const *vendor; + GtkWidget *dialog; + + vendor = + ServerVendor (GDK_DISPLAY_XDISPLAY + (gdk_display_get_default ())); + + /* VNC viewers will not work, do not barrage them with warnings */ + if (NULL != vendor && NULL != strstr (vendor, "VNC")) + return; + + dialog = gtk_message_dialog_new_with_markup (NULL, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _ + ("Error activating XKB configuration.\n" + "There can be various reasons for that.\n\n" + "If you report this situation as a bug, include the results of\n" + " • %s\n" + " • %s\n" + " • %s\n" + " • %s"), + "xprop -root | grep XKB", + "gsettings get org.gnome.libgnomekbd.keyboard model", + "gsettings get org.gnome.libgnomekbd.keyboard layouts", + "gsettings get org.gnome.libgnomekbd.keyboard options"); + g_signal_connect (dialog, "response", + G_CALLBACK (gtk_widget_destroy), NULL); + gsd_delayed_show_dialog (dialog); +} + +static gboolean +ensure_xkl_registry (void) +{ + if (!xkl_registry) { + xkl_registry = + xkl_config_registry_get_instance (xkl_engine); + /* load all materials, unconditionally! */ + if (!xkl_config_registry_load (xkl_registry, TRUE)) { + g_object_unref (xkl_registry); + xkl_registry = NULL; + return FALSE; + } + } + + return TRUE; +} + +static void +apply_desktop_settings (void) +{ + if (!inited_ok) + return; + + gsd_keyboard_manager_apply_settings (manager); + gkbd_desktop_config_load (¤t_config); + /* again, probably it would be nice to compare things + before activating them */ + gkbd_desktop_config_activate (¤t_config); +} + +static void +popup_menu_launch_capplet () +{ + GAppInfo *info; + GdkAppLaunchContext *ctx; + GError *error = NULL; + + info = + g_app_info_create_from_commandline + ("gnome-control-center region", NULL, 0, &error); + + if (info != NULL) { + ctx = + gdk_display_get_app_launch_context + (gdk_display_get_default ()); + + if (g_app_info_launch (info, NULL, + G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) { + g_warning + ("Could not execute keyboard properties capplet: [%s]\n", + error->message); + g_error_free (error); + } + + g_object_unref (info); + g_object_unref (ctx); + } + +} + +static void +show_layout_destroy (GtkWidget * dialog, gint group) +{ + g_hash_table_remove (preview_dialogs, GINT_TO_POINTER (group)); +} + +static void +popup_menu_show_layout () +{ + GtkWidget *dialog; + XklEngine *engine = + xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY + (gdk_display_get_default ())); + XklState *xkl_state = xkl_engine_get_current_state (engine); +#ifdef HAVE_APPINDICATOR + gchar **group_names = gkbd_configuration_get_group_names (gkbd_configuration); +#else + gchar **group_names = gkbd_status_get_group_names (); +#endif + gpointer p = g_hash_table_lookup (preview_dialogs, + GINT_TO_POINTER + (xkl_state->group)); + + if (xkl_state->group < 0 + || xkl_state->group >= g_strv_length (group_names)) { + return; + } + + if (p != NULL) { + /* existing window */ + gtk_window_present (GTK_WINDOW (p)); + return; + } + + if (!ensure_xkl_registry ()) + return; + + dialog = gkbd_keyboard_drawing_dialog_new (); + gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group); + + g_signal_connect (dialog, "destroy", + G_CALLBACK (show_layout_destroy), + GINT_TO_POINTER (xkl_state->group)); + g_hash_table_insert (preview_dialogs, + GINT_TO_POINTER (xkl_state->group), dialog); + gtk_widget_show_all (dialog); +} + +static void +popup_menu_set_group (gint group_number, gboolean only_menu) +{ +#ifdef HAVE_APPINDICATOR + XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration); +#else + XklEngine *engine = gkbd_status_get_xkl_engine (); +#endif + XklState *st = xkl_engine_get_current_state(engine); + Window cur; + st->group = group_number; + xkl_engine_allow_one_switch_to_secondary_group (engine); + cur = xkl_engine_get_current_window (engine); + if (cur != (Window) NULL) { + xkl_debug (150, "Enforcing the state %d for window %lx\n", + st->group, cur); +#ifdef HAVE_APPINDICATOR + // Setting the state may trigger state_callback to be called, which will then + // cause popup_menu_set_group to be called again. + g_signal_handlers_block_by_func (engine, G_CALLBACK (state_callback), NULL); +#endif + xkl_engine_save_state (engine, + xkl_engine_get_current_window + (engine), st); +#ifdef HAVE_APPINDICATOR + g_signal_handlers_unblock_by_func (engine, G_CALLBACK (state_callback), NULL); +#endif +/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ + } else { + xkl_debug (150, + "??? Enforcing the state %d for unknown window\n", + st->group); + /* strange situation - bad things can happen */ + } + if (!only_menu) + xkl_engine_lock_group (engine, st->group); +#ifdef HAVE_APPINDICATOR + XklConfigRec * xklrec = xkl_config_rec_new(); + xkl_config_rec_get_from_server (xklrec, engine); + XklConfigRegistry *registry = xkl_config_registry_get_instance(engine); + + gkbd_keyboard_config_load_from_x_current (¤t_kbd_config, xklrec); + xkl_config_registry_load (registry, current_config.load_extra_items); + + int g; + + if (current_ind_config.show_flags) { + gchar *image_file = gkbd_indicator_config_get_images_file (¤t_ind_config, + ¤t_kbd_config, + st->group); + + + app_indicator_set_icon_full(app_indicator, image_file, _("Keyboard")); + app_indicator_set_label(app_indicator, NULL, NULL); + g_free(image_file); + } else { + gchar * guide = "XXX"; + gchar ** shortnames; + gchar ** longnames; + gchar * layout_name = NULL; + gchar * lname = NULL; + GHashTable *ln2cnt_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); + + gkbd_desktop_config_load_group_descriptions(¤t_config, registry, + (const gchar **) xklrec->layouts, + (const gchar **) xklrec->variants, + &shortnames, + &longnames); + + for (g = 0; g < g_strv_length (shortnames);g++) { + gpointer pcounter = NULL; + gchar *prev_layout_name = NULL; + int counter = 0; + + if (g < g_strv_length (shortnames)) { + if (xkl_engine_get_features (engine) & + XKLF_MULTIPLE_LAYOUTS_SUPPORTED) { + gchar *longname = (gchar *) current_kbd_config.layouts_variants[g]; + gchar *variant_name; + if (!gkbd_keyboard_config_split_items (longname, &lname, &variant_name)) + /* just in case */ + lname = longname; + + if (shortnames != NULL) { + gchar *shortname = shortnames[g]; + if (shortname != NULL && *shortname != '\0') { + lname = shortname; + } + } + } else { + lname = longnames[g]; + } + } + if (lname == NULL) + lname = ""; + + /* Process layouts with repeating description */ + if (g_hash_table_lookup_extended (ln2cnt_map, lname, (gpointer *) & prev_layout_name, &pcounter)) { + /* "next" same description */ + counter = GPOINTER_TO_INT (pcounter); + guide = "XXX1"; + } + g_hash_table_insert (ln2cnt_map, g_strdup (lname), GINT_TO_POINTER (counter+1)); + + if (st->group == g) { + if (counter > 0) { + gchar appendix[10] = ""; + gint utf8length; + gunichar cidx; + /* Unicode subscript 2, 3, 4 */ + cidx = 0x2081 + counter; + utf8length = g_unichar_to_utf8 (cidx, appendix); + appendix[utf8length] = '\0'; + layout_name = g_strconcat (lname, appendix, NULL); + } else { + layout_name = g_strdup(lname); + } + } + } + + // Guide of 3 wide-ish and one thin + app_indicator_set_label(app_indicator, layout_name, guide); + g_hash_table_destroy(ln2cnt_map); + g_free(layout_name); + g_strfreev(longnames); + g_strfreev(shortnames); + } + + // Refresh popup menu + gsd_keyboard_configuration_changed (gkbd_configuration); + + g_object_unref (G_OBJECT (xklrec)); + g_object_unref (G_OBJECT (registry)); +#endif +} + +static void +popup_menu_set_group_cb (GtkMenuItem * item, gpointer param) +{ + gint group_number = GPOINTER_TO_INT (param); + +#ifdef HAVE_APPINDICATOR + if ((item) != NULL && (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item)))) + return; +#endif + + popup_menu_set_group(group_number, FALSE); +} + +#ifdef HAVE_APPINDICATOR +static void +state_callback (XklEngine * engine, + XklEngineStateChange changeType, + gint group, gboolean restore) +{ + if ((changeType == GROUP_CHANGED) || (changeType == INDICATORS_CHANGED)) + popup_menu_set_group (GINT_TO_POINTER(group), TRUE); +} + +static int +get_current_group(void) +{ + XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration); + return xkl_engine_get_current_window_group (engine); +} +#endif + +static GtkMenu * +create_status_menu (void) +{ + GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ()); + int i = 0; +#ifdef HAVE_APPINDICATOR + const char * const *current_name = gkbd_configuration_get_group_names (gkbd_configuration); + groups_items_group = NULL; + GtkWidget *item; + int group = get_current_group(); + lang_menu_items = 0; +#else + GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ()); + gchar **current_name = gkbd_status_get_group_names (); + + GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Layouts")); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), + GTK_WIDGET (groups_menu)); + + item = gtk_menu_item_new_with_mnemonic (_("Show _Keyboard Layout...")); + gtk_widget_show (item); + g_signal_connect (item, "activate", popup_menu_show_layout, NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); + + /* translators note: + * This is the name of the gnome-control-center "region" panel */ + item = gtk_menu_item_new_with_mnemonic (_("Region and Language Settings")); + gtk_widget_show (item); + g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); +#endif + + for (i = 0; current_name && *current_name; i++, current_name++) { +#ifdef HAVE_APPINDICATOR + item = gtk_radio_menu_item_new_with_label (groups_items_group, *current_name); + groups_items_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), + i == group); + + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); + g_signal_connect (item, "activate", + G_CALLBACK (popup_menu_set_group_cb), + GINT_TO_POINTER (i)); + lang_menu_items++; +#else + gchar *image_file = gkbd_status_get_image_filename (i); + + if (image_file == NULL) { + item = + gtk_menu_item_new_with_label (*current_name); + } else { + GdkPixbuf *pixbuf = + gdk_pixbuf_new_from_file_at_size (image_file, + 24, 24, + NULL); + GtkWidget *img = + gtk_image_new_from_pixbuf (pixbuf); + item = + gtk_image_menu_item_new_with_label + (*current_name); + gtk_widget_show (img); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM + (item), img); + gtk_image_menu_item_set_always_show_image + (GTK_IMAGE_MENU_ITEM (item), TRUE); + g_free (image_file); + } + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item); + g_signal_connect (item, "activate", + G_CALLBACK (popup_menu_set_group_cb), + GINT_TO_POINTER (i)); +#endif + } + +#ifdef HAVE_APPINDICATOR + item = gtk_separator_menu_item_new(); + gtk_widget_show(item); + gtk_menu_shell_append(GTK_MENU_SHELL (popup_menu), item); + + item = + gtk_menu_item_new_with_mnemonic (_("Show _Layout Chart")); + gtk_widget_show (item); + g_signal_connect (item, "activate", popup_menu_show_layout, + NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); + + item = gtk_menu_item_new_with_mnemonic (_("Keyboard Layout _Settings...")); + gtk_widget_show (item); + g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item); +#endif + + return popup_menu; +} + +#ifndef HAVE_APPINDICATOR +static void +status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time) +{ + GtkMenu *popup_menu = create_status_menu (); + + gtk_menu_popup (popup_menu, NULL, NULL, + gtk_status_icon_position_menu, + (gpointer) icon, button, time); +} +#endif + +#ifdef HAVE_APPINDICATOR +static void +scroll_event (AppIndicator *indicator, gint delta, guint direction) +{ + g_return_if_fail(IS_APP_INDICATOR(indicator)); + int group = get_current_group(); + + if ((direction == 0 && group == 0) || + (direction == 1 && group == lang_menu_items-1)) + return; + + popup_menu_set_group((direction == 0 ? group-1 : group+1), FALSE); +} +#endif + +static void +show_hide_icon () +{ + if (g_strv_length (current_kbd_config.layouts_variants) > 1) { +#ifdef HAVE_APPINDICATOR + if (app_indicator == NULL) { + GtkMenu *popup_menu = create_status_menu (); + + app_indicator = app_indicator_new ("keyboard", + "keyboard", + APP_INDICATOR_CATEGORY_HARDWARE); + int group = get_current_group(); + popup_menu_set_group(GINT_TO_POINTER(group), TRUE); + app_indicator_set_status (app_indicator, + APP_INDICATOR_STATUS_ACTIVE); + app_indicator_set_menu (app_indicator, + popup_menu); + app_indicator_set_title (app_indicator, _("Keyboard")); + g_signal_connect (app_indicator, "scroll-event", G_CALLBACK (scroll_event), NULL); + } else { + XklEngine *engine = gkbd_configuration_get_xkl_engine (gkbd_configuration); + XklState *st = xkl_engine_get_current_state(engine); + popup_menu_set_group(GINT_TO_POINTER(st->group), TRUE); + } +#else + if (icon == NULL) { + xkl_debug (150, "Creating keyboard status icon\n"); + icon = gkbd_status_new (); + g_signal_connect (icon, "popup-menu", + G_CALLBACK + (status_icon_popup_menu_cb), + NULL); + + } +#endif + } else { +#ifdef HAVE_APPINDICATOR + g_clear_object (&app_indicator); +#else + if (icon != NULL) { + xkl_debug (150, "Destroying icon\n"); + g_object_unref (icon); + icon = NULL; + } +#endif + } +} + +static gboolean +try_activating_xkb_config_if_new (GkbdKeyboardConfig * + current_sys_kbd_config) +{ + /* Activate - only if different! */ + if (!gkbd_keyboard_config_equals + (¤t_kbd_config, current_sys_kbd_config)) { + if (gkbd_keyboard_config_activate (¤t_kbd_config)) { + if (pa_callback != NULL) { + (*pa_callback) (pa_callback_user_data); + return TRUE; + } + } else { + return FALSE; + } + } + return TRUE; +} + +static gboolean +filter_xkb_config (void) +{ + XklConfigItem *item; + gchar *lname; + gchar *vname; + gchar **lv; + gboolean any_change = FALSE; + + xkl_debug (100, "Filtering configuration against the registry\n"); + if (!ensure_xkl_registry ()) + return FALSE; + + lv = current_kbd_config.layouts_variants; + item = xkl_config_item_new (); + while (*lv) { + xkl_debug (100, "Checking [%s]\n", *lv); + if (gkbd_keyboard_config_split_items (*lv, &lname, &vname)) { + gboolean should_be_dropped = FALSE; + g_snprintf (item->name, sizeof (item->name), "%s", + lname); + if (!xkl_config_registry_find_layout + (xkl_registry, item)) { + xkl_debug (100, "Bad layout [%s]\n", + lname); + should_be_dropped = TRUE; + } else if (vname) { + g_snprintf (item->name, + sizeof (item->name), "%s", + vname); + if (!xkl_config_registry_find_variant + (xkl_registry, lname, item)) { + xkl_debug (100, + "Bad variant [%s(%s)]\n", + lname, vname); + should_be_dropped = TRUE; + } + } + if (should_be_dropped) { + gkbd_strv_behead (lv); + any_change = TRUE; + continue; + } + } + lv++; + } + g_object_unref (item); + return any_change; +} + +static void +apply_xkb_settings (void) +{ + GkbdKeyboardConfig current_sys_kbd_config; + + if (!inited_ok) + return; + + gkbd_keyboard_config_init (¤t_sys_kbd_config, xkl_engine); + + gkbd_keyboard_config_load (¤t_kbd_config, + &initial_sys_kbd_config); + + gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config, + NULL); + +#ifdef HAVE_APPINDICATOR + gkbd_indicator_config_init (¤t_ind_config, xkl_engine); + gkbd_indicator_config_load (¤t_ind_config); + + gkbd_indicator_config_load_image_filenames (¤t_ind_config, + ¤t_kbd_config); + gkbd_indicator_config_activate (¤t_ind_config); +#endif /* HAVE_APPINDICATOR */ + + if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) { + if (filter_xkb_config ()) { + if (!try_activating_xkb_config_if_new + (¤t_sys_kbd_config)) { + g_warning + ("Could not activate the filtered XKB configuration"); + activation_error (); + } + } else { + g_warning + ("Could not activate the XKB configuration"); + activation_error (); + } + } else + xkl_debug (100, + "Actual KBD configuration was not changed: redundant notification\n"); + + gkbd_keyboard_config_term (¤t_sys_kbd_config); + show_hide_icon (); +} + +static void +gsd_keyboard_xkb_analyze_sysconfig (void) +{ + if (!inited_ok) + return; + + gkbd_keyboard_config_init (&initial_sys_kbd_config, xkl_engine); + gkbd_keyboard_config_load_from_x_initial (&initial_sys_kbd_config, + NULL); +} + +#ifdef HAVE_APPINDICATOR +/* When the configuration changed update the indicator */ +static void +gsd_keyboard_configuration_changed (GkbdConfiguration *configuration) +{ + GtkMenu *popup_menu; + + if (!app_indicator) + return; + + popup_menu = create_status_menu (); + app_indicator_set_menu (app_indicator, + popup_menu); +} +#endif + +void +gsd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, + void *user_data) +{ + pa_callback = fun; + pa_callback_user_data = user_data; +} + +static GdkFilterReturn +gsd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event) +{ + XEvent *xevent = (XEvent *) xev; + xkl_engine_filter_events (xkl_engine, xevent); + return GDK_FILTER_CONTINUE; +} + +/* When new Keyboard is plugged in - reload the settings */ +static void +gsd_keyboard_new_device (XklEngine * engine) +{ + apply_desktop_settings (); + apply_xkb_settings (); +} + +void +gsd_keyboard_xkb_init (GsdKeyboardManager * kbd_manager) +{ + Display *display = + GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + gnome_settings_profile_start (NULL); + + gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), + DATADIR G_DIR_SEPARATOR_S + "icons"); + +#ifdef HAVE_APPINDICATOR + gkbd_configuration = gkbd_configuration_get (); + g_signal_connect (gkbd_configuration, "changed", + G_CALLBACK (gsd_keyboard_configuration_changed), NULL); + g_signal_connect (gkbd_configuration, "group-changed", + G_CALLBACK (gsd_keyboard_configuration_changed), NULL); +#endif + manager = kbd_manager; + gnome_settings_profile_start ("xkl_engine_get_instance"); + xkl_engine = xkl_engine_get_instance (display); + gnome_settings_profile_end ("xkl_engine_get_instance"); + if (xkl_engine) { + inited_ok = TRUE; + + gkbd_desktop_config_init (¤t_config, xkl_engine); + gkbd_keyboard_config_init (¤t_kbd_config, + xkl_engine); + xkl_engine_backup_names_prop (xkl_engine); + gsd_keyboard_xkb_analyze_sysconfig (); + + settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); + settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); + g_signal_connect (settings_desktop, "changed", + (GCallback) apply_desktop_settings, + NULL); + g_signal_connect (settings_keyboard, "changed", + (GCallback) apply_xkb_settings, NULL); + +#ifdef HAVE_APPINDICATOR + g_signal_connect (xkl_engine, "X-state-changed", G_CALLBACK (state_callback), NULL); +#endif + gdk_window_add_filter (NULL, (GdkFilterFunc) + gsd_keyboard_xkb_evt_filter, NULL); + + if (xkl_engine_get_features (xkl_engine) & + XKLF_DEVICE_DISCOVERY) + g_signal_connect (xkl_engine, "X-new-device", + G_CALLBACK + (gsd_keyboard_new_device), NULL); + + gnome_settings_profile_start ("xkl_engine_start_listen"); + xkl_engine_start_listen (xkl_engine, + XKLL_MANAGE_LAYOUTS | + XKLL_MANAGE_WINDOW_STATES); + gnome_settings_profile_end ("xkl_engine_start_listen"); + + gnome_settings_profile_start ("apply_desktop_settings"); + apply_desktop_settings (); + gnome_settings_profile_end ("apply_desktop_settings"); + gnome_settings_profile_start ("apply_xkb_settings"); + apply_xkb_settings (); + gnome_settings_profile_end ("apply_xkb_settings"); + } + preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); + + gnome_settings_profile_end (NULL); +} + +void +gsd_keyboard_xkb_shutdown (void) +{ + if (!inited_ok) + return; + + pa_callback = NULL; + pa_callback_user_data = NULL; + manager = NULL; + + if (preview_dialogs != NULL) + g_hash_table_destroy (preview_dialogs); + + if (!inited_ok) + return; + + xkl_engine_stop_listen (xkl_engine, + XKLL_MANAGE_LAYOUTS | + XKLL_MANAGE_WINDOW_STATES); + + gdk_window_remove_filter (NULL, (GdkFilterFunc) + gsd_keyboard_xkb_evt_filter, NULL); + + g_object_unref (settings_desktop); + settings_desktop = NULL; + g_object_unref (settings_keyboard); + settings_keyboard = NULL; + + if (xkl_registry) { + g_object_unref (xkl_registry); + } + + g_object_unref (xkl_engine); + + xkl_engine = NULL; + +#ifdef HAVE_APPINDICATOR + g_clear_object (&gkbd_configuration); +#endif + + inited_ok = FALSE; +} diff --git a/plugins/keyboard/gsd-keyboard-xkb.h b/plugins/keyboard/gsd-keyboard-xkb.h new file mode 100644 index 00000000..c5ac24c5 --- /dev/null +++ b/plugins/keyboard/gsd-keyboard-xkb.h @@ -0,0 +1,39 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * gnome-settings-keyboard-xkb.h + * + * Copyright (C) 2001 Udaltsoft + * + * Written by Sergey V. Oudaltsov + * + * 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, 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_KEYBOARD_XKB_H +#define __GSD_KEYBOARD_XKB_H + +#include +#include "gsd-keyboard-manager.h" + +void gsd_keyboard_xkb_init (GsdKeyboardManager *manager); +void gsd_keyboard_xkb_shutdown (void); + +typedef void (*PostActivationCallback) (void *userData); + +void +gsd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun, + void *userData); + +#endif diff --git a/plugins/keyboard/kbd-capslock-off.png b/plugins/keyboard/kbd-capslock-off.png new file mode 100644 index 00000000..828cfa8e Binary files /dev/null and b/plugins/keyboard/kbd-capslock-off.png differ diff --git a/plugins/keyboard/kbd-capslock-on.png b/plugins/keyboard/kbd-capslock-on.png new file mode 100644 index 00000000..32ea0c9d Binary files /dev/null and b/plugins/keyboard/kbd-capslock-on.png differ diff --git a/plugins/keyboard/kbd-numlock-off.png b/plugins/keyboard/kbd-numlock-off.png new file mode 100644 index 00000000..21cac591 Binary files /dev/null and b/plugins/keyboard/kbd-numlock-off.png differ diff --git a/plugins/keyboard/kbd-numlock-on.png b/plugins/keyboard/kbd-numlock-on.png new file mode 100644 index 00000000..bd9b9fca Binary files /dev/null and b/plugins/keyboard/kbd-numlock-on.png differ diff --git a/plugins/keyboard/kbd-scrolllock-off.png b/plugins/keyboard/kbd-scrolllock-off.png new file mode 100644 index 00000000..2ff8748f Binary files /dev/null and b/plugins/keyboard/kbd-scrolllock-off.png differ diff --git a/plugins/keyboard/kbd-scrolllock-on.png b/plugins/keyboard/kbd-scrolllock-on.png new file mode 100644 index 00000000..77a47946 Binary files /dev/null and b/plugins/keyboard/kbd-scrolllock-on.png differ diff --git a/plugins/keyboard/keyboard.gnome-settings-plugin.in b/plugins/keyboard/keyboard.gnome-settings-plugin.in new file mode 100644 index 00000000..a2a31487 --- /dev/null +++ b/plugins/keyboard/keyboard.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=keyboard +IAge=0 +_Name=Keyboard +_Description=Keyboard plugin +Authors= +Copyright=Copyright © 2007 +Website= diff --git a/plugins/media-keys/Makefile.am b/plugins/media-keys/Makefile.am new file mode 100644 index 00000000..bb446ea2 --- /dev/null +++ b/plugins/media-keys/Makefile.am @@ -0,0 +1,147 @@ +icondir = $(datadir)/icons/hicolor +context = actions + +plugin_name = media-keys + +NULL = + +SUBDIRS = cut-n-paste +plugin_LTLIBRARIES = libmedia-keys.la + +BUILT_SOURCES = \ + gsd-marshal.h \ + gsd-marshal.c \ + $(NULL) + +gsd-marshal.c: gsd-marshal.list + $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=gsd_marshal $< --header --body --internal > $@ + +gsd-marshal.h: gsd-marshal.list + $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=gsd_marshal $< --header --internal > $@ + +libmedia_keys_la_SOURCES = \ + gsd-media-keys-plugin.h \ + gsd-media-keys-plugin.c \ + gsd-media-keys-manager.h \ + gsd-media-keys-manager.c \ + gsd-osd-window.c \ + gsd-osd-window.h \ + gsd-osd-window-private.h \ + shortcuts-list.h \ + $(BUILT_SOURCES) \ + $(NULL) + +libmedia_keys_la_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -I$(top_srcdir)/plugins/media-keys/cut-n-paste \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libmedia_keys_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MEDIA_KEYS_CFLAGS) \ + $(AM_CFLAGS) + +libmedia_keys_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libmedia_keys_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \ + $(MEDIA_KEYS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + -lm + +plugin_in_files = \ + media-keys.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +noinst_PROGRAMS = test-media-window + +test_media_window_SOURCES = \ + gsd-osd-window.c \ + gsd-osd-window.h \ + gsd-osd-window-private.h \ + test-media-window.c \ + $(NULL) + +test_media_window_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -I$(top_srcdir)/plugins/media-keys/cut-n-paste \ + -DDATADIR=\""$(datadir)"\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_media_window_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_media_window_LDADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + -lm + +libexec_PROGRAMS = gsd-test-media-keys + +gsd_test_media_keys_SOURCES = \ + gsd-media-keys-manager.c \ + gsd-media-keys-manager.h \ + gsd-osd-window.c \ + gsd-osd-window.h \ + gsd-osd-window-private.h \ + test-media-keys.c \ + $(BUILT_SOURCES) \ + $(NULL) + +gsd_test_media_keys_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -I$(top_srcdir)/plugins/media-keys/cut-n-paste \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gsd_test_media_keys_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MEDIA_KEYS_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_media_keys_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(MEDIA_KEYS_LIBS) \ + -lm + +EXTRA_DIST = \ + gsd-marshal.list \ + README.media-keys-API \ + test-media-window-clutter.c \ + $(plugin_in_files) + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/media-keys/Makefile.in b/plugins/media-keys/Makefile.in new file mode 100644 index 00000000..bb988c86 --- /dev/null +++ b/plugins/media-keys/Makefile.in @@ -0,0 +1,1224 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = test-media-window$(EXEEXT) +libexec_PROGRAMS = gsd-test-media-keys$(EXEEXT) +subdir = plugins/media-keys +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libmedia_keys_la_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = libmedia_keys_la-gsd-marshal.lo $(am__objects_1) +am_libmedia_keys_la_OBJECTS = \ + libmedia_keys_la-gsd-media-keys-plugin.lo \ + libmedia_keys_la-gsd-media-keys-manager.lo \ + libmedia_keys_la-gsd-osd-window.lo $(am__objects_2) \ + $(am__objects_1) +libmedia_keys_la_OBJECTS = $(am_libmedia_keys_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libmedia_keys_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libmedia_keys_la_CFLAGS) $(CFLAGS) \ + $(libmedia_keys_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS) +am__objects_3 = gsd_test_media_keys-gsd-marshal.$(OBJEXT) \ + $(am__objects_1) +am_gsd_test_media_keys_OBJECTS = \ + gsd_test_media_keys-gsd-media-keys-manager.$(OBJEXT) \ + gsd_test_media_keys-gsd-osd-window.$(OBJEXT) \ + gsd_test_media_keys-test-media-keys.$(OBJEXT) $(am__objects_3) \ + $(am__objects_1) +gsd_test_media_keys_OBJECTS = $(am_gsd_test_media_keys_OBJECTS) +gsd_test_media_keys_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_test_media_keys_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_media_keys_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_media_window_OBJECTS = \ + test_media_window-gsd-osd-window.$(OBJEXT) \ + test_media_window-test-media-window.$(OBJEXT) $(am__objects_1) +test_media_window_OBJECTS = $(am_test_media_window_OBJECTS) +test_media_window_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +test_media_window_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_media_window_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libmedia_keys_la_SOURCES) $(gsd_test_media_keys_SOURCES) \ + $(test_media_window_SOURCES) +DIST_SOURCES = $(libmedia_keys_la_SOURCES) \ + $(gsd_test_media_keys_SOURCES) $(test_media_window_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +icondir = $(datadir)/icons/hicolor +context = actions +plugin_name = media-keys +NULL = +SUBDIRS = cut-n-paste +plugin_LTLIBRARIES = libmedia-keys.la +BUILT_SOURCES = \ + gsd-marshal.h \ + gsd-marshal.c \ + $(NULL) + +libmedia_keys_la_SOURCES = \ + gsd-media-keys-plugin.h \ + gsd-media-keys-plugin.c \ + gsd-media-keys-manager.h \ + gsd-media-keys-manager.c \ + gsd-osd-window.c \ + gsd-osd-window.h \ + gsd-osd-window-private.h \ + shortcuts-list.h \ + $(BUILT_SOURCES) \ + $(NULL) + +libmedia_keys_la_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -I$(top_srcdir)/plugins/media-keys/cut-n-paste \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libmedia_keys_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MEDIA_KEYS_CFLAGS) \ + $(AM_CFLAGS) + +libmedia_keys_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libmedia_keys_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \ + $(MEDIA_KEYS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + -lm + +plugin_in_files = \ + media-keys.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +test_media_window_SOURCES = \ + gsd-osd-window.c \ + gsd-osd-window.h \ + gsd-osd-window-private.h \ + test-media-window.c \ + $(NULL) + +test_media_window_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -I$(top_srcdir)/plugins/media-keys/cut-n-paste \ + -DDATADIR=\""$(datadir)"\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +test_media_window_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +test_media_window_LDADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + -lm + +gsd_test_media_keys_SOURCES = \ + gsd-media-keys-manager.c \ + gsd-media-keys-manager.h \ + gsd-osd-window.c \ + gsd-osd-window.h \ + gsd-osd-window-private.h \ + test-media-keys.c \ + $(BUILT_SOURCES) \ + $(NULL) + +gsd_test_media_keys_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -I$(top_srcdir)/plugins/media-keys/cut-n-paste \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gsd_test_media_keys_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MEDIA_KEYS_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_media_keys_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(MEDIA_KEYS_LIBS) \ + -lm + +EXTRA_DIST = \ + gsd-marshal.list \ + README.media-keys-API \ + test-media-window-clutter.c \ + $(plugin_in_files) + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/media-keys/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/media-keys/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libmedia-keys.la: $(libmedia_keys_la_OBJECTS) $(libmedia_keys_la_DEPENDENCIES) $(EXTRA_libmedia_keys_la_DEPENDENCIES) + $(AM_V_CCLD)$(libmedia_keys_la_LINK) -rpath $(plugindir) $(libmedia_keys_la_OBJECTS) $(libmedia_keys_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-media-keys$(EXEEXT): $(gsd_test_media_keys_OBJECTS) $(gsd_test_media_keys_DEPENDENCIES) $(EXTRA_gsd_test_media_keys_DEPENDENCIES) + @rm -f gsd-test-media-keys$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_media_keys_LINK) $(gsd_test_media_keys_OBJECTS) $(gsd_test_media_keys_LDADD) $(LIBS) +test-media-window$(EXEEXT): $(test_media_window_OBJECTS) $(test_media_window_DEPENDENCIES) $(EXTRA_test_media_window_DEPENDENCIES) + @rm -f test-media-window$(EXEEXT) + $(AM_V_CCLD)$(test_media_window_LINK) $(test_media_window_OBJECTS) $(test_media_window_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_media_keys-gsd-marshal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_media_keys-test-media-keys.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmedia_keys_la-gsd-marshal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmedia_keys_la-gsd-media-keys-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmedia_keys_la-gsd-media-keys-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmedia_keys_la-gsd-osd-window.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_media_window-gsd-osd-window.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_media_window-test-media-window.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libmedia_keys_la-gsd-media-keys-plugin.lo: gsd-media-keys-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -MT libmedia_keys_la-gsd-media-keys-plugin.lo -MD -MP -MF $(DEPDIR)/libmedia_keys_la-gsd-media-keys-plugin.Tpo -c -o libmedia_keys_la-gsd-media-keys-plugin.lo `test -f 'gsd-media-keys-plugin.c' || echo '$(srcdir)/'`gsd-media-keys-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmedia_keys_la-gsd-media-keys-plugin.Tpo $(DEPDIR)/libmedia_keys_la-gsd-media-keys-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-media-keys-plugin.c' object='libmedia_keys_la-gsd-media-keys-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -c -o libmedia_keys_la-gsd-media-keys-plugin.lo `test -f 'gsd-media-keys-plugin.c' || echo '$(srcdir)/'`gsd-media-keys-plugin.c + +libmedia_keys_la-gsd-media-keys-manager.lo: gsd-media-keys-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -MT libmedia_keys_la-gsd-media-keys-manager.lo -MD -MP -MF $(DEPDIR)/libmedia_keys_la-gsd-media-keys-manager.Tpo -c -o libmedia_keys_la-gsd-media-keys-manager.lo `test -f 'gsd-media-keys-manager.c' || echo '$(srcdir)/'`gsd-media-keys-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmedia_keys_la-gsd-media-keys-manager.Tpo $(DEPDIR)/libmedia_keys_la-gsd-media-keys-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-media-keys-manager.c' object='libmedia_keys_la-gsd-media-keys-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -c -o libmedia_keys_la-gsd-media-keys-manager.lo `test -f 'gsd-media-keys-manager.c' || echo '$(srcdir)/'`gsd-media-keys-manager.c + +libmedia_keys_la-gsd-osd-window.lo: gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -MT libmedia_keys_la-gsd-osd-window.lo -MD -MP -MF $(DEPDIR)/libmedia_keys_la-gsd-osd-window.Tpo -c -o libmedia_keys_la-gsd-osd-window.lo `test -f 'gsd-osd-window.c' || echo '$(srcdir)/'`gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmedia_keys_la-gsd-osd-window.Tpo $(DEPDIR)/libmedia_keys_la-gsd-osd-window.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-osd-window.c' object='libmedia_keys_la-gsd-osd-window.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -c -o libmedia_keys_la-gsd-osd-window.lo `test -f 'gsd-osd-window.c' || echo '$(srcdir)/'`gsd-osd-window.c + +libmedia_keys_la-gsd-marshal.lo: gsd-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -MT libmedia_keys_la-gsd-marshal.lo -MD -MP -MF $(DEPDIR)/libmedia_keys_la-gsd-marshal.Tpo -c -o libmedia_keys_la-gsd-marshal.lo `test -f 'gsd-marshal.c' || echo '$(srcdir)/'`gsd-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmedia_keys_la-gsd-marshal.Tpo $(DEPDIR)/libmedia_keys_la-gsd-marshal.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-marshal.c' object='libmedia_keys_la-gsd-marshal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmedia_keys_la_CPPFLAGS) $(CPPFLAGS) $(libmedia_keys_la_CFLAGS) $(CFLAGS) -c -o libmedia_keys_la-gsd-marshal.lo `test -f 'gsd-marshal.c' || echo '$(srcdir)/'`gsd-marshal.c + +gsd_test_media_keys-gsd-media-keys-manager.o: gsd-media-keys-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-gsd-media-keys-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Tpo -c -o gsd_test_media_keys-gsd-media-keys-manager.o `test -f 'gsd-media-keys-manager.c' || echo '$(srcdir)/'`gsd-media-keys-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Tpo $(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-media-keys-manager.c' object='gsd_test_media_keys-gsd-media-keys-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-gsd-media-keys-manager.o `test -f 'gsd-media-keys-manager.c' || echo '$(srcdir)/'`gsd-media-keys-manager.c + +gsd_test_media_keys-gsd-media-keys-manager.obj: gsd-media-keys-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-gsd-media-keys-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Tpo -c -o gsd_test_media_keys-gsd-media-keys-manager.obj `if test -f 'gsd-media-keys-manager.c'; then $(CYGPATH_W) 'gsd-media-keys-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-media-keys-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Tpo $(DEPDIR)/gsd_test_media_keys-gsd-media-keys-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-media-keys-manager.c' object='gsd_test_media_keys-gsd-media-keys-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-gsd-media-keys-manager.obj `if test -f 'gsd-media-keys-manager.c'; then $(CYGPATH_W) 'gsd-media-keys-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-media-keys-manager.c'; fi` + +gsd_test_media_keys-gsd-osd-window.o: gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-gsd-osd-window.o -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Tpo -c -o gsd_test_media_keys-gsd-osd-window.o `test -f 'gsd-osd-window.c' || echo '$(srcdir)/'`gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Tpo $(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-osd-window.c' object='gsd_test_media_keys-gsd-osd-window.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-gsd-osd-window.o `test -f 'gsd-osd-window.c' || echo '$(srcdir)/'`gsd-osd-window.c + +gsd_test_media_keys-gsd-osd-window.obj: gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-gsd-osd-window.obj -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Tpo -c -o gsd_test_media_keys-gsd-osd-window.obj `if test -f 'gsd-osd-window.c'; then $(CYGPATH_W) 'gsd-osd-window.c'; else $(CYGPATH_W) '$(srcdir)/gsd-osd-window.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Tpo $(DEPDIR)/gsd_test_media_keys-gsd-osd-window.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-osd-window.c' object='gsd_test_media_keys-gsd-osd-window.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-gsd-osd-window.obj `if test -f 'gsd-osd-window.c'; then $(CYGPATH_W) 'gsd-osd-window.c'; else $(CYGPATH_W) '$(srcdir)/gsd-osd-window.c'; fi` + +gsd_test_media_keys-test-media-keys.o: test-media-keys.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-test-media-keys.o -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-test-media-keys.Tpo -c -o gsd_test_media_keys-test-media-keys.o `test -f 'test-media-keys.c' || echo '$(srcdir)/'`test-media-keys.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-test-media-keys.Tpo $(DEPDIR)/gsd_test_media_keys-test-media-keys.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-media-keys.c' object='gsd_test_media_keys-test-media-keys.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-test-media-keys.o `test -f 'test-media-keys.c' || echo '$(srcdir)/'`test-media-keys.c + +gsd_test_media_keys-test-media-keys.obj: test-media-keys.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-test-media-keys.obj -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-test-media-keys.Tpo -c -o gsd_test_media_keys-test-media-keys.obj `if test -f 'test-media-keys.c'; then $(CYGPATH_W) 'test-media-keys.c'; else $(CYGPATH_W) '$(srcdir)/test-media-keys.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-test-media-keys.Tpo $(DEPDIR)/gsd_test_media_keys-test-media-keys.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-media-keys.c' object='gsd_test_media_keys-test-media-keys.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-test-media-keys.obj `if test -f 'test-media-keys.c'; then $(CYGPATH_W) 'test-media-keys.c'; else $(CYGPATH_W) '$(srcdir)/test-media-keys.c'; fi` + +gsd_test_media_keys-gsd-marshal.o: gsd-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-gsd-marshal.o -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-gsd-marshal.Tpo -c -o gsd_test_media_keys-gsd-marshal.o `test -f 'gsd-marshal.c' || echo '$(srcdir)/'`gsd-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-gsd-marshal.Tpo $(DEPDIR)/gsd_test_media_keys-gsd-marshal.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-marshal.c' object='gsd_test_media_keys-gsd-marshal.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-gsd-marshal.o `test -f 'gsd-marshal.c' || echo '$(srcdir)/'`gsd-marshal.c + +gsd_test_media_keys-gsd-marshal.obj: gsd-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -MT gsd_test_media_keys-gsd-marshal.obj -MD -MP -MF $(DEPDIR)/gsd_test_media_keys-gsd-marshal.Tpo -c -o gsd_test_media_keys-gsd-marshal.obj `if test -f 'gsd-marshal.c'; then $(CYGPATH_W) 'gsd-marshal.c'; else $(CYGPATH_W) '$(srcdir)/gsd-marshal.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_media_keys-gsd-marshal.Tpo $(DEPDIR)/gsd_test_media_keys-gsd-marshal.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-marshal.c' object='gsd_test_media_keys-gsd-marshal.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_media_keys_CPPFLAGS) $(CPPFLAGS) $(gsd_test_media_keys_CFLAGS) $(CFLAGS) -c -o gsd_test_media_keys-gsd-marshal.obj `if test -f 'gsd-marshal.c'; then $(CYGPATH_W) 'gsd-marshal.c'; else $(CYGPATH_W) '$(srcdir)/gsd-marshal.c'; fi` + +test_media_window-gsd-osd-window.o: gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -MT test_media_window-gsd-osd-window.o -MD -MP -MF $(DEPDIR)/test_media_window-gsd-osd-window.Tpo -c -o test_media_window-gsd-osd-window.o `test -f 'gsd-osd-window.c' || echo '$(srcdir)/'`gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_media_window-gsd-osd-window.Tpo $(DEPDIR)/test_media_window-gsd-osd-window.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-osd-window.c' object='test_media_window-gsd-osd-window.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -c -o test_media_window-gsd-osd-window.o `test -f 'gsd-osd-window.c' || echo '$(srcdir)/'`gsd-osd-window.c + +test_media_window-gsd-osd-window.obj: gsd-osd-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -MT test_media_window-gsd-osd-window.obj -MD -MP -MF $(DEPDIR)/test_media_window-gsd-osd-window.Tpo -c -o test_media_window-gsd-osd-window.obj `if test -f 'gsd-osd-window.c'; then $(CYGPATH_W) 'gsd-osd-window.c'; else $(CYGPATH_W) '$(srcdir)/gsd-osd-window.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_media_window-gsd-osd-window.Tpo $(DEPDIR)/test_media_window-gsd-osd-window.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-osd-window.c' object='test_media_window-gsd-osd-window.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -c -o test_media_window-gsd-osd-window.obj `if test -f 'gsd-osd-window.c'; then $(CYGPATH_W) 'gsd-osd-window.c'; else $(CYGPATH_W) '$(srcdir)/gsd-osd-window.c'; fi` + +test_media_window-test-media-window.o: test-media-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -MT test_media_window-test-media-window.o -MD -MP -MF $(DEPDIR)/test_media_window-test-media-window.Tpo -c -o test_media_window-test-media-window.o `test -f 'test-media-window.c' || echo '$(srcdir)/'`test-media-window.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_media_window-test-media-window.Tpo $(DEPDIR)/test_media_window-test-media-window.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-media-window.c' object='test_media_window-test-media-window.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -c -o test_media_window-test-media-window.o `test -f 'test-media-window.c' || echo '$(srcdir)/'`test-media-window.c + +test_media_window-test-media-window.obj: test-media-window.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -MT test_media_window-test-media-window.obj -MD -MP -MF $(DEPDIR)/test_media_window-test-media-window.Tpo -c -o test_media_window-test-media-window.obj `if test -f 'test-media-window.c'; then $(CYGPATH_W) 'test-media-window.c'; else $(CYGPATH_W) '$(srcdir)/test-media-window.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_media_window-test-media-window.Tpo $(DEPDIR)/test_media_window-test-media-window.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-media-window.c' object='test_media_window-test-media-window.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_media_window_CPPFLAGS) $(CPPFLAGS) $(test_media_window_CFLAGS) $(CFLAGS) -c -o test_media_window-test-media-window.obj `if test -f 'test-media-window.c'; then $(CYGPATH_W) 'test-media-window.c'; else $(CYGPATH_W) '$(srcdir)/test-media-window.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-noinstPROGRAMS clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + cscopelist-recursive ctags-recursive install install-am \ + install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-noinstPROGRAMS \ + clean-pluginLTLIBRARIES cscopelist cscopelist-recursive ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-libexecPROGRAMS \ + uninstall-pluginDATA uninstall-pluginLTLIBRARIES + + +gsd-marshal.c: gsd-marshal.list + $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=gsd_marshal $< --header --body --internal > $@ + +gsd-marshal.h: gsd-marshal.list + $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=gsd_marshal $< --header --internal > $@ + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/media-keys/README.media-keys-API b/plugins/media-keys/README.media-keys-API new file mode 100644 index 00000000..55d1a59a --- /dev/null +++ b/plugins/media-keys/README.media-keys-API @@ -0,0 +1,51 @@ +This is very simple documentation to gnome-settings-daemon's +D-Bus API for media players. + +gnome-settings-daemon will send key press events from multimedia +keys to applications that register their interest in those events. +This allows the play/pause button to control an audio player that's +not focused for example. + +The D-Bus API is described in gsd-media-keys-manager.c (look for +introspection_xml), but a small explanation follows here. + +1. Create yourself a proxy object for the remote interface: +Object path: /org/gnome/SettingsDaemon/MediaKeys +D-Bus name: org.gnome.SettingsDaemon.MediaKeys +Interface name: org.gnome.SettingsDaemon.MediaKeys + +2. Register your application with gnome-settings-daemon +GrabMediaPlayerKeys ("my-application", 0) +with the second argument being the current time (usually 0, +or the time passed to you from an event, such as a mouse click) + +3. Listen to the MediaPlayerKeyPressed() signal + +4. When receiving a MediaPlayerKeyPressed() signal, +check whether the first argument (application) matches +the value you passed to GrabMediaPlayerKeys() and apply the +action depending on the key (2nd argument) + +Possible values of key are: +- Play +- Pause +- Stop +- Previous +- Next +- Rewind +- FastForward +- Repeat +- Shuffle + +5. Every time your application is focused, you should call +GrabMediaPlayerKeys() again, so that gnome-settings-daemon knows +which one was last used. This allows switching between a movie player +and a music player, for example, and have the buttons control the +last used application. + +6. When your application wants to stop using the functionality +it can call ReleaseMediaPlayerKeys(). If your application does +not call ReleaseMediaPlayerKeys() and releases its D-Bus connection +then the application will be automatically removed from the list of +applications held by gnome-settings-daemon. + diff --git a/plugins/media-keys/cut-n-paste/Makefile.am b/plugins/media-keys/cut-n-paste/Makefile.am new file mode 100644 index 00000000..45a3c996 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/Makefile.am @@ -0,0 +1,42 @@ +NULL = + +noinst_LTLIBRARIES = libgvc.la + +INCLUDES = \ + $(WARN_CFLAGS) \ + $(MEDIA_KEYS_CFLAGS) \ + $(NULL) + +libgvc_la_LIBADD = \ + $(MEDIA_KEYS_LIBS) \ + $(NULL) + +libgvc_la_SOURCES = \ + gvc-mixer-stream.h \ + gvc-mixer-stream.c \ + gvc-mixer-stream-private.h \ + gvc-channel-map.h \ + gvc-channel-map.c \ + gvc-channel-map-private.h \ + gvc-mixer-card.c \ + gvc-mixer-card.h \ + gvc-mixer-card-private.h \ + gvc-mixer-sink.h \ + gvc-mixer-sink.c \ + gvc-mixer-source.h \ + gvc-mixer-source.c \ + gvc-mixer-sink-input.h \ + gvc-mixer-sink-input.c \ + gvc-mixer-source-output.h \ + gvc-mixer-source-output.c \ + gvc-mixer-event-role.h \ + gvc-mixer-event-role.c \ + gvc-mixer-control.h \ + gvc-mixer-control.c \ + gvc-mixer-control-private.h \ + gvc-pulseaudio-fake.h \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in diff --git a/plugins/media-keys/cut-n-paste/Makefile.in b/plugins/media-keys/cut-n-paste/Makefile.in new file mode 100644 index 00000000..856a9fd3 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/Makefile.in @@ -0,0 +1,693 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/media-keys/cut-n-paste +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgvc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_libgvc_la_OBJECTS = gvc-mixer-stream.lo gvc-channel-map.lo \ + gvc-mixer-card.lo gvc-mixer-sink.lo gvc-mixer-source.lo \ + gvc-mixer-sink-input.lo gvc-mixer-source-output.lo \ + gvc-mixer-event-role.lo gvc-mixer-control.lo $(am__objects_1) +libgvc_la_OBJECTS = $(am_libgvc_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgvc_la_SOURCES) +DIST_SOURCES = $(libgvc_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +noinst_LTLIBRARIES = libgvc.la +INCLUDES = \ + $(WARN_CFLAGS) \ + $(MEDIA_KEYS_CFLAGS) \ + $(NULL) + +libgvc_la_LIBADD = \ + $(MEDIA_KEYS_LIBS) \ + $(NULL) + +libgvc_la_SOURCES = \ + gvc-mixer-stream.h \ + gvc-mixer-stream.c \ + gvc-mixer-stream-private.h \ + gvc-channel-map.h \ + gvc-channel-map.c \ + gvc-channel-map-private.h \ + gvc-mixer-card.c \ + gvc-mixer-card.h \ + gvc-mixer-card-private.h \ + gvc-mixer-sink.h \ + gvc-mixer-sink.c \ + gvc-mixer-source.h \ + gvc-mixer-source.c \ + gvc-mixer-sink-input.h \ + gvc-mixer-sink-input.c \ + gvc-mixer-source-output.h \ + gvc-mixer-source-output.c \ + gvc-mixer-event-role.h \ + gvc-mixer-event-role.c \ + gvc-mixer-control.h \ + gvc-mixer-control.c \ + gvc-mixer-control-private.h \ + gvc-pulseaudio-fake.h \ + $(NULL) + +MAINTAINERCLEANFILES = \ + *~ \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/media-keys/cut-n-paste/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/media-keys/cut-n-paste/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libgvc.la: $(libgvc_la_OBJECTS) $(libgvc_la_DEPENDENCIES) $(EXTRA_libgvc_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libgvc_la_OBJECTS) $(libgvc_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-channel-map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-card.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-control.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-event-role.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-sink-input.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-sink.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-source-output.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-source.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvc-mixer-stream.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map-private.h b/plugins/media-keys/cut-n-paste/gvc-channel-map-private.h new file mode 100644 index 00000000..3949de3a --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-channel-map-private.h @@ -0,0 +1,39 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_CHANNEL_MAP_PRIVATE_H +#define __GVC_CHANNEL_MAP_PRIVATE_H + +#include +#include + +G_BEGIN_DECLS + +GvcChannelMap * gvc_channel_map_new_from_pa_channel_map (const pa_channel_map *map); +const pa_channel_map * gvc_channel_map_get_pa_channel_map (const GvcChannelMap *map); + +void gvc_channel_map_volume_changed (GvcChannelMap *map, + const pa_cvolume *cv, + gboolean set); +const pa_cvolume * gvc_channel_map_get_cvolume (const GvcChannelMap *map); + +G_END_DECLS + +#endif /* __GVC_CHANNEL_MAP_PRIVATE_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.c b/plugins/media-keys/cut-n-paste/gvc-channel-map.c new file mode 100644 index 00000000..a2073fd3 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.c @@ -0,0 +1,254 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-channel-map.h" +#include "gvc-channel-map-private.h" + +#define GVC_CHANNEL_MAP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMapPrivate)) + +struct GvcChannelMapPrivate +{ + pa_channel_map pa_map; + gboolean pa_volume_is_set; + pa_cvolume pa_volume; + gdouble extern_volume[NUM_TYPES]; /* volume, balance, fade, lfe */ + gboolean can_balance; + gboolean can_fade; +}; + +enum { + VOLUME_CHANGED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + +static void gvc_channel_map_class_init (GvcChannelMapClass *klass); +static void gvc_channel_map_init (GvcChannelMap *channel_map); +static void gvc_channel_map_finalize (GObject *object); + +G_DEFINE_TYPE (GvcChannelMap, gvc_channel_map, G_TYPE_OBJECT) + +guint +gvc_channel_map_get_num_channels (const GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), 0); + + if (!pa_channel_map_valid(&map->priv->pa_map)) + return 0; + + return map->priv->pa_map.channels; +} + +const gdouble * +gvc_channel_map_get_volume (GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); + + if (!pa_channel_map_valid(&map->priv->pa_map)) + return NULL; + + map->priv->extern_volume[VOLUME] = (gdouble) pa_cvolume_max (&map->priv->pa_volume); + if (gvc_channel_map_can_balance (map)) + map->priv->extern_volume[BALANCE] = (gdouble) pa_cvolume_get_balance (&map->priv->pa_volume, &map->priv->pa_map); + else + map->priv->extern_volume[BALANCE] = 0; + if (gvc_channel_map_can_fade (map)) + map->priv->extern_volume[FADE] = (gdouble) pa_cvolume_get_fade (&map->priv->pa_volume, &map->priv->pa_map); + else + map->priv->extern_volume[FADE] = 0; + if (gvc_channel_map_has_lfe (map)) + map->priv->extern_volume[LFE] = (gdouble) pa_cvolume_get_position (&map->priv->pa_volume, &map->priv->pa_map, PA_CHANNEL_POSITION_LFE); + else + map->priv->extern_volume[LFE] = 0; + + return map->priv->extern_volume; +} + +gboolean +gvc_channel_map_can_balance (const GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE); + + return map->priv->can_balance; +} + +gboolean +gvc_channel_map_can_fade (const GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE); + + return map->priv->can_fade; +} + +const char * +gvc_channel_map_get_mapping (const GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); + + if (!pa_channel_map_valid(&map->priv->pa_map)) + return NULL; + + return pa_channel_map_to_pretty_name (&map->priv->pa_map); +} + +/** + * gvc_channel_map_has_position: (skip) + * + * @map: + * @position: + * + * Returns: + */ +gboolean +gvc_channel_map_has_position (const GvcChannelMap *map, + pa_channel_position_t position) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), FALSE); + + return pa_channel_map_has_position (&(map->priv->pa_map), position); +} + +const pa_channel_map * +gvc_channel_map_get_pa_channel_map (const GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); + + if (!pa_channel_map_valid(&map->priv->pa_map)) + return NULL; + + return &map->priv->pa_map; +} + +const pa_cvolume * +gvc_channel_map_get_cvolume (const GvcChannelMap *map) +{ + g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); + + if (!pa_channel_map_valid(&map->priv->pa_map)) + return NULL; + + return &map->priv->pa_volume; +} + +static void +gvc_channel_map_class_init (GvcChannelMapClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = gvc_channel_map_finalize; + + signals [VOLUME_CHANGED] = + g_signal_new ("volume-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcChannelMapClass, volume_changed), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + + g_type_class_add_private (klass, sizeof (GvcChannelMapPrivate)); +} + +void +gvc_channel_map_volume_changed (GvcChannelMap *map, + const pa_cvolume *cv, + gboolean set) +{ + g_return_if_fail (GVC_IS_CHANNEL_MAP (map)); + g_return_if_fail (cv != NULL); + g_return_if_fail (pa_cvolume_compatible_with_channel_map(cv, &map->priv->pa_map)); + + if (pa_cvolume_equal(cv, &map->priv->pa_volume)) + return; + + map->priv->pa_volume = *cv; + + if (map->priv->pa_volume_is_set == FALSE) { + map->priv->pa_volume_is_set = TRUE; + return; + } + g_signal_emit (map, signals[VOLUME_CHANGED], 0, set); +} + +static void +gvc_channel_map_init (GvcChannelMap *map) +{ + map->priv = GVC_CHANNEL_MAP_GET_PRIVATE (map); + map->priv->pa_volume_is_set = FALSE; +} + +static void +gvc_channel_map_finalize (GObject *object) +{ + GvcChannelMap *channel_map; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_CHANNEL_MAP (object)); + + channel_map = GVC_CHANNEL_MAP (object); + + g_return_if_fail (channel_map->priv != NULL); + + G_OBJECT_CLASS (gvc_channel_map_parent_class)->finalize (object); +} + +GvcChannelMap * +gvc_channel_map_new (void) +{ + GObject *map; + map = g_object_new (GVC_TYPE_CHANNEL_MAP, NULL); + return GVC_CHANNEL_MAP (map); +} + +static void +set_from_pa_map (GvcChannelMap *map, + const pa_channel_map *pa_map) +{ + g_assert (pa_channel_map_valid(pa_map)); + + map->priv->can_balance = pa_channel_map_can_balance (pa_map); + map->priv->can_fade = pa_channel_map_can_fade (pa_map); + + map->priv->pa_map = *pa_map; + pa_cvolume_set(&map->priv->pa_volume, pa_map->channels, PA_VOLUME_NORM); +} + +GvcChannelMap * +gvc_channel_map_new_from_pa_channel_map (const pa_channel_map *pa_map) +{ + GObject *map; + map = g_object_new (GVC_TYPE_CHANNEL_MAP, NULL); + + set_from_pa_map (GVC_CHANNEL_MAP (map), pa_map); + + return GVC_CHANNEL_MAP (map); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-channel-map.h b/plugins/media-keys/cut-n-paste/gvc-channel-map.h new file mode 100644 index 00000000..85c57728 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-channel-map.h @@ -0,0 +1,73 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_CHANNEL_MAP_H +#define __GVC_CHANNEL_MAP_H + +#include +#include + +G_BEGIN_DECLS + +#define GVC_TYPE_CHANNEL_MAP (gvc_channel_map_get_type ()) +#define GVC_CHANNEL_MAP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMap)) +#define GVC_CHANNEL_MAP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_CHANNEL_MAP, GvcChannelMapClass)) +#define GVC_IS_CHANNEL_MAP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_CHANNEL_MAP)) +#define GVC_IS_CHANNEL_MAP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_CHANNEL_MAP)) +#define GVC_CHANNEL_MAP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_CHANNEL_MAP, GvcChannelMapClass)) + +typedef struct GvcChannelMapPrivate GvcChannelMapPrivate; + +typedef struct +{ + GObject parent; + GvcChannelMapPrivate *priv; +} GvcChannelMap; + +typedef struct +{ + GObjectClass parent_class; + void (*volume_changed) (GvcChannelMap *channel_map, gboolean set); +} GvcChannelMapClass; + +enum { + VOLUME, + BALANCE, + FADE, + LFE, + NUM_TYPES +}; + +GType gvc_channel_map_get_type (void); + +GvcChannelMap * gvc_channel_map_new (void); +guint gvc_channel_map_get_num_channels (const GvcChannelMap *map); +const gdouble * gvc_channel_map_get_volume (GvcChannelMap *map); +gboolean gvc_channel_map_can_balance (const GvcChannelMap *map); +gboolean gvc_channel_map_can_fade (const GvcChannelMap *map); +gboolean gvc_channel_map_has_position (const GvcChannelMap *map, + pa_channel_position_t position); +#define gvc_channel_map_has_lfe(x) gvc_channel_map_has_position (x, PA_CHANNEL_POSITION_LFE) + +const char * gvc_channel_map_get_mapping (const GvcChannelMap *map); + +G_END_DECLS + +#endif /* __GVC_CHANNEL_MAP_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card-private.h b/plugins/media-keys/cut-n-paste/gvc-mixer-card-private.h new file mode 100644 index 00000000..e190f7f4 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card-private.h @@ -0,0 +1,35 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008-2009 Red Hat, Inc. + * + * 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 __GVC_MIXER_CARD_PRIVATE_H +#define __GVC_MIXER_CARD_PRIVATE_H + +#include +#include "gvc-mixer-card.h" + +G_BEGIN_DECLS + +GvcMixerCard * gvc_mixer_card_new (pa_context *context, + guint index); +pa_context * gvc_mixer_card_get_pa_context (GvcMixerCard *card); + +G_END_DECLS + +#endif /* __GVC_MIXER_CARD_PRIVATE_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card.c b/plugins/media-keys/cut-n-paste/gvc-mixer-card.c new file mode 100644 index 00000000..168bc798 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card.c @@ -0,0 +1,515 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * Copyright (C) 2009 Bastien Nocera + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-mixer-card.h" +#include "gvc-mixer-card-private.h" + +#define GVC_MIXER_CARD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_CARD, GvcMixerCardPrivate)) + +static guint32 card_serial = 1; + +struct GvcMixerCardPrivate +{ + pa_context *pa_context; + guint id; + guint index; + char *name; + char *icon_name; + char *profile; + char *target_profile; + char *human_profile; + GList *profiles; + pa_operation *profile_op; +}; + +enum +{ + PROP_0, + PROP_ID, + PROP_PA_CONTEXT, + PROP_INDEX, + PROP_NAME, + PROP_ICON_NAME, + PROP_PROFILE, + PROP_HUMAN_PROFILE, +}; + +static void gvc_mixer_card_class_init (GvcMixerCardClass *klass); +static void gvc_mixer_card_init (GvcMixerCard *mixer_card); +static void gvc_mixer_card_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerCard, gvc_mixer_card, G_TYPE_OBJECT) + +static guint32 +get_next_card_serial (void) +{ + guint32 serial; + + serial = card_serial++; + + if ((gint32)card_serial < 0) { + card_serial = 1; + } + + return serial; +} + +pa_context * +gvc_mixer_card_get_pa_context (GvcMixerCard *card) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), 0); + return card->priv->pa_context; +} + +guint +gvc_mixer_card_get_index (GvcMixerCard *card) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), 0); + return card->priv->index; +} + +guint +gvc_mixer_card_get_id (GvcMixerCard *card) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), 0); + return card->priv->id; +} + +const char * +gvc_mixer_card_get_name (GvcMixerCard *card) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), NULL); + return card->priv->name; +} + +gboolean +gvc_mixer_card_set_name (GvcMixerCard *card, + const char *name) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); + + g_free (card->priv->name); + card->priv->name = g_strdup (name); + g_object_notify (G_OBJECT (card), "name"); + + return TRUE; +} + +const char * +gvc_mixer_card_get_icon_name (GvcMixerCard *card) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), NULL); + return card->priv->icon_name; +} + +gboolean +gvc_mixer_card_set_icon_name (GvcMixerCard *card, + const char *icon_name) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); + + g_free (card->priv->icon_name); + card->priv->icon_name = g_strdup (icon_name); + g_object_notify (G_OBJECT (card), "icon-name"); + + return TRUE; +} + +/** + * gvc_mixer_card_get_profile: (skip) + * + * @card: + * + * Returns: + */ +GvcMixerCardProfile * +gvc_mixer_card_get_profile (GvcMixerCard *card) +{ + GList *l; + + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), NULL); + g_return_val_if_fail (card->priv->profiles != NULL, NULL); + + for (l = card->priv->profiles; l != NULL; l = l->next) { + GvcMixerCardProfile *p = l->data; + if (g_str_equal (card->priv->profile, p->profile)) { + return p; + } + } + + g_assert_not_reached (); + + return NULL; +} + +gboolean +gvc_mixer_card_set_profile (GvcMixerCard *card, + const char *profile) +{ + GList *l; + + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); + g_return_val_if_fail (card->priv->profiles != NULL, FALSE); + + g_free (card->priv->profile); + card->priv->profile = g_strdup (profile); + + g_free (card->priv->human_profile); + card->priv->human_profile = NULL; + + for (l = card->priv->profiles; l != NULL; l = l->next) { + GvcMixerCardProfile *p = l->data; + if (g_str_equal (card->priv->profile, p->profile)) { + card->priv->human_profile = g_strdup (p->human_profile); + break; + } + } + + g_object_notify (G_OBJECT (card), "profile"); + + return TRUE; +} + +static void +_pa_context_set_card_profile_by_index_cb (pa_context *context, + int success, + void *userdata) +{ + GvcMixerCard *card = GVC_MIXER_CARD (userdata); + + g_assert (card->priv->target_profile); + + if (success > 0) { + gvc_mixer_card_set_profile (card, card->priv->target_profile); + } else { + g_debug ("Failed to switch profile on '%s' from '%s' to '%s'", + card->priv->name, + card->priv->profile, + card->priv->target_profile); + } + g_free (card->priv->target_profile); + card->priv->target_profile = NULL; + + pa_operation_unref (card->priv->profile_op); + card->priv->profile_op = NULL; +} + +gboolean +gvc_mixer_card_change_profile (GvcMixerCard *card, + const char *profile) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); + g_return_val_if_fail (card->priv->profiles != NULL, FALSE); + + /* Same profile, or already requested? */ + if (g_strcmp0 (card->priv->profile, profile) == 0) + return TRUE; + if (g_strcmp0 (profile, card->priv->target_profile) == 0) + return TRUE; + if (card->priv->profile_op != NULL) { + pa_operation_cancel (card->priv->profile_op); + pa_operation_unref (card->priv->profile_op); + card->priv->profile_op = NULL; + } + + if (card->priv->profile != NULL) { + g_free (card->priv->target_profile); + card->priv->target_profile = g_strdup (profile); + + card->priv->profile_op = pa_context_set_card_profile_by_index (card->priv->pa_context, + card->priv->index, + card->priv->target_profile, + _pa_context_set_card_profile_by_index_cb, + card); + + if (card->priv->profile_op == NULL) { + g_warning ("pa_context_set_card_profile_by_index() failed"); + return FALSE; + } + } else { + g_assert (card->priv->human_profile == NULL); + card->priv->profile = g_strdup (profile); + } + + return TRUE; +} + +/** + * gvc_mixer_card_get_profiles: + * + * Return value: (transfer none) (element-type GvcMixerCardProfile): + */ +const GList * +gvc_mixer_card_get_profiles (GvcMixerCard *card) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), NULL); + return card->priv->profiles; +} + +static int +sort_profiles (GvcMixerCardProfile *a, + GvcMixerCardProfile *b) +{ + if (a->priority == b->priority) + return 0; + if (a->priority > b->priority) + return 1; + return -1; +} + +/** + * gvc_mixer_card_set_profiles: + * @profiles: (transfer full) (element-type GvcMixerCardProfile): + */ +gboolean +gvc_mixer_card_set_profiles (GvcMixerCard *card, + GList *profiles) +{ + g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); + g_return_val_if_fail (card->priv->profiles == NULL, FALSE); + + card->priv->profiles = g_list_sort (profiles, (GCompareFunc) sort_profiles); + + return TRUE; +} + +static void +gvc_mixer_card_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GvcMixerCard *self = GVC_MIXER_CARD (object); + + switch (prop_id) { + case PROP_PA_CONTEXT: + self->priv->pa_context = g_value_get_pointer (value); + break; + case PROP_INDEX: + self->priv->index = g_value_get_ulong (value); + break; + case PROP_ID: + self->priv->id = g_value_get_ulong (value); + break; + case PROP_NAME: + gvc_mixer_card_set_name (self, g_value_get_string (value)); + break; + case PROP_ICON_NAME: + gvc_mixer_card_set_icon_name (self, g_value_get_string (value)); + break; + case PROP_PROFILE: + gvc_mixer_card_set_profile (self, g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gvc_mixer_card_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GvcMixerCard *self = GVC_MIXER_CARD (object); + + switch (prop_id) { + case PROP_PA_CONTEXT: + g_value_set_pointer (value, self->priv->pa_context); + break; + case PROP_INDEX: + g_value_set_ulong (value, self->priv->index); + break; + case PROP_ID: + g_value_set_ulong (value, self->priv->id); + break; + case PROP_NAME: + g_value_set_string (value, self->priv->name); + break; + case PROP_ICON_NAME: + g_value_set_string (value, self->priv->icon_name); + break; + case PROP_PROFILE: + g_value_set_string (value, self->priv->profile); + break; + case PROP_HUMAN_PROFILE: + g_value_set_string (value, self->priv->human_profile); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gvc_mixer_card_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params) +{ + GObject *object; + GvcMixerCard *self; + + object = G_OBJECT_CLASS (gvc_mixer_card_parent_class)->constructor (type, n_construct_properties, construct_params); + + self = GVC_MIXER_CARD (object); + + self->priv->id = get_next_card_serial (); + + return object; +} + +static void +gvc_mixer_card_class_init (GvcMixerCardClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->constructor = gvc_mixer_card_constructor; + gobject_class->finalize = gvc_mixer_card_finalize; + + gobject_class->set_property = gvc_mixer_card_set_property; + gobject_class->get_property = gvc_mixer_card_get_property; + + g_object_class_install_property (gobject_class, + PROP_INDEX, + g_param_spec_ulong ("index", + "Index", + "The index for this card", + 0, G_MAXULONG, 0, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (gobject_class, + PROP_ID, + g_param_spec_ulong ("id", + "id", + "The id for this card", + 0, G_MAXULONG, 0, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (gobject_class, + PROP_PA_CONTEXT, + g_param_spec_pointer ("pa-context", + "PulseAudio context", + "The PulseAudio context for this card", + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (gobject_class, + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name to display for this card", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_ICON_NAME, + g_param_spec_string ("icon-name", + "Icon Name", + "Name of icon to display for this card", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_PROFILE, + g_param_spec_string ("profile", + "Profile", + "Name of current profile for this card", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_HUMAN_PROFILE, + g_param_spec_string ("human-profile", + "Profile (Human readable)", + "Name of current profile for this card in human readable form", + NULL, + G_PARAM_READABLE)); + + g_type_class_add_private (klass, sizeof (GvcMixerCardPrivate)); +} + +static void +gvc_mixer_card_init (GvcMixerCard *card) +{ + card->priv = GVC_MIXER_CARD_GET_PRIVATE (card); +} + +GvcMixerCard * +gvc_mixer_card_new (pa_context *context, + guint index) +{ + GObject *object; + + object = g_object_new (GVC_TYPE_MIXER_CARD, + "index", index, + "pa-context", context, + NULL); + return GVC_MIXER_CARD (object); +} + +static void +free_profile (GvcMixerCardProfile *p) +{ + g_free (p->profile); + g_free (p->human_profile); + g_free (p->status); + g_free (p); +} + +static void +gvc_mixer_card_finalize (GObject *object) +{ + GvcMixerCard *mixer_card; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_CARD (object)); + + mixer_card = GVC_MIXER_CARD (object); + + g_return_if_fail (mixer_card->priv != NULL); + + g_free (mixer_card->priv->name); + mixer_card->priv->name = NULL; + + g_free (mixer_card->priv->icon_name); + mixer_card->priv->icon_name = NULL; + + g_free (mixer_card->priv->target_profile); + mixer_card->priv->target_profile = NULL; + + g_free (mixer_card->priv->profile); + mixer_card->priv->profile = NULL; + + g_free (mixer_card->priv->human_profile); + mixer_card->priv->human_profile = NULL; + + g_list_foreach (mixer_card->priv->profiles, (GFunc) free_profile, NULL); + g_list_free (mixer_card->priv->profiles); + mixer_card->priv->profiles = NULL; + + G_OBJECT_CLASS (gvc_mixer_card_parent_class)->finalize (object); +} + diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-card.h b/plugins/media-keys/cut-n-paste/gvc-mixer-card.h new file mode 100644 index 00000000..5a3a7bc4 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-card.h @@ -0,0 +1,83 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008-2009 Red Hat, Inc. + * + * 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 __GVC_MIXER_CARD_H +#define __GVC_MIXER_CARD_H + +#include + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_CARD (gvc_mixer_card_get_type ()) +#define GVC_MIXER_CARD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_CARD, GvcMixerCard)) +#define GVC_MIXER_CARD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_CARD, GvcMixerCardClass)) +#define GVC_IS_MIXER_CARD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_CARD)) +#define GVC_IS_MIXER_CARD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_CARD)) +#define GVC_MIXER_CARD_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_CARD, GvcMixerCardClass)) + +typedef struct GvcMixerCardPrivate GvcMixerCardPrivate; + +typedef struct +{ + GObject parent; + GvcMixerCardPrivate *priv; +} GvcMixerCard; + +typedef struct +{ + GObjectClass parent_class; + + /* vtable */ +} GvcMixerCardClass; + +typedef struct +{ + char *profile; + char *human_profile; + char *status; + guint priority; + guint n_sinks, n_sources; +} GvcMixerCardProfile; + +GType gvc_mixer_card_get_type (void); + +guint gvc_mixer_card_get_id (GvcMixerCard *card); +guint gvc_mixer_card_get_index (GvcMixerCard *card); +const char * gvc_mixer_card_get_name (GvcMixerCard *card); +const char * gvc_mixer_card_get_icon_name (GvcMixerCard *card); +GvcMixerCardProfile * gvc_mixer_card_get_profile (GvcMixerCard *card); +const GList * gvc_mixer_card_get_profiles (GvcMixerCard *card); + +gboolean gvc_mixer_card_change_profile (GvcMixerCard *card, + const char *profile); + +/* private */ +gboolean gvc_mixer_card_set_name (GvcMixerCard *card, + const char *name); +gboolean gvc_mixer_card_set_icon_name (GvcMixerCard *card, + const char *name); +gboolean gvc_mixer_card_set_profile (GvcMixerCard *card, + const char *profile); +gboolean gvc_mixer_card_set_profiles (GvcMixerCard *card, + GList *profiles); + +G_END_DECLS + +#endif /* __GVC_MIXER_CARD_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-control-private.h b/plugins/media-keys/cut-n-paste/gvc-mixer-control-private.h new file mode 100644 index 00000000..ac79975a --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-control-private.h @@ -0,0 +1,35 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_CONTROL_PRIVATE_H +#define __GVC_MIXER_CONTROL_PRIVATE_H + +#include +#include +#include "gvc-mixer-stream.h" +#include "gvc-mixer-card.h" + +G_BEGIN_DECLS + +pa_context * gvc_mixer_control_get_pa_context (GvcMixerControl *control); + +G_END_DECLS + +#endif /* __GVC_MIXER_CONTROL_PRIVATE_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-control.c b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c new file mode 100644 index 00000000..3568386f --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-control.c @@ -0,0 +1,2253 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2006-2008 Lennart Poettering + * Copyright (C) 2008 Sjoerd Simons + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include +#include +#include + +#include "gvc-mixer-control.h" +#include "gvc-mixer-sink.h" +#include "gvc-mixer-source.h" +#include "gvc-mixer-sink-input.h" +#include "gvc-mixer-source-output.h" +#include "gvc-mixer-event-role.h" +#include "gvc-mixer-card.h" +#include "gvc-mixer-card-private.h" +#include "gvc-channel-map-private.h" +#include "gvc-mixer-control-private.h" + +#define GVC_MIXER_CONTROL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_CONTROL, GvcMixerControlPrivate)) + +#define RECONNECT_DELAY 5 + +enum { + PROP_0, + PROP_NAME +}; + +struct GvcMixerControlPrivate +{ + pa_glib_mainloop *pa_mainloop; + pa_mainloop_api *pa_api; + pa_context *pa_context; + int n_outstanding; + guint reconnect_id; + char *name; + + gboolean default_sink_is_set; + guint default_sink_id; + char *default_sink_name; + gboolean default_source_is_set; + guint default_source_id; + char *default_source_name; + + gboolean event_sink_input_is_set; + guint event_sink_input_id; + + GHashTable *all_streams; + GHashTable *sinks; /* fixed outputs */ + GHashTable *sources; /* fixed inputs */ + GHashTable *sink_inputs; /* routable output streams */ + GHashTable *source_outputs; /* routable input streams */ + GHashTable *clients; + GHashTable *cards; + + GvcMixerStream *new_default_stream; /* new default stream, used in gvc_mixer_control_set_default_sink () */ + + GvcMixerControlState state; +}; + +enum { + STATE_CHANGED, + STREAM_ADDED, + STREAM_REMOVED, + CARD_ADDED, + CARD_REMOVED, + DEFAULT_SINK_CHANGED, + DEFAULT_SOURCE_CHANGED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + +static void gvc_mixer_control_class_init (GvcMixerControlClass *klass); +static void gvc_mixer_control_init (GvcMixerControl *mixer_control); +static void gvc_mixer_control_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerControl, gvc_mixer_control, G_TYPE_OBJECT) + +pa_context * +gvc_mixer_control_get_pa_context (GvcMixerControl *control) +{ + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + return control->priv->pa_context; +} + +/** + * gvc_mixer_control_get_event_sink_input: + * + * @control: + * + * Returns: (transfer none): + */ +GvcMixerStream * +gvc_mixer_control_get_event_sink_input (GvcMixerControl *control) +{ + GvcMixerStream *stream; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + stream = g_hash_table_lookup (control->priv->all_streams, + GUINT_TO_POINTER (control->priv->event_sink_input_id)); + + return stream; +} + +static void +gvc_mixer_control_stream_restore_cb (pa_context *c, + const pa_ext_stream_restore_info *info, + int eol, + void *userdata) +{ + pa_operation *o; + GvcMixerControl *control = (GvcMixerControl *) userdata; + pa_ext_stream_restore_info new_info; + + if (eol || control->priv->new_default_stream == NULL) + return; + + new_info.name = info->name; + new_info.channel_map = info->channel_map; + new_info.volume = info->volume; + new_info.mute = info->mute; + + new_info.device = gvc_mixer_stream_get_name (control->priv->new_default_stream); + + o = pa_ext_stream_restore_write (control->priv->pa_context, + PA_UPDATE_REPLACE, + &new_info, 1, + TRUE, NULL, NULL); + + if (o == NULL) { + g_warning ("pa_ext_stream_restore_write() failed: %s", + pa_strerror (pa_context_errno (control->priv->pa_context))); + return; + } + + g_debug ("Changed default device for %s to %s", info->name, info->device); + + pa_operation_unref (o); +} + +gboolean +gvc_mixer_control_set_default_sink (GvcMixerControl *control, + GvcMixerStream *stream) +{ + pa_operation *o; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), FALSE); + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + o = pa_context_set_default_sink (control->priv->pa_context, + gvc_mixer_stream_get_name (stream), + NULL, + NULL); + if (o == NULL) { + g_warning ("pa_context_set_default_sink() failed: %s", + pa_strerror (pa_context_errno (control->priv->pa_context))); + return FALSE; + } + + pa_operation_unref (o); + + control->priv->new_default_stream = stream; + g_object_add_weak_pointer (G_OBJECT (stream), (gpointer *) &control->priv->new_default_stream); + + o = pa_ext_stream_restore_read (control->priv->pa_context, + gvc_mixer_control_stream_restore_cb, + control); + + if (o == NULL) { + g_warning ("pa_ext_stream_restore_read() failed: %s", + pa_strerror (pa_context_errno (control->priv->pa_context))); + return FALSE; + } + + pa_operation_unref (o); + + return TRUE; +} + +gboolean +gvc_mixer_control_set_default_source (GvcMixerControl *control, + GvcMixerStream *stream) +{ + pa_operation *o; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), FALSE); + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + o = pa_context_set_default_source (control->priv->pa_context, + gvc_mixer_stream_get_name (stream), + NULL, + NULL); + if (o == NULL) { + g_warning ("pa_context_set_default_source() failed"); + return FALSE; + } + + pa_operation_unref (o); + + return TRUE; +} + +/** + * gvc_mixer_control_get_default_sink: + * + * @control: + * + * Returns: (transfer none): + */ +GvcMixerStream * +gvc_mixer_control_get_default_sink (GvcMixerControl *control) +{ + GvcMixerStream *stream; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + if (control->priv->default_sink_is_set) { + stream = g_hash_table_lookup (control->priv->all_streams, + GUINT_TO_POINTER (control->priv->default_sink_id)); + } else { + stream = NULL; + } + + return stream; +} + +/** + * gvc_mixer_control_get_default_source: + * + * @control: + * + * Returns: (transfer none): + */ +GvcMixerStream * +gvc_mixer_control_get_default_source (GvcMixerControl *control) +{ + GvcMixerStream *stream; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + if (control->priv->default_source_is_set) { + stream = g_hash_table_lookup (control->priv->all_streams, + GUINT_TO_POINTER (control->priv->default_source_id)); + } else { + stream = NULL; + } + + return stream; +} + +static gpointer +gvc_mixer_control_lookup_id (GHashTable *hash_table, + guint id) +{ + return g_hash_table_lookup (hash_table, + GUINT_TO_POINTER (id)); +} + +/** + * gvc_mixer_control_lookup_stream_id: + * + * @control: + * @id: + * + * Returns: (transfer none): + */ +GvcMixerStream * +gvc_mixer_control_lookup_stream_id (GvcMixerControl *control, + guint id) +{ + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + return gvc_mixer_control_lookup_id (control->priv->all_streams, id); +} + +/** + * gvc_mixer_control_lookup_card_id: + * + * @control: + * @id: + * + * Returns: (transfer none): + */ +GvcMixerCard * +gvc_mixer_control_lookup_card_id (GvcMixerControl *control, + guint id) +{ + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + return gvc_mixer_control_lookup_id (control->priv->cards, id); +} + +static void +listify_hash_values_hfunc (gpointer key, + gpointer value, + gpointer user_data) +{ + GSList **list = user_data; + + *list = g_slist_prepend (*list, value); +} + +static int +gvc_name_collate (const char *namea, + const char *nameb) +{ + if (nameb == NULL && namea == NULL) + return 0; + if (nameb == NULL) + return 1; + if (namea == NULL) + return -1; + + return g_utf8_collate (namea, nameb); +} + +static int +gvc_card_collate (GvcMixerCard *a, + GvcMixerCard *b) +{ + const char *namea; + const char *nameb; + + g_return_val_if_fail (a == NULL || GVC_IS_MIXER_CARD (a), 0); + g_return_val_if_fail (b == NULL || GVC_IS_MIXER_CARD (b), 0); + + namea = gvc_mixer_card_get_name (a); + nameb = gvc_mixer_card_get_name (b); + + return gvc_name_collate (namea, nameb); +} + +/** + * gvc_mixer_control_get_cards: + * + * @control: + * + * Returns: (transfer container) (element-type Gvc.MixerCard): + */ +GSList * +gvc_mixer_control_get_cards (GvcMixerControl *control) +{ + GSList *retval; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + retval = NULL; + g_hash_table_foreach (control->priv->cards, + listify_hash_values_hfunc, + &retval); + return g_slist_sort (retval, (GCompareFunc) gvc_card_collate); +} + +static int +gvc_stream_collate (GvcMixerStream *a, + GvcMixerStream *b) +{ + const char *namea; + const char *nameb; + + g_return_val_if_fail (a == NULL || GVC_IS_MIXER_STREAM (a), 0); + g_return_val_if_fail (b == NULL || GVC_IS_MIXER_STREAM (b), 0); + + namea = gvc_mixer_stream_get_name (a); + nameb = gvc_mixer_stream_get_name (b); + + return gvc_name_collate (namea, nameb); +} + +/** + * gvc_mixer_control_get_streams: + * + * @control: + * + * Returns: (transfer container) (element-type Gvc.MixerStream): + */ +GSList * +gvc_mixer_control_get_streams (GvcMixerControl *control) +{ + GSList *retval; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + retval = NULL; + g_hash_table_foreach (control->priv->all_streams, + listify_hash_values_hfunc, + &retval); + return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate); +} + +/** + * gvc_mixer_control_get_sinks: + * + * @control: + * + * Returns: (transfer container) (element-type Gvc.MixerSink): + */ +GSList * +gvc_mixer_control_get_sinks (GvcMixerControl *control) +{ + GSList *retval; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + retval = NULL; + g_hash_table_foreach (control->priv->sinks, + listify_hash_values_hfunc, + &retval); + return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate); +} + +/** + * gvc_mixer_control_get_sources: + * + * @control: + * + * Returns: (transfer container) (element-type Gvc.MixerSource): + */ +GSList * +gvc_mixer_control_get_sources (GvcMixerControl *control) +{ + GSList *retval; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + retval = NULL; + g_hash_table_foreach (control->priv->sources, + listify_hash_values_hfunc, + &retval); + return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate); +} + +/** + * gvc_mixer_control_get_sink_inputs: + * + * @control: + * + * Returns: (transfer container) (element-type Gvc.MixerSinkInput): + */ +GSList * +gvc_mixer_control_get_sink_inputs (GvcMixerControl *control) +{ + GSList *retval; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + retval = NULL; + g_hash_table_foreach (control->priv->sink_inputs, + listify_hash_values_hfunc, + &retval); + return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate); +} + +/** + * gvc_mixer_control_get_source_outputs: + * + * @control: + * + * Returns: (transfer container) (element-type Gvc.MixerSourceOutput): + */ +GSList * +gvc_mixer_control_get_source_outputs (GvcMixerControl *control) +{ + GSList *retval; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL); + + retval = NULL; + g_hash_table_foreach (control->priv->source_outputs, + listify_hash_values_hfunc, + &retval); + return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate); +} + +static void +dec_outstanding (GvcMixerControl *control) +{ + if (control->priv->n_outstanding <= 0) { + return; + } + + if (--control->priv->n_outstanding <= 0) { + control->priv->state = GVC_STATE_READY; + g_signal_emit (G_OBJECT (control), signals[STATE_CHANGED], 0, GVC_STATE_READY); + } +} + +GvcMixerControlState +gvc_mixer_control_get_state (GvcMixerControl *control) +{ + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), FALSE); + + return control->priv->state; +} + + +static void +_set_default_source (GvcMixerControl *control, + GvcMixerStream *stream) +{ + guint new_id; + + if (stream == NULL) { + control->priv->default_source_id = 0; + control->priv->default_source_is_set = FALSE; + g_signal_emit (control, + signals[DEFAULT_SOURCE_CHANGED], + 0, + PA_INVALID_INDEX); + return; + } + + new_id = gvc_mixer_stream_get_id (stream); + + if (control->priv->default_source_id != new_id) { + control->priv->default_source_id = new_id; + control->priv->default_source_is_set = TRUE; + g_signal_emit (control, + signals[DEFAULT_SOURCE_CHANGED], + 0, + new_id); + } +} + +static void +_set_default_sink (GvcMixerControl *control, + GvcMixerStream *stream) +{ + guint new_id; + + if (stream == NULL) { + /* Don't tell front-ends about an unset default + * sink if it's already unset */ + if (control->priv->default_sink_is_set == FALSE) + return; + control->priv->default_sink_id = 0; + control->priv->default_sink_is_set = FALSE; + g_signal_emit (control, + signals[DEFAULT_SINK_CHANGED], + 0, + PA_INVALID_INDEX); + return; + } + + new_id = gvc_mixer_stream_get_id (stream); + + if (control->priv->default_sink_id != new_id) { + control->priv->default_sink_id = new_id; + control->priv->default_sink_is_set = TRUE; + g_signal_emit (control, + signals[DEFAULT_SINK_CHANGED], + 0, + new_id); + } +} + +static gboolean +_stream_has_name (gpointer key, + GvcMixerStream *stream, + const char *name) +{ + const char *t_name; + + t_name = gvc_mixer_stream_get_name (stream); + + if (t_name != NULL + && name != NULL + && strcmp (t_name, name) == 0) { + return TRUE; + } + + return FALSE; +} + +static GvcMixerStream * +find_stream_for_name (GvcMixerControl *control, + const char *name) +{ + GvcMixerStream *stream; + + stream = g_hash_table_find (control->priv->all_streams, + (GHRFunc)_stream_has_name, + (char *)name); + return stream; +} + +static void +update_default_source_from_name (GvcMixerControl *control, + const char *name) +{ + gboolean changed = FALSE; + + if ((control->priv->default_source_name == NULL + && name != NULL) + || (control->priv->default_source_name != NULL + && name == NULL) + || (name != NULL && strcmp (control->priv->default_source_name, name) != 0)) { + changed = TRUE; + } + + if (changed) { + GvcMixerStream *stream; + + g_free (control->priv->default_source_name); + control->priv->default_source_name = g_strdup (name); + + stream = find_stream_for_name (control, name); + _set_default_source (control, stream); + } +} + +static void +update_default_sink_from_name (GvcMixerControl *control, + const char *name) +{ + gboolean changed = FALSE; + + if ((control->priv->default_sink_name == NULL + && name != NULL) + || (control->priv->default_sink_name != NULL + && name == NULL) + || (name != NULL && strcmp (control->priv->default_sink_name, name) != 0)) { + changed = TRUE; + } + + if (changed) { + GvcMixerStream *stream; + g_free (control->priv->default_sink_name); + control->priv->default_sink_name = g_strdup (name); + + stream = find_stream_for_name (control, name); + _set_default_sink (control, stream); + } +} + +static void +update_server (GvcMixerControl *control, + const pa_server_info *info) +{ + if (info->default_source_name != NULL) { + update_default_source_from_name (control, info->default_source_name); + } + if (info->default_sink_name != NULL) { + update_default_sink_from_name (control, info->default_sink_name); + } +} + +static void +remove_stream (GvcMixerControl *control, + GvcMixerStream *stream) +{ + guint id; + + g_object_ref (stream); + + id = gvc_mixer_stream_get_id (stream); + + if (id == control->priv->default_sink_id) { + _set_default_sink (control, NULL); + } else if (id == control->priv->default_source_id) { + _set_default_source (control, NULL); + } + + g_hash_table_remove (control->priv->all_streams, + GUINT_TO_POINTER (id)); + g_signal_emit (G_OBJECT (control), + signals[STREAM_REMOVED], + 0, + gvc_mixer_stream_get_id (stream)); + g_object_unref (stream); +} + +static void +add_stream (GvcMixerControl *control, + GvcMixerStream *stream) +{ + g_hash_table_insert (control->priv->all_streams, + GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)), + stream); + g_signal_emit (G_OBJECT (control), + signals[STREAM_ADDED], + 0, + gvc_mixer_stream_get_id (stream)); +} + +static void +set_icon_name_from_proplist (GvcMixerStream *stream, + pa_proplist *l, + const char *default_icon_name) +{ + const char *t; + + if ((t = pa_proplist_gets (l, PA_PROP_DEVICE_ICON_NAME))) { + goto finish; + } + + if ((t = pa_proplist_gets (l, PA_PROP_MEDIA_ICON_NAME))) { + goto finish; + } + + if ((t = pa_proplist_gets (l, PA_PROP_WINDOW_ICON_NAME))) { + goto finish; + } + + if ((t = pa_proplist_gets (l, PA_PROP_APPLICATION_ICON_NAME))) { + goto finish; + } + + if ((t = pa_proplist_gets (l, PA_PROP_MEDIA_ROLE))) { + + if (strcmp (t, "video") == 0 || + strcmp (t, "phone") == 0) { + goto finish; + } + + if (strcmp (t, "music") == 0) { + t = "audio"; + goto finish; + } + + if (strcmp (t, "game") == 0) { + t = "applications-games"; + goto finish; + } + + if (strcmp (t, "event") == 0) { + t = "dialog-information"; + goto finish; + } + } + + t = default_icon_name; + + finish: + gvc_mixer_stream_set_icon_name (stream, t); +} + +static void +update_sink (GvcMixerControl *control, + const pa_sink_info *info) +{ + GvcMixerStream *stream; + gboolean is_new; + pa_volume_t max_volume; + GvcChannelMap *map; + char map_buff[PA_CHANNEL_MAP_SNPRINT_MAX]; + + pa_channel_map_snprint (map_buff, PA_CHANNEL_MAP_SNPRINT_MAX, &info->channel_map); +#if 1 + g_debug ("Updating sink: index=%u name='%s' description='%s' map='%s'", + info->index, + info->name, + info->description, + map_buff); +#endif + + map = NULL; + is_new = FALSE; + stream = g_hash_table_lookup (control->priv->sinks, + GUINT_TO_POINTER (info->index)); + if (stream == NULL) { + GList *list = NULL; + guint i; + + map = gvc_channel_map_new_from_pa_channel_map (&info->channel_map); + stream = gvc_mixer_sink_new (control->priv->pa_context, + info->index, + map); + + for (i = 0; i < info->n_ports; i++) { + GvcMixerStreamPort *port; + + port = g_new0 (GvcMixerStreamPort, 1); + port->port = g_strdup (info->ports[i]->name); + port->human_port = g_strdup (info->ports[i]->description); + port->priority = info->ports[i]->priority; + list = g_list_prepend (list, port); + } + gvc_mixer_stream_set_ports (stream, list); + + g_object_unref (map); + is_new = TRUE; + } else if (gvc_mixer_stream_is_running (stream)) { + /* Ignore events if volume changes are outstanding */ + g_debug ("Ignoring event, volume changes are outstanding"); + return; + } + + max_volume = pa_cvolume_max (&info->volume); + gvc_mixer_stream_set_name (stream, info->name); + gvc_mixer_stream_set_card_index (stream, info->card); + gvc_mixer_stream_set_description (stream, info->description); + set_icon_name_from_proplist (stream, info->proplist, "audio-card"); + gvc_mixer_stream_set_sysfs_path (stream, pa_proplist_gets (info->proplist, "sysfs.path")); + gvc_mixer_stream_set_volume (stream, (guint)max_volume); + gvc_mixer_stream_set_is_muted (stream, info->mute); + gvc_mixer_stream_set_can_decibel (stream, !!(info->flags & PA_SINK_DECIBEL_VOLUME)); + gvc_mixer_stream_set_base_volume (stream, (guint32) info->base_volume); + + if (info->active_port != NULL) + gvc_mixer_stream_set_port (stream, info->active_port->name); + + if (is_new) { + g_hash_table_insert (control->priv->sinks, + GUINT_TO_POINTER (info->index), + g_object_ref (stream)); + add_stream (control, stream); + } + + if (control->priv->default_sink_name != NULL + && info->name != NULL + && strcmp (control->priv->default_sink_name, info->name) == 0) { + _set_default_sink (control, stream); + } + + if (map == NULL) + map = (GvcChannelMap *) gvc_mixer_stream_get_channel_map (stream); + gvc_channel_map_volume_changed (map, &info->volume, FALSE); +} + +static void +update_source (GvcMixerControl *control, + const pa_source_info *info) +{ + GvcMixerStream *stream; + gboolean is_new; + pa_volume_t max_volume; + +#if 1 + g_debug ("Updating source: index=%u name='%s' description='%s'", + info->index, + info->name, + info->description); +#endif + + /* completely ignore monitors, they're not real sources */ + if (info->monitor_of_sink != PA_INVALID_INDEX) { + return; + } + + is_new = FALSE; + + stream = g_hash_table_lookup (control->priv->sources, + GUINT_TO_POINTER (info->index)); + if (stream == NULL) { + GList *list = NULL; + guint i; + GvcChannelMap *map; + + map = gvc_channel_map_new_from_pa_channel_map (&info->channel_map); + stream = gvc_mixer_source_new (control->priv->pa_context, + info->index, + map); + + for (i = 0; i < info->n_ports; i++) { + GvcMixerStreamPort *port; + + port = g_new0 (GvcMixerStreamPort, 1); + port->port = g_strdup (info->ports[i]->name); + port->human_port = g_strdup (info->ports[i]->description); + port->priority = info->ports[i]->priority; + list = g_list_prepend (list, port); + } + gvc_mixer_stream_set_ports (stream, list); + + g_object_unref (map); + is_new = TRUE; + } else if (gvc_mixer_stream_is_running (stream)) { + /* Ignore events if volume changes are outstanding */ + g_debug ("Ignoring event, volume changes are outstanding"); + return; + } + + max_volume = pa_cvolume_max (&info->volume); + + gvc_mixer_stream_set_name (stream, info->name); + gvc_mixer_stream_set_card_index (stream, info->card); + gvc_mixer_stream_set_description (stream, info->description); + set_icon_name_from_proplist (stream, info->proplist, "audio-input-microphone"); + gvc_mixer_stream_set_volume (stream, (guint)max_volume); + gvc_mixer_stream_set_is_muted (stream, info->mute); + gvc_mixer_stream_set_can_decibel (stream, !!(info->flags & PA_SOURCE_DECIBEL_VOLUME)); + gvc_mixer_stream_set_base_volume (stream, (guint32) info->base_volume); + + if (info->active_port != NULL) + gvc_mixer_stream_set_port (stream, info->active_port->name); + + if (is_new) { + g_hash_table_insert (control->priv->sources, + GUINT_TO_POINTER (info->index), + g_object_ref (stream)); + add_stream (control, stream); + } + + if (control->priv->default_source_name != NULL + && info->name != NULL + && strcmp (control->priv->default_source_name, info->name) == 0) { + _set_default_source (control, stream); + } +} + +static void +set_is_event_stream_from_proplist (GvcMixerStream *stream, + pa_proplist *l) +{ + const char *t; + gboolean is_event_stream; + + is_event_stream = FALSE; + + if ((t = pa_proplist_gets (l, PA_PROP_MEDIA_ROLE))) { + if (g_str_equal (t, "event")) + is_event_stream = TRUE; + } + + gvc_mixer_stream_set_is_event_stream (stream, is_event_stream); +} + +static void +set_application_id_from_proplist (GvcMixerStream *stream, + pa_proplist *l) +{ + const char *t; + + if ((t = pa_proplist_gets (l, PA_PROP_APPLICATION_ID))) { + gvc_mixer_stream_set_application_id (stream, t); + } +} + +static void +update_sink_input (GvcMixerControl *control, + const pa_sink_input_info *info) +{ + GvcMixerStream *stream; + gboolean is_new; + pa_volume_t max_volume; + const char *name; + +#if 0 + g_debug ("Updating sink input: index=%u name='%s' client=%u sink=%u", + info->index, + info->name, + info->client, + info->sink); +#endif + + is_new = FALSE; + + stream = g_hash_table_lookup (control->priv->sink_inputs, + GUINT_TO_POINTER (info->index)); + if (stream == NULL) { + GvcChannelMap *map; + map = gvc_channel_map_new_from_pa_channel_map (&info->channel_map); + stream = gvc_mixer_sink_input_new (control->priv->pa_context, + info->index, + map); + g_object_unref (map); + is_new = TRUE; + } else if (gvc_mixer_stream_is_running (stream)) { + /* Ignore events if volume changes are outstanding */ + g_debug ("Ignoring event, volume changes are outstanding"); + return; + } + + max_volume = pa_cvolume_max (&info->volume); + + name = (const char *)g_hash_table_lookup (control->priv->clients, + GUINT_TO_POINTER (info->client)); + gvc_mixer_stream_set_name (stream, name); + gvc_mixer_stream_set_description (stream, info->name); + + set_application_id_from_proplist (stream, info->proplist); + set_is_event_stream_from_proplist (stream, info->proplist); + set_icon_name_from_proplist (stream, info->proplist, "applications-multimedia"); + gvc_mixer_stream_set_volume (stream, (guint)max_volume); + gvc_mixer_stream_set_is_muted (stream, info->mute); + gvc_mixer_stream_set_is_virtual (stream, info->client == PA_INVALID_INDEX); + + if (is_new) { + g_hash_table_insert (control->priv->sink_inputs, + GUINT_TO_POINTER (info->index), + g_object_ref (stream)); + add_stream (control, stream); + } +} + +static void +update_source_output (GvcMixerControl *control, + const pa_source_output_info *info) +{ + GvcMixerStream *stream; + gboolean is_new; + const char *name; + +#if 1 + g_debug ("Updating source output: index=%u name='%s' client=%u source=%u", + info->index, + info->name, + info->client, + info->source); +#endif + + is_new = FALSE; + stream = g_hash_table_lookup (control->priv->source_outputs, + GUINT_TO_POINTER (info->index)); + if (stream == NULL) { + GvcChannelMap *map; + map = gvc_channel_map_new_from_pa_channel_map (&info->channel_map); + stream = gvc_mixer_source_output_new (control->priv->pa_context, + info->index, + map); + g_object_unref (map); + is_new = TRUE; + } + + name = (const char *)g_hash_table_lookup (control->priv->clients, + GUINT_TO_POINTER (info->client)); + + gvc_mixer_stream_set_name (stream, name); + gvc_mixer_stream_set_description (stream, info->name); + set_application_id_from_proplist (stream, info->proplist); + set_is_event_stream_from_proplist (stream, info->proplist); + set_icon_name_from_proplist (stream, info->proplist, "audio-input-microphone"); + + if (is_new) { + g_hash_table_insert (control->priv->source_outputs, + GUINT_TO_POINTER (info->index), + g_object_ref (stream)); + add_stream (control, stream); + } +} + +static void +update_client (GvcMixerControl *control, + const pa_client_info *info) +{ +#if 1 + g_debug ("Updating client: index=%u name='%s'", + info->index, + info->name); +#endif + g_hash_table_insert (control->priv->clients, + GUINT_TO_POINTER (info->index), + g_strdup (info->name)); +} + +static char * +card_num_streams_to_status (guint sinks, + guint sources) +{ + char *sinks_str; + char *sources_str; + char *ret; + + if (sinks == 0 && sources == 0) { + /* translators: + * The device has been disabled */ + return g_strdup (_("Disabled")); + } + if (sinks == 0) { + sinks_str = NULL; + } else { + /* translators: + * The number of sound outputs on a particular device */ + sinks_str = g_strdup_printf (ngettext ("%u Output", + "%u Outputs", + sinks), + sinks); + } + if (sources == 0) { + sources_str = NULL; + } else { + /* translators: + * The number of sound inputs on a particular device */ + sources_str = g_strdup_printf (ngettext ("%u Input", + "%u Inputs", + sources), + sources); + } + if (sources_str == NULL) + return sinks_str; + if (sinks_str == NULL) + return sources_str; + ret = g_strdup_printf ("%s / %s", sinks_str, sources_str); + g_free (sinks_str); + g_free (sources_str); + return ret; +} + +static void +update_card (GvcMixerControl *control, + const pa_card_info *info) +{ + GvcMixerCard *card; + gboolean is_new = FALSE; +#if 1 + guint i; + const char *key; + void *state; + + g_debug ("Udpating card %s (index: %u driver: %s):", + info->name, info->index, info->driver); + + for (i = 0; i < info->n_profiles; i++) { + struct pa_card_profile_info pi = info->profiles[i]; + gboolean is_default; + + is_default = (g_strcmp0 (pi.name, info->active_profile->name) == 0); + g_debug ("\tProfile '%s': %d sources %d sinks%s", + pi.name, pi.n_sources, pi.n_sinks, + is_default ? " (Current)" : ""); + } + state = NULL; + key = pa_proplist_iterate (info->proplist, &state); + while (key != NULL) { + g_debug ("\tProperty: '%s' = '%s'", + key, pa_proplist_gets (info->proplist, key)); + key = pa_proplist_iterate (info->proplist, &state); + } +#endif + card = g_hash_table_lookup (control->priv->cards, + GUINT_TO_POINTER (info->index)); + if (card == NULL) { + GList *list = NULL; + + for (i = 0; i < info->n_profiles; i++) { + struct pa_card_profile_info pi = info->profiles[i]; + GvcMixerCardProfile *profile; + + profile = g_new0 (GvcMixerCardProfile, 1); + profile->profile = g_strdup (pi.name); + profile->human_profile = g_strdup (pi.description); + profile->status = card_num_streams_to_status (pi.n_sinks, pi.n_sources); + profile->n_sinks = pi.n_sinks; + profile->n_sources = pi.n_sources; + profile->priority = pi.priority; + list = g_list_prepend (list, profile); + } + card = gvc_mixer_card_new (control->priv->pa_context, + info->index); + gvc_mixer_card_set_profiles (card, list); + is_new = TRUE; + } + + gvc_mixer_card_set_name (card, pa_proplist_gets (info->proplist, "device.description")); + gvc_mixer_card_set_icon_name (card, pa_proplist_gets (info->proplist, "device.icon_name")); + gvc_mixer_card_set_profile (card, info->active_profile->name); + + if (is_new) { + g_hash_table_insert (control->priv->cards, + GUINT_TO_POINTER (info->index), + g_object_ref (card)); + } + g_signal_emit (G_OBJECT (control), + signals[CARD_ADDED], + 0, + info->index); +} + +static void +_pa_context_get_sink_info_cb (pa_context *context, + const pa_sink_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + if (pa_context_errno (context) == PA_ERR_NOENTITY) { + return; + } + + g_warning ("Sink callback failure"); + return; + } + + if (eol > 0) { + dec_outstanding (control); + return; + } + + update_sink (control, i); +} + +static void +_pa_context_get_source_info_cb (pa_context *context, + const pa_source_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + if (pa_context_errno (context) == PA_ERR_NOENTITY) { + return; + } + + g_warning ("Source callback failure"); + return; + } + + if (eol > 0) { + dec_outstanding (control); + return; + } + + update_source (control, i); +} + +static void +_pa_context_get_sink_input_info_cb (pa_context *context, + const pa_sink_input_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + if (pa_context_errno (context) == PA_ERR_NOENTITY) { + return; + } + + g_warning ("Sink input callback failure"); + return; + } + + if (eol > 0) { + dec_outstanding (control); + return; + } + + update_sink_input (control, i); +} + +static void +_pa_context_get_source_output_info_cb (pa_context *context, + const pa_source_output_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + if (pa_context_errno (context) == PA_ERR_NOENTITY) { + return; + } + + g_warning ("Source output callback failure"); + return; + } + + if (eol > 0) { + dec_outstanding (control); + return; + } + + update_source_output (control, i); +} + +static void +_pa_context_get_client_info_cb (pa_context *context, + const pa_client_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + if (pa_context_errno (context) == PA_ERR_NOENTITY) { + return; + } + + g_warning ("Client callback failure"); + return; + } + + if (eol > 0) { + dec_outstanding (control); + return; + } + + update_client (control, i); +} + +static void +_pa_context_get_card_info_by_index_cb (pa_context *context, + const pa_card_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + if (pa_context_errno (context) == PA_ERR_NOENTITY) + return; + + g_warning ("Card callback failure"); + return; + } + + if (eol > 0) { + dec_outstanding (control); + return; + } + + update_card (control, i); +} + +static void +_pa_context_get_server_info_cb (pa_context *context, + const pa_server_info *i, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (i == NULL) { + g_warning ("Server info callback failure"); + return; + } + + update_server (control, i); + dec_outstanding (control); +} + +static void +remove_event_role_stream (GvcMixerControl *control) +{ + g_debug ("Removing event role"); +} + +static void +update_event_role_stream (GvcMixerControl *control, + const pa_ext_stream_restore_info *info) +{ + GvcMixerStream *stream; + gboolean is_new; + pa_volume_t max_volume; + + if (strcmp (info->name, "sink-input-by-media-role:event") != 0) { + return; + } + +#if 0 + g_debug ("Updating event role: name='%s' device='%s'", + info->name, + info->device); +#endif + + is_new = FALSE; + + if (!control->priv->event_sink_input_is_set) { + pa_channel_map pa_map; + GvcChannelMap *map; + + pa_map.channels = 1; + pa_map.map[0] = PA_CHANNEL_POSITION_MONO; + map = gvc_channel_map_new_from_pa_channel_map (&pa_map); + + stream = gvc_mixer_event_role_new (control->priv->pa_context, + info->device, + map); + control->priv->event_sink_input_id = gvc_mixer_stream_get_id (stream); + control->priv->event_sink_input_is_set = TRUE; + + is_new = TRUE; + } else { + stream = g_hash_table_lookup (control->priv->all_streams, + GUINT_TO_POINTER (control->priv->event_sink_input_id)); + } + + max_volume = pa_cvolume_max (&info->volume); + + gvc_mixer_stream_set_name (stream, _("System Sounds")); + gvc_mixer_stream_set_icon_name (stream, "multimedia-volume-control"); + gvc_mixer_stream_set_volume (stream, (guint)max_volume); + gvc_mixer_stream_set_is_muted (stream, info->mute); + + if (is_new) { + add_stream (control, stream); + } +} + +static void +_pa_ext_stream_restore_read_cb (pa_context *context, + const pa_ext_stream_restore_info *i, + int eol, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + if (eol < 0) { + g_debug ("Failed to initialized stream_restore extension: %s", + pa_strerror (pa_context_errno (context))); + remove_event_role_stream (control); + return; + } + + if (eol > 0) { + dec_outstanding (control); + /* If we don't have an event stream to restore, then + * set one up with a default 100% volume */ + if (!control->priv->event_sink_input_is_set) { + pa_ext_stream_restore_info info; + + memset (&info, 0, sizeof(info)); + info.name = "sink-input-by-media-role:event"; + info.volume.channels = 1; + info.volume.values[0] = PA_VOLUME_NORM; + update_event_role_stream (control, &info); + } + return; + } + + update_event_role_stream (control, i); +} + +static void +_pa_ext_stream_restore_subscribe_cb (pa_context *context, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + pa_operation *o; + + o = pa_ext_stream_restore_read (context, + _pa_ext_stream_restore_read_cb, + control); + if (o == NULL) { + g_warning ("pa_ext_stream_restore_read() failed"); + return; + } + + pa_operation_unref (o); +} + +static void +req_update_server_info (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + o = pa_context_get_server_info (control->priv->pa_context, + _pa_context_get_server_info_cb, + control); + if (o == NULL) { + g_warning ("pa_context_get_server_info() failed"); + return; + } + pa_operation_unref (o); +} + +static void +req_update_client_info (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + if (index < 0) { + o = pa_context_get_client_info_list (control->priv->pa_context, + _pa_context_get_client_info_cb, + control); + } else { + o = pa_context_get_client_info (control->priv->pa_context, + index, + _pa_context_get_client_info_cb, + control); + } + + if (o == NULL) { + g_warning ("pa_context_client_info_list() failed"); + return; + } + pa_operation_unref (o); +} + +static void +req_update_card (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + if (index < 0) { + o = pa_context_get_card_info_list (control->priv->pa_context, + _pa_context_get_card_info_by_index_cb, + control); + } else { + o = pa_context_get_card_info_by_index (control->priv->pa_context, + index, + _pa_context_get_card_info_by_index_cb, + control); + } + + if (o == NULL) { + g_warning ("pa_context_get_card_info_by_index() failed"); + return; + } + pa_operation_unref (o); +} + +static void +req_update_sink_info (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + if (index < 0) { + o = pa_context_get_sink_info_list (control->priv->pa_context, + _pa_context_get_sink_info_cb, + control); + } else { + o = pa_context_get_sink_info_by_index (control->priv->pa_context, + index, + _pa_context_get_sink_info_cb, + control); + } + + if (o == NULL) { + g_warning ("pa_context_get_sink_info_list() failed"); + return; + } + pa_operation_unref (o); +} + +static void +req_update_source_info (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + if (index < 0) { + o = pa_context_get_source_info_list (control->priv->pa_context, + _pa_context_get_source_info_cb, + control); + } else { + o = pa_context_get_source_info_by_index(control->priv->pa_context, + index, + _pa_context_get_source_info_cb, + control); + } + + if (o == NULL) { + g_warning ("pa_context_get_source_info_list() failed"); + return; + } + pa_operation_unref (o); +} + +static void +req_update_sink_input_info (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + if (index < 0) { + o = pa_context_get_sink_input_info_list (control->priv->pa_context, + _pa_context_get_sink_input_info_cb, + control); + } else { + o = pa_context_get_sink_input_info (control->priv->pa_context, + index, + _pa_context_get_sink_input_info_cb, + control); + } + + if (o == NULL) { + g_warning ("pa_context_get_sink_input_info_list() failed"); + return; + } + pa_operation_unref (o); +} + +static void +req_update_source_output_info (GvcMixerControl *control, + int index) +{ + pa_operation *o; + + if (index < 0) { + o = pa_context_get_source_output_info_list (control->priv->pa_context, + _pa_context_get_source_output_info_cb, + control); + } else { + o = pa_context_get_source_output_info (control->priv->pa_context, + index, + _pa_context_get_source_output_info_cb, + control); + } + + if (o == NULL) { + g_warning ("pa_context_get_source_output_info_list() failed"); + return; + } + pa_operation_unref (o); +} + +static void +remove_client (GvcMixerControl *control, + guint index) +{ + g_hash_table_remove (control->priv->clients, + GUINT_TO_POINTER (index)); +} + +static void +remove_card (GvcMixerControl *control, + guint index) +{ + g_hash_table_remove (control->priv->cards, + GUINT_TO_POINTER (index)); + + g_signal_emit (G_OBJECT (control), + signals[CARD_REMOVED], + 0, + index); +} + +static void +remove_sink (GvcMixerControl *control, + guint index) +{ + GvcMixerStream *stream; + +#if 0 + g_debug ("Removing sink: index=%u", index); +#endif + + stream = g_hash_table_lookup (control->priv->sinks, + GUINT_TO_POINTER (index)); + if (stream == NULL) { + return; + } + g_hash_table_remove (control->priv->sinks, + GUINT_TO_POINTER (index)); + + remove_stream (control, stream); +} + +static void +remove_source (GvcMixerControl *control, + guint index) +{ + GvcMixerStream *stream; + +#if 0 + g_debug ("Removing source: index=%u", index); +#endif + + stream = g_hash_table_lookup (control->priv->sources, + GUINT_TO_POINTER (index)); + if (stream == NULL) { + return; + } + g_hash_table_remove (control->priv->sources, + GUINT_TO_POINTER (index)); + + remove_stream (control, stream); +} + +static void +remove_sink_input (GvcMixerControl *control, + guint index) +{ + GvcMixerStream *stream; + +#if 0 + g_debug ("Removing sink input: index=%u", index); +#endif + stream = g_hash_table_lookup (control->priv->sink_inputs, + GUINT_TO_POINTER (index)); + if (stream == NULL) { + return; + } + g_hash_table_remove (control->priv->sink_inputs, + GUINT_TO_POINTER (index)); + + remove_stream (control, stream); +} + +static void +remove_source_output (GvcMixerControl *control, + guint index) +{ + GvcMixerStream *stream; + +#if 0 + g_debug ("Removing source output: index=%u", index); +#endif + + stream = g_hash_table_lookup (control->priv->source_outputs, + GUINT_TO_POINTER (index)); + if (stream == NULL) { + return; + } + g_hash_table_remove (control->priv->source_outputs, + GUINT_TO_POINTER (index)); + + remove_stream (control, stream); +} + +static void +_pa_context_subscribe_cb (pa_context *context, + pa_subscription_event_type_t t, + uint32_t index, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) { + case PA_SUBSCRIPTION_EVENT_SINK: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + remove_sink (control, index); + } else { + req_update_sink_info (control, index); + } + break; + + case PA_SUBSCRIPTION_EVENT_SOURCE: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + remove_source (control, index); + } else { + req_update_source_info (control, index); + } + break; + + case PA_SUBSCRIPTION_EVENT_SINK_INPUT: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + remove_sink_input (control, index); + } else { + req_update_sink_input_info (control, index); + } + break; + + case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + remove_source_output (control, index); + } else { + req_update_source_output_info (control, index); + } + break; + + case PA_SUBSCRIPTION_EVENT_CLIENT: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + remove_client (control, index); + } else { + req_update_client_info (control, index); + } + break; + + case PA_SUBSCRIPTION_EVENT_SERVER: + req_update_server_info (control, index); + break; + + case PA_SUBSCRIPTION_EVENT_CARD: + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { + remove_card (control, index); + } else { + req_update_card (control, index); + } + break; + } +} + +static void +gvc_mixer_control_ready (GvcMixerControl *control) +{ + pa_operation *o; + + pa_context_set_subscribe_callback (control->priv->pa_context, + _pa_context_subscribe_cb, + control); + o = pa_context_subscribe (control->priv->pa_context, + (pa_subscription_mask_t) + (PA_SUBSCRIPTION_MASK_SINK| + PA_SUBSCRIPTION_MASK_SOURCE| + PA_SUBSCRIPTION_MASK_SINK_INPUT| + PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| + PA_SUBSCRIPTION_MASK_CLIENT| + PA_SUBSCRIPTION_MASK_SERVER| + PA_SUBSCRIPTION_MASK_CARD), + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_subscribe() failed"); + return; + } + pa_operation_unref (o); + + req_update_server_info (control, -1); + req_update_client_info (control, -1); + req_update_sink_info (control, -1); + req_update_source_info (control, -1); + req_update_sink_input_info (control, -1); + req_update_source_output_info (control, -1); + req_update_card (control, -1); + + control->priv->n_outstanding = 6; + + /* This call is not always supported */ + o = pa_ext_stream_restore_read (control->priv->pa_context, + _pa_ext_stream_restore_read_cb, + control); + if (o != NULL) { + pa_operation_unref (o); + control->priv->n_outstanding++; + + pa_ext_stream_restore_set_subscribe_cb (control->priv->pa_context, + _pa_ext_stream_restore_subscribe_cb, + control); + + o = pa_ext_stream_restore_subscribe (control->priv->pa_context, + 1, + NULL, + NULL); + if (o != NULL) { + pa_operation_unref (o); + } + + } else { + g_debug ("Failed to initialized stream_restore extension: %s", + pa_strerror (pa_context_errno (control->priv->pa_context))); + } +} + +static void +gvc_mixer_new_pa_context (GvcMixerControl *self) +{ + pa_proplist *proplist; + + g_return_if_fail (self); + g_return_if_fail (!self->priv->pa_context); + + proplist = pa_proplist_new (); + pa_proplist_sets (proplist, + PA_PROP_APPLICATION_NAME, + self->priv->name); + pa_proplist_sets (proplist, + PA_PROP_APPLICATION_ID, + "org.gnome.VolumeControl"); + pa_proplist_sets (proplist, + PA_PROP_APPLICATION_ICON_NAME, + "multimedia-volume-control"); + pa_proplist_sets (proplist, + PA_PROP_APPLICATION_VERSION, + PACKAGE_VERSION); + + self->priv->pa_context = pa_context_new_with_proplist (self->priv->pa_api, NULL, proplist); + + pa_proplist_free (proplist); + g_assert (self->priv->pa_context); +} + +static void +remove_all_streams (GvcMixerControl *control, GHashTable *hash_table) +{ + GHashTableIter iter; + gpointer key, value; + + g_hash_table_iter_init (&iter, hash_table); + while (g_hash_table_iter_next (&iter, &key, &value)) { + remove_stream (control, value); + g_hash_table_iter_remove (&iter); + } +} + +static gboolean +idle_reconnect (gpointer data) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (data); + GHashTableIter iter; + gpointer key, value; + + g_return_val_if_fail (control, FALSE); + + if (control->priv->pa_context) { + pa_context_unref (control->priv->pa_context); + control->priv->pa_context = NULL; + gvc_mixer_new_pa_context (control); + } + + remove_all_streams (control, control->priv->sinks); + remove_all_streams (control, control->priv->sources); + remove_all_streams (control, control->priv->sink_inputs); + remove_all_streams (control, control->priv->source_outputs); + + g_hash_table_iter_init (&iter, control->priv->clients); + while (g_hash_table_iter_next (&iter, &key, &value)) + g_hash_table_iter_remove (&iter); + + gvc_mixer_control_open (control); /* cannot fail */ + + control->priv->reconnect_id = 0; + return FALSE; +} + +static void +_pa_context_state_cb (pa_context *context, + void *userdata) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (userdata); + + switch (pa_context_get_state (context)) { + case PA_CONTEXT_UNCONNECTED: + case PA_CONTEXT_CONNECTING: + case PA_CONTEXT_AUTHORIZING: + case PA_CONTEXT_SETTING_NAME: + break; + + case PA_CONTEXT_READY: + gvc_mixer_control_ready (control); + break; + + case PA_CONTEXT_FAILED: + control->priv->state = GVC_STATE_FAILED; + g_signal_emit (control, signals[STATE_CHANGED], 0, GVC_STATE_FAILED); + if (control->priv->reconnect_id == 0) + control->priv->reconnect_id = g_timeout_add_seconds (RECONNECT_DELAY, idle_reconnect, control); + break; + + case PA_CONTEXT_TERMINATED: + default: + /* FIXME: */ + break; + } +} + +gboolean +gvc_mixer_control_open (GvcMixerControl *control) +{ + int res; + + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), FALSE); + g_return_val_if_fail (control->priv->pa_context != NULL, FALSE); + g_return_val_if_fail (pa_context_get_state (control->priv->pa_context) == PA_CONTEXT_UNCONNECTED, FALSE); + + pa_context_set_state_callback (control->priv->pa_context, + _pa_context_state_cb, + control); + + control->priv->state = GVC_STATE_CONNECTING; + g_signal_emit (G_OBJECT (control), signals[STATE_CHANGED], 0, GVC_STATE_CONNECTING); + res = pa_context_connect (control->priv->pa_context, NULL, (pa_context_flags_t) PA_CONTEXT_NOFAIL, NULL); + if (res < 0) { + g_warning ("Failed to connect context: %s", + pa_strerror (pa_context_errno (control->priv->pa_context))); + } + + return res; +} + +gboolean +gvc_mixer_control_close (GvcMixerControl *control) +{ + g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), FALSE); + g_return_val_if_fail (control->priv->pa_context != NULL, FALSE); + + pa_context_disconnect (control->priv->pa_context); + + control->priv->state = GVC_STATE_CLOSED; + g_signal_emit (G_OBJECT (control), signals[STATE_CHANGED], 0, GVC_STATE_CLOSED); + return TRUE; +} + +static void +gvc_mixer_control_dispose (GObject *object) +{ + GvcMixerControl *control = GVC_MIXER_CONTROL (object); + + if (control->priv->reconnect_id != 0) { + g_source_remove (control->priv->reconnect_id); + control->priv->reconnect_id = 0; + } + + if (control->priv->pa_context != NULL) { + pa_context_unref (control->priv->pa_context); + control->priv->pa_context = NULL; + } + + if (control->priv->default_source_name != NULL) { + g_free (control->priv->default_source_name); + control->priv->default_source_name = NULL; + } + if (control->priv->default_sink_name != NULL) { + g_free (control->priv->default_sink_name); + control->priv->default_sink_name = NULL; + } + + if (control->priv->pa_mainloop != NULL) { + pa_glib_mainloop_free (control->priv->pa_mainloop); + control->priv->pa_mainloop = NULL; + } + + if (control->priv->all_streams != NULL) { + g_hash_table_destroy (control->priv->all_streams); + control->priv->all_streams = NULL; + } + + if (control->priv->sinks != NULL) { + g_hash_table_destroy (control->priv->sinks); + control->priv->sinks = NULL; + } + if (control->priv->sources != NULL) { + g_hash_table_destroy (control->priv->sources); + control->priv->sources = NULL; + } + if (control->priv->sink_inputs != NULL) { + g_hash_table_destroy (control->priv->sink_inputs); + control->priv->sink_inputs = NULL; + } + if (control->priv->source_outputs != NULL) { + g_hash_table_destroy (control->priv->source_outputs); + control->priv->source_outputs = NULL; + } + if (control->priv->clients != NULL) { + g_hash_table_destroy (control->priv->clients); + control->priv->clients = NULL; + } + if (control->priv->cards != NULL) { + g_hash_table_destroy (control->priv->cards); + control->priv->cards = NULL; + } + + G_OBJECT_CLASS (gvc_mixer_control_parent_class)->dispose (object); +} + +static void +gvc_mixer_control_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GvcMixerControl *self = GVC_MIXER_CONTROL (object); + + switch (prop_id) { + case PROP_NAME: + g_free (self->priv->name); + self->priv->name = g_value_dup_string (value); + g_object_notify (G_OBJECT (self), "name"); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gvc_mixer_control_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GvcMixerControl *self = GVC_MIXER_CONTROL (object); + + switch (prop_id) { + case PROP_NAME: + g_value_set_string (value, self->priv->name); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + + +static GObject * +gvc_mixer_control_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params) +{ + GObject *object; + GvcMixerControl *self; + + object = G_OBJECT_CLASS (gvc_mixer_control_parent_class)->constructor (type, n_construct_properties, construct_params); + + self = GVC_MIXER_CONTROL (object); + + gvc_mixer_new_pa_context (self); + + return object; +} + +static void +gvc_mixer_control_class_init (GvcMixerControlClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gvc_mixer_control_constructor; + object_class->dispose = gvc_mixer_control_dispose; + object_class->finalize = gvc_mixer_control_finalize; + object_class->set_property = gvc_mixer_control_set_property; + object_class->get_property = gvc_mixer_control_get_property; + + g_object_class_install_property (object_class, + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name to display for this mixer control", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + + signals [STATE_CHANGED] = + g_signal_new ("state-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, state_changed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [STREAM_ADDED] = + g_signal_new ("stream-added", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, stream_added), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [STREAM_REMOVED] = + g_signal_new ("stream-removed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, stream_removed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [CARD_ADDED] = + g_signal_new ("card-added", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, card_added), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [CARD_REMOVED] = + g_signal_new ("card-removed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, card_removed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [DEFAULT_SINK_CHANGED] = + g_signal_new ("default-sink-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, default_sink_changed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [DEFAULT_SOURCE_CHANGED] = + g_signal_new ("default-source-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GvcMixerControlClass, default_source_changed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + + g_type_class_add_private (klass, sizeof (GvcMixerControlPrivate)); +} + +static void +gvc_mixer_control_init (GvcMixerControl *control) +{ + control->priv = GVC_MIXER_CONTROL_GET_PRIVATE (control); + + control->priv->pa_mainloop = pa_glib_mainloop_new (g_main_context_default ()); + g_assert (control->priv->pa_mainloop); + + control->priv->pa_api = pa_glib_mainloop_get_api (control->priv->pa_mainloop); + g_assert (control->priv->pa_api); + + control->priv->all_streams = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref); + control->priv->sinks = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref); + control->priv->sources = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref); + control->priv->sink_inputs = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref); + control->priv->source_outputs = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref); + control->priv->cards = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref); + + control->priv->clients = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_free); + + control->priv->state = GVC_STATE_CLOSED; +} + +static void +gvc_mixer_control_finalize (GObject *object) +{ + GvcMixerControl *mixer_control; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_CONTROL (object)); + + mixer_control = GVC_MIXER_CONTROL (object); + g_free (mixer_control->priv->name); + mixer_control->priv->name = NULL; + + g_return_if_fail (mixer_control->priv != NULL); + G_OBJECT_CLASS (gvc_mixer_control_parent_class)->finalize (object); +} + +GvcMixerControl * +gvc_mixer_control_new (const char *name) +{ + GObject *control; + control = g_object_new (GVC_TYPE_MIXER_CONTROL, + "name", name, + NULL); + return GVC_MIXER_CONTROL (control); +} + +/* FIXME: Remove when PA 0.9.23 is used */ +#ifndef PA_VOLUME_UI_MAX +#define PA_VOLUME_UI_MAX pa_sw_volume_from_dB(+11.0) +#endif + +gdouble +gvc_mixer_control_get_vol_max_norm (GvcMixerControl *control) +{ + return (gdouble) PA_VOLUME_NORM; +} + +gdouble +gvc_mixer_control_get_vol_max_amplified (GvcMixerControl *control) +{ + return (gdouble) PA_VOLUME_UI_MAX; +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-control.h b/plugins/media-keys/cut-n-paste/gvc-mixer-control.h new file mode 100644 index 00000000..598ca019 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-control.h @@ -0,0 +1,108 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_CONTROL_H +#define __GVC_MIXER_CONTROL_H + +#include +#include "gvc-mixer-stream.h" +#include "gvc-mixer-card.h" + +G_BEGIN_DECLS + +typedef enum +{ + GVC_STATE_CLOSED, + GVC_STATE_READY, + GVC_STATE_CONNECTING, + GVC_STATE_FAILED +} GvcMixerControlState; + +#define GVC_TYPE_MIXER_CONTROL (gvc_mixer_control_get_type ()) +#define GVC_MIXER_CONTROL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_CONTROL, GvcMixerControl)) +#define GVC_MIXER_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_CONTROL, GvcMixerControlClass)) +#define GVC_IS_MIXER_CONTROL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_CONTROL)) +#define GVC_IS_MIXER_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_CONTROL)) +#define GVC_MIXER_CONTROL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_CONTROL, GvcMixerControlClass)) + +typedef struct GvcMixerControlPrivate GvcMixerControlPrivate; + +typedef struct +{ + GObject parent; + GvcMixerControlPrivate *priv; +} GvcMixerControl; + +typedef struct +{ + GObjectClass parent_class; + + void (*state_changed) (GvcMixerControl *control, + GvcMixerControlState new_state); + void (*stream_added) (GvcMixerControl *control, + guint id); + void (*stream_removed) (GvcMixerControl *control, + guint id); + void (*card_added) (GvcMixerControl *control, + guint id); + void (*card_removed) (GvcMixerControl *control, + guint id); + void (*default_sink_changed) (GvcMixerControl *control, + guint id); + void (*default_source_changed) (GvcMixerControl *control, + guint id); +} GvcMixerControlClass; + +GType gvc_mixer_control_get_type (void); + +GvcMixerControl * gvc_mixer_control_new (const char *name); + +gboolean gvc_mixer_control_open (GvcMixerControl *control); +gboolean gvc_mixer_control_close (GvcMixerControl *control); + +GSList * gvc_mixer_control_get_cards (GvcMixerControl *control); +GSList * gvc_mixer_control_get_streams (GvcMixerControl *control); +GSList * gvc_mixer_control_get_sinks (GvcMixerControl *control); +GSList * gvc_mixer_control_get_sources (GvcMixerControl *control); +GSList * gvc_mixer_control_get_sink_inputs (GvcMixerControl *control); +GSList * gvc_mixer_control_get_source_outputs (GvcMixerControl *control); + +GvcMixerStream * gvc_mixer_control_lookup_stream_id (GvcMixerControl *control, + guint id); +GvcMixerCard * gvc_mixer_control_lookup_card_id (GvcMixerControl *control, + guint id); + +GvcMixerStream * gvc_mixer_control_get_default_sink (GvcMixerControl *control); +GvcMixerStream * gvc_mixer_control_get_default_source (GvcMixerControl *control); +GvcMixerStream * gvc_mixer_control_get_event_sink_input (GvcMixerControl *control); + +gboolean gvc_mixer_control_set_default_sink (GvcMixerControl *control, + GvcMixerStream *stream); +gboolean gvc_mixer_control_set_default_source (GvcMixerControl *control, + GvcMixerStream *stream); + +gdouble gvc_mixer_control_get_vol_max_norm (GvcMixerControl *control); +gdouble gvc_mixer_control_get_vol_max_amplified (GvcMixerControl *control); + +GvcMixerControlState gvc_mixer_control_get_state (GvcMixerControl *control); + +G_END_DECLS + +#endif /* __GVC_MIXER_CONTROL_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c new file mode 100644 index 00000000..5a287675 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.c @@ -0,0 +1,231 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include +#include + +#include "gvc-mixer-event-role.h" +#include "gvc-mixer-stream-private.h" +#include "gvc-channel-map-private.h" + +#define GVC_MIXER_EVENT_ROLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_EVENT_ROLE, GvcMixerEventRolePrivate)) + +struct GvcMixerEventRolePrivate +{ + char *device; +}; + +enum +{ + PROP_0, + PROP_DEVICE +}; + +static void gvc_mixer_event_role_class_init (GvcMixerEventRoleClass *klass); +static void gvc_mixer_event_role_init (GvcMixerEventRole *mixer_event_role); +static void gvc_mixer_event_role_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerEventRole, gvc_mixer_event_role, GVC_TYPE_MIXER_STREAM) + +static gboolean +update_settings (GvcMixerEventRole *role, + gboolean is_muted, + gpointer *op) +{ + pa_operation *o; + const GvcChannelMap *map; + pa_context *context; + pa_ext_stream_restore_info info; + + map = gvc_mixer_stream_get_channel_map (GVC_MIXER_STREAM(role)); + + info.volume = *gvc_channel_map_get_cvolume(map); + info.name = "sink-input-by-media-role:event"; + info.channel_map = *gvc_channel_map_get_pa_channel_map(map); + info.device = role->priv->device; + info.mute = is_muted; + + context = gvc_mixer_stream_get_pa_context (GVC_MIXER_STREAM (role)); + + o = pa_ext_stream_restore_write (context, + PA_UPDATE_REPLACE, + &info, + 1, + TRUE, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_ext_stream_restore_write() failed"); + return FALSE; + } + + if (op != NULL) + *op = o; + + return TRUE; +} + +static gboolean +gvc_mixer_event_role_push_volume (GvcMixerStream *stream, gpointer *op) +{ + return update_settings (GVC_MIXER_EVENT_ROLE (stream), + gvc_mixer_stream_get_is_muted (stream), op); +} + +static gboolean +gvc_mixer_event_role_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + return update_settings (GVC_MIXER_EVENT_ROLE (stream), + is_muted, NULL); +} + +static gboolean +gvc_mixer_event_role_set_device (GvcMixerEventRole *role, + const char *device) +{ + g_return_val_if_fail (GVC_IS_MIXER_EVENT_ROLE (role), FALSE); + + g_free (role->priv->device); + role->priv->device = g_strdup (device); + g_object_notify (G_OBJECT (role), "device"); + + return TRUE; +} + +static void +gvc_mixer_event_role_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GvcMixerEventRole *self = GVC_MIXER_EVENT_ROLE (object); + + switch (prop_id) { + case PROP_DEVICE: + gvc_mixer_event_role_set_device (self, g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gvc_mixer_event_role_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GvcMixerEventRole *self = GVC_MIXER_EVENT_ROLE (object); + + switch (prop_id) { + case PROP_DEVICE: + g_value_set_string (value, self->priv->device); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gvc_mixer_event_role_class_init (GvcMixerEventRoleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GvcMixerStreamClass *stream_class = GVC_MIXER_STREAM_CLASS (klass); + + object_class->finalize = gvc_mixer_event_role_finalize; + object_class->set_property = gvc_mixer_event_role_set_property; + object_class->get_property = gvc_mixer_event_role_get_property; + + stream_class->push_volume = gvc_mixer_event_role_push_volume; + stream_class->change_is_muted = gvc_mixer_event_role_change_is_muted; + + g_object_class_install_property (object_class, + PROP_DEVICE, + g_param_spec_string ("device", + "Device", + "Device", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + + g_type_class_add_private (klass, sizeof (GvcMixerEventRolePrivate)); +} + +static void +gvc_mixer_event_role_init (GvcMixerEventRole *event_role) +{ + event_role->priv = GVC_MIXER_EVENT_ROLE_GET_PRIVATE (event_role); + +} + +static void +gvc_mixer_event_role_finalize (GObject *object) +{ + GvcMixerEventRole *mixer_event_role; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_EVENT_ROLE (object)); + + mixer_event_role = GVC_MIXER_EVENT_ROLE (object); + + g_return_if_fail (mixer_event_role->priv != NULL); + + g_free (mixer_event_role->priv->device); + + G_OBJECT_CLASS (gvc_mixer_event_role_parent_class)->finalize (object); +} + +/** + * gvc_mixer_event_role_new: (skip) + * + * @context: + * @index: + * @channel_map: + * + * Returns: + */ +GvcMixerStream * +gvc_mixer_event_role_new (pa_context *context, + const char *device, + GvcChannelMap *channel_map) +{ + GObject *object; + + object = g_object_new (GVC_TYPE_MIXER_EVENT_ROLE, + "pa-context", context, + "index", 0, + "device", device, + "channel-map", channel_map, + NULL); + + return GVC_MIXER_STREAM (object); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.h b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.h new file mode 100644 index 00000000..ab4c509e --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-event-role.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_EVENT_ROLE_H +#define __GVC_MIXER_EVENT_ROLE_H + +#include +#include "gvc-mixer-stream.h" + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_EVENT_ROLE (gvc_mixer_event_role_get_type ()) +#define GVC_MIXER_EVENT_ROLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_EVENT_ROLE, GvcMixerEventRole)) +#define GVC_MIXER_EVENT_ROLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_EVENT_ROLE, GvcMixerEventRoleClass)) +#define GVC_IS_MIXER_EVENT_ROLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_EVENT_ROLE)) +#define GVC_IS_MIXER_EVENT_ROLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_EVENT_ROLE)) +#define GVC_MIXER_EVENT_ROLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_EVENT_ROLE, GvcMixerEventRoleClass)) + +typedef struct GvcMixerEventRolePrivate GvcMixerEventRolePrivate; + +typedef struct +{ + GvcMixerStream parent; + GvcMixerEventRolePrivate *priv; +} GvcMixerEventRole; + +typedef struct +{ + GvcMixerStreamClass parent_class; +} GvcMixerEventRoleClass; + +GType gvc_mixer_event_role_get_type (void); + +GvcMixerStream * gvc_mixer_event_role_new (pa_context *context, + const char *device, + GvcChannelMap *channel_map); + +G_END_DECLS + +#endif /* __GVC_MIXER_EVENT_ROLE_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c new file mode 100644 index 00000000..03ba3b2f --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.c @@ -0,0 +1,166 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-mixer-sink-input.h" +#include "gvc-mixer-stream-private.h" +#include "gvc-channel-map-private.h" + +#define GVC_MIXER_SINK_INPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_SINK_INPUT, GvcMixerSinkInputPrivate)) + +struct GvcMixerSinkInputPrivate +{ + gpointer dummy; +}; + +static void gvc_mixer_sink_input_class_init (GvcMixerSinkInputClass *klass); +static void gvc_mixer_sink_input_init (GvcMixerSinkInput *mixer_sink_input); +static void gvc_mixer_sink_input_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerSinkInput, gvc_mixer_sink_input, GVC_TYPE_MIXER_STREAM) + +static gboolean +gvc_mixer_sink_input_push_volume (GvcMixerStream *stream, gpointer *op) +{ + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; + + index = gvc_mixer_stream_get_index (stream); + + map = gvc_mixer_stream_get_channel_map (stream); + + cv = gvc_channel_map_get_cvolume(map); + + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_sink_input_volume (context, + index, + cv, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_sink_input_volume() failed"); + return FALSE; + } + + *op = o; + + return TRUE; +} + +static gboolean +gvc_mixer_sink_input_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + pa_operation *o; + guint index; + pa_context *context; + + index = gvc_mixer_stream_get_index (stream); + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_sink_input_mute (context, + index, + is_muted, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_sink_input_mute_by_index() failed"); + return FALSE; + } + + pa_operation_unref(o); + + return TRUE; +} + +static void +gvc_mixer_sink_input_class_init (GvcMixerSinkInputClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GvcMixerStreamClass *stream_class = GVC_MIXER_STREAM_CLASS (klass); + + object_class->finalize = gvc_mixer_sink_input_finalize; + + stream_class->push_volume = gvc_mixer_sink_input_push_volume; + stream_class->change_is_muted = gvc_mixer_sink_input_change_is_muted; + + g_type_class_add_private (klass, sizeof (GvcMixerSinkInputPrivate)); +} + +static void +gvc_mixer_sink_input_init (GvcMixerSinkInput *sink_input) +{ + sink_input->priv = GVC_MIXER_SINK_INPUT_GET_PRIVATE (sink_input); +} + +static void +gvc_mixer_sink_input_finalize (GObject *object) +{ + GvcMixerSinkInput *mixer_sink_input; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_SINK_INPUT (object)); + + mixer_sink_input = GVC_MIXER_SINK_INPUT (object); + + g_return_if_fail (mixer_sink_input->priv != NULL); + G_OBJECT_CLASS (gvc_mixer_sink_input_parent_class)->finalize (object); +} + +/** + * gvc_mixer_sink_input_new: (skip) + * + * @context: + * @index: + * @channel_map: + * + * Returns: + */ +GvcMixerStream * +gvc_mixer_sink_input_new (pa_context *context, + guint index, + GvcChannelMap *channel_map) +{ + GObject *object; + + object = g_object_new (GVC_TYPE_MIXER_SINK_INPUT, + "pa-context", context, + "index", index, + "channel-map", channel_map, + NULL); + + return GVC_MIXER_STREAM (object); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.h b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.h new file mode 100644 index 00000000..8a4b7145 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink-input.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_SINK_INPUT_H +#define __GVC_MIXER_SINK_INPUT_H + +#include +#include "gvc-mixer-stream.h" + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_SINK_INPUT (gvc_mixer_sink_input_get_type ()) +#define GVC_MIXER_SINK_INPUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_SINK_INPUT, GvcMixerSinkInput)) +#define GVC_MIXER_SINK_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_SINK_INPUT, GvcMixerSinkInputClass)) +#define GVC_IS_MIXER_SINK_INPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_SINK_INPUT)) +#define GVC_IS_MIXER_SINK_INPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_SINK_INPUT)) +#define GVC_MIXER_SINK_INPUT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_SINK_INPUT, GvcMixerSinkInputClass)) + +typedef struct GvcMixerSinkInputPrivate GvcMixerSinkInputPrivate; + +typedef struct +{ + GvcMixerStream parent; + GvcMixerSinkInputPrivate *priv; +} GvcMixerSinkInput; + +typedef struct +{ + GvcMixerStreamClass parent_class; +} GvcMixerSinkInputClass; + +GType gvc_mixer_sink_input_get_type (void); + +GvcMixerStream * gvc_mixer_sink_input_new (pa_context *context, + guint index, + GvcChannelMap *map); + +G_END_DECLS + +#endif /* __GVC_MIXER_SINK_INPUT_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c new file mode 100644 index 00000000..78c3c680 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.c @@ -0,0 +1,196 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-mixer-sink.h" +#include "gvc-mixer-stream-private.h" +#include "gvc-channel-map-private.h" + +#define GVC_MIXER_SINK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_SINK, GvcMixerSinkPrivate)) + +struct GvcMixerSinkPrivate +{ + gpointer dummy; +}; + +static void gvc_mixer_sink_class_init (GvcMixerSinkClass *klass); +static void gvc_mixer_sink_init (GvcMixerSink *mixer_sink); +static void gvc_mixer_sink_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerSink, gvc_mixer_sink, GVC_TYPE_MIXER_STREAM) + +static gboolean +gvc_mixer_sink_push_volume (GvcMixerStream *stream, gpointer *op) +{ + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; + + index = gvc_mixer_stream_get_index (stream); + + map = gvc_mixer_stream_get_channel_map (stream); + + /* set the volume */ + cv = gvc_channel_map_get_cvolume(map); + + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_sink_volume_by_index (context, + index, + cv, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_sink_volume_by_index() failed: %s", pa_strerror(pa_context_errno(context))); + return FALSE; + } + + *op = o; + + return TRUE; +} + +static gboolean +gvc_mixer_sink_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + pa_operation *o; + guint index; + pa_context *context; + + index = gvc_mixer_stream_get_index (stream); + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_sink_mute_by_index (context, + index, + is_muted, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_sink_mute_by_index() failed: %s", pa_strerror(pa_context_errno(context))); + return FALSE; + } + + pa_operation_unref(o); + + return TRUE; +} + +static gboolean +gvc_mixer_sink_change_port (GvcMixerStream *stream, + const char *port) +{ + pa_operation *o; + guint index; + pa_context *context; + + index = gvc_mixer_stream_get_index (stream); + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_sink_port_by_index (context, + index, + port, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_sink_port_by_index() failed: %s", pa_strerror(pa_context_errno(context))); + return FALSE; + } + + pa_operation_unref(o); + + return TRUE; +} + +static void +gvc_mixer_sink_class_init (GvcMixerSinkClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GvcMixerStreamClass *stream_class = GVC_MIXER_STREAM_CLASS (klass); + + object_class->finalize = gvc_mixer_sink_finalize; + + stream_class->push_volume = gvc_mixer_sink_push_volume; + stream_class->change_port = gvc_mixer_sink_change_port; + stream_class->change_is_muted = gvc_mixer_sink_change_is_muted; + + g_type_class_add_private (klass, sizeof (GvcMixerSinkPrivate)); +} + +static void +gvc_mixer_sink_init (GvcMixerSink *sink) +{ + sink->priv = GVC_MIXER_SINK_GET_PRIVATE (sink); +} + +static void +gvc_mixer_sink_finalize (GObject *object) +{ + GvcMixerSink *mixer_sink; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_SINK (object)); + + mixer_sink = GVC_MIXER_SINK (object); + + g_return_if_fail (mixer_sink->priv != NULL); + G_OBJECT_CLASS (gvc_mixer_sink_parent_class)->finalize (object); +} + +/** + * gvc_mixer_sink_new: (skip) + * + * @context: + * @index: + * @channel_map: + * + * Returns: + */ +GvcMixerStream * +gvc_mixer_sink_new (pa_context *context, + guint index, + GvcChannelMap *channel_map) + +{ + GObject *object; + + object = g_object_new (GVC_TYPE_MIXER_SINK, + "pa-context", context, + "index", index, + "channel-map", channel_map, + NULL); + + return GVC_MIXER_STREAM (object); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-sink.h b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.h new file mode 100644 index 00000000..2a4a4bad --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-sink.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_SINK_H +#define __GVC_MIXER_SINK_H + +#include +#include "gvc-mixer-stream.h" + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_SINK (gvc_mixer_sink_get_type ()) +#define GVC_MIXER_SINK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_SINK, GvcMixerSink)) +#define GVC_MIXER_SINK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_SINK, GvcMixerSinkClass)) +#define GVC_IS_MIXER_SINK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_SINK)) +#define GVC_IS_MIXER_SINK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_SINK)) +#define GVC_MIXER_SINK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_SINK, GvcMixerSinkClass)) + +typedef struct GvcMixerSinkPrivate GvcMixerSinkPrivate; + +typedef struct +{ + GvcMixerStream parent; + GvcMixerSinkPrivate *priv; +} GvcMixerSink; + +typedef struct +{ + GvcMixerStreamClass parent_class; +} GvcMixerSinkClass; + +GType gvc_mixer_sink_get_type (void); + +GvcMixerStream * gvc_mixer_sink_new (pa_context *context, + guint index, + GvcChannelMap *map); + +G_END_DECLS + +#endif /* __GVC_MIXER_SINK_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c new file mode 100644 index 00000000..536487b7 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.c @@ -0,0 +1,121 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-mixer-source-output.h" + +#define GVC_MIXER_SOURCE_OUTPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_SOURCE_OUTPUT, GvcMixerSourceOutputPrivate)) + +struct GvcMixerSourceOutputPrivate +{ + gpointer dummy; +}; + +static void gvc_mixer_source_output_class_init (GvcMixerSourceOutputClass *klass); +static void gvc_mixer_source_output_init (GvcMixerSourceOutput *mixer_source_output); +static void gvc_mixer_source_output_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerSourceOutput, gvc_mixer_source_output, GVC_TYPE_MIXER_STREAM) + +static gboolean +gvc_mixer_source_output_push_volume (GvcMixerStream *stream, gpointer *op) +{ + /* FIXME: */ + *op = NULL; + return TRUE; +} + +static gboolean +gvc_mixer_source_output_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + /* FIXME: */ + return TRUE; +} + +static void +gvc_mixer_source_output_class_init (GvcMixerSourceOutputClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GvcMixerStreamClass *stream_class = GVC_MIXER_STREAM_CLASS (klass); + + object_class->finalize = gvc_mixer_source_output_finalize; + + stream_class->push_volume = gvc_mixer_source_output_push_volume; + stream_class->change_is_muted = gvc_mixer_source_output_change_is_muted; + + g_type_class_add_private (klass, sizeof (GvcMixerSourceOutputPrivate)); +} + +static void +gvc_mixer_source_output_init (GvcMixerSourceOutput *source_output) +{ + source_output->priv = GVC_MIXER_SOURCE_OUTPUT_GET_PRIVATE (source_output); + +} + +static void +gvc_mixer_source_output_finalize (GObject *object) +{ + GvcMixerSourceOutput *mixer_source_output; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_SOURCE_OUTPUT (object)); + + mixer_source_output = GVC_MIXER_SOURCE_OUTPUT (object); + + g_return_if_fail (mixer_source_output->priv != NULL); + G_OBJECT_CLASS (gvc_mixer_source_output_parent_class)->finalize (object); +} + +/** + * gvc_mixer_source_output_new: (skip) + * + * @context: + * @index: + * @channel_map: + * + * Returns: + */ +GvcMixerStream * +gvc_mixer_source_output_new (pa_context *context, + guint index, + GvcChannelMap *channel_map) +{ + GObject *object; + + object = g_object_new (GVC_TYPE_MIXER_SOURCE_OUTPUT, + "pa-context", context, + "index", index, + "channel-map", channel_map, + NULL); + + return GVC_MIXER_STREAM (object); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.h b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.h new file mode 100644 index 00000000..2283e3b6 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source-output.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_SOURCE_OUTPUT_H +#define __GVC_MIXER_SOURCE_OUTPUT_H + +#include +#include "gvc-mixer-stream.h" + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_SOURCE_OUTPUT (gvc_mixer_source_output_get_type ()) +#define GVC_MIXER_SOURCE_OUTPUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_SOURCE_OUTPUT, GvcMixerSourceOutput)) +#define GVC_MIXER_SOURCE_OUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_SOURCE_OUTPUT, GvcMixerSourceOutputClass)) +#define GVC_IS_MIXER_SOURCE_OUTPUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_SOURCE_OUTPUT)) +#define GVC_IS_MIXER_SOURCE_OUTPUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_SOURCE_OUTPUT)) +#define GVC_MIXER_SOURCE_OUTPUT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_SOURCE_OUTPUT, GvcMixerSourceOutputClass)) + +typedef struct GvcMixerSourceOutputPrivate GvcMixerSourceOutputPrivate; + +typedef struct +{ + GvcMixerStream parent; + GvcMixerSourceOutputPrivate *priv; +} GvcMixerSourceOutput; + +typedef struct +{ + GvcMixerStreamClass parent_class; +} GvcMixerSourceOutputClass; + +GType gvc_mixer_source_output_get_type (void); + +GvcMixerStream * gvc_mixer_source_output_new (pa_context *context, + guint index, + GvcChannelMap *map); + +G_END_DECLS + +#endif /* __GVC_MIXER_SOURCE_OUTPUT_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source.c b/plugins/media-keys/cut-n-paste/gvc-mixer-source.c new file mode 100644 index 00000000..dd2d0b40 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source.c @@ -0,0 +1,196 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-mixer-source.h" +#include "gvc-mixer-stream-private.h" +#include "gvc-channel-map-private.h" + +#define GVC_MIXER_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_SOURCE, GvcMixerSourcePrivate)) + +struct GvcMixerSourcePrivate +{ + gpointer dummy; +}; + +static void gvc_mixer_source_class_init (GvcMixerSourceClass *klass); +static void gvc_mixer_source_init (GvcMixerSource *mixer_source); +static void gvc_mixer_source_finalize (GObject *object); + +G_DEFINE_TYPE (GvcMixerSource, gvc_mixer_source, GVC_TYPE_MIXER_STREAM) + +static gboolean +gvc_mixer_source_push_volume (GvcMixerStream *stream, gpointer *op) +{ + pa_operation *o; + guint index; + const GvcChannelMap *map; + pa_context *context; + const pa_cvolume *cv; + + index = gvc_mixer_stream_get_index (stream); + + map = gvc_mixer_stream_get_channel_map (stream); + + /* set the volume */ + cv = gvc_channel_map_get_cvolume (map); + + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_source_volume_by_index (context, + index, + cv, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_source_volume_by_index() failed: %s", pa_strerror(pa_context_errno(context))); + return FALSE; + } + + *op = o; + + return TRUE; +} + +static gboolean +gvc_mixer_source_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + pa_operation *o; + guint index; + pa_context *context; + + index = gvc_mixer_stream_get_index (stream); + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_source_mute_by_index (context, + index, + is_muted, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_source_mute_by_index() failed: %s", pa_strerror(pa_context_errno(context))); + return FALSE; + } + + pa_operation_unref(o); + + return TRUE; +} + +static gboolean +gvc_mixer_source_change_port (GvcMixerStream *stream, + const char *port) +{ + pa_operation *o; + guint index; + pa_context *context; + + index = gvc_mixer_stream_get_index (stream); + context = gvc_mixer_stream_get_pa_context (stream); + + o = pa_context_set_source_port_by_index (context, + index, + port, + NULL, + NULL); + + if (o == NULL) { + g_warning ("pa_context_set_source_port_by_index() failed: %s", pa_strerror(pa_context_errno(context))); + return FALSE; + } + + pa_operation_unref(o); + + return TRUE; +} + +static void +gvc_mixer_source_class_init (GvcMixerSourceClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GvcMixerStreamClass *stream_class = GVC_MIXER_STREAM_CLASS (klass); + + object_class->finalize = gvc_mixer_source_finalize; + + stream_class->push_volume = gvc_mixer_source_push_volume; + stream_class->change_is_muted = gvc_mixer_source_change_is_muted; + stream_class->change_port = gvc_mixer_source_change_port; + + g_type_class_add_private (klass, sizeof (GvcMixerSourcePrivate)); +} + +static void +gvc_mixer_source_init (GvcMixerSource *source) +{ + source->priv = GVC_MIXER_SOURCE_GET_PRIVATE (source); +} + +static void +gvc_mixer_source_finalize (GObject *object) +{ + GvcMixerSource *mixer_source; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_SOURCE (object)); + + mixer_source = GVC_MIXER_SOURCE (object); + + g_return_if_fail (mixer_source->priv != NULL); + G_OBJECT_CLASS (gvc_mixer_source_parent_class)->finalize (object); +} + +/** + * gvc_mixer_source_new: (skip) + * + * @context: + * @index: + * @channel_map: + * + * Returns: + */ +GvcMixerStream * +gvc_mixer_source_new (pa_context *context, + guint index, + GvcChannelMap *channel_map) + +{ + GObject *object; + + object = g_object_new (GVC_TYPE_MIXER_SOURCE, + "pa-context", context, + "index", index, + "channel-map", channel_map, + NULL); + + return GVC_MIXER_STREAM (object); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-source.h b/plugins/media-keys/cut-n-paste/gvc-mixer-source.h new file mode 100644 index 00000000..503f1b54 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-source.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_SOURCE_H +#define __GVC_MIXER_SOURCE_H + +#include +#include "gvc-mixer-stream.h" + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_SOURCE (gvc_mixer_source_get_type ()) +#define GVC_MIXER_SOURCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_SOURCE, GvcMixerSource)) +#define GVC_MIXER_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_SOURCE, GvcMixerSourceClass)) +#define GVC_IS_MIXER_SOURCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_SOURCE)) +#define GVC_IS_MIXER_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_SOURCE)) +#define GVC_MIXER_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_SOURCE, GvcMixerSourceClass)) + +typedef struct GvcMixerSourcePrivate GvcMixerSourcePrivate; + +typedef struct +{ + GvcMixerStream parent; + GvcMixerSourcePrivate *priv; +} GvcMixerSource; + +typedef struct +{ + GvcMixerStreamClass parent_class; +} GvcMixerSourceClass; + +GType gvc_mixer_source_get_type (void); + +GvcMixerStream * gvc_mixer_source_new (pa_context *context, + guint index, + GvcChannelMap *map); + +G_END_DECLS + +#endif /* __GVC_MIXER_SOURCE_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream-private.h b/plugins/media-keys/cut-n-paste/gvc-mixer-stream-private.h new file mode 100644 index 00000000..b97ecf5e --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream-private.h @@ -0,0 +1,34 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_STREAM_PRIVATE_H +#define __GVC_MIXER_STREAM_PRIVATE_H + +#include + +#include "gvc-channel-map.h" + +G_BEGIN_DECLS + +pa_context * gvc_mixer_stream_get_pa_context (GvcMixerStream *stream); + +G_END_DECLS + +#endif /* __GVC_MIXER_STREAM_PRIVATE_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c new file mode 100644 index 00000000..0a5663ed --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.c @@ -0,0 +1,1006 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann + * + * 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 +#include +#include + +#include +#include + +#include + +#include "gvc-mixer-stream.h" +#include "gvc-mixer-stream-private.h" +#include "gvc-channel-map-private.h" + +#define GVC_MIXER_STREAM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_MIXER_STREAM, GvcMixerStreamPrivate)) + +static guint32 stream_serial = 1; + +struct GvcMixerStreamPrivate +{ + pa_context *pa_context; + guint id; + guint index; + gint card_index; + GvcChannelMap *channel_map; + char *name; + char *description; + char *application_id; + char *icon_name; + char *sysfs_path; + gboolean is_muted; + gboolean can_decibel; + gboolean is_event_stream; + gboolean is_virtual; + pa_volume_t base_volume; + pa_operation *change_volume_op; + char *port; + char *human_port; + GList *ports; +}; + +enum +{ + PROP_0, + PROP_ID, + PROP_PA_CONTEXT, + PROP_CHANNEL_MAP, + PROP_INDEX, + PROP_NAME, + PROP_DESCRIPTION, + PROP_APPLICATION_ID, + PROP_ICON_NAME, + PROP_SYSFS_PATH, + PROP_VOLUME, + PROP_DECIBEL, + PROP_IS_MUTED, + PROP_CAN_DECIBEL, + PROP_IS_EVENT_STREAM, + PROP_IS_VIRTUAL, + PROP_CARD_INDEX, + PROP_PORT, +}; + +static void gvc_mixer_stream_class_init (GvcMixerStreamClass *klass); +static void gvc_mixer_stream_init (GvcMixerStream *mixer_stream); +static void gvc_mixer_stream_finalize (GObject *object); + +G_DEFINE_ABSTRACT_TYPE (GvcMixerStream, gvc_mixer_stream, G_TYPE_OBJECT) + +static guint32 +get_next_stream_serial (void) +{ + guint32 serial; + + serial = stream_serial++; + + if ((gint32)stream_serial < 0) { + stream_serial = 1; + } + + return serial; +} + +pa_context * +gvc_mixer_stream_get_pa_context (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), 0); + return stream->priv->pa_context; +} + +guint +gvc_mixer_stream_get_index (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), 0); + return stream->priv->index; +} + +guint +gvc_mixer_stream_get_id (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), 0); + return stream->priv->id; +} + +const GvcChannelMap * +gvc_mixer_stream_get_channel_map (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->channel_map; +} + +/** + * gvc_mixer_stream_get_volume: + * + * @stream: + * + * Returns: (type guint32) (transfer none): + */ +pa_volume_t +gvc_mixer_stream_get_volume (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), 0); + + return (pa_volume_t) gvc_channel_map_get_volume(stream->priv->channel_map)[VOLUME]; +} + +gdouble +gvc_mixer_stream_get_decibel (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), 0); + + return pa_sw_volume_to_dB( + (pa_volume_t) gvc_channel_map_get_volume(stream->priv->channel_map)[VOLUME]); +} + +/** + * gvc_mixer_stream_set_volume: + * + * @stream: + * @volume: (type guint32): + * + * Returns: + */ +gboolean +gvc_mixer_stream_set_volume (GvcMixerStream *stream, + pa_volume_t volume) +{ + pa_cvolume cv; + + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + cv = *gvc_channel_map_get_cvolume(stream->priv->channel_map); + pa_cvolume_scale(&cv, volume); + + if (!pa_cvolume_equal(gvc_channel_map_get_cvolume(stream->priv->channel_map), &cv)) { + gvc_channel_map_volume_changed(stream->priv->channel_map, &cv, FALSE); + g_object_notify (G_OBJECT (stream), "volume"); + return TRUE; + } + + return FALSE; +} + +gboolean +gvc_mixer_stream_set_decibel (GvcMixerStream *stream, + gdouble db) +{ + pa_cvolume cv; + + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + cv = *gvc_channel_map_get_cvolume(stream->priv->channel_map); + pa_cvolume_scale(&cv, pa_sw_volume_from_dB(db)); + + if (!pa_cvolume_equal(gvc_channel_map_get_cvolume(stream->priv->channel_map), &cv)) { + gvc_channel_map_volume_changed(stream->priv->channel_map, &cv, FALSE); + g_object_notify (G_OBJECT (stream), "volume"); + } + + return TRUE; +} + +gboolean +gvc_mixer_stream_get_is_muted (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + return stream->priv->is_muted; +} + +gboolean +gvc_mixer_stream_get_can_decibel (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + return stream->priv->can_decibel; +} + +gboolean +gvc_mixer_stream_set_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + if (is_muted != stream->priv->is_muted) { + stream->priv->is_muted = is_muted; + g_object_notify (G_OBJECT (stream), "is-muted"); + } + + return TRUE; +} + +gboolean +gvc_mixer_stream_set_can_decibel (GvcMixerStream *stream, + gboolean can_decibel) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + if (can_decibel != stream->priv->can_decibel) { + stream->priv->can_decibel = can_decibel; + g_object_notify (G_OBJECT (stream), "can-decibel"); + } + + return TRUE; +} + +const char * +gvc_mixer_stream_get_name (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->name; +} + +const char * +gvc_mixer_stream_get_description (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->description; +} + +gboolean +gvc_mixer_stream_set_name (GvcMixerStream *stream, + const char *name) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + g_free (stream->priv->name); + stream->priv->name = g_strdup (name); + g_object_notify (G_OBJECT (stream), "name"); + + return TRUE; +} + +gboolean +gvc_mixer_stream_set_description (GvcMixerStream *stream, + const char *description) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + g_free (stream->priv->description); + stream->priv->description = g_strdup (description); + g_object_notify (G_OBJECT (stream), "description"); + + return TRUE; +} + +gboolean +gvc_mixer_stream_is_event_stream (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + return stream->priv->is_event_stream; +} + +gboolean +gvc_mixer_stream_set_is_event_stream (GvcMixerStream *stream, + gboolean is_event_stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + stream->priv->is_event_stream = is_event_stream; + g_object_notify (G_OBJECT (stream), "is-event-stream"); + + return TRUE; +} + +gboolean +gvc_mixer_stream_is_virtual (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + return stream->priv->is_virtual; +} + +gboolean +gvc_mixer_stream_set_is_virtual (GvcMixerStream *stream, + gboolean is_virtual) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + stream->priv->is_virtual = is_virtual; + g_object_notify (G_OBJECT (stream), "is-virtual"); + + return TRUE; +} + +const char * +gvc_mixer_stream_get_application_id (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->application_id; +} + +gboolean +gvc_mixer_stream_set_application_id (GvcMixerStream *stream, + const char *application_id) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + g_free (stream->priv->application_id); + stream->priv->application_id = g_strdup (application_id); + g_object_notify (G_OBJECT (stream), "application-id"); + + return TRUE; +} + +static void +on_channel_map_volume_changed (GvcChannelMap *channel_map, + gboolean set, + GvcMixerStream *stream) +{ + if (set == TRUE) + gvc_mixer_stream_push_volume (stream); + + g_object_notify (G_OBJECT (stream), "volume"); +} + +static gboolean +gvc_mixer_stream_set_channel_map (GvcMixerStream *stream, + GvcChannelMap *channel_map) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + if (channel_map != NULL) { + g_object_ref (channel_map); + } + + if (stream->priv->channel_map != NULL) { + g_signal_handlers_disconnect_by_func (stream->priv->channel_map, + on_channel_map_volume_changed, + stream); + g_object_unref (stream->priv->channel_map); + } + + stream->priv->channel_map = channel_map; + + if (stream->priv->channel_map != NULL) { + g_signal_connect (stream->priv->channel_map, + "volume-changed", + G_CALLBACK (on_channel_map_volume_changed), + stream); + + g_object_notify (G_OBJECT (stream), "channel-map"); + } + + return TRUE; +} + +const char * +gvc_mixer_stream_get_icon_name (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->icon_name; +} + +const char * +gvc_mixer_stream_get_sysfs_path (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->sysfs_path; +} + +/** + * gvc_mixer_stream_get_gicon: + * @stream: a #GvcMixerStream + * + * Returns: (transfer full): a new #GIcon + */ +GIcon * +gvc_mixer_stream_get_gicon (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + if (stream->priv->icon_name == NULL) + return NULL; + return g_themed_icon_new_with_default_fallbacks (stream->priv->icon_name); +} + +gboolean +gvc_mixer_stream_set_icon_name (GvcMixerStream *stream, + const char *icon_name) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + g_free (stream->priv->icon_name); + stream->priv->icon_name = g_strdup (icon_name); + g_object_notify (G_OBJECT (stream), "icon-name"); + + return TRUE; +} + +gboolean +gvc_mixer_stream_set_sysfs_path (GvcMixerStream *stream, + const char *sysfs_path) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + g_free (stream->priv->sysfs_path); + stream->priv->sysfs_path = g_strdup (sysfs_path); + g_object_notify (G_OBJECT (stream), "sysfs-path"); + + return TRUE; +} + +/** + * gvc_mixer_stream_get_base_volume: + * + * @stream: + * + * Returns: (type guint32) (transfer none): + */ +pa_volume_t +gvc_mixer_stream_get_base_volume (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), 0); + + return stream->priv->base_volume; +} + +/** + * gvc_mixer_stream_set_base_volume: + * + * @stream: + * @base_volume: (type guint32): + * + * Returns: + */ +gboolean +gvc_mixer_stream_set_base_volume (GvcMixerStream *stream, + pa_volume_t base_volume) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + stream->priv->base_volume = base_volume; + + return TRUE; +} + +const GvcMixerStreamPort * +gvc_mixer_stream_get_port (GvcMixerStream *stream) +{ + GList *l; + + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + g_return_val_if_fail (stream->priv->ports != NULL, NULL); + + for (l = stream->priv->ports; l != NULL; l = l->next) { + GvcMixerStreamPort *p = l->data; + if (g_strcmp0 (stream->priv->port, p->port) == 0) { + return p; + } + } + + g_assert_not_reached (); + + return NULL; +} + +gboolean +gvc_mixer_stream_set_port (GvcMixerStream *stream, + const char *port) +{ + GList *l; + + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + g_return_val_if_fail (stream->priv->ports != NULL, FALSE); + + g_free (stream->priv->port); + stream->priv->port = g_strdup (port); + + g_free (stream->priv->human_port); + stream->priv->human_port = NULL; + + for (l = stream->priv->ports; l != NULL; l = l->next) { + GvcMixerStreamPort *p = l->data; + if (g_str_equal (stream->priv->port, p->port)) { + stream->priv->human_port = g_strdup (p->human_port); + break; + } + } + + g_object_notify (G_OBJECT (stream), "port"); + + return TRUE; +} + +gboolean +gvc_mixer_stream_change_port (GvcMixerStream *stream, + const char *port) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + return GVC_MIXER_STREAM_GET_CLASS (stream)->change_port (stream, port); +} + +/** + * gvc_mixer_stream_get_ports: + * + * Return value: (transfer none) (element-type GvcMixerStreamPort): + */ +const GList * +gvc_mixer_stream_get_ports (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), NULL); + return stream->priv->ports; +} + +static int +sort_ports (GvcMixerStreamPort *a, + GvcMixerStreamPort *b) +{ + if (a->priority == b->priority) + return 0; + if (a->priority > b->priority) + return 1; + return -1; +} + +/** + * gvc_mixer_stream_set_ports: + * @ports: (transfer full) (element-type GvcMixerStreamPort): + */ +gboolean +gvc_mixer_stream_set_ports (GvcMixerStream *stream, + GList *ports) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + g_return_val_if_fail (stream->priv->ports == NULL, FALSE); + + stream->priv->ports = g_list_sort (ports, (GCompareFunc) sort_ports); + + return TRUE; +} + +gint +gvc_mixer_stream_get_card_index (GvcMixerStream *stream) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), PA_INVALID_INDEX); + return stream->priv->card_index; +} + +gboolean +gvc_mixer_stream_set_card_index (GvcMixerStream *stream, + gint card_index) +{ + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + stream->priv->card_index = card_index; + g_object_notify (G_OBJECT (stream), "card-index"); + + return TRUE; +} + +static void +gvc_mixer_stream_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GvcMixerStream *self = GVC_MIXER_STREAM (object); + + switch (prop_id) { + case PROP_PA_CONTEXT: + self->priv->pa_context = g_value_get_pointer (value); + break; + case PROP_INDEX: + self->priv->index = g_value_get_ulong (value); + break; + case PROP_ID: + self->priv->id = g_value_get_ulong (value); + break; + case PROP_CHANNEL_MAP: + gvc_mixer_stream_set_channel_map (self, g_value_get_object (value)); + break; + case PROP_NAME: + gvc_mixer_stream_set_name (self, g_value_get_string (value)); + break; + case PROP_DESCRIPTION: + gvc_mixer_stream_set_description (self, g_value_get_string (value)); + break; + case PROP_APPLICATION_ID: + gvc_mixer_stream_set_application_id (self, g_value_get_string (value)); + break; + case PROP_ICON_NAME: + gvc_mixer_stream_set_icon_name (self, g_value_get_string (value)); + break; + case PROP_SYSFS_PATH: + gvc_mixer_stream_set_sysfs_path (self, g_value_get_string (value)); + break; + case PROP_VOLUME: + gvc_mixer_stream_set_volume (self, g_value_get_ulong (value)); + break; + case PROP_DECIBEL: + gvc_mixer_stream_set_decibel (self, g_value_get_double (value)); + break; + case PROP_IS_MUTED: + gvc_mixer_stream_set_is_muted (self, g_value_get_boolean (value)); + break; + case PROP_IS_EVENT_STREAM: + gvc_mixer_stream_set_is_event_stream (self, g_value_get_boolean (value)); + break; + case PROP_IS_VIRTUAL: + gvc_mixer_stream_set_is_virtual (self, g_value_get_boolean (value)); + break; + case PROP_CAN_DECIBEL: + gvc_mixer_stream_set_can_decibel (self, g_value_get_boolean (value)); + break; + case PROP_PORT: + gvc_mixer_stream_set_port (self, g_value_get_string (value)); + break; + case PROP_CARD_INDEX: + self->priv->card_index = g_value_get_long (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gvc_mixer_stream_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GvcMixerStream *self = GVC_MIXER_STREAM (object); + + switch (prop_id) { + case PROP_PA_CONTEXT: + g_value_set_pointer (value, self->priv->pa_context); + break; + case PROP_INDEX: + g_value_set_ulong (value, self->priv->index); + break; + case PROP_ID: + g_value_set_ulong (value, self->priv->id); + break; + case PROP_CHANNEL_MAP: + g_value_set_object (value, self->priv->channel_map); + break; + case PROP_NAME: + g_value_set_string (value, self->priv->name); + break; + case PROP_DESCRIPTION: + g_value_set_string (value, self->priv->description); + break; + case PROP_APPLICATION_ID: + g_value_set_string (value, self->priv->application_id); + break; + case PROP_ICON_NAME: + g_value_set_string (value, self->priv->icon_name); + break; + case PROP_SYSFS_PATH: + g_value_set_string (value, self->priv->sysfs_path); + break; + case PROP_VOLUME: + g_value_set_ulong (value, + pa_cvolume_max(gvc_channel_map_get_cvolume(self->priv->channel_map))); + break; + case PROP_DECIBEL: + g_value_set_double (value, + pa_sw_volume_to_dB(pa_cvolume_max(gvc_channel_map_get_cvolume(self->priv->channel_map)))); + break; + case PROP_IS_MUTED: + g_value_set_boolean (value, self->priv->is_muted); + break; + case PROP_IS_EVENT_STREAM: + g_value_set_boolean (value, self->priv->is_event_stream); + break; + case PROP_IS_VIRTUAL: + g_value_set_boolean (value, self->priv->is_virtual); + break; + case PROP_CAN_DECIBEL: + g_value_set_boolean (value, self->priv->can_decibel); + break; + case PROP_PORT: + g_value_set_string (value, self->priv->port); + break; + case PROP_CARD_INDEX: + g_value_set_long (value, self->priv->card_index); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gvc_mixer_stream_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params) +{ + GObject *object; + GvcMixerStream *self; + + object = G_OBJECT_CLASS (gvc_mixer_stream_parent_class)->constructor (type, n_construct_properties, construct_params); + + self = GVC_MIXER_STREAM (object); + + self->priv->id = get_next_stream_serial (); + + return object; +} + +static gboolean +gvc_mixer_stream_real_change_port (GvcMixerStream *stream, + const char *port) +{ + return FALSE; +} + +static gboolean +gvc_mixer_stream_real_push_volume (GvcMixerStream *stream, gpointer *op) +{ + return FALSE; +} + +static gboolean +gvc_mixer_stream_real_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + return FALSE; +} + +gboolean +gvc_mixer_stream_push_volume (GvcMixerStream *stream) +{ + pa_operation *op; + gboolean ret; + + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + + if (stream->priv->is_event_stream != FALSE) + return TRUE; + + g_debug ("Pushing new volume to stream '%s' (%s)", + stream->priv->description, stream->priv->name); + + ret = GVC_MIXER_STREAM_GET_CLASS (stream)->push_volume (stream, (gpointer *) &op); + if (ret) { + if (stream->priv->change_volume_op != NULL) + pa_operation_unref (stream->priv->change_volume_op); + stream->priv->change_volume_op = op; + } + return ret; +} + +gboolean +gvc_mixer_stream_change_is_muted (GvcMixerStream *stream, + gboolean is_muted) +{ + gboolean ret; + g_return_val_if_fail (GVC_IS_MIXER_STREAM (stream), FALSE); + ret = GVC_MIXER_STREAM_GET_CLASS (stream)->change_is_muted (stream, is_muted); + return ret; +} + +gboolean +gvc_mixer_stream_is_running (GvcMixerStream *stream) +{ + if (stream->priv->change_volume_op == NULL) + return FALSE; + + if ((pa_operation_get_state(stream->priv->change_volume_op) == PA_OPERATION_RUNNING)) + return TRUE; + + pa_operation_unref(stream->priv->change_volume_op); + stream->priv->change_volume_op = NULL; + + return FALSE; +} + +static void +gvc_mixer_stream_class_init (GvcMixerStreamClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->constructor = gvc_mixer_stream_constructor; + gobject_class->finalize = gvc_mixer_stream_finalize; + gobject_class->set_property = gvc_mixer_stream_set_property; + gobject_class->get_property = gvc_mixer_stream_get_property; + + klass->push_volume = gvc_mixer_stream_real_push_volume; + klass->change_port = gvc_mixer_stream_real_change_port; + klass->change_is_muted = gvc_mixer_stream_real_change_is_muted; + + g_object_class_install_property (gobject_class, + PROP_INDEX, + g_param_spec_ulong ("index", + "Index", + "The index for this stream", + 0, G_MAXULONG, 0, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (gobject_class, + PROP_ID, + g_param_spec_ulong ("id", + "id", + "The id for this stream", + 0, G_MAXULONG, 0, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (gobject_class, + PROP_CHANNEL_MAP, + g_param_spec_object ("channel-map", + "channel map", + "The channel map for this stream", + GVC_TYPE_CHANNEL_MAP, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_PA_CONTEXT, + g_param_spec_pointer ("pa-context", + "PulseAudio context", + "The PulseAudio context for this stream", + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (gobject_class, + PROP_VOLUME, + g_param_spec_ulong ("volume", + "Volume", + "The volume for this stream", + 0, G_MAXULONG, 0, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_DECIBEL, + g_param_spec_double ("decibel", + "Decibel", + "The decibel level for this stream", + -G_MAXDOUBLE, G_MAXDOUBLE, 0, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + + g_object_class_install_property (gobject_class, + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name to display for this stream", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_DESCRIPTION, + g_param_spec_string ("description", + "Description", + "Description to display for this stream", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_APPLICATION_ID, + g_param_spec_string ("application-id", + "Application identifier", + "Application identifier for this stream", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_ICON_NAME, + g_param_spec_string ("icon-name", + "Icon Name", + "Name of icon to display for this stream", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_SYSFS_PATH, + g_param_spec_string ("sysfs-path", + "Sysfs path", + "Sysfs path for the device associated with this stream", + NULL, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_IS_MUTED, + g_param_spec_boolean ("is-muted", + "is muted", + "Whether stream is muted", + FALSE, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_CAN_DECIBEL, + g_param_spec_boolean ("can-decibel", + "can decibel", + "Whether stream volume can be converted to decibel units", + FALSE, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_IS_EVENT_STREAM, + g_param_spec_boolean ("is-event-stream", + "is event stream", + "Whether stream's role is to play an event", + FALSE, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_IS_VIRTUAL, + g_param_spec_boolean ("is-virtual", + "is virtual stream", + "Whether the stream is virtual", + FALSE, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_PORT, + g_param_spec_string ("port", + "Port", + "The name of the current port for this stream", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_CARD_INDEX, + g_param_spec_long ("card-index", + "Card index", + "The index of the card for this stream", + PA_INVALID_INDEX, G_MAXLONG, PA_INVALID_INDEX, + G_PARAM_READWRITE|G_PARAM_CONSTRUCT)); + g_type_class_add_private (klass, sizeof (GvcMixerStreamPrivate)); +} + +static void +gvc_mixer_stream_init (GvcMixerStream *stream) +{ + stream->priv = GVC_MIXER_STREAM_GET_PRIVATE (stream); +} + +static void +free_port (GvcMixerStreamPort *p) +{ + g_free (p->port); + g_free (p->human_port); + g_free (p); +} + +static void +gvc_mixer_stream_finalize (GObject *object) +{ + GvcMixerStream *mixer_stream; + + g_return_if_fail (object != NULL); + g_return_if_fail (GVC_IS_MIXER_STREAM (object)); + + mixer_stream = GVC_MIXER_STREAM (object); + + g_return_if_fail (mixer_stream->priv != NULL); + + g_object_unref (mixer_stream->priv->channel_map); + mixer_stream->priv->channel_map = NULL; + + g_free (mixer_stream->priv->name); + mixer_stream->priv->name = NULL; + + g_free (mixer_stream->priv->description); + mixer_stream->priv->description = NULL; + + g_free (mixer_stream->priv->application_id); + mixer_stream->priv->application_id = NULL; + + g_free (mixer_stream->priv->icon_name); + mixer_stream->priv->icon_name = NULL; + + g_free (mixer_stream->priv->sysfs_path); + mixer_stream->priv->sysfs_path = NULL; + + g_free (mixer_stream->priv->port); + mixer_stream->priv->port = NULL; + + g_free (mixer_stream->priv->human_port); + mixer_stream->priv->human_port = NULL; + + g_list_foreach (mixer_stream->priv->ports, (GFunc) free_port, NULL); + g_list_free (mixer_stream->priv->ports); + mixer_stream->priv->ports = NULL; + + if (mixer_stream->priv->change_volume_op) { + pa_operation_unref(mixer_stream->priv->change_volume_op); + mixer_stream->priv->change_volume_op = NULL; + } + + G_OBJECT_CLASS (gvc_mixer_stream_parent_class)->finalize (object); +} diff --git a/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h new file mode 100644 index 00000000..ad79024e --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-mixer-stream.h @@ -0,0 +1,130 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_MIXER_STREAM_H +#define __GVC_MIXER_STREAM_H + +#include +#include "gvc-pulseaudio-fake.h" +#include "gvc-channel-map.h" +#include + +G_BEGIN_DECLS + +#define GVC_TYPE_MIXER_STREAM (gvc_mixer_stream_get_type ()) +#define GVC_MIXER_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GVC_TYPE_MIXER_STREAM, GvcMixerStream)) +#define GVC_MIXER_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GVC_TYPE_MIXER_STREAM, GvcMixerStreamClass)) +#define GVC_IS_MIXER_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GVC_TYPE_MIXER_STREAM)) +#define GVC_IS_MIXER_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GVC_TYPE_MIXER_STREAM)) +#define GVC_MIXER_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GVC_TYPE_MIXER_STREAM, GvcMixerStreamClass)) + +typedef struct GvcMixerStreamPrivate GvcMixerStreamPrivate; + +typedef struct +{ + GObject parent; + GvcMixerStreamPrivate *priv; +} GvcMixerStream; + +typedef struct +{ + GObjectClass parent_class; + + /* vtable */ + gboolean (*push_volume) (GvcMixerStream *stream, + gpointer *operation); + gboolean (*change_is_muted) (GvcMixerStream *stream, + gboolean is_muted); + gboolean (*change_port) (GvcMixerStream *stream, + const char *port); +} GvcMixerStreamClass; + +typedef struct +{ + char *port; + char *human_port; + guint priority; +} GvcMixerStreamPort; + +GType gvc_mixer_stream_get_type (void); + +guint gvc_mixer_stream_get_index (GvcMixerStream *stream); +guint gvc_mixer_stream_get_id (GvcMixerStream *stream); +const GvcChannelMap *gvc_mixer_stream_get_channel_map(GvcMixerStream *stream); +const GvcMixerStreamPort *gvc_mixer_stream_get_port (GvcMixerStream *stream); +const GList * gvc_mixer_stream_get_ports (GvcMixerStream *stream); +gboolean gvc_mixer_stream_change_port (GvcMixerStream *stream, + const char *port); + +pa_volume_t gvc_mixer_stream_get_volume (GvcMixerStream *stream); +gdouble gvc_mixer_stream_get_decibel (GvcMixerStream *stream); +gboolean gvc_mixer_stream_push_volume (GvcMixerStream *stream); +pa_volume_t gvc_mixer_stream_get_base_volume (GvcMixerStream *stream); + +gboolean gvc_mixer_stream_get_is_muted (GvcMixerStream *stream); +gboolean gvc_mixer_stream_get_can_decibel (GvcMixerStream *stream); +gboolean gvc_mixer_stream_change_is_muted (GvcMixerStream *stream, + gboolean is_muted); +gboolean gvc_mixer_stream_is_running (GvcMixerStream *stream); +const char * gvc_mixer_stream_get_name (GvcMixerStream *stream); +const char * gvc_mixer_stream_get_icon_name (GvcMixerStream *stream); +const char * gvc_mixer_stream_get_sysfs_path (GvcMixerStream *stream); +GIcon * gvc_mixer_stream_get_gicon (GvcMixerStream *stream); +const char * gvc_mixer_stream_get_description (GvcMixerStream *stream); +const char * gvc_mixer_stream_get_application_id (GvcMixerStream *stream); +gboolean gvc_mixer_stream_is_event_stream (GvcMixerStream *stream); +gboolean gvc_mixer_stream_is_virtual (GvcMixerStream *stream); +gint gvc_mixer_stream_get_card_index (GvcMixerStream *stream); + +/* private */ +gboolean gvc_mixer_stream_set_volume (GvcMixerStream *stream, + pa_volume_t volume); +gboolean gvc_mixer_stream_set_decibel (GvcMixerStream *stream, + gdouble db); +gboolean gvc_mixer_stream_set_is_muted (GvcMixerStream *stream, + gboolean is_muted); +gboolean gvc_mixer_stream_set_can_decibel (GvcMixerStream *stream, + gboolean can_decibel); +gboolean gvc_mixer_stream_set_name (GvcMixerStream *stream, + const char *name); +gboolean gvc_mixer_stream_set_description (GvcMixerStream *stream, + const char *description); +gboolean gvc_mixer_stream_set_icon_name (GvcMixerStream *stream, + const char *name); +gboolean gvc_mixer_stream_set_sysfs_path (GvcMixerStream *stream, + const char *sysfs_path); +gboolean gvc_mixer_stream_set_is_event_stream (GvcMixerStream *stream, + gboolean is_event_stream); +gboolean gvc_mixer_stream_set_is_virtual (GvcMixerStream *stream, + gboolean is_event_stream); +gboolean gvc_mixer_stream_set_application_id (GvcMixerStream *stream, + const char *application_id); +gboolean gvc_mixer_stream_set_base_volume (GvcMixerStream *stream, + pa_volume_t base_volume); +gboolean gvc_mixer_stream_set_port (GvcMixerStream *stream, + const char *port); +gboolean gvc_mixer_stream_set_ports (GvcMixerStream *stream, + GList *ports); +gboolean gvc_mixer_stream_set_card_index (GvcMixerStream *stream, + gint card_index); + +G_END_DECLS + +#endif /* __GVC_MIXER_STREAM_H */ diff --git a/plugins/media-keys/cut-n-paste/gvc-pulseaudio-fake.h b/plugins/media-keys/cut-n-paste/gvc-pulseaudio-fake.h new file mode 100644 index 00000000..ab8f6b41 --- /dev/null +++ b/plugins/media-keys/cut-n-paste/gvc-pulseaudio-fake.h @@ -0,0 +1,34 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * 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 __GVC_PULSEAUDIO_FAKE_H +#define __GVC_PULSEAUDIO_FAKE_H + +#ifdef WITH_INTROSPECTION + +#ifndef PA_API_VERSION +#define pa_channel_position_t int +#define pa_volume_t guint32 +#define pa_context gpointer +#endif /* PA_API_VERSION */ + +#endif /* WITH_INTROSPECTION */ + +#endif /* __GVC_PULSEAUDIO_FAKE_H */ diff --git a/plugins/media-keys/gsd-marshal.c b/plugins/media-keys/gsd-marshal.c new file mode 100644 index 00000000..a64ea6ba --- /dev/null +++ b/plugins/media-keys/gsd-marshal.c @@ -0,0 +1,102 @@ + +#ifndef __gsd_marshal_MARSHAL_H__ +#define __gsd_marshal_MARSHAL_H__ + +#include + +G_BEGIN_DECLS + +#ifdef G_ENABLE_DEBUG +#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +#define g_marshal_value_peek_char(v) g_value_get_schar (v) +#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) +#define g_marshal_value_peek_int(v) g_value_get_int (v) +#define g_marshal_value_peek_uint(v) g_value_get_uint (v) +#define g_marshal_value_peek_long(v) g_value_get_long (v) +#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) +#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) +#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) +#define g_marshal_value_peek_enum(v) g_value_get_enum (v) +#define g_marshal_value_peek_flags(v) g_value_get_flags (v) +#define g_marshal_value_peek_float(v) g_value_get_float (v) +#define g_marshal_value_peek_double(v) g_value_get_double (v) +#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) +#define g_marshal_value_peek_param(v) g_value_get_param (v) +#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) +#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) +#define g_marshal_value_peek_object(v) g_value_get_object (v) +#define g_marshal_value_peek_variant(v) g_value_get_variant (v) +#else /* !G_ENABLE_DEBUG */ +/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. + * Do not access GValues directly in your code. Instead, use the + * g_value_get_*() functions + */ +#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int +#define g_marshal_value_peek_char(v) (v)->data[0].v_int +#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint +#define g_marshal_value_peek_int(v) (v)->data[0].v_int +#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint +#define g_marshal_value_peek_long(v) (v)->data[0].v_long +#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 +#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 +#define g_marshal_value_peek_enum(v) (v)->data[0].v_long +#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong +#define g_marshal_value_peek_float(v) (v)->data[0].v_float +#define g_marshal_value_peek_double(v) (v)->data[0].v_double +#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer +#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer +#endif /* !G_ENABLE_DEBUG */ + + +/* VOID:STRING,STRING (gsd-marshal.list:1) */ +G_GNUC_INTERNAL void gsd_marshal_VOID__STRING_STRING (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +void +gsd_marshal_VOID__STRING_STRING (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer data2); + register GMarshalFunc_VOID__STRING_STRING callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_string (param_values + 1), + g_marshal_value_peek_string (param_values + 2), + data2); +} + +G_END_DECLS + +#endif /* __gsd_marshal_MARSHAL_H__ */ + diff --git a/plugins/media-keys/gsd-marshal.h b/plugins/media-keys/gsd-marshal.h new file mode 100644 index 00000000..f48b067d --- /dev/null +++ b/plugins/media-keys/gsd-marshal.h @@ -0,0 +1,20 @@ + +#ifndef __gsd_marshal_MARSHAL_H__ +#define __gsd_marshal_MARSHAL_H__ + +#include + +G_BEGIN_DECLS + +/* VOID:STRING,STRING (gsd-marshal.list:1) */ +G_GNUC_INTERNAL void gsd_marshal_VOID__STRING_STRING (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +G_END_DECLS + +#endif /* __gsd_marshal_MARSHAL_H__ */ + diff --git a/plugins/media-keys/gsd-marshal.list b/plugins/media-keys/gsd-marshal.list new file mode 100644 index 00000000..72f99379 --- /dev/null +++ b/plugins/media-keys/gsd-marshal.list @@ -0,0 +1 @@ +VOID:STRING,STRING diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c new file mode 100644 index 00000000..4b1e99b4 --- /dev/null +++ b/plugins/media-keys/gsd-media-keys-manager.c @@ -0,0 +1,2753 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001-2003 Bastien Nocera + * Copyright (C) 2006-2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_GUDEV +#include +#endif + +#include "gnome-settings-profile.h" +#include "gsd-marshal.h" +#include "gsd-media-keys-manager.h" + +#include "shortcuts-list.h" +#include "gsd-osd-window.h" +#include "gsd-input-helper.h" +#include "gsd-power-helper.h" +#include "gsd-enums.h" + +#include +#include +#include "gvc-mixer-control.h" + +#include + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_DBUS_NAME "org.gnome.SettingsDaemon" +#define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys" +#define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +#define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring" +#define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon" +#define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon" + +#define CUSTOM_BINDING_SCHEMA SETTINGS_BINDING_DIR ".custom-keybinding" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +#define SETTINGS_INTERFACE_DIR "org.gnome.desktop.interface" +#define SETTINGS_POWER_DIR "org.gnome.settings-daemon.plugins.power" +#define SETTINGS_XSETTINGS_DIR "org.gnome.settings-daemon.plugins.xsettings" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" +#define TOUCHPAD_ENABLED_KEY "touchpad-enabled" +#define HIGH_CONTRAST "HighContrast" + +#define VOLUME_STEP 6 /* percents for one volume button press */ +#define MAX_VOLUME 65536.0 + +#define GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerPrivate)) + +typedef struct { + char *application; + char *name; + guint32 time; + guint watch_id; +} MediaPlayer; + +typedef struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; + char *custom_path; + char *custom_command; + Key *key; +} MediaKey; + +struct GsdMediaKeysManagerPrivate +{ + /* Volume bits */ + GvcMixerControl *volume; + GvcMixerStream *stream; + ca_context *ca; + GtkSettings *gtksettings; +#ifdef HAVE_GUDEV + GHashTable *streams; /* key = X device ID, value = stream id */ + GUdevClient *udev_client; +#endif /* HAVE_GUDEV */ + + GtkWidget *dialog; + GSettings *settings; + GHashTable *custom_settings; + + GPtrArray *keys; + + /* HighContrast theme settings */ + GSettings *interface_settings; + char *icon_theme; + char *gtk_theme; + + /* Power stuff */ + GSettings *power_settings; + GDBusProxy *upower_proxy; + GDBusProxy *power_screen_proxy; + GDBusProxy *power_keyboard_proxy; + + /* Multihead stuff */ + GdkScreen *current_screen; + GSList *screens; + int opcode; + + GList *media_players; + + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + guint start_idle_id; + + /* Ubuntu notifications */ + NotifyNotification *volume_notification; + NotifyNotification *brightness_notification; + NotifyNotification *kb_backlight_notification; +}; + +static void gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass); +static void gsd_media_keys_manager_init (GsdMediaKeysManager *media_keys_manager); +static void gsd_media_keys_manager_finalize (GObject *object); +static void register_manager (GsdMediaKeysManager *manager); +static void custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager); +G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous" +#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only" +#define NOTIFY_HINT_TRUE "true" + +typedef struct { + GsdMediaKeysManager *manager; + MediaKeyType type; + guint old_percentage; + +} GsdBrightnessActionData; + +static const char *volume_icons[] = { + "notification-audio-volume-muted", + "notification-audio-volume-low", + "notification-audio-volume-medium", + "notification-audio-volume-high", + NULL +}; + +static const char *brightness_icons[] = { + "notification-display-brightness-off", + "notification-display-brightness-low", + "notification-display-brightness-medium", + "notification-display-brightness-high", + "notification-display-brightness-full", + NULL +}; + +static const char *kb_backlight_icons[] = { + "notification-keyboard-brightness-off", + "notification-keyboard-brightness-low", + "notification-keyboard-brightness-medium", + "notification-keyboard-brightness-high", + "notification-keyboard-brightness-full", + NULL +}; + +static const char * +calculate_icon_name (gint value, const char **icon_names) +{ + value = CLAMP (value, 0, 100); + gint length = g_strv_length (icon_names); + gint s = (length - 1) * value / 100 + 1; + s = CLAMP (s, 1, length - 1); + + return icon_names[s]; +} + +static gboolean +ubuntu_osd_notification_is_supported (void) +{ + GList *caps; + gboolean has_cap; + + caps = notify_get_server_caps (); + has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL); + g_list_foreach (caps, (GFunc) g_free, NULL); + g_list_free (caps); + + return has_cap; +} + +static gboolean +ubuntu_osd_notification_show_icon (const char *icon, + const char *hint) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + NotifyNotification *notification = notify_notification_new (" ", "", icon); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + notify_notification_set_hint_string (notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE); + + gboolean res = notify_notification_show (notification, NULL); + g_object_unref (notification); + + return res; +} + +static gboolean +ubuntu_osd_do_notification (NotifyNotification **notification, + const char *hint, + gint value, + gboolean muted, + const char **icon_names) +{ + if (!ubuntu_osd_notification_is_supported ()) + return FALSE; + + if (!*notification) { + *notification = notify_notification_new (" ", "", NULL); + notify_notification_set_hint_string (*notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint); + } + + value = CLAMP (value, -1, 101); + const char *icon = muted ? icon_names[0] : calculate_icon_name (value, icon_names); + notify_notification_set_hint_int32 (*notification, "value", value); + notify_notification_update (*notification, " ", "", icon); + + return notify_notification_show (*notification, NULL); +} + +static gboolean +ubuntu_osd_notification_show_volume (GsdMediaKeysManager *manager, + gint value, + gboolean muted) +{ + return ubuntu_osd_do_notification (&manager->priv->volume_notification, + "volume", value, muted, volume_icons); +} + +static gboolean +ubuntu_osd_notification_show_brightness (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->brightness_notification, + "brightness", value, value <= 0, brightness_icons); +} + +static gboolean +ubuntu_osd_notification_show_kb_backlight (GsdMediaKeysManager *manager, + gint value) +{ + return ubuntu_osd_do_notification (&manager->priv->kb_backlight_notification, + "keyboard", value, value <= 0, kb_backlight_icons); +} + +static void +init_screens (GsdMediaKeysManager *manager) +{ + GdkDisplay *display; + int i; + + display = gdk_display_get_default (); + for (i = 0; i < gdk_display_get_n_screens (display); i++) { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + if (screen == NULL) { + continue; + } + manager->priv->screens = g_slist_append (manager->priv->screens, screen); + } + + manager->priv->current_screen = manager->priv->screens->data; +} + +static void +media_key_free (MediaKey *key) +{ + if (key == NULL) + return; + g_free (key->custom_path); + g_free (key->custom_command); + free_key (key->key); + g_free (key); +} + +static char * +get_term_command (GsdMediaKeysManager *manager) +{ + char *cmd_term, *cmd_args;; + char *cmd = NULL; + GSettings *settings; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + cmd_term = g_settings_get_string (settings, "exec"); + if (cmd_term[0] == '\0') + cmd_term = g_strdup ("gnome-terminal"); + + cmd_args = g_settings_get_string (settings, "exec-arg"); + if (strcmp (cmd_term, "") != 0) { + cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args); + } else { + cmd = g_strdup_printf ("%s -e", cmd_term); + } + + g_free (cmd_args); + g_free (cmd_term); + g_object_unref (settings); + + return cmd; +} + +static char ** +get_keyring_env (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant, *item; + GVariantIter *iter; + char **envp; + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_KEYRING_DBUS_NAME, + GNOME_KEYRING_DBUS_PATH, + GNOME_KEYRING_DBUS_INTERFACE, + "GetEnvironment", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call GetEnvironment on keyring daemon: %s", error->message); + g_error_free (error); + return NULL; + } + + envp = g_get_environ (); + + g_variant_get (variant, "(a{ss})", &iter); + + while ((item = g_variant_iter_next_value (iter))) { + char *key; + char *value; + + g_variant_get (item, + "{ss}", + &key, + &value); + + envp = g_environ_setenv (envp, key, value, TRUE); + + g_variant_unref (item); + g_free (key); + g_free (value); + } + + g_variant_iter_free (iter); + g_variant_unref (variant); + + return envp; +} + +static void +execute (GsdMediaKeysManager *manager, + char *cmd, + gboolean need_term) +{ + gboolean retval; + char **argv; + int argc; + char *exec; + char *term = NULL; + GError *error = NULL; + + retval = FALSE; + + if (need_term) + term = get_term_command (manager); + + if (term) { + exec = g_strdup_printf ("%s %s", term, cmd); + g_free (term); + } else { + exec = g_strdup (cmd); + } + + if (g_shell_parse_argv (exec, &argc, &argv, NULL)) { + char **envp; + + envp = get_keyring_env (manager); + + retval = g_spawn_async (g_get_home_dir (), + argv, + envp, + G_SPAWN_SEARCH_PATH, + NULL, + NULL, + NULL, + &error); + + g_strfreev (argv); + g_strfreev (envp); + } + + if (retval == FALSE) { + g_warning ("Couldn't execute command: %s: %s", exec, error->message); + g_error_free (error); + } + g_free (exec); +} + +static void +dialog_init (GsdMediaKeysManager *manager) +{ + if (manager->priv->dialog != NULL + && !gsd_osd_window_is_valid (GSD_OSD_WINDOW (manager->priv->dialog))) { + gtk_widget_destroy (manager->priv->dialog); + manager->priv->dialog = NULL; + } + + if (manager->priv->dialog == NULL) { + manager->priv->dialog = gsd_osd_window_new (); + } +} + +static void +print_key_parse_error (MediaKey *key, + const char *str) +{ + if (str == NULL || *str == '\0') + return; + if (key->settings_key != NULL) + g_debug ("Unable to parse key '%s' for GSettings entry '%s'", str, key->settings_key); + else + g_debug ("Unable to parse hard-coded key '%s'", key->hard_coded); +} + +static char * +get_key_string (GsdMediaKeysManager *manager, + MediaKey *key) +{ + if (key->settings_key != NULL) + return g_settings_get_string (manager->priv->settings, key->settings_key); + else if (key->hard_coded != NULL) + return g_strdup (key->hard_coded); + else if (key->custom_path != NULL) { + GSettings *settings; + + settings = g_hash_table_lookup (manager->priv->custom_settings, + key->custom_path); + return g_settings_get_string (settings, "binding"); + } else + g_assert_not_reached (); +} + +static gboolean +grab_media_key (MediaKey *key, + GsdMediaKeysManager *manager) +{ + char *tmp; + gboolean need_flush; + + need_flush = FALSE; + + if (key->key != NULL) { + need_flush = TRUE; + ungrab_key_unsafe (key->key, manager->priv->screens); + } + + free_key (key->key); + key->key = NULL; + + tmp = get_key_string (manager, key); + + key->key = parse_key (tmp); + if (key->key == NULL) { + print_key_parse_error (key, tmp); + g_free (tmp); + return need_flush; + } + + grab_key_unsafe (key->key, GSD_KEYGRAB_NORMAL, manager->priv->screens); + + g_free (tmp); + + return TRUE; +} + +static void +gsettings_changed_cb (GSettings *settings, + const gchar *settings_key, + GsdMediaKeysManager *manager) +{ + int i; + gboolean need_flush = TRUE; + + /* handled in gsettings_custom_changed_cb() */ + if (g_str_equal (settings_key, "custom-keybindings")) + return; + + gdk_error_trap_push (); + + /* Find the key that was modified */ + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + /* Skip over hard-coded and GConf keys */ + if (key->settings_key == NULL) + continue; + if (strcmp (settings_key, key->settings_key) == 0) { + if (grab_media_key (key, manager)) + need_flush = TRUE; + break; + } + } + + if (need_flush) + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); +} + +static MediaKey * +media_key_new_for_path (GsdMediaKeysManager *manager, + char *path) +{ + GSettings *settings; + char *command, *binding; + MediaKey *key; + + g_debug ("media_key_new_for_path: %s", path); + + settings = g_hash_table_lookup (manager->priv->custom_settings, path); + if (settings == NULL) { + settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path); + + g_signal_connect (settings, "changed", + G_CALLBACK (custom_binding_changed), manager); + g_hash_table_insert (manager->priv->custom_settings, + g_strdup (path), settings); + } + + command = g_settings_get_string (settings, "command"); + binding = g_settings_get_string (settings, "binding"); + + if (*command == '\0' && *binding == '\0') { + g_debug ("Key binding (%s) is incomplete", path); + g_free (command); + g_free (binding); + return NULL; + } + g_free (binding); + + key = g_new0 (MediaKey, 1); + key->key_type = CUSTOM_KEY; + key->custom_path = g_strdup (path); + key->custom_command = command; + + return key; +} + +static void +update_custom_binding (GsdMediaKeysManager *manager, + char *path) +{ + MediaKey *key; + int i; + + /* Remove the existing key */ + for (i = 0; i < manager->priv->keys->len; i++) { + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->custom_path == NULL) + continue; + if (strcmp (key->custom_path, path) == 0) { + g_debug ("Removing custom key binding %s", path); + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", path); + } + g_ptr_array_remove_index_fast (manager->priv->keys, i); + break; + } + } + + /* And create a new one! */ + key = media_key_new_for_path (manager, path); + if (key) { + g_debug ("Adding new custom key binding %s", path); + g_ptr_array_add (manager->priv->keys, key); + + gdk_error_trap_push (); + + grab_media_key (key, manager); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for custom key '%s'", + key->custom_path); + } +} + +static void +custom_binding_changed (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char *path; + + if (strcmp (settings_key, "name") == 0) + return; /* we don't care */ + + g_object_get (settings, "path", &path, NULL); + update_custom_binding (manager, path); + g_free (path); +} + +static void +gsettings_custom_changed_cb (GSettings *settings, + const char *settings_key, + GsdMediaKeysManager *manager) +{ + char **bindings; + int i, j, n_bindings; + + bindings = g_settings_get_strv (settings, settings_key); + n_bindings = g_strv_length (bindings); + + /* Handle additions */ + for (i = 0; i < n_bindings; i++) { + if (g_hash_table_lookup (manager->priv->custom_settings, + bindings[i])) + continue; + update_custom_binding (manager, bindings[i]); + } + + /* Handle removals */ + for (i = 0; i < manager->priv->keys->len; i++) { + gboolean found = FALSE; + MediaKey *key = g_ptr_array_index (manager->priv->keys, i); + if (key->key_type != CUSTOM_KEY) + continue; + + for (j = 0; j < n_bindings && !found; j++) + found = strcmp (bindings[j], key->custom_path) == 0; + + if (found) + continue; + + if (key->key) { + gdk_error_trap_push (); + + ungrab_key_unsafe (key->key, + manager->priv->screens); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Ungrab failed for custom key '%s'", key->custom_path); + } + g_hash_table_remove (manager->priv->custom_settings, + key->custom_path); + g_ptr_array_remove_index_fast (manager->priv->keys, i); + --i; /* make up for the removed key */ + } + g_strfreev (bindings); +} + +static void +add_key (GsdMediaKeysManager *manager, guint i) +{ + MediaKey *key; + + key = g_new0 (MediaKey, 1); + key->key_type = media_keys[i].key_type; + key->settings_key = media_keys[i].settings_key; + key->hard_coded = media_keys[i].hard_coded; + + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); +} + +static void +init_kbd (GsdMediaKeysManager *manager) +{ + char **custom_paths; + int i; + + gnome_settings_profile_start (NULL); + + gdk_error_trap_push (); + + manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free); + + /* Media keys + * Add hard-coded shortcuts first so that they can't be preempted */ + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded) + add_key (manager, i); + } + for (i = 0; i < G_N_ELEMENTS (media_keys); i++) { + if (media_keys[i].hard_coded == NULL) + add_key (manager, i); + } + + /* Custom shortcuts */ + custom_paths = g_settings_get_strv (manager->priv->settings, + "custom-keybindings"); + + for (i = 0; i < g_strv_length (custom_paths); i++) { + MediaKey *key; + + g_debug ("Setting up custom keybinding %s", custom_paths[i]); + + key = media_key_new_for_path (manager, custom_paths[i]); + if (!key) { + continue; + } + g_ptr_array_add (manager->priv->keys, key); + + grab_media_key (key, manager); + } + g_strfreev (custom_paths); + + gdk_flush (); + if (gdk_error_trap_pop ()) + g_warning ("Grab failed for some keys, another application may already have access the them."); + + gnome_settings_profile_end (NULL); +} + +static void +dialog_show (GsdMediaKeysManager *manager) +{ + int orig_w; + int orig_h; + int screen_w; + int screen_h; + int x; + int y; + GdkRectangle geometry; + int monitor; + + gtk_window_set_screen (GTK_WINDOW (manager->priv->dialog), + manager->priv->current_screen); + + /* + * get the window size + * if the window hasn't been mapped, it doesn't necessarily + * know its true size, yet, so we need to jump through hoops + */ + gtk_window_get_default_size (GTK_WINDOW (manager->priv->dialog), &orig_w, &orig_h); + + monitor = gdk_screen_get_primary_monitor (manager->priv->current_screen); + + gdk_screen_get_monitor_geometry (manager->priv->current_screen, + monitor, + &geometry); + + screen_w = geometry.width; + screen_h = geometry.height; + + x = ((screen_w - orig_w) / 2) + geometry.x; + y = geometry.y + (screen_h / 2) + (screen_h / 2 - orig_h) / 2; + + gtk_window_move (GTK_WINDOW (manager->priv->dialog), x, y); + + gtk_widget_show (manager->priv->dialog); + + gdk_display_sync (gdk_screen_get_display (manager->priv->current_screen)); +} + +static void +launch_app (GAppInfo *app_info, + gint64 timestamp) +{ + GError *error = NULL; + GdkAppLaunchContext *launch_context; + + /* setup the launch context so the startup notification is correct */ + launch_context = gdk_display_get_app_launch_context (gdk_display_get_default ()); + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + if (!g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) { + g_warning ("Could not launch '%s': %s", + g_app_info_get_commandline (app_info), + error->message); + g_error_free (error); + } + g_object_unref (launch_context); +} + +static void +do_url_action (GsdMediaKeysManager *manager, + const char *scheme, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_uri_scheme (scheme); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' scheme", scheme); + } +} + +static void +do_media_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GAppInfo *app_info; + + app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE); + if (app_info != NULL) { + launch_app (app_info, timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg"); + } +} + +static void +do_terminal_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + char *term; + + settings = g_settings_new ("org.gnome.desktop.default-applications.terminal"); + term = g_settings_get_string (settings, "exec"); + + if (term) + execute (manager, term, FALSE); + + g_free (term); + g_object_unref (settings); +} + +static void +gnome_session_shutdown (GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + /* Shouldn't happen, but you never know */ + if (manager->priv->connection == NULL) { + execute (manager, "gnome-session-quit --logout", FALSE); + return; + } + + variant = g_dbus_connection_call_sync (manager->priv->connection, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + "Shutdown", + NULL, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_warning ("Failed to call Shutdown on session manager: %s", error->message); + g_error_free (error); + return; + } + g_variant_unref (variant); +} + +static void +do_logout_action (GsdMediaKeysManager *manager) +{ + execute (manager, "gnome-session-quit --logout", FALSE); +} + +static void +do_eject_action_cb (GDrive *drive, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + g_drive_eject_with_operation_finish (drive, res, NULL); +} + +#define NO_SCORE 0 +#define SCORE_CAN_EJECT 50 +#define SCORE_HAS_MEDIA 100 +static void +do_eject_action (GsdMediaKeysManager *manager) +{ + GList *drives, *l; + GDrive *fav_drive; + guint score; + GVolumeMonitor *volume_monitor; + + volume_monitor = g_volume_monitor_get (); + + + /* Find the best drive to eject */ + fav_drive = NULL; + score = NO_SCORE; + drives = g_volume_monitor_get_connected_drives (volume_monitor); + for (l = drives; l != NULL; l = l->next) { + GDrive *drive = l->data; + + if (g_drive_can_eject (drive) == FALSE) + continue; + if (g_drive_is_media_removable (drive) == FALSE) + continue; + if (score < SCORE_CAN_EJECT) { + fav_drive = drive; + score = SCORE_CAN_EJECT; + } + if (g_drive_has_media (drive) == FALSE) + continue; + if (score < SCORE_HAS_MEDIA) { + fav_drive = drive; + score = SCORE_HAS_MEDIA; + break; + } + } + + /* Show the dialogue */ + if (!ubuntu_osd_notification_show_icon ("notification-device-eject", "Eject")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "media-eject-symbolic", + FALSE); + dialog_show (manager); + } + + /* Clean up the drive selection and exit if no suitable + * drives are found */ + if (fav_drive != NULL) + fav_drive = g_object_ref (fav_drive); + + g_list_foreach (drives, (GFunc) g_object_unref, NULL); + if (fav_drive == NULL) + return; + + /* Eject! */ + g_drive_eject_with_operation (fav_drive, G_MOUNT_UNMOUNT_FORCE, + NULL, NULL, + (GAsyncReadyCallback) do_eject_action_cb, + manager); + g_object_unref (fav_drive); + g_object_unref (volume_monitor); +} + +static void +do_home_key_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + GFile *file; + GError *error = NULL; + char *uri; + + file = g_file_new_for_path (g_get_home_dir ()); + uri = g_file_get_uri (file); + g_object_unref (file); + + if (gtk_show_uri (NULL, uri, timestamp, &error) == FALSE) { + g_warning ("Failed to launch '%s': %s", uri, error->message); + g_error_free (error); + } + g_free (uri); +} + +static void +do_execute_desktop (GsdMediaKeysManager *manager, + const char *desktop, + gint64 timestamp) +{ + GDesktopAppInfo *app_info; + + app_info = g_desktop_app_info_new (desktop); + if (app_info != NULL) { + launch_app (G_APP_INFO (app_info), timestamp); + g_object_unref (app_info); + } else { + g_warning ("Could not find application '%s'", desktop); + } +} + +static void +do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state) +{ + if (!ubuntu_osd_notification_show_icon ((!state) ? "touchpad-disabled-symbolic" : "input-touchpad-symbolic", "Touchpad")) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic", + FALSE); + dialog_show (manager); + } +} + +static void +do_touchpad_action (GsdMediaKeysManager *manager) +{ + GSettings *settings; + gboolean state; + + if (touchpad_is_present () == FALSE) { + do_touchpad_osd_action (manager, FALSE); + return; + } + + settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY); + + do_touchpad_osd_action (manager, !state); + + g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state); + g_object_unref (settings); +} + +static void +update_dialog (GsdMediaKeysManager *manager, + GvcMixerStream *stream, + guint vol, + gboolean muted, + gboolean sound_changed, + gboolean quiet) +{ + if (ubuntu_osd_notification_show_volume (manager, vol, muted)) + goto done; + + vol = CLAMP (vol, 0, 100); + + dialog_init (manager); + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (manager->priv->dialog), + muted); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), vol); + gsd_osd_window_set_action (GSD_OSD_WINDOW (manager->priv->dialog), + GSD_OSD_WINDOW_ACTION_VOLUME); + dialog_show (manager); + +done: + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) { + ca_context_change_device (manager->priv->ca, + gvc_mixer_stream_get_name (stream)); + ca_context_play (manager->priv->ca, 1, + CA_PROP_EVENT_ID, "audio-volume-change", + CA_PROP_EVENT_DESCRIPTION, "volume changed through key press", + CA_PROP_CANBERRA_CACHE_CONTROL, "permanent", + NULL); + } +} + +#ifdef HAVE_GUDEV +/* PulseAudio gives us /devices/... paths, when udev + * expects /sys/devices/... paths. */ +static GUdevDevice * +get_udev_device_for_sysfs_path (GsdMediaKeysManager *manager, + const char *sysfs_path) +{ + char *path; + GUdevDevice *dev; + + path = g_strdup_printf ("/sys%s", sysfs_path); + dev = g_udev_client_query_by_sysfs_path (manager->priv->udev_client, path); + g_free (path); + + return dev; +} + +static GvcMixerStream * +get_stream_for_device_id (GsdMediaKeysManager *manager, + guint deviceid) +{ + char *devnode; + gpointer id_ptr; + GvcMixerStream *res; + GUdevDevice *dev, *parent; + GSList *sinks, *l; + + id_ptr = g_hash_table_lookup (manager->priv->streams, GUINT_TO_POINTER (deviceid)); + if (id_ptr != NULL) { + if (GPOINTER_TO_UINT (id_ptr) == (guint) -1) + return NULL; + else + return gvc_mixer_control_lookup_stream_id (manager->priv->volume, GPOINTER_TO_UINT (id_ptr)); + } + + devnode = xdevice_get_device_node (deviceid); + if (devnode == NULL) { + g_debug ("Could not find device node for XInput device %d", deviceid); + return NULL; + } + + dev = g_udev_client_query_by_device_file (manager->priv->udev_client, devnode); + if (dev == NULL) { + g_debug ("Could not find udev device for device path '%s'", devnode); + g_free (devnode); + return NULL; + } + g_free (devnode); + + if (g_strcmp0 (g_udev_device_get_property (dev, "ID_BUS"), "usb") != 0) { + g_debug ("Not handling XInput device %d, not USB", deviceid); + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + g_object_unref (dev); + return NULL; + } + + parent = g_udev_device_get_parent_with_subsystem (dev, "usb", "usb_device"); + if (parent == NULL) { + g_warning ("No USB device parent for XInput device %d even though it's USB", deviceid); + g_object_unref (dev); + return NULL; + } + + res = NULL; + sinks = gvc_mixer_control_get_sinks (manager->priv->volume); + for (l = sinks; l; l = l->next) { + GvcMixerStream *stream = l->data; + const char *sysfs_path; + GUdevDevice *sink_dev, *sink_parent; + + sysfs_path = gvc_mixer_stream_get_sysfs_path (stream); + sink_dev = get_udev_device_for_sysfs_path (manager, sysfs_path); + if (sink_dev == NULL) + continue; + sink_parent = g_udev_device_get_parent_with_subsystem (sink_dev, "usb", "usb_device"); + g_object_unref (sink_dev); + if (sink_parent == NULL) + continue; + + if (g_strcmp0 (g_udev_device_get_sysfs_path (sink_parent), + g_udev_device_get_sysfs_path (parent)) == 0) { + res = stream; + } + g_object_unref (sink_parent); + if (res != NULL) + break; + } + + if (res) + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER (gvc_mixer_stream_get_id (res))); + else + g_hash_table_insert (manager->priv->streams, + GUINT_TO_POINTER (deviceid), + GUINT_TO_POINTER ((guint) -1)); + + return res; +} +#endif /* HAVE_GUDEV */ + +static void +do_sound_action (GsdMediaKeysManager *manager, + guint deviceid, + int type, + gboolean quiet) +{ + GvcMixerStream *stream; + gboolean old_muted, new_muted; + guint old_vol, new_vol, norm_vol_step, osd_vol; + gboolean sound_changed; + + /* Find the stream that corresponds to the device, if any */ +#ifdef HAVE_GUDEV + stream = get_stream_for_device_id (manager, deviceid); + if (stream == NULL) +#endif /* HAVE_GUDEV */ + stream = manager->priv->stream; + if (stream == NULL) + return; + + norm_vol_step = PA_VOLUME_NORM * VOLUME_STEP / 100; + + /* FIXME: this is racy */ + new_vol = old_vol = gvc_mixer_stream_get_volume (stream); + new_muted = old_muted = gvc_mixer_stream_get_is_muted (stream); + sound_changed = FALSE; + + switch (type) { + case MUTE_KEY: + new_muted = !old_muted; + break; + case VOLUME_DOWN_KEY: + if (old_vol <= norm_vol_step) { + new_vol = 0; + new_muted = TRUE; + } else { + new_vol = old_vol - norm_vol_step; + } + break; + case VOLUME_UP_KEY: + new_muted = FALSE; + /* When coming out of mute only increase the volume if it was 0 */ + if (!old_muted || old_vol == 0) + new_vol = MIN (old_vol + norm_vol_step, MAX_VOLUME); + break; + } + + if (old_muted != new_muted) { + gvc_mixer_stream_change_is_muted (stream, new_muted); + sound_changed = TRUE; + } + + if (old_vol != new_vol) { + if (gvc_mixer_stream_set_volume (stream, new_vol) != FALSE) { + gvc_mixer_stream_push_volume (stream); + sound_changed = TRUE; + } + } + + if (type == VOLUME_DOWN_KEY && old_vol == 0 && old_muted) + osd_vol = -1; + else if (type == VOLUME_UP_KEY && old_vol == PA_VOLUME_NORM && !old_muted) + osd_vol = 101; + else if (!new_muted) + osd_vol = (int) (100 * (double) new_vol / PA_VOLUME_NORM); + else + osd_vol = 0; + + update_dialog (manager, stream, osd_vol, new_muted, sound_changed, quiet); +} + +static void +sound_theme_changed (GtkSettings *settings, + GParamSpec *pspec, + GsdMediaKeysManager *manager) +{ + char *theme_name; + + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); +} + +static void +update_default_sink (GsdMediaKeysManager *manager) +{ + GvcMixerStream *stream; + + stream = gvc_mixer_control_get_default_sink (manager->priv->volume); + if (stream == manager->priv->stream) + return; + + if (manager->priv->stream != NULL) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + + if (stream != NULL) { + manager->priv->stream = g_object_ref (stream); + } else { + g_warning ("Unable to get default sink"); + } +} + +static void +on_control_state_changed (GvcMixerControl *control, + GvcMixerControlState new_state, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +static void +on_control_default_sink_changed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + update_default_sink (manager); +} + +#ifdef HAVE_GUDEV +static gboolean +remove_stream (gpointer key, + gpointer value, + gpointer id) +{ + if (GPOINTER_TO_UINT (value) == GPOINTER_TO_UINT (id)) + return TRUE; + return FALSE; +} +#endif /* HAVE_GUDEV */ + +static void +on_control_stream_removed (GvcMixerControl *control, + guint id, + GsdMediaKeysManager *manager) +{ + if (manager->priv->stream != NULL) { + if (gvc_mixer_stream_get_id (manager->priv->stream) == id) { + g_object_unref (manager->priv->stream); + manager->priv->stream = NULL; + } + } + +#ifdef HAVE_GUDEV + g_hash_table_foreach_remove (manager->priv->streams, (GHRFunc) remove_stream, GUINT_TO_POINTER (id)); +#endif +} + +static void +free_media_player (MediaPlayer *player) +{ + if (player->watch_id > 0) { + g_bus_unwatch_name (player->watch_id); + player->watch_id = 0; + } + g_free (player->application); + g_free (player->name); + g_free (player); +} + +static gint +find_by_application (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->application, b); +} + +static gint +find_by_name (gconstpointer a, + gconstpointer b) +{ + return strcmp (((MediaPlayer *)a)->name, b); +} + +static gint +find_by_time (gconstpointer a, + gconstpointer b) +{ + return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time; +} + +static void +name_vanished_handler (GDBusConnection *connection, + const gchar *name, + GsdMediaKeysManager *manager) +{ + GList *iter; + + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering vanished %s (name: %s)", player->application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +/* + * Register a new media player. Most applications will want to call + * this with time = GDK_CURRENT_TIME. This way, the last registered + * player will receive media events. In some cases, applications + * may want to register with a lower priority (usually 1), to grab + * events only nobody is interested. + */ +static void +gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name, + guint32 time) +{ + GList *iter; + MediaPlayer *media_player; + guint watch_id; + + if (time == GDK_CURRENT_TIME) { + GTimeVal tv; + + g_get_current_time (&tv); + time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + } + + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + + if (iter != NULL) { + if (((MediaPlayer *)iter->data)->time < time) { + MediaPlayer *player = iter->data; + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } else { + return; + } + } + + watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_handler, + manager, + NULL); + + g_debug ("Registering %s at %u", application, time); + media_player = g_new0 (MediaPlayer, 1); + media_player->application = g_strdup (application); + media_player->name = g_strdup (name); + media_player->time = time; + media_player->watch_id = watch_id; + + manager->priv->media_players = g_list_insert_sorted (manager->priv->media_players, + media_player, + find_by_time); +} + +static void +gsd_media_keys_manager_release_media_player_keys (GsdMediaKeysManager *manager, + const char *application, + const char *name) +{ + GList *iter = NULL; + + g_return_if_fail (application != NULL || name != NULL); + + if (application != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + application, + find_by_application); + } + + if (iter == NULL && name != NULL) { + iter = g_list_find_custom (manager->priv->media_players, + name, + find_by_name); + } + + if (iter != NULL) { + MediaPlayer *player; + + player = iter->data; + g_debug ("Deregistering %s (name: %s)", application, player->name); + free_media_player (player); + manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter); + } +} + +static gboolean +gsd_media_player_key_pressed (GsdMediaKeysManager *manager, + const char *key) +{ + const char *application; + gboolean have_listeners; + GError *error = NULL; + MediaPlayer *player; + + g_return_val_if_fail (key != NULL, FALSE); + + g_debug ("Media key '%s' pressed", key); + + have_listeners = (manager->priv->media_players != NULL); + + if (!have_listeners) { + /* Popup a dialog with an (/) icon */ + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "action-unavailable-symbolic", + FALSE); + dialog_show (manager); + return TRUE; + } + + player = manager->priv->media_players->data; + application = player->application; + + if (g_dbus_connection_emit_signal (manager->priv->connection, + player->name, + GSD_MEDIA_KEYS_DBUS_PATH, + GSD_MEDIA_KEYS_DBUS_NAME, + "MediaPlayerKeyPressed", + g_variant_new ("(ss)", application ? application : "", key), + &error) == FALSE) { + g_debug ("Error emitting signal: %s", error->message); + g_error_free (error); + } + + return !have_listeners; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdMediaKeysManager *manager = (GsdMediaKeysManager *) user_data; + + g_debug ("Calling method '%s' for media-keys", method_name); + + if (g_strcmp0 (method_name, "ReleaseMediaPlayerKeys") == 0) { + const char *app_name; + + g_variant_get (parameters, "(&s)", &app_name); + gsd_media_keys_manager_release_media_player_keys (manager, app_name, sender); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "GrabMediaPlayerKeys") == 0) { + const char *app_name; + guint32 time; + + g_variant_get (parameters, "(&su)", &app_name, &time); + gsd_media_keys_manager_grab_media_player_keys (manager, app_name, sender, time); + g_dbus_method_invocation_return_value (invocation, NULL); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* Get Property */ + NULL, /* Set Property */ +}; + +static gboolean +do_multimedia_player_action (GsdMediaKeysManager *manager, + const char *icon, + const char *key) +{ + if (icon != NULL) + ubuntu_osd_notification_show_icon (icon, key); + return gsd_media_player_key_pressed (manager, key); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + GVariant *variant; + char *action; + + action = g_object_get_data (G_OBJECT (source_object), + "gsd-media-keys-manager-xrandr-action"); + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call '%s': %s", action, error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } + + g_free (action); +} + +static void +do_xrandr_action (GsdMediaKeysManager *manager, + const char *action, + gint64 timestamp) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + priv->cancellable = g_cancellable_new (); + + g_object_set_data (G_OBJECT (priv->xrandr_proxy), + "gsd-media-keys-manager-xrandr-action", + g_strdup (action)); + + g_dbus_proxy_call (priv->xrandr_proxy, + action, + g_variant_new ("(x)", timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static gboolean +do_video_out_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "VideoModeSwitch", timestamp); + return FALSE; +} + +static gboolean +do_video_rotate_action (GsdMediaKeysManager *manager, + gint64 timestamp) +{ + do_xrandr_action (manager, "Rotate", timestamp); + return FALSE; +} + +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.gnome.desktop.a11y.applications"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (GsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + +static void +do_text_size_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + gdouble factor, best, distance; + guint i; + + /* Same values used in the Seeing tab of the Universal Access panel */ + static gdouble factors[] = { + 0.75, + 1.0, + 1.25, + 1.5 + }; + + /* Figure out the current DPI scaling factor */ + factor = g_settings_get_double (manager->priv->interface_settings, "text-scaling-factor"); + factor += (type == INCREASE_TEXT_KEY ? 0.25 : -0.25); + + /* Try to find a matching value */ + distance = 1e6; + best = 1.0; + for (i = 0; i < G_N_ELEMENTS(factors); i++) { + gdouble d; + d = fabs (factor - factors[i]); + if (d < distance) { + best = factors[i]; + distance = d; + } + } + + if (best == 1.0) + g_settings_reset (manager->priv->interface_settings, "text-scaling-factor"); + else + g_settings_set_double (manager->priv->interface_settings, "text-scaling-factor", best); +} + +static void +do_magnifier_zoom_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + GSettings *settings; + gdouble offset, value; + + if (type == MAGNIFIER_ZOOM_IN_KEY) + offset = 1.0; + else + offset = -1.0; + + settings = g_settings_new ("org.gnome.desktop.a11y.magnifier"); + value = g_settings_get_double (settings, "mag-factor"); + value += offset; + value = roundl (value); + g_settings_set_double (settings, "mag-factor", value); + g_object_unref (settings); +} + +static void +do_toggle_contrast_action (GsdMediaKeysManager *manager) +{ + gboolean high_contrast; + char *theme; + + /* Are we using HighContrast now? */ + theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + high_contrast = g_str_equal (theme, HIGH_CONTRAST); + g_free (theme); + + if (high_contrast != FALSE) { + if (manager->priv->gtk_theme == NULL) + g_settings_reset (manager->priv->interface_settings, "gtk-theme"); + else + g_settings_set (manager->priv->interface_settings, "gtk-theme", manager->priv->gtk_theme); + g_settings_set (manager->priv->interface_settings, "icon-theme", manager->priv->icon_theme); + } else { + g_settings_set (manager->priv->interface_settings, "gtk-theme", HIGH_CONTRAST); + g_settings_set (manager->priv->interface_settings, "icon-theme", HIGH_CONTRAST); + } +} + +static void +do_config_power_action (GsdMediaKeysManager *manager, + const gchar *config_key) +{ + GsdPowerActionType action_type; + + action_type = g_settings_get_enum (manager->priv->power_settings, + config_key); + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + case GSD_POWER_ACTION_SHUTDOWN: + gnome_session_shutdown (manager); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_BLANK: + case GSD_POWER_ACTION_NOTHING: + /* these actions cannot be handled by media-keys and + * are not used in this context */ + break; + } +} + +static void +update_screen_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new screen percentage: %s", + error->message); + g_error_free (error); + g_free (data); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + guint osd_percentage; + + if (data->old_percentage == 100 && data->type == SCREEN_BRIGHTNESS_UP_KEY) + osd_percentage = 101; + else if (data->old_percentage == 0 && data->type == SCREEN_BRIGHTNESS_DOWN_KEY) + osd_percentage = -1; + else + osd_percentage = CLAMP (percentage, 0, 100); + + if (!ubuntu_osd_notification_show_brightness (manager, osd_percentage)) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "display-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_free (data); + g_variant_unref (new_percentage); +} + +static void +do_screen_brightness_action_real (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdBrightnessActionData *data = (GsdBrightnessActionData *) user_data; + GsdMediaKeysManager *manager = data->manager; + GError *error = NULL; + + GVariant *old_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (old_percentage == NULL) { + g_warning ("Failed to get old screen percentage: %s", error->message); + g_error_free (error); + g_free (data); + return; + } + + g_variant_get (old_percentage, "(u)", &data->old_percentage); + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_screen_proxy, + data->type == SCREEN_BRIGHTNESS_UP_KEY ? "StepUp" : "StepDown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_screen_cb, + data); + + g_variant_unref (old_percentage); +} + +static void +do_screen_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + if (manager->priv->connection == NULL || + manager->priv->power_screen_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + GsdBrightnessActionData *data = g_new0 (GsdBrightnessActionData, 1); + data->manager = manager; + data->type = type; + + g_dbus_proxy_call (manager->priv->power_screen_proxy, + "GetPercentage", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + do_screen_brightness_action_real, + data); +} + +static void +update_keyboard_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + guint percentage; + GVariant *new_percentage; + GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data); + + new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, &error); + if (new_percentage == NULL) { + g_warning ("Failed to set new keyboard percentage: %s", + error->message); + g_error_free (error); + return; + } + + /* update the dialog with the new value */ + g_variant_get (new_percentage, "(u)", &percentage); + + /* FIXME: No overshoot effect for keyboard, as the power plugin has no interface + * to get the old brightness */ + if (!ubuntu_osd_notification_show_kb_backlight (manager, CLAMP (percentage, 0, 100))) { + dialog_init (manager); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog), + "keyboard-brightness-symbolic", + TRUE); + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (manager->priv->dialog), + percentage); + dialog_show (manager); + } + g_variant_unref (new_percentage); +} + +static void +do_keyboard_brightness_action (GsdMediaKeysManager *manager, + MediaKeyType type) +{ + const char *cmd; + + if (manager->priv->connection == NULL || + manager->priv->power_keyboard_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle power keys"); + return; + } + + switch (type) { + case KEYBOARD_BRIGHTNESS_UP_KEY: + cmd = "StepUp"; + break; + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + cmd = "StepDown"; + break; + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + cmd = "Toggle"; + break; + default: + g_assert_not_reached (); + } + + /* call into the power plugin */ + g_dbus_proxy_call (manager->priv->power_keyboard_proxy, + cmd, + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + update_keyboard_cb, + manager); +} + +static void +do_custom_action (GsdMediaKeysManager *manager, + MediaKey *key, + gint64 timestamp) +{ + execute (manager, key->custom_command, FALSE); +} + +static gboolean +do_action (GsdMediaKeysManager *manager, + guint deviceid, + MediaKeyType type, + gint64 timestamp) +{ + char *cmd; + + g_debug ("Launching action for key type '%d' (on device id %d)", type, deviceid); + + switch (type) { + case TOUCHPAD_KEY: + do_touchpad_action (manager); + break; + case TOUCHPAD_ON_KEY: + do_touchpad_osd_action (manager, TRUE); + break; + case TOUCHPAD_OFF_KEY: + do_touchpad_osd_action (manager, FALSE); + break; + case MUTE_KEY: + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + do_sound_action (manager, deviceid, type, FALSE); + break; + case MUTE_QUIET_KEY: + do_sound_action (manager, deviceid, MUTE_KEY, TRUE); + break; + case VOLUME_DOWN_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_DOWN_KEY, TRUE); + break; + case VOLUME_UP_QUIET_KEY: + do_sound_action (manager, deviceid, VOLUME_UP_KEY, TRUE); + break; + case LOGOUT_KEY: + do_logout_action (manager); + break; + case EJECT_KEY: + do_eject_action (manager); + break; + case HOME_KEY: + do_home_key_action (manager, timestamp); + break; + case SEARCH_KEY: + cmd = NULL; + if ((cmd = g_find_program_in_path ("tracker-search-tool"))) + do_execute_desktop (manager, "tracker-needle.desktop", timestamp); + else + do_execute_desktop (manager, "gnome-search-tool.desktop", timestamp); + g_free (cmd); + break; + case EMAIL_KEY: + do_url_action (manager, "mailto", timestamp); + break; + case SCREENSAVER_KEY: + execute (manager, "gnome-screensaver-command --lock", FALSE); + break; + case HELP_KEY: + do_url_action (manager, "ghelp", timestamp); + break; + case SCREENSHOT_KEY: + execute (manager, "gnome-screenshot", FALSE); + break; + case WINDOW_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --window", FALSE); + break; + case AREA_SCREENSHOT_KEY: + execute (manager, "gnome-screenshot --area", FALSE); + break; + case SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --clipboard", FALSE); + break; + case WINDOW_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --window --clipboard", FALSE); + break; + case AREA_SCREENSHOT_CLIP_KEY: + execute (manager, "gnome-screenshot --area --clipboard", FALSE); + break; + case TERMINAL_KEY: + do_terminal_action (manager); + break; + case WWW_KEY: + do_url_action (manager, "http", timestamp); + break; + case MEDIA_KEY: + do_media_action (manager, timestamp); + break; + case CALCULATOR_KEY: + do_execute_desktop (manager, "gcalctool.desktop", timestamp); + break; + case PLAY_KEY: + return do_multimedia_player_action (manager, NULL, "Play"); + case PAUSE_KEY: + return do_multimedia_player_action (manager, NULL, "Pause"); + case STOP_KEY: + return do_multimedia_player_action (manager, NULL, "Stop"); + case PREVIOUS_KEY: + return do_multimedia_player_action (manager, NULL, "Previous"); + case NEXT_KEY: + return do_multimedia_player_action (manager, NULL, "Next"); + case REWIND_KEY: + return do_multimedia_player_action (manager, NULL, "Rewind"); + case FORWARD_KEY: + return do_multimedia_player_action (manager, NULL, "FastForward"); + case REPEAT_KEY: + return do_multimedia_player_action (manager, NULL, "Repeat"); + case RANDOM_KEY: + return do_multimedia_player_action (manager, NULL, "Shuffle"); + case VIDEO_OUT_KEY: + do_video_out_action (manager, timestamp); + break; + case ROTATE_VIDEO_KEY: + do_video_rotate_action (manager, timestamp); + break; + case MAGNIFIER_KEY: + do_magnifier_action (manager); + break; + case SCREENREADER_KEY: + do_screenreader_action (manager); + break; + case ON_SCREEN_KEYBOARD_KEY: + do_on_screen_keyboard_action (manager); + break; + case INCREASE_TEXT_KEY: + case DECREASE_TEXT_KEY: + do_text_size_action (manager, type); + break; + case MAGNIFIER_ZOOM_IN_KEY: + case MAGNIFIER_ZOOM_OUT_KEY: + do_magnifier_zoom_action (manager, type); + break; + case TOGGLE_CONTRAST_KEY: + do_toggle_contrast_action (manager); + break; + case POWER_KEY: + do_config_power_action (manager, "button-power"); + break; + case SLEEP_KEY: + do_config_power_action (manager, "button-sleep"); + break; + case SUSPEND_KEY: + do_config_power_action (manager, "button-suspend"); + break; + case HIBERNATE_KEY: + do_config_power_action (manager, "button-hibernate"); + break; + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + do_screen_brightness_action (manager, type); + break; + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_TOGGLE_KEY: + do_keyboard_brightness_action (manager, type); + break; + case BATTERY_KEY: + do_execute_desktop (manager, "gnome-power-statistics.desktop", timestamp); + break; + /* Note, no default so compiler catches missing keys */ + case CUSTOM_KEY: + g_assert_not_reached (); + } + + return FALSE; +} + +static GdkScreen * +get_screen_from_root (GsdMediaKeysManager *manager, + Window root) +{ + GSList *l; + + /* Look for which screen we're receiving events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + GdkScreen *screen = (GdkScreen *) l->data; + GdkWindow *window = gdk_screen_get_root_window (screen); + + if (GDK_WINDOW_XID (window) == root) + return screen; + } + + return NULL; +} + +static GdkFilterReturn +filter_key_events (XEvent *xevent, + GdkEvent *event, + GsdMediaKeysManager *manager) +{ + XIEvent *xiev; + XIDeviceEvent *xev; + XGenericEventCookie *cookie; + guint i; + guint deviceid; + + /* verify we have a key event */ + if (xevent->type != GenericEvent) + return GDK_FILTER_CONTINUE; + cookie = &xevent->xcookie; + if (cookie->extension != manager->priv->opcode) + return GDK_FILTER_CONTINUE; + + xiev = (XIEvent *) xevent->xcookie.data; + + if (xiev->evtype != XI_KeyPress && + xiev->evtype != XI_KeyRelease) + return GDK_FILTER_CONTINUE; + + xev = (XIDeviceEvent *) xiev; + + deviceid = xev->sourceid; + + for (i = 0; i < manager->priv->keys->len; i++) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (match_xi2_key (key->key, xev)) { + switch (key->key_type) { + case VOLUME_DOWN_KEY: + case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: + case SCREEN_BRIGHTNESS_UP_KEY: + case SCREEN_BRIGHTNESS_DOWN_KEY: + case KEYBOARD_BRIGHTNESS_UP_KEY: + case KEYBOARD_BRIGHTNESS_DOWN_KEY: + /* auto-repeatable keys */ + if (xiev->evtype != XI_KeyPress) + return GDK_FILTER_CONTINUE; + break; + default: + if (xiev->evtype != XI_KeyRelease) { + return GDK_FILTER_CONTINUE; + } + } + + manager->priv->current_screen = get_screen_from_root (manager, xev->root); + + if (key->key_type == CUSTOM_KEY) { + do_custom_action (manager, key, xev->time); + return GDK_FILTER_REMOVE; + } + + if (do_action (manager, deviceid, key->key_type, xev->time) == FALSE) { + return GDK_FILTER_REMOVE; + } else { + return GDK_FILTER_CONTINUE; + } + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +update_theme_settings (GSettings *settings, + const char *key, + GsdMediaKeysManager *manager) +{ + char *theme; + + theme = g_settings_get_string (manager->priv->interface_settings, key); + if (g_str_equal (theme, HIGH_CONTRAST)) { + g_free (theme); + } else { + if (g_str_equal (key, "gtk-theme")) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = theme; + } else { + g_free (manager->priv->icon_theme); + manager->priv->icon_theme = theme; + } + } +} + +static gboolean +start_media_keys_idle_cb (GsdMediaKeysManager *manager) +{ + GSList *l; + char *theme_name; + + g_debug ("Starting media_keys manager"); + gnome_settings_profile_start (NULL); + + + gvc_mixer_control_open (manager->priv->volume); + + manager->priv->settings = g_settings_new (SETTINGS_BINDING_DIR); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (gsettings_changed_cb), manager); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::custom-keybindings", + G_CALLBACK (gsettings_custom_changed_cb), manager); + + manager->priv->custom_settings = + g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_object_unref); + + /* Sound events */ + ca_context_create (&manager->priv->ca); + ca_context_set_driver (manager->priv->ca, "pulse"); + ca_context_change_props (manager->priv->ca, 0, + CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", + NULL); + manager->priv->gtksettings = gtk_settings_get_for_screen (gdk_screen_get_default ()); + g_object_get (G_OBJECT (manager->priv->gtksettings), "gtk-sound-theme-name", &theme_name, NULL); + if (theme_name) + ca_context_change_props (manager->priv->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme_name, NULL); + g_free (theme_name); + g_signal_connect (manager->priv->gtksettings, "notify::gtk-sound-theme-name", + G_CALLBACK (sound_theme_changed), manager); + + /* for the power plugin interface code */ + manager->priv->power_settings = g_settings_new (SETTINGS_POWER_DIR); + + /* Logic from http://git.gnome.org/browse/gnome-shell/tree/js/ui/status/accessibility.js#n163 */ + manager->priv->interface_settings = g_settings_new (SETTINGS_INTERFACE_DIR); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::gtk-theme", + G_CALLBACK (update_theme_settings), manager); + g_signal_connect (G_OBJECT (manager->priv->interface_settings), "changed::icon-theme", + G_CALLBACK (update_theme_settings), manager); + manager->priv->gtk_theme = g_settings_get_string (manager->priv->interface_settings, "gtk-theme"); + if (g_str_equal (manager->priv->gtk_theme, HIGH_CONTRAST)) { + g_free (manager->priv->gtk_theme); + manager->priv->gtk_theme = NULL; + } + manager->priv->icon_theme = g_settings_get_string (manager->priv->interface_settings, "icon-theme"); + + init_screens (manager); + init_kbd (manager); + + /* Start filtering the events */ + for (l = manager->priv->screens; l != NULL; l = l->next) { + gnome_settings_profile_start ("gdk_window_add_filter"); + + g_debug ("adding key filter for screen: %d", + gdk_screen_get_number (l->data)); + + gdk_window_add_filter (gdk_screen_get_root_window (l->data), + (GdkFilterFunc) filter_key_events, + manager); + gnome_settings_profile_end ("gdk_window_add_filter"); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error) +{ + const char * const subsystems[] = { "input", "usb", "sound", NULL }; + + gnome_settings_profile_start (NULL); + + if (supports_xinput2_devices (&manager->priv->opcode) == FALSE) { + g_debug ("No Xinput2 support, disabling plugin"); + return TRUE; + } + +#ifdef HAVE_GUDEV + manager->priv->streams = g_hash_table_new (g_direct_hash, g_direct_equal); + manager->priv->udev_client = g_udev_client_new (subsystems); +#endif + + /* initialise Volume handler + * + * We do this one here to force checking gstreamer cache, etc. + * The rest (grabbing and setting the keys) can happen in an + * idle. + */ + gnome_settings_profile_start ("gvc_mixer_control_new"); + + manager->priv->volume = gvc_mixer_control_new ("GNOME Volume Control Media Keys"); + + g_signal_connect (manager->priv->volume, + "state-changed", + G_CALLBACK (on_control_state_changed), + manager); + g_signal_connect (manager->priv->volume, + "default-sink-changed", + G_CALLBACK (on_control_default_sink_changed), + manager); + g_signal_connect (manager->priv->volume, + "stream-removed", + G_CALLBACK (on_control_stream_removed), + manager); + + gnome_settings_profile_end ("gvc_mixer_control_new"); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); + + register_manager (manager_object); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_media_keys_manager_stop (GsdMediaKeysManager *manager) +{ + GsdMediaKeysManagerPrivate *priv = manager->priv; + GSList *ls; + GList *l; + int i; + + g_debug ("Stopping media_keys manager"); + + if (priv->bus_cancellable != NULL) { + g_cancellable_cancel (priv->bus_cancellable); + g_object_unref (priv->bus_cancellable); + priv->bus_cancellable = NULL; + } + + for (ls = priv->screens; ls != NULL; ls = ls->next) { + gdk_window_remove_filter (gdk_screen_get_root_window (ls->data), + (GdkFilterFunc) filter_key_events, + manager); + } + + if (manager->priv->gtksettings != NULL) { + g_signal_handlers_disconnect_by_func (manager->priv->gtksettings, sound_theme_changed, manager); + manager->priv->gtksettings = NULL; + } + + if (manager->priv->ca) { + ca_context_destroy (manager->priv->ca); + manager->priv->ca = NULL; + } + +#ifdef HAVE_GUDEV + if (priv->streams) { + g_hash_table_destroy (priv->streams); + priv->streams = NULL; + } + if (priv->udev_client) { + g_object_unref (priv->udev_client); + priv->udev_client = NULL; + } +#endif /* HAVE_GUDEV */ + + if (priv->settings) { + g_object_unref (priv->settings); + priv->settings = NULL; + } + + if (priv->power_settings) { + g_object_unref (priv->power_settings); + priv->power_settings = NULL; + } + + if (priv->power_screen_proxy) { + g_object_unref (priv->power_screen_proxy); + priv->power_screen_proxy = NULL; + } + + if (priv->power_keyboard_proxy) { + g_object_unref (priv->power_keyboard_proxy); + priv->power_keyboard_proxy = NULL; + } + + if (priv->upower_proxy) { + g_object_unref (priv->upower_proxy); + priv->upower_proxy = NULL; + } + + if (priv->cancellable != NULL) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + + if (priv->introspection_data) { + g_dbus_node_info_unref (priv->introspection_data); + priv->introspection_data = NULL; + } + + if (priv->connection != NULL) { + g_object_unref (priv->connection); + priv->connection = NULL; + } + + if (priv->volume_notification != NULL) { + notify_notification_close (priv->volume_notification, NULL); + g_object_unref (priv->volume_notification); + priv->volume_notification = NULL; + } + + if (priv->brightness_notification != NULL) { + notify_notification_close (priv->brightness_notification, NULL); + g_object_unref (priv->brightness_notification); + priv->brightness_notification = NULL; + } + + if (priv->kb_backlight_notification != NULL) { + notify_notification_close (priv->kb_backlight_notification, NULL); + g_object_unref (priv->kb_backlight_notification); + priv->kb_backlight_notification = NULL; + } + + if (priv->keys != NULL) { + gdk_error_trap_push (); + for (i = 0; i < priv->keys->len; ++i) { + MediaKey *key; + + key = g_ptr_array_index (manager->priv->keys, i); + + if (key->key) + ungrab_key_unsafe (key->key, priv->screens); + } + g_ptr_array_free (priv->keys, TRUE); + priv->keys = NULL; + + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (priv->screens != NULL) { + g_slist_free (priv->screens); + priv->screens = NULL; + } + + if (priv->stream) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + if (priv->volume) { + g_object_unref (priv->volume); + priv->volume = NULL; + } + + if (priv->dialog != NULL) { + gtk_widget_destroy (priv->dialog); + priv->dialog = NULL; + } + + if (priv->media_players != NULL) { + for (l = priv->media_players; l; l = l->next) { + MediaPlayer *mp = l->data; + g_free (mp->application); + g_free (mp); + } + g_list_free (priv->media_players); + priv->media_players = NULL; + } +} + +static GObject * +gsd_media_keys_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMediaKeysManager *media_keys_manager; + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (media_keys_manager); +} + +static void +gsd_media_keys_manager_class_init (GsdMediaKeysManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_media_keys_manager_constructor; + object_class->finalize = gsd_media_keys_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysManagerPrivate)); +} + +static void +gsd_media_keys_manager_init (GsdMediaKeysManager *manager) +{ + manager->priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_media_keys_manager_finalize (GObject *object) +{ + GsdMediaKeysManager *media_keys_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_MANAGER (object)); + + media_keys_manager = GSD_MEDIA_KEYS_MANAGER (object); + + g_return_if_fail (media_keys_manager->priv != NULL); + + if (media_keys_manager->priv->start_idle_id != 0) + g_source_remove (media_keys_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object); +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +upower_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->upower_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Failed to get proxy for upower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_screen_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_screen_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_screen_proxy == NULL) { + g_warning ("Failed to get proxy for power (screen): %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GError *error = NULL; + + manager->priv->power_keyboard_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->power_keyboard_proxy == NULL) { + g_warning ("Failed to get proxy for power (keyboard): %s", + error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdMediaKeysManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_MEDIA_KEYS_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Screen", + NULL, + (GAsyncReadyCallback) power_screen_ready_cb, + manager); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/Power", + "org.gnome.SettingsDaemon.Power.Keyboard", + NULL, + (GAsyncReadyCallback) power_keyboard_ready_cb, + manager); +} + +static void +register_manager (GsdMediaKeysManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + NULL, + (GAsyncReadyCallback) upower_ready_cb, + manager); +} + +GsdMediaKeysManager * +gsd_media_keys_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MEDIA_KEYS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MEDIA_KEYS_MANAGER (manager_object); +} diff --git a/plugins/media-keys/gsd-media-keys-manager.h b/plugins/media-keys/gsd-media-keys-manager.h new file mode 100644 index 00000000..f7b0187a --- /dev/null +++ b/plugins/media-keys/gsd-media-keys-manager.h @@ -0,0 +1,61 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_MANAGER_H +#define __GSD_MEDIA_KEYS_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_MEDIA_KEYS_MANAGER (gsd_media_keys_manager_get_type ()) +#define GSD_MEDIA_KEYS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManager)) +#define GSD_MEDIA_KEYS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerClass)) +#define GSD_IS_MEDIA_KEYS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MEDIA_KEYS_MANAGER)) +#define GSD_IS_MEDIA_KEYS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MEDIA_KEYS_MANAGER)) +#define GSD_MEDIA_KEYS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MEDIA_KEYS_MANAGER, GsdMediaKeysManagerClass)) + +typedef struct GsdMediaKeysManagerPrivate GsdMediaKeysManagerPrivate; + +typedef struct +{ + GObject parent; + GsdMediaKeysManagerPrivate *priv; +} GsdMediaKeysManager; + +typedef struct +{ + GObjectClass parent_class; + void (* media_player_key_pressed) (GsdMediaKeysManager *manager, + const char *application, + const char *key); +} GsdMediaKeysManagerClass; + +GType gsd_media_keys_manager_get_type (void); + +GsdMediaKeysManager * gsd_media_keys_manager_new (void); +gboolean gsd_media_keys_manager_start (GsdMediaKeysManager *manager, + GError **error); +void gsd_media_keys_manager_stop (GsdMediaKeysManager *manager); + + +G_END_DECLS + +#endif /* __GSD_MEDIA_KEYS_MANAGER_H */ diff --git a/plugins/media-keys/gsd-media-keys-plugin.c b/plugins/media-keys/gsd-media-keys-plugin.c new file mode 100644 index 00000000..3fe36e48 --- /dev/null +++ b/plugins/media-keys/gsd-media-keys-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-media-keys-plugin.h" +#include "gsd-media-keys-manager.h" + +struct GsdMediaKeysPluginPrivate { + GsdMediaKeysManager *manager; +}; + +#define GSD_MEDIA_KEYS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_MEDIA_KEYS_PLUGIN, GsdMediaKeysPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdMediaKeysPlugin, gsd_media_keys_plugin) + +static void +gsd_media_keys_plugin_init (GsdMediaKeysPlugin *plugin) +{ + plugin->priv = GSD_MEDIA_KEYS_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdMediaKeysPlugin initializing"); + + plugin->priv->manager = gsd_media_keys_manager_new (); +} + +static void +gsd_media_keys_plugin_finalize (GObject *object) +{ + GsdMediaKeysPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MEDIA_KEYS_PLUGIN (object)); + + g_debug ("GsdMediaKeysPlugin finalizing"); + + plugin = GSD_MEDIA_KEYS_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_media_keys_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating media_keys plugin"); + + error = NULL; + res = gsd_media_keys_manager_start (GSD_MEDIA_KEYS_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start media_keys manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating media_keys plugin"); + gsd_media_keys_manager_stop (GSD_MEDIA_KEYS_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_media_keys_plugin_class_init (GsdMediaKeysPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_media_keys_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdMediaKeysPluginPrivate)); +} diff --git a/plugins/media-keys/gsd-media-keys-plugin.h b/plugins/media-keys/gsd-media-keys-plugin.h new file mode 100644 index 00000000..057d42e1 --- /dev/null +++ b/plugins/media-keys/gsd-media-keys-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_PLUGIN_H__ +#define __GSD_MEDIA_KEYS_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_MEDIA_KEYS_PLUGIN (gsd_media_keys_plugin_get_type ()) +#define GSD_MEDIA_KEYS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MEDIA_KEYS_PLUGIN, GsdMediaKeysPlugin)) +#define GSD_MEDIA_KEYS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MEDIA_KEYS_PLUGIN, GsdMediaKeysPluginClass)) +#define GSD_IS_MEDIA_KEYS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MEDIA_KEYS_PLUGIN)) +#define GSD_IS_MEDIA_KEYS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MEDIA_KEYS_PLUGIN)) +#define GSD_MEDIA_KEYS_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MEDIA_KEYS_PLUGIN, GsdMediaKeysPluginClass)) + +typedef struct GsdMediaKeysPluginPrivate GsdMediaKeysPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdMediaKeysPluginPrivate *priv; +} GsdMediaKeysPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdMediaKeysPluginClass; + +GType gsd_media_keys_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_MEDIA_KEYS_PLUGIN_H__ */ diff --git a/plugins/media-keys/gsd-osd-window-private.h b/plugins/media-keys/gsd-osd-window-private.h new file mode 100644 index 00000000..b922ed4a --- /dev/null +++ b/plugins/media-keys/gsd-osd-window-private.h @@ -0,0 +1,70 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- + * + * On-screen-display (OSD) window for gnome-settings-daemon's plugins + * + * Copyright (C) 2006 William Jon McCann + * Copyright (C) 2009 Novell, Inc + * + * Authors: + * William Jon McCann + * Federico Mena-Quintero + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2, 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 Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser 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. + * + */ + +/* GsdOsdWindow is an "on-screen-display" window (OSD). It is the cute, + * semi-transparent, curved popup that appears when you press a hotkey global to + * the desktop, such as to change the volume, switch your monitor's parameters, + * etc. + * + * You can create a GsdOsdWindow and use it as a normal GtkWindow. It will + * automatically center itself, figure out if it needs to be composited, etc. + * Just pack your widgets in it, sit back, and enjoy the ride. + */ + +#ifndef GSD_OSD_WINDOW_PRIVATE_H +#define GSD_OSD_WINDOW_PRIVATE_H + +#include +#include +#include + +G_BEGIN_DECLS + +#define DIALOG_FADE_TIMEOUT 1500 /* timeout before fade starts */ +#define FADE_FRAME_TIMEOUT 10 /* timeout in ms between each frame of the fade */ + +typedef struct { + int size; + GtkStyleContext *style; + GtkTextDirection direction; + + GsdOsdWindowAction action; + GtkIconTheme *theme; + const char *icon_name; + + gboolean show_level; + int volume_level; + guint volume_muted : 1; +} GsdOsdDrawContext; + +void gsd_osd_window_draw (GsdOsdDrawContext *ctx, cairo_t *cr); + +G_END_DECLS + +#endif diff --git a/plugins/media-keys/gsd-osd-window.c b/plugins/media-keys/gsd-osd-window.c new file mode 100644 index 00000000..f6593b5b --- /dev/null +++ b/plugins/media-keys/gsd-osd-window.c @@ -0,0 +1,1019 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * On-screen-display (OSD) window for gnome-settings-daemon's plugins + * + * Copyright (C) 2006-2007 William Jon McCann + * Copyright (C) 2009 Novell, Inc + * + * Authors: + * William Jon McCann + * Federico Mena-Quintero + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2, 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 Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser 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 +#include +#include +#include +#include +#include +#include + +#include "gsd-osd-window.h" +#include "gsd-osd-window-private.h" + +#define ICON_SCALE 0.50 /* size of the icon compared to the whole OSD */ +#define FG_ALPHA 1.0 /* Alpha value to be used for foreground objects drawn in an OSD window */ + +#define GSD_OSD_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_OSD_WINDOW, GsdOsdWindowPrivate)) + +struct GsdOsdWindowPrivate +{ + guint hide_timeout_id; + guint fade_timeout_id; + double fade_out_alpha; + + gint screen_width; + gint screen_height; + gint primary_monitor; + guint monitors_changed_id; + guint monitor_changed : 1; + + GsdOsdWindowAction action; + char *icon_name; + gboolean show_level; + + int volume_level; + guint volume_muted : 1; +}; + +G_DEFINE_TYPE (GsdOsdWindow, gsd_osd_window, GTK_TYPE_WINDOW) + +static void gsd_osd_window_update_and_hide (GsdOsdWindow *window); + +static void +gsd_osd_window_draw_rounded_rectangle (cairo_t* cr, + gdouble aspect, + gdouble x, + gdouble y, + gdouble corner_radius, + gdouble width, + gdouble height) +{ + gdouble radius = corner_radius / aspect; + + cairo_move_to (cr, x + radius, y); + + cairo_line_to (cr, + x + width - radius, + y); + cairo_arc (cr, + x + width - radius, + y + radius, + radius, + -90.0f * G_PI / 180.0f, + 0.0f * G_PI / 180.0f); + cairo_line_to (cr, + x + width, + y + height - radius); + cairo_arc (cr, + x + width - radius, + y + height - radius, + radius, + 0.0f * G_PI / 180.0f, + 90.0f * G_PI / 180.0f); + cairo_line_to (cr, + x + radius, + y + height); + cairo_arc (cr, + x + radius, + y + height - radius, + radius, + 90.0f * G_PI / 180.0f, + 180.0f * G_PI / 180.0f); + cairo_line_to (cr, + x, + y + radius); + cairo_arc (cr, + x + radius, + y + radius, + radius, + 180.0f * G_PI / 180.0f, + 270.0f * G_PI / 180.0f); + cairo_close_path (cr); +} + +static gboolean +fade_timeout (GsdOsdWindow *window) +{ + if (window->priv->fade_out_alpha <= 0.0) { + gtk_widget_hide (GTK_WIDGET (window)); + + /* Reset it for the next time */ + window->priv->fade_out_alpha = 1.0; + window->priv->fade_timeout_id = 0; + + return FALSE; + } else { + GdkRectangle rect; + GtkWidget *win = GTK_WIDGET (window); + GtkAllocation allocation; + + window->priv->fade_out_alpha -= 0.10; + + rect.x = 0; + rect.y = 0; + gtk_widget_get_allocation (win, &allocation); + rect.width = allocation.width; + rect.height = allocation.height; + + gtk_widget_realize (win); + gdk_window_invalidate_rect (gtk_widget_get_window (win), &rect, FALSE); + } + + return TRUE; +} + +static gboolean +hide_timeout (GsdOsdWindow *window) +{ + window->priv->hide_timeout_id = 0; + window->priv->fade_timeout_id = g_timeout_add (FADE_FRAME_TIMEOUT, + (GSourceFunc) fade_timeout, + window); + + return FALSE; +} + +static void +remove_hide_timeout (GsdOsdWindow *window) +{ + if (window->priv->hide_timeout_id != 0) { + g_source_remove (window->priv->hide_timeout_id); + window->priv->hide_timeout_id = 0; + } + + if (window->priv->fade_timeout_id != 0) { + g_source_remove (window->priv->fade_timeout_id); + window->priv->fade_timeout_id = 0; + window->priv->fade_out_alpha = 1.0; + } +} + +static void +add_hide_timeout (GsdOsdWindow *window) +{ + window->priv->hide_timeout_id = g_timeout_add (DIALOG_FADE_TIMEOUT, + (GSourceFunc) hide_timeout, + window); +} + +static const char * +get_image_name_for_volume (gboolean muted, + int volume) +{ + static const char *icon_names[] = { + "audio-volume-muted-symbolic", + "audio-volume-low-symbolic", + "audio-volume-medium-symbolic", + "audio-volume-high-symbolic", + NULL + }; + int n; + + if (muted) { + n = 0; + } else { + /* select image */ + n = 3 * volume / 100 + 1; + if (n < 1) { + n = 1; + } else if (n > 3) { + n = 3; + } + } + + return icon_names[n]; +} + +static void +action_changed (GsdOsdWindow *window) +{ + gsd_osd_window_update_and_hide (GSD_OSD_WINDOW (window)); +} + +static void +volume_level_changed (GsdOsdWindow *window) +{ + gsd_osd_window_update_and_hide (GSD_OSD_WINDOW (window)); +} + +static void +volume_muted_changed (GsdOsdWindow *window) +{ + gsd_osd_window_update_and_hide (GSD_OSD_WINDOW (window)); +} + +void +gsd_osd_window_set_action (GsdOsdWindow *window, + GsdOsdWindowAction action) +{ + g_return_if_fail (GSD_IS_OSD_WINDOW (window)); + g_return_if_fail (action == GSD_OSD_WINDOW_ACTION_VOLUME); + + if (window->priv->action != action) { + window->priv->action = action; + action_changed (window); + } else { + gsd_osd_window_update_and_hide (GSD_OSD_WINDOW (window)); + } +} + +void +gsd_osd_window_set_action_custom (GsdOsdWindow *window, + const char *icon_name, + gboolean show_level) +{ + g_return_if_fail (GSD_IS_OSD_WINDOW (window)); + g_return_if_fail (icon_name != NULL); + + if (window->priv->action != GSD_OSD_WINDOW_ACTION_CUSTOM || + g_strcmp0 (window->priv->icon_name, icon_name) != 0 || + window->priv->show_level != show_level) { + window->priv->action = GSD_OSD_WINDOW_ACTION_CUSTOM; + g_free (window->priv->icon_name); + window->priv->icon_name = g_strdup (icon_name); + window->priv->show_level = show_level; + action_changed (window); + } else { + gsd_osd_window_update_and_hide (GSD_OSD_WINDOW (window)); + } +} + +void +gsd_osd_window_set_volume_muted (GsdOsdWindow *window, + gboolean muted) +{ + g_return_if_fail (GSD_IS_OSD_WINDOW (window)); + + if (window->priv->volume_muted != muted) { + window->priv->volume_muted = muted; + volume_muted_changed (window); + } +} + +void +gsd_osd_window_set_volume_level (GsdOsdWindow *window, + int level) +{ + g_return_if_fail (GSD_IS_OSD_WINDOW (window)); + + if (window->priv->volume_level != level) { + window->priv->volume_level = level; + volume_level_changed (window); + } +} + +static GdkPixbuf * +load_pixbuf (GsdOsdDrawContext *ctx, + const char *name, + int icon_size) +{ + GtkIconInfo *info; + GdkPixbuf *pixbuf; + + info = gtk_icon_theme_lookup_icon (ctx->theme, + name, + icon_size, + GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK); + + if (info == NULL) { + g_warning ("Failed to load '%s'", name); + return NULL; + } + + pixbuf = gtk_icon_info_load_symbolic_for_context (info, + ctx->style, + NULL, + NULL); + gtk_icon_info_free (info); + + return pixbuf; +} + +static void +draw_eject (cairo_t *cr, + double _x0, + double _y0, + double width, + double height) +{ + int box_height; + int tri_height; + int separation; + + box_height = height * 0.2; + separation = box_height / 3; + tri_height = height - box_height - separation; + + cairo_rectangle (cr, _x0, _y0 + height - box_height, width, box_height); + + cairo_move_to (cr, _x0, _y0 + tri_height); + cairo_rel_line_to (cr, width, 0); + cairo_rel_line_to (cr, -width / 2, -tri_height); + cairo_rel_line_to (cr, -width / 2, tri_height); + cairo_close_path (cr); + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA); + cairo_fill_preserve (cr); + + cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2); + cairo_set_line_width (cr, 2); + cairo_stroke (cr); +} + +static void +draw_waves (cairo_t *cr, + double cx, + double cy, + double max_radius, + int volume_level) +{ + const int n_waves = 3; + int last_wave; + int i; + + last_wave = n_waves * volume_level / 100; + + for (i = 0; i < n_waves; i++) { + double angle1; + double angle2; + double radius; + double alpha; + + angle1 = -M_PI / 4; + angle2 = M_PI / 4; + + if (i < last_wave) + alpha = 1.0; + else if (i > last_wave) + alpha = 0.1; + else alpha = 0.1 + 0.9 * (n_waves * volume_level % 100) / 100.0; + + radius = (i + 1) * (max_radius / n_waves); + cairo_arc (cr, cx, cy, radius, angle1, angle2); + cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, alpha / 2); + cairo_set_line_width (cr, 14); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + cairo_stroke_preserve (cr); + + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha); + cairo_set_line_width (cr, 10); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + cairo_stroke (cr); + } +} + +static void +draw_cross (cairo_t *cr, + double cx, + double cy, + double size) +{ + cairo_move_to (cr, cx, cy - size/2.0); + cairo_rel_line_to (cr, size, size); + + cairo_move_to (cr, cx, cy + size/2.0); + cairo_rel_line_to (cr, size, -size); + + cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2); + cairo_set_line_width (cr, 14); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + cairo_stroke_preserve (cr); + + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA); + cairo_set_line_width (cr, 10); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + cairo_stroke (cr); +} + +static void +draw_speaker (cairo_t *cr, + double cx, + double cy, + double width, + double height) +{ + double box_width; + double box_height; + double _x0; + double _y0; + + box_width = width / 3; + box_height = height / 3; + + _x0 = cx - (width / 2) + box_width; + _y0 = cy - box_height / 2; + + cairo_move_to (cr, _x0, _y0); + cairo_rel_line_to (cr, - box_width, 0); + cairo_rel_line_to (cr, 0, box_height); + cairo_rel_line_to (cr, box_width, 0); + + cairo_line_to (cr, cx + box_width, cy + height / 2); + cairo_rel_line_to (cr, 0, -height); + cairo_line_to (cr, _x0, _y0); + cairo_close_path (cr); + + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA); + cairo_fill_preserve (cr); + + cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2); + cairo_set_line_width (cr, 2); + cairo_stroke (cr); +} + +static gboolean +render_speaker (GsdOsdDrawContext *ctx, + cairo_t *cr, + double _x0, + double _y0, + double width, + double height) +{ + GdkPixbuf *pixbuf; + const char *icon_name; + int icon_size; + + icon_name = get_image_name_for_volume (ctx->volume_muted, + ctx->volume_level); + + icon_size = (int) width; + + pixbuf = load_pixbuf (ctx, icon_name, icon_size); + + if (pixbuf == NULL) { + return FALSE; + } + + gtk_render_icon (ctx->style, cr, + pixbuf, _x0, _y0); + + g_object_unref (pixbuf); + + return TRUE; +} + +static void +draw_volume_boxes (GsdOsdDrawContext *ctx, + cairo_t *cr, + double percentage, + double _x0, + double _y0, + double width, + double height) +{ + gdouble x1; + GdkRGBA acolor; + + height = round (height) - 1; + width = round (width) - 1; + x1 = round ((width - 1) * percentage); + + /* bar background */ + gtk_style_context_save (ctx->style); + gtk_style_context_add_class (ctx->style, GTK_STYLE_CLASS_TROUGH); + gtk_style_context_get_background_color (ctx->style, GTK_STATE_NORMAL, &acolor); + + gsd_osd_window_draw_rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, width, height); + gdk_cairo_set_source_rgba (cr, &acolor); + cairo_fill (cr); + + gtk_style_context_restore (ctx->style); + + /* bar progress */ + if (percentage < 0.01) + return; + gtk_style_context_save (ctx->style); + gtk_style_context_add_class (ctx->style, GTK_STYLE_CLASS_PROGRESSBAR); + gtk_style_context_get_background_color (ctx->style, GTK_STATE_NORMAL, &acolor); + + gsd_osd_window_draw_rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, x1, height); + gdk_cairo_set_source_rgba (cr, &acolor); + cairo_fill (cr); + + gtk_style_context_restore (ctx->style); +} + +static void +draw_action_volume (GsdOsdDrawContext *ctx, + cairo_t *cr) +{ + int window_width; + int window_height; + double icon_box_width; + double icon_box_height; + double icon_box_x0; + double icon_box_y0; + double volume_box_x0; + double volume_box_y0; + double volume_box_width; + double volume_box_height; + gboolean res; + + window_width = window_height = ctx->size; + + icon_box_width = round (window_width * ICON_SCALE); + icon_box_height = round (window_height * ICON_SCALE); + volume_box_width = icon_box_width; + volume_box_height = round (window_height * 0.05); + + icon_box_x0 = round ((window_width - icon_box_width) / 2); + icon_box_y0 = round ((window_height - icon_box_height - volume_box_height) / 2 - volume_box_height); + volume_box_x0 = round (icon_box_x0); + volume_box_y0 = round (icon_box_height + icon_box_y0) + volume_box_height; + +#if 0 + g_message ("icon box: w=%f h=%f _x0=%f _y0=%f", + icon_box_width, + icon_box_height, + icon_box_x0, + icon_box_y0); + g_message ("volume box: w=%f h=%f _x0=%f _y0=%f", + volume_box_width, + volume_box_height, + volume_box_x0, + volume_box_y0); +#endif + + res = render_speaker (ctx, + cr, + icon_box_x0, icon_box_y0, + icon_box_width, icon_box_height); + if (! res) { + double speaker_width; + double speaker_height; + double speaker_cx; + double speaker_cy; + + speaker_width = icon_box_width * 0.5; + speaker_height = icon_box_height * 0.75; + speaker_cx = icon_box_x0 + speaker_width / 2; + speaker_cy = icon_box_y0 + speaker_height / 2; + +#if 0 + g_message ("speaker box: w=%f h=%f cx=%f cy=%f", + speaker_width, + speaker_height, + speaker_cx, + speaker_cy); +#endif + + /* draw speaker symbol */ + draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height); + + if (!ctx->volume_muted) { + /* draw sound waves */ + double wave_x0; + double wave_y0; + double wave_radius; + + wave_x0 = window_width / 2; + wave_y0 = speaker_cy; + wave_radius = icon_box_width / 2; + + draw_waves (cr, wave_x0, wave_y0, wave_radius, ctx->volume_level); + } else { + /* draw 'mute' cross */ + double cross_x0; + double cross_y0; + double cross_size; + + cross_size = speaker_width * 3 / 4; + cross_x0 = icon_box_x0 + icon_box_width - cross_size; + cross_y0 = speaker_cy; + + draw_cross (cr, cross_x0, cross_y0, cross_size); + } + } + + /* draw volume meter */ + draw_volume_boxes (ctx, + cr, + (double) ctx->volume_level / 100.0, + volume_box_x0, + volume_box_y0, + volume_box_width, + volume_box_height); +} + +static gboolean +render_custom (GsdOsdDrawContext *ctx, + cairo_t *cr, + double _x0, + double _y0, + double width, + double height) +{ + GdkPixbuf *pixbuf; + int icon_size; + + icon_size = (int)width; + + pixbuf = load_pixbuf (ctx, ctx->icon_name, icon_size); + + if (pixbuf == NULL) { + char *name; + if (ctx->direction == GTK_TEXT_DIR_RTL) + name = g_strdup_printf ("%s-rtl", ctx->icon_name); + else + name = g_strdup_printf ("%s-ltr", ctx->icon_name); + pixbuf = load_pixbuf (ctx, name, icon_size); + g_free (name); + if (pixbuf == NULL) + return FALSE; + } + + gtk_render_icon (ctx->style, cr, + pixbuf, _x0, _y0); + + g_object_unref (pixbuf); + + return TRUE; +} + +static void +draw_action_custom (GsdOsdDrawContext *ctx, + cairo_t *cr) +{ + int window_width; + int window_height; + double icon_box_width; + double icon_box_height; + double icon_box_x0; + double icon_box_y0; + double bright_box_x0; + double bright_box_y0; + double bright_box_width; + double bright_box_height; + gboolean res; + + window_width = window_height = ctx->size; + + icon_box_width = round (window_width * ICON_SCALE); + icon_box_height = round (window_height * ICON_SCALE); + bright_box_width = round (icon_box_width); + bright_box_height = round (window_height * 0.05); + + icon_box_x0 = round ((window_width - icon_box_width) / 2); + icon_box_y0 = round ((window_height - icon_box_height - bright_box_height) / 2 - bright_box_height); + bright_box_x0 = round (icon_box_x0); + bright_box_y0 = round (icon_box_height + icon_box_y0) + bright_box_height; + +#if 0 + g_message ("icon box: w=%f h=%f _x0=%f _y0=%f", + icon_box_width, + icon_box_height, + icon_box_x0, + icon_box_y0); + g_message ("brightness box: w=%f h=%f _x0=%f _y0=%f", + bright_box_width, + bright_box_height, + bright_box_x0, + bright_box_y0); +#endif + + res = render_custom (ctx, + cr, + icon_box_x0, icon_box_y0, + icon_box_width, icon_box_height); + if (!res && g_str_has_prefix (ctx->icon_name, "media-eject")) { + /* draw eject symbol */ + draw_eject (cr, + icon_box_x0, icon_box_y0, + icon_box_width, icon_box_height); + } + + if (ctx->show_level != FALSE) { + /* draw volume meter */ + draw_volume_boxes (ctx, + cr, + (double) ctx->volume_level / 100.0, + bright_box_x0, + bright_box_y0, + bright_box_width, + bright_box_height); + } +} + +void +gsd_osd_window_draw (GsdOsdDrawContext *ctx, + cairo_t *cr) +{ + gdouble corner_radius; + GdkRGBA acolor; + + /* draw a box */ + corner_radius = ctx->size / 10; + gsd_osd_window_draw_rounded_rectangle (cr, 1.0, 0.0, 0.0, corner_radius, ctx->size - 1, ctx->size - 1); + + gtk_style_context_get_background_color (ctx->style, GTK_STATE_NORMAL, &acolor); + gdk_cairo_set_source_rgba (cr, &acolor); + cairo_fill (cr); + + switch (ctx->action) { + case GSD_OSD_WINDOW_ACTION_VOLUME: + draw_action_volume (ctx, cr); + break; + case GSD_OSD_WINDOW_ACTION_CUSTOM: + draw_action_custom (ctx, cr); + break; + default: + break; + } +} + +static gboolean +gsd_osd_window_obj_draw (GtkWidget *widget, + cairo_t *orig_cr) +{ + GsdOsdWindow *window; + cairo_t *cr; + cairo_surface_t *surface; + GtkStyleContext *context; + GsdOsdDrawContext ctx; + int width, height, size; + + window = GSD_OSD_WINDOW (widget); + gtk_window_get_size (GTK_WINDOW (widget), &width, &height); + size = MIN (width, height); + + context = gtk_widget_get_style_context (widget); + gtk_style_context_save (context); + gtk_style_context_add_class (context, "osd"); + + cairo_set_operator (orig_cr, CAIRO_OPERATOR_SOURCE); + + surface = cairo_surface_create_similar (cairo_get_target (orig_cr), + CAIRO_CONTENT_COLOR_ALPHA, + size, + size); + + if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) { + goto done; + } + + cr = cairo_create (surface); + if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { + goto done; + } + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cairo_paint (cr); + + ctx.size = size; + ctx.style = context; + ctx.volume_level = window->priv->volume_level; + ctx.volume_muted = window->priv->volume_muted; + ctx.icon_name = window->priv->icon_name; + ctx.direction = gtk_widget_get_direction (GTK_WIDGET (window)); + ctx.show_level = window->priv->show_level; + ctx.action = window->priv->action; + if (window != NULL && gtk_widget_has_screen (GTK_WIDGET (window))) { + ctx.theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))); + } else { + ctx.theme = gtk_icon_theme_get_default (); + } + gsd_osd_window_draw (&ctx, cr); + + cairo_destroy (cr); + gtk_style_context_restore (context); + + /* Make sure we have a transparent background */ + cairo_rectangle (orig_cr, 0, 0, size, size); + cairo_set_source_rgba (orig_cr, 0.0, 0.0, 0.0, 0.0); + cairo_fill (orig_cr); + + cairo_set_source_surface (orig_cr, surface, 0, 0); + cairo_paint_with_alpha (orig_cr, window->priv->fade_out_alpha); + + done: + if (surface != NULL) { + cairo_surface_destroy (surface); + } + + return FALSE; +} + +static void +gsd_osd_window_real_show (GtkWidget *widget) +{ + GsdOsdWindow *window; + + if (GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->show) { + GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->show (widget); + } + + window = GSD_OSD_WINDOW (widget); + remove_hide_timeout (window); + add_hide_timeout (window); +} + +static void +gsd_osd_window_real_hide (GtkWidget *widget) +{ + GsdOsdWindow *window; + + if (GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->hide) { + GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->hide (widget); + } + + window = GSD_OSD_WINDOW (widget); + remove_hide_timeout (window); +} + +static void +gsd_osd_window_real_realize (GtkWidget *widget) +{ + cairo_region_t *region; + GdkScreen *screen; + GdkVisual *visual; + + screen = gtk_widget_get_screen (widget); + visual = gdk_screen_get_rgba_visual (screen); + if (visual == NULL) { + visual = gdk_screen_get_system_visual (screen); + } + + gtk_widget_set_visual (widget, visual); + + if (GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->realize) { + GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->realize (widget); + } + + /* make the whole window ignore events */ + region = cairo_region_create (); + gtk_widget_input_shape_combine_region (widget, region); + cairo_region_destroy (region); +} + +static GObject * +gsd_osd_window_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params) +{ + GObject *object; + + object = G_OBJECT_CLASS (gsd_osd_window_parent_class)->constructor (type, n_construct_properties, construct_params); + + g_object_set (object, + "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 object; +} + +static void +gsd_osd_window_finalize (GObject *object) +{ + GsdOsdWindow *window; + + window = GSD_OSD_WINDOW (object); + if (window->priv->icon_name) { + g_free (window->priv->icon_name); + window->priv->icon_name = NULL; + } + + if (window->priv->monitors_changed_id > 0) { + GdkScreen *screen; + screen = gtk_widget_get_screen (GTK_WIDGET (object)); + g_signal_handler_disconnect (G_OBJECT (screen), window->priv->monitors_changed_id); + window->priv->monitors_changed_id = 0; + } + + G_OBJECT_CLASS (gsd_osd_window_parent_class)->finalize (object); +} + +static void +gsd_osd_window_class_init (GsdOsdWindowClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + gobject_class->constructor = gsd_osd_window_constructor; + gobject_class->finalize = gsd_osd_window_finalize; + + widget_class->show = gsd_osd_window_real_show; + widget_class->hide = gsd_osd_window_real_hide; + widget_class->realize = gsd_osd_window_real_realize; + widget_class->draw = gsd_osd_window_obj_draw; + + g_type_class_add_private (klass, sizeof (GsdOsdWindowPrivate)); +} + +/** + * gsd_osd_window_is_valid: + * @window: a #GsdOsdWindow + * + * Return value: TRUE if the @window's idea of the screen geometry is the + * same as the current screen's. + */ +gboolean +gsd_osd_window_is_valid (GsdOsdWindow *window) +{ + return window->priv->monitor_changed; +} + +static void +monitors_changed_cb (GdkScreen *screen, + GsdOsdWindow *window) +{ + gint primary_monitor; + GdkRectangle mon_rect; + + primary_monitor = gdk_screen_get_primary_monitor (screen); + if (primary_monitor != window->priv->primary_monitor) { + window->priv->monitor_changed = TRUE; + return; + } + + gdk_screen_get_monitor_geometry (screen, primary_monitor, &mon_rect); + + if (window->priv->screen_width != mon_rect.width || + window->priv->screen_height != mon_rect.height) + window->priv->monitor_changed = TRUE; +} + +static void +gsd_osd_window_init (GsdOsdWindow *window) +{ + GdkScreen *screen; + gdouble scalew, scaleh, scale; + GdkRectangle monitor; + int size; + + window->priv = GSD_OSD_WINDOW_GET_PRIVATE (window); + + screen = gtk_widget_get_screen (GTK_WIDGET (window)); + window->priv->monitors_changed_id = g_signal_connect (G_OBJECT (screen), "monitors-changed", + G_CALLBACK (monitors_changed_cb), window); + + window->priv->primary_monitor = gdk_screen_get_primary_monitor (screen); + gdk_screen_get_monitor_geometry (screen, window->priv->primary_monitor, &monitor); + window->priv->screen_width = monitor.width; + window->priv->screen_height = monitor.height; + + 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 = monitor.width / 640.0; + scaleh = monitor.height / 480.0; + scale = MIN (scalew, scaleh); + size = 130 * MAX (1, scale); + gtk_window_set_default_size (GTK_WINDOW (window), size, size); + + window->priv->fade_out_alpha = 1.0; +} + +GtkWidget * +gsd_osd_window_new (void) +{ + return g_object_new (GSD_TYPE_OSD_WINDOW, NULL); +} + +/** + * gsd_osd_window_update_and_hide: + * @window: a #GsdOsdWindow + * + * Queues the @window for immediate drawing, and queues a timer to hide the window. + */ +static void +gsd_osd_window_update_and_hide (GsdOsdWindow *window) +{ + remove_hide_timeout (window); + add_hide_timeout (window); + + gtk_widget_queue_draw (GTK_WIDGET (window)); +} diff --git a/plugins/media-keys/gsd-osd-window.h b/plugins/media-keys/gsd-osd-window.h new file mode 100644 index 00000000..caeb9bcb --- /dev/null +++ b/plugins/media-keys/gsd-osd-window.h @@ -0,0 +1,86 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- + * + * On-screen-display (OSD) window for gnome-settings-daemon's plugins + * + * Copyright (C) 2006 William Jon McCann + * Copyright (C) 2009 Novell, Inc + * + * Authors: + * William Jon McCann + * Federico Mena-Quintero + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2, 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 Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser 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. + * + */ + +/* GsdOsdWindow is an "on-screen-display" window (OSD). It is the cute, + * semi-transparent, curved popup that appears when you press a hotkey global to + * the desktop, such as to change the volume, switch your monitor's parameters, + * etc. + */ + +#ifndef GSD_OSD_WINDOW_H +#define GSD_OSD_WINDOW_H + +#include +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_OSD_WINDOW (gsd_osd_window_get_type ()) +#define GSD_OSD_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_OSD_WINDOW, GsdOsdWindow)) +#define GSD_OSD_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_OSD_WINDOW, GsdOsdWindowClass)) +#define GSD_IS_OSD_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_OSD_WINDOW)) +#define GSD_IS_OSD_WINDOW_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS ((klass), GSD_TYPE_OSD_WINDOW)) +#define GSD_OSD_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_OSD_WINDOW, GsdOsdWindowClass)) + +typedef struct GsdOsdWindow GsdOsdWindow; +typedef struct GsdOsdWindowClass GsdOsdWindowClass; +typedef struct GsdOsdWindowPrivate GsdOsdWindowPrivate; + +struct GsdOsdWindow { + GtkWindow parent; + + GsdOsdWindowPrivate *priv; +}; + +struct GsdOsdWindowClass { + GtkWindowClass parent_class; +}; + +typedef enum { + GSD_OSD_WINDOW_ACTION_VOLUME, + GSD_OSD_WINDOW_ACTION_CUSTOM +} GsdOsdWindowAction; + +GType gsd_osd_window_get_type (void); + +GtkWidget * gsd_osd_window_new (void); +gboolean gsd_osd_window_is_valid (GsdOsdWindow *window); +void gsd_osd_window_set_action (GsdOsdWindow *window, + GsdOsdWindowAction action); +void gsd_osd_window_set_action_custom (GsdOsdWindow *window, + const char *icon_name, + gboolean show_level); +void gsd_osd_window_set_volume_muted (GsdOsdWindow *window, + gboolean muted); +void gsd_osd_window_set_volume_level (GsdOsdWindow *window, + int level); + +G_END_DECLS + +#endif diff --git a/plugins/media-keys/media-keys.gnome-settings-plugin.in b/plugins/media-keys/media-keys.gnome-settings-plugin.in new file mode 100644 index 00000000..ae7e546e --- /dev/null +++ b/plugins/media-keys/media-keys.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=media-keys +IAge=0 +_Name=Media keys +_Description=Media keys plugin +Authors= +Copyright=Copyright © 2007 +Website= diff --git a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h new file mode 100644 index 00000000..0ca0b993 --- /dev/null +++ b/plugins/media-keys/shortcuts-list.h @@ -0,0 +1,154 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2001 Bastien Nocera + * + * 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 __ACME_H__ +#define __ACME_H__ + +#include "gsd-keygrab.h" + +#define SETTINGS_BINDING_DIR "org.gnome.settings-daemon.plugins.media-keys" + +typedef enum { + TOUCHPAD_KEY, + TOUCHPAD_ON_KEY, + TOUCHPAD_OFF_KEY, + MUTE_KEY, + VOLUME_DOWN_KEY, + VOLUME_UP_KEY, + MUTE_QUIET_KEY, + VOLUME_DOWN_QUIET_KEY, + VOLUME_UP_QUIET_KEY, + LOGOUT_KEY, + EJECT_KEY, + HOME_KEY, + MEDIA_KEY, + CALCULATOR_KEY, + SEARCH_KEY, + EMAIL_KEY, + SCREENSAVER_KEY, + HELP_KEY, + SCREENSHOT_KEY, + WINDOW_SCREENSHOT_KEY, + AREA_SCREENSHOT_KEY, + SCREENSHOT_CLIP_KEY, + WINDOW_SCREENSHOT_CLIP_KEY, + AREA_SCREENSHOT_CLIP_KEY, + TERMINAL_KEY, + WWW_KEY, + PLAY_KEY, + PAUSE_KEY, + STOP_KEY, + PREVIOUS_KEY, + NEXT_KEY, + REWIND_KEY, + FORWARD_KEY, + REPEAT_KEY, + RANDOM_KEY, + VIDEO_OUT_KEY, + ROTATE_VIDEO_KEY, + MAGNIFIER_KEY, + SCREENREADER_KEY, + ON_SCREEN_KEYBOARD_KEY, + INCREASE_TEXT_KEY, + DECREASE_TEXT_KEY, + TOGGLE_CONTRAST_KEY, + MAGNIFIER_ZOOM_IN_KEY, + MAGNIFIER_ZOOM_OUT_KEY, + POWER_KEY, + SLEEP_KEY, + SUSPEND_KEY, + HIBERNATE_KEY, + SCREEN_BRIGHTNESS_UP_KEY, + SCREEN_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_UP_KEY, + KEYBOARD_BRIGHTNESS_DOWN_KEY, + KEYBOARD_BRIGHTNESS_TOGGLE_KEY, + BATTERY_KEY, + CUSTOM_KEY +} MediaKeyType; + +static struct { + MediaKeyType key_type; + const char *settings_key; + const char *hard_coded; +} media_keys[] = { + { TOUCHPAD_KEY, NULL, "XF86TouchpadToggle" }, + { TOUCHPAD_ON_KEY, NULL, "XF86TouchpadOn" }, + { TOUCHPAD_OFF_KEY, NULL, "XF86TouchpadOff" }, + { MUTE_KEY, "volume-mute", NULL }, + { VOLUME_DOWN_KEY, "volume-down", NULL }, + { VOLUME_UP_KEY, "volume-up", NULL }, + { MUTE_QUIET_KEY, NULL, "XF86AudioMute" }, + { VOLUME_DOWN_QUIET_KEY, NULL, "XF86AudioLowerVolume" }, + { VOLUME_UP_QUIET_KEY, NULL, "XF86AudioRaiseVolume" }, + { LOGOUT_KEY, "logout", NULL }, + { EJECT_KEY, "eject", NULL }, + { HOME_KEY, "home", NULL }, + { MEDIA_KEY, "media", NULL }, + { CALCULATOR_KEY, "calculator", NULL }, + { SEARCH_KEY, "search", NULL }, + { EMAIL_KEY, "email", NULL }, + { SCREENSAVER_KEY, "screensaver", NULL }, + { SCREENSAVER_KEY, NULL, "XF86ScreenSaver" }, + { HELP_KEY, "help", NULL }, + { SCREENSHOT_KEY, "screenshot", NULL }, + { WINDOW_SCREENSHOT_KEY, "window-screenshot", NULL }, + { AREA_SCREENSHOT_KEY, "area-screenshot", NULL }, + { SCREENSHOT_CLIP_KEY, "screenshot-clip", NULL }, + { WINDOW_SCREENSHOT_CLIP_KEY, "window-screenshot-clip", NULL }, + { AREA_SCREENSHOT_CLIP_KEY, "area-screenshot-clip", NULL }, + { TERMINAL_KEY, "terminal", NULL }, + { WWW_KEY, "www", NULL }, + { PLAY_KEY, "play", NULL }, + { PAUSE_KEY, "pause", NULL }, + { STOP_KEY, "stop", NULL }, + { PREVIOUS_KEY, "previous", NULL }, + { NEXT_KEY, "next", NULL }, + { REWIND_KEY, NULL, "XF86AudioRewind" }, + { FORWARD_KEY, NULL, "XF86AudioForward" }, + { REPEAT_KEY, NULL, "XF86AudioRepeat" }, + { RANDOM_KEY, NULL, "XF86AudioRandomPlay"}, + { VIDEO_OUT_KEY, NULL, "p" }, + /* Key code of the XF86Display key (Fn-F7 on Thinkpads, Fn-F4 on HP machines, etc.) */ + { VIDEO_OUT_KEY, NULL, "XF86Display" }, + /* Key code of the XF86RotateWindows key (present on some tablets) */ + { ROTATE_VIDEO_KEY, NULL, "XF86RotateWindows" }, + { MAGNIFIER_KEY, "magnifier", NULL }, + { SCREENREADER_KEY, "screenreader", NULL }, + { ON_SCREEN_KEYBOARD_KEY, "on-screen-keyboard", NULL }, + { INCREASE_TEXT_KEY, "increase-text-size", NULL }, + { DECREASE_TEXT_KEY, "decrease-text-size", NULL }, + { TOGGLE_CONTRAST_KEY, "toggle-contrast", NULL }, + { MAGNIFIER_ZOOM_IN_KEY, "magnifier-zoom-in", NULL }, + { MAGNIFIER_ZOOM_OUT_KEY, "magnifier-zoom-out", NULL }, + { POWER_KEY, NULL, "XF86PowerOff" }, + /* the kernel / Xorg names really are like this... */ + { SLEEP_KEY, NULL, "XF86Suspend" }, + { SUSPEND_KEY, NULL, "XF86Sleep" }, + { HIBERNATE_KEY, NULL, "XF86Hibernate" }, + { SCREEN_BRIGHTNESS_UP_KEY, NULL, "XF86MonBrightnessUp" }, + { SCREEN_BRIGHTNESS_DOWN_KEY, NULL, "XF86MonBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_UP_KEY, NULL, "XF86KbdBrightnessUp" }, + { KEYBOARD_BRIGHTNESS_DOWN_KEY, NULL, "XF86KbdBrightnessDown" }, + { KEYBOARD_BRIGHTNESS_TOGGLE_KEY, NULL, "XF86KbdLightOnOff" }, + { BATTERY_KEY, NULL, "XF86Battery" }, +}; + +#endif /* __ACME_H__ */ diff --git a/plugins/media-keys/test-media-keys.c b/plugins/media-keys/test-media-keys.c new file mode 100644 index 00000000..2471563e --- /dev/null +++ b/plugins/media-keys/test-media-keys.c @@ -0,0 +1,7 @@ +#define NEW gsd_media_keys_manager_new +#define START gsd_media_keys_manager_start +#define STOP gsd_media_keys_manager_stop +#define MANAGER GsdMediaKeysManager +#include "gsd-media-keys-manager.h" + +#include "test-plugin.h" diff --git a/plugins/media-keys/test-media-window-clutter.c b/plugins/media-keys/test-media-window-clutter.c new file mode 100644 index 00000000..b43ccca7 --- /dev/null +++ b/plugins/media-keys/test-media-window-clutter.c @@ -0,0 +1,98 @@ +// gcc -o test-media-window-clutter `pkg-config --libs --cflags clutter-1.0 gtk+-3.0 cairo` -I../../ -lm test-media-window-clutter.c gsd-osd-window.c + +#include +#include + +#include +#include + +#include "gsd-osd-window.h" +#include "gsd-osd-window-private.h" + +static gboolean +draw_box (ClutterCanvas *canvas, + cairo_t *cr, + int width, + int height, + GsdOsdDrawContext *ctx) +{ + cairo_save (cr); + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + cairo_paint (cr); + + cairo_restore (cr); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + + ctx->size = MIN(width, height); + + ctx->action = GSD_OSD_WINDOW_ACTION_CUSTOM; + ctx->icon_name = "touchpad-disabled-symbolic"; + + gsd_osd_window_draw (ctx, cr); + + return FALSE; +} + +static void +test_window (void) +{ + GsdOsdDrawContext ctx; + ClutterActor *stage, *actor; + ClutterContent *canvas; + GtkWidgetPath *widget_path; + + /* create a resizable stage */ + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "OSD Test"); + clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); + clutter_actor_set_background_color (stage, CLUTTER_COLOR_Red); + clutter_actor_set_size (stage, 300, 300); + clutter_actor_show (stage); + + /* box canvas */ + canvas = clutter_canvas_new (); + clutter_canvas_set_size (CLUTTER_CANVAS (canvas), 300, 300); + + actor = clutter_actor_new (); + clutter_actor_add_constraint (actor, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0)); + clutter_actor_set_content (actor, canvas); + g_object_unref (canvas); + + clutter_actor_add_child (stage, actor); + + memset (&ctx, 0, sizeof(ctx)); + + widget_path = gtk_widget_path_new (); + gtk_widget_path_append_type (widget_path, GTK_TYPE_WINDOW); + ctx.style = gtk_style_context_new (); + gtk_style_context_set_path (ctx.style, widget_path); + + ctx.direction = clutter_get_default_text_direction (); + ctx.theme = gtk_icon_theme_get_default (); + + g_signal_connect (canvas, "draw", G_CALLBACK (draw_box), &ctx); + clutter_content_invalidate (canvas); + + g_signal_connect (stage, "destroy", G_CALLBACK (gtk_main_quit), NULL); +} + +int +main (int argc, + char **argv) +{ + GError *error = NULL; + + if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) { + fprintf (stderr, "%s", error->message); + g_error_free (error); + exit (1); + } + if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) + return EXIT_FAILURE; + + test_window (); + + gtk_main (); + + return 0; +} diff --git a/plugins/media-keys/test-media-window.c b/plugins/media-keys/test-media-window.c new file mode 100644 index 00000000..1fbd273f --- /dev/null +++ b/plugins/media-keys/test-media-window.c @@ -0,0 +1,147 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 + +#include +#include + +#include "gsd-osd-window.h" + +static gboolean +update_state (GtkWidget *window) +{ + static int count = 0; + + count++; + + switch (count) { + case 1: + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (window), 50); + gsd_osd_window_set_action (GSD_OSD_WINDOW (window), + GSD_OSD_WINDOW_ACTION_VOLUME); + + gtk_widget_show (window); + break; + case 2: + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (window), 100); + gsd_osd_window_set_action (GSD_OSD_WINDOW (window), + GSD_OSD_WINDOW_ACTION_VOLUME); + + gtk_widget_show (window); + break; + case 3: + gsd_osd_window_set_volume_muted (GSD_OSD_WINDOW (window), TRUE); + gsd_osd_window_set_action (GSD_OSD_WINDOW (window), + GSD_OSD_WINDOW_ACTION_VOLUME); + + gtk_widget_show (window); + break; + case 4: + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (window), + "media-eject-symbolic", + FALSE); + + gtk_widget_show (window); + break; + case 5: + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (window), 50); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (window), + "display-brightness-symbolic", + TRUE); + + gtk_widget_show (window); + break; + case 6: + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (window), 50); + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (window), + "keyboard-brightness-symbolic", + TRUE); + + gtk_widget_show (window); + break; + case 7: + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (window), + "touchpad-disabled-symbolic", + TRUE); + + gtk_widget_show (window); + break; + case 8: + gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (window), + "input-touchpad-symbolic", + TRUE); + + gtk_widget_show (window); + break; + default: + gtk_main_quit (); + break; + } + + return TRUE; +} + +static void +test_window (void) +{ + GtkWidget *window; + + window = gsd_osd_window_new (); + gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ALWAYS); + + gsd_osd_window_set_volume_level (GSD_OSD_WINDOW (window), 0); + gsd_osd_window_set_action (GSD_OSD_WINDOW (window), + GSD_OSD_WINDOW_ACTION_VOLUME); + + gtk_widget_show (window); + + g_timeout_add (3000, (GSourceFunc) update_state, window); +} + +int +main (int argc, + char **argv) +{ + GError *error = NULL; + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) { + fprintf (stderr, "%s", error->message); + g_error_free (error); + exit (1); + } + + gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), + DATADIR G_DIR_SEPARATOR_S "gnome-power-manager" G_DIR_SEPARATOR_S "icons"); + + test_window (); + + gtk_main (); + + return 0; +} diff --git a/plugins/mouse/Makefile.am b/plugins/mouse/Makefile.am new file mode 100644 index 00000000..57f03436 --- /dev/null +++ b/plugins/mouse/Makefile.am @@ -0,0 +1,88 @@ +plugin_name = mouse + +plugin_LTLIBRARIES = libmouse.la + +libmouse_la_SOURCES = \ + gsd-mouse-plugin.h \ + gsd-mouse-plugin.c \ + gsd-mouse-manager.h \ + gsd-mouse-manager.c + +libmouse_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -I$(top_srcdir)/data/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +libmouse_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MOUSE_CFLAGS) \ + $(AM_CFLAGS) + +libmouse_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libmouse_la_LIBADD = \ + $(MOUSE_LIBS) \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = mouse.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +libexec_PROGRAMS = gsd-locate-pointer + +gsd_locate_pointer_SOURCES = \ + gsd-locate-pointer.h \ + gsd-locate-pointer.c \ + gsd-timeline.h \ + gsd-timeline.c + +gsd_locate_pointer_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MOUSE_CFLAGS) \ + $(AM_CFLAGS) + +gsd_locate_pointer_LDADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(MOUSE_LIBS) \ + -lm + +libexec_PROGRAMS += gsd-test-mouse + +gsd_test_mouse_SOURCES = \ + test-mouse.c \ + gsd-mouse-manager.c \ + gsd-mouse-manager.h + +gsd_test_mouse_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +gsd_test_mouse_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MOUSE_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_mouse_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(MOUSE_LIBS) \ + -lm + +EXTRA_DIST = $(plugin_in_files) +CLEANFILES = $(plugin_DATA) +DISTCLEANFILES = $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/mouse/Makefile.in b/plugins/mouse/Makefile.in new file mode 100644 index 00000000..09cfdfee --- /dev/null +++ b/plugins/mouse/Makefile.in @@ -0,0 +1,963 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-locate-pointer$(EXEEXT) gsd-test-mouse$(EXEEXT) +subdir = plugins/mouse +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libmouse_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) +am_libmouse_la_OBJECTS = libmouse_la-gsd-mouse-plugin.lo \ + libmouse_la-gsd-mouse-manager.lo +libmouse_la_OBJECTS = $(am_libmouse_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libmouse_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmouse_la_CFLAGS) \ + $(CFLAGS) $(libmouse_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_locate_pointer_OBJECTS = \ + gsd_locate_pointer-gsd-locate-pointer.$(OBJEXT) \ + gsd_locate_pointer-gsd-timeline.$(OBJEXT) +gsd_locate_pointer_OBJECTS = $(am_gsd_locate_pointer_OBJECTS) +gsd_locate_pointer_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_locate_pointer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_locate_pointer_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_gsd_test_mouse_OBJECTS = gsd_test_mouse-test-mouse.$(OBJEXT) \ + gsd_test_mouse-gsd-mouse-manager.$(OBJEXT) +gsd_test_mouse_OBJECTS = $(am_gsd_test_mouse_OBJECTS) +gsd_test_mouse_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_test_mouse_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_mouse_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libmouse_la_SOURCES) $(gsd_locate_pointer_SOURCES) \ + $(gsd_test_mouse_SOURCES) +DIST_SOURCES = $(libmouse_la_SOURCES) $(gsd_locate_pointer_SOURCES) \ + $(gsd_test_mouse_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = mouse +plugin_LTLIBRARIES = libmouse.la +libmouse_la_SOURCES = \ + gsd-mouse-plugin.h \ + gsd-mouse-plugin.c \ + gsd-mouse-manager.h \ + gsd-mouse-manager.c + +libmouse_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -I$(top_srcdir)/data/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +libmouse_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MOUSE_CFLAGS) \ + $(AM_CFLAGS) + +libmouse_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libmouse_la_LIBADD = \ + $(MOUSE_LIBS) \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = mouse.gnome-settings-plugin.in +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +gsd_locate_pointer_SOURCES = \ + gsd-locate-pointer.h \ + gsd-locate-pointer.c \ + gsd-timeline.h \ + gsd-timeline.c + +gsd_locate_pointer_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MOUSE_CFLAGS) \ + $(AM_CFLAGS) + +gsd_locate_pointer_LDADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(MOUSE_LIBS) \ + -lm + +gsd_test_mouse_SOURCES = \ + test-mouse.c \ + gsd-mouse-manager.c \ + gsd-mouse-manager.h + +gsd_test_mouse_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +gsd_test_mouse_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(MOUSE_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_mouse_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(MOUSE_LIBS) \ + -lm + +EXTRA_DIST = $(plugin_in_files) +CLEANFILES = $(plugin_DATA) +DISTCLEANFILES = $(plugin_DATA) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/mouse/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/mouse/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libmouse.la: $(libmouse_la_OBJECTS) $(libmouse_la_DEPENDENCIES) $(EXTRA_libmouse_la_DEPENDENCIES) + $(AM_V_CCLD)$(libmouse_la_LINK) -rpath $(plugindir) $(libmouse_la_OBJECTS) $(libmouse_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-locate-pointer$(EXEEXT): $(gsd_locate_pointer_OBJECTS) $(gsd_locate_pointer_DEPENDENCIES) $(EXTRA_gsd_locate_pointer_DEPENDENCIES) + @rm -f gsd-locate-pointer$(EXEEXT) + $(AM_V_CCLD)$(gsd_locate_pointer_LINK) $(gsd_locate_pointer_OBJECTS) $(gsd_locate_pointer_LDADD) $(LIBS) +gsd-test-mouse$(EXEEXT): $(gsd_test_mouse_OBJECTS) $(gsd_test_mouse_DEPENDENCIES) $(EXTRA_gsd_test_mouse_DEPENDENCIES) + @rm -f gsd-test-mouse$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_mouse_LINK) $(gsd_test_mouse_OBJECTS) $(gsd_test_mouse_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_locate_pointer-gsd-timeline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_mouse-test-mouse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmouse_la-gsd-mouse-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmouse_la-gsd-mouse-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libmouse_la-gsd-mouse-plugin.lo: gsd-mouse-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -MT libmouse_la-gsd-mouse-plugin.lo -MD -MP -MF $(DEPDIR)/libmouse_la-gsd-mouse-plugin.Tpo -c -o libmouse_la-gsd-mouse-plugin.lo `test -f 'gsd-mouse-plugin.c' || echo '$(srcdir)/'`gsd-mouse-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmouse_la-gsd-mouse-plugin.Tpo $(DEPDIR)/libmouse_la-gsd-mouse-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-mouse-plugin.c' object='libmouse_la-gsd-mouse-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -c -o libmouse_la-gsd-mouse-plugin.lo `test -f 'gsd-mouse-plugin.c' || echo '$(srcdir)/'`gsd-mouse-plugin.c + +libmouse_la-gsd-mouse-manager.lo: gsd-mouse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -MT libmouse_la-gsd-mouse-manager.lo -MD -MP -MF $(DEPDIR)/libmouse_la-gsd-mouse-manager.Tpo -c -o libmouse_la-gsd-mouse-manager.lo `test -f 'gsd-mouse-manager.c' || echo '$(srcdir)/'`gsd-mouse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmouse_la-gsd-mouse-manager.Tpo $(DEPDIR)/libmouse_la-gsd-mouse-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-mouse-manager.c' object='libmouse_la-gsd-mouse-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -c -o libmouse_la-gsd-mouse-manager.lo `test -f 'gsd-mouse-manager.c' || echo '$(srcdir)/'`gsd-mouse-manager.c + +gsd_locate_pointer-gsd-locate-pointer.o: gsd-locate-pointer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-locate-pointer.o -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo -c -o gsd_locate_pointer-gsd-locate-pointer.o `test -f 'gsd-locate-pointer.c' || echo '$(srcdir)/'`gsd-locate-pointer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-locate-pointer.c' object='gsd_locate_pointer-gsd-locate-pointer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-locate-pointer.o `test -f 'gsd-locate-pointer.c' || echo '$(srcdir)/'`gsd-locate-pointer.c + +gsd_locate_pointer-gsd-locate-pointer.obj: gsd-locate-pointer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-locate-pointer.obj -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo -c -o gsd_locate_pointer-gsd-locate-pointer.obj `if test -f 'gsd-locate-pointer.c'; then $(CYGPATH_W) 'gsd-locate-pointer.c'; else $(CYGPATH_W) '$(srcdir)/gsd-locate-pointer.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-locate-pointer.c' object='gsd_locate_pointer-gsd-locate-pointer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-locate-pointer.obj `if test -f 'gsd-locate-pointer.c'; then $(CYGPATH_W) 'gsd-locate-pointer.c'; else $(CYGPATH_W) '$(srcdir)/gsd-locate-pointer.c'; fi` + +gsd_locate_pointer-gsd-timeline.o: gsd-timeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-timeline.o -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo -c -o gsd_locate_pointer-gsd-timeline.o `test -f 'gsd-timeline.c' || echo '$(srcdir)/'`gsd-timeline.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-timeline.c' object='gsd_locate_pointer-gsd-timeline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-timeline.o `test -f 'gsd-timeline.c' || echo '$(srcdir)/'`gsd-timeline.c + +gsd_locate_pointer-gsd-timeline.obj: gsd-timeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-timeline.obj -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo -c -o gsd_locate_pointer-gsd-timeline.obj `if test -f 'gsd-timeline.c'; then $(CYGPATH_W) 'gsd-timeline.c'; else $(CYGPATH_W) '$(srcdir)/gsd-timeline.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-timeline.c' object='gsd_locate_pointer-gsd-timeline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-timeline.obj `if test -f 'gsd-timeline.c'; then $(CYGPATH_W) 'gsd-timeline.c'; else $(CYGPATH_W) '$(srcdir)/gsd-timeline.c'; fi` + +gsd_test_mouse-test-mouse.o: test-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -MT gsd_test_mouse-test-mouse.o -MD -MP -MF $(DEPDIR)/gsd_test_mouse-test-mouse.Tpo -c -o gsd_test_mouse-test-mouse.o `test -f 'test-mouse.c' || echo '$(srcdir)/'`test-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_mouse-test-mouse.Tpo $(DEPDIR)/gsd_test_mouse-test-mouse.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-mouse.c' object='gsd_test_mouse-test-mouse.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -c -o gsd_test_mouse-test-mouse.o `test -f 'test-mouse.c' || echo '$(srcdir)/'`test-mouse.c + +gsd_test_mouse-test-mouse.obj: test-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -MT gsd_test_mouse-test-mouse.obj -MD -MP -MF $(DEPDIR)/gsd_test_mouse-test-mouse.Tpo -c -o gsd_test_mouse-test-mouse.obj `if test -f 'test-mouse.c'; then $(CYGPATH_W) 'test-mouse.c'; else $(CYGPATH_W) '$(srcdir)/test-mouse.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_mouse-test-mouse.Tpo $(DEPDIR)/gsd_test_mouse-test-mouse.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-mouse.c' object='gsd_test_mouse-test-mouse.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -c -o gsd_test_mouse-test-mouse.obj `if test -f 'test-mouse.c'; then $(CYGPATH_W) 'test-mouse.c'; else $(CYGPATH_W) '$(srcdir)/test-mouse.c'; fi` + +gsd_test_mouse-gsd-mouse-manager.o: gsd-mouse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -MT gsd_test_mouse-gsd-mouse-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Tpo -c -o gsd_test_mouse-gsd-mouse-manager.o `test -f 'gsd-mouse-manager.c' || echo '$(srcdir)/'`gsd-mouse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Tpo $(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-mouse-manager.c' object='gsd_test_mouse-gsd-mouse-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -c -o gsd_test_mouse-gsd-mouse-manager.o `test -f 'gsd-mouse-manager.c' || echo '$(srcdir)/'`gsd-mouse-manager.c + +gsd_test_mouse-gsd-mouse-manager.obj: gsd-mouse-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -MT gsd_test_mouse-gsd-mouse-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Tpo -c -o gsd_test_mouse-gsd-mouse-manager.obj `if test -f 'gsd-mouse-manager.c'; then $(CYGPATH_W) 'gsd-mouse-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-mouse-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Tpo $(DEPDIR)/gsd_test_mouse-gsd-mouse-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-mouse-manager.c' object='gsd_test_mouse-gsd-mouse-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_mouse_CPPFLAGS) $(CPPFLAGS) $(gsd_test_mouse_CFLAGS) $(CFLAGS) -c -o gsd_test_mouse-gsd-mouse-manager.obj `if test -f 'gsd-mouse-manager.c'; then $(CYGPATH_W) 'gsd-mouse-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-mouse-manager.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/mouse/gsd-locate-pointer.c b/plugins/mouse/gsd-locate-pointer.c new file mode 100644 index 00000000..32b1a758 --- /dev/null +++ b/plugins/mouse/gsd-locate-pointer.c @@ -0,0 +1,520 @@ +/* gsd-locate-pointer.c + * + * Copyright (C) 2008 Carlos Garnacho + * + * 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 +#include "gsd-timeline.h" +#include "gsd-locate-pointer.h" + +#include +#include +#include + +#define ANIMATION_LENGTH 750 +#define WINDOW_SIZE 101 +#define N_CIRCLES 4 + +/* All circles are supposed to be moving when progress + * reaches 0.5, and each of them are supposed to long + * for half of the progress, hence the need of 0.5 to + * get the circles interval, and the multiplication + * by 2 to know a circle progress */ +#define CIRCLES_PROGRESS_INTERVAL (0.5 / N_CIRCLES) +#define CIRCLE_PROGRESS(p) (MIN (1., ((gdouble) (p) * 2.))) + +typedef struct GsdLocatePointerData GsdLocatePointerData; + +struct GsdLocatePointerData +{ + GsdTimeline *timeline; + GtkWidget *widget; + GdkWindow *window; + + gdouble progress; +}; + +static GsdLocatePointerData *data = NULL; + +static void +locate_pointer_paint (GsdLocatePointerData *data, + cairo_t *cr, + gboolean composite) +{ + GdkRGBA color; + gdouble progress, circle_progress; + gint width, height, i; + GtkStyleContext *context; + + progress = data->progress; + + width = gdk_window_get_width (data->window); + height = gdk_window_get_height (data->window); + context = gtk_widget_get_style_context (data->widget); + gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &color); + + cairo_set_source_rgba (cr, 1., 1., 1., 0.); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr); + + for (i = 0; i <= N_CIRCLES; i++) + { + if (progress < 0.) + break; + + circle_progress = MIN (1., (progress * 2)); + progress -= CIRCLES_PROGRESS_INTERVAL; + + if (circle_progress >= 1.) + continue; + + if (composite) + { + cairo_set_source_rgba (cr, + color.red, + color.green, + color.blue, + 1 - circle_progress); + cairo_arc (cr, + width / 2, + height / 2, + circle_progress * width / 2, + 0, 2 * G_PI); + + cairo_fill (cr); + } + else + { + cairo_set_source_rgb (cr, 0., 0., 0.); + cairo_set_line_width (cr, 3.); + cairo_arc (cr, + width / 2, + height / 2, + circle_progress * width / 2, + 0, 2 * G_PI); + cairo_stroke (cr); + + cairo_set_source_rgb (cr, 1., 1., 1.); + cairo_set_line_width (cr, 1.); + cairo_arc (cr, + width / 2, + height / 2, + circle_progress * width / 2, + 0, 2 * G_PI); + cairo_stroke (cr); + } + } +} + +static gboolean +locate_pointer_draw (GtkWidget *widget, + cairo_t *cr, + gpointer user_data) +{ + GsdLocatePointerData *data = (GsdLocatePointerData *) user_data; + + if (gtk_cairo_should_draw_window (cr, data->window)) + locate_pointer_paint (data, cr, gtk_widget_is_composited (data->widget)); + + return TRUE; +} + +static void +update_shape (GsdLocatePointerData *data) +{ + cairo_t *cr; + cairo_region_t *region; + cairo_surface_t *mask; + + mask = cairo_image_surface_create (CAIRO_FORMAT_A1, WINDOW_SIZE, WINDOW_SIZE); + cr = cairo_create (mask); + + locate_pointer_paint (data, cr, FALSE); + + region = gdk_cairo_region_create_from_surface (mask); + gdk_window_shape_combine_region (data->window, region, 0, 0); + + cairo_region_destroy (region); + cairo_destroy (cr); + cairo_surface_destroy (mask); +} + +static void +timeline_frame_cb (GsdTimeline *timeline, + gdouble progress, + gpointer user_data) +{ + GsdLocatePointerData *data = (GsdLocatePointerData *) user_data; + GdkScreen *screen; + gint cursor_x, cursor_y; + + if (gtk_widget_is_composited (data->widget)) + { + gdk_window_invalidate_rect (data->window, NULL, FALSE); + data->progress = progress; + } + else if (progress >= data->progress + CIRCLES_PROGRESS_INTERVAL) + { + /* only invalidate window each circle interval */ + update_shape (data); + gdk_window_invalidate_rect (data->window, NULL, FALSE); + data->progress += CIRCLES_PROGRESS_INTERVAL; + } + + screen = gdk_window_get_screen (data->window); + gdk_window_get_pointer (gdk_screen_get_root_window (screen), + &cursor_x, &cursor_y, NULL); + gdk_window_move (data->window, + cursor_x - WINDOW_SIZE / 2, + cursor_y - WINDOW_SIZE / 2); +} + +static void +set_transparent_shape (GdkWindow *window) +{ + cairo_region_t *region; + + region = cairo_region_create (); + gdk_window_shape_combine_region (data->window, region, 0, 0); + cairo_region_destroy (region); +} + +static void +unset_transparent_shape (GdkWindow *window) +{ + gdk_window_shape_combine_region (data->window, NULL, 0, 0); +} + +static void +composited_changed (GtkWidget *widget, + GsdLocatePointerData *data) +{ + if (!gtk_widget_is_composited (widget)) + set_transparent_shape (data->window); + else + unset_transparent_shape (data->window); +} + +static void +timeline_finished_cb (GsdTimeline *timeline, + gpointer user_data) +{ + GsdLocatePointerData *data = (GsdLocatePointerData *) user_data; + + /* set transparent shape and hide window */ + if (!gtk_widget_is_composited (data->widget)) + set_transparent_shape (data->window); + + gtk_widget_hide (data->widget); + gdk_window_hide (data->window); +} + +static void +create_window (GsdLocatePointerData *data, + GdkScreen *screen) +{ + GdkVisual *visual; + GdkWindowAttr attributes; + gint attributes_mask; + + visual = gdk_screen_get_rgba_visual (screen); + + if (visual == NULL) + visual = gdk_screen_get_system_visual (screen); + + attributes_mask = GDK_WA_X | GDK_WA_Y; + + if (visual != NULL) + attributes_mask = attributes_mask | GDK_WA_VISUAL; + + attributes.window_type = GDK_WINDOW_TEMP; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.visual = visual; + attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK; + attributes.width = 1; + attributes.height = 1; + + data->window = gdk_window_new (gdk_screen_get_root_window (screen), + &attributes, + attributes_mask); + + gdk_window_set_user_data (data->window, data->widget); +} + +static GsdLocatePointerData * +gsd_locate_pointer_data_new (GdkScreen *screen) +{ + GsdLocatePointerData *data; + + data = g_new0 (GsdLocatePointerData, 1); + + /* this widget will never be shown, it's + * mainly used to get signals/events from + */ + data->widget = gtk_invisible_new (); + gtk_widget_realize (data->widget); + + g_signal_connect (G_OBJECT (data->widget), "draw", + G_CALLBACK (locate_pointer_draw), + data); + + data->timeline = gsd_timeline_new (ANIMATION_LENGTH); + g_signal_connect (data->timeline, "frame", + G_CALLBACK (timeline_frame_cb), data); + g_signal_connect (data->timeline, "finished", + G_CALLBACK (timeline_finished_cb), data); + + create_window (data, screen); + + return data; +} + +static void +move_locate_pointer_window (GsdLocatePointerData *data, + GdkScreen *screen) +{ + cairo_region_t *region; + gint cursor_x, cursor_y; + + gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL); + + gdk_window_move_resize (data->window, + cursor_x - WINDOW_SIZE / 2, + cursor_y - WINDOW_SIZE / 2, + WINDOW_SIZE, WINDOW_SIZE); + + /* allow events to happen through the window */ + region = cairo_region_create (); + gdk_window_input_shape_combine_region (data->window, region, 0, 0); + cairo_region_destroy (region); +} + +void +gsd_locate_pointer (GdkScreen *screen) +{ + if (!data) + data = gsd_locate_pointer_data_new (screen); + + gsd_timeline_pause (data->timeline); + gsd_timeline_rewind (data->timeline); + + /* Create again the window if it is not for the current screen */ + if (gdk_screen_get_number (screen) != gdk_screen_get_number (gdk_window_get_screen (data->window))) + { + gdk_window_set_user_data (data->window, NULL); + gdk_window_destroy (data->window); + + create_window (data, screen); + } + + data->progress = 0.; + + g_signal_connect (data->widget, "composited-changed", + G_CALLBACK (composited_changed), data); + + move_locate_pointer_window (data, screen); + composited_changed (data->widget, data); + gdk_window_show (data->window); + gtk_widget_show (data->widget); + + gsd_timeline_start (data->timeline); +} + + +#define KEYBOARD_GROUP_SHIFT 13 +#define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14)) + +/* Owen magic */ +static GdkFilterReturn +filter (GdkXEvent *xevent, + GdkEvent *event, + gpointer data) +{ + XEvent *xev = (XEvent *) xevent; + guint keyval; + gint group; + + GdkScreen *screen = (GdkScreen *)data; + + if (xev->type == ButtonPress) + { + XAllowEvents (xev->xbutton.display, + ReplayPointer, + xev->xbutton.time); + XUngrabButton (xev->xbutton.display, + AnyButton, + AnyModifier, + xev->xbutton.window); + XUngrabKeyboard (xev->xbutton.display, + xev->xbutton.time); + } + + if (xev->type == KeyPress || xev->type == KeyRelease) + { + /* get the keysym */ + group = (xev->xkey.state & KEYBOARD_GROUP_MASK) >> KEYBOARD_GROUP_SHIFT; + gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (), + xev->xkey.keycode, + xev->xkey.state, + group, + &keyval, + NULL, NULL, NULL); + if (keyval == GDK_KEY_Control_L || keyval == GDK_KEY_Control_R) + { + if (xev->type == KeyPress) + { + XAllowEvents (xev->xkey.display, + SyncKeyboard, + xev->xkey.time); + XGrabButton (xev->xkey.display, + AnyButton, + AnyModifier, + xev->xkey.window, + False, + ButtonPressMask, + GrabModeSync, + GrabModeAsync, + None, + None); + } + else + { + XUngrabButton (xev->xkey.display, + AnyButton, + AnyModifier, + xev->xkey.window); + XAllowEvents (xev->xkey.display, + AsyncKeyboard, + xev->xkey.time); + gsd_locate_pointer (screen); + } + } + else + { + XAllowEvents (xev->xkey.display, + ReplayKeyboard, + xev->xkey.time); + XUngrabButton (xev->xkey.display, + AnyButton, + AnyModifier, + xev->xkey.window); + XUngrabKeyboard (xev->xkey.display, + xev->xkey.time); + } + } + + return GDK_FILTER_CONTINUE; +} + +static void +set_locate_pointer (void) +{ + GdkKeymapKey *keys; + GdkDisplay *display; + int n_screens; + int n_keys; + gboolean has_entries; + static const guint keyvals[] = { GDK_KEY_Control_L, GDK_KEY_Control_R }; + unsigned j; + + display = gdk_display_get_default (); + n_screens = gdk_display_get_n_screens (display); + + for (j = 0 ; j < G_N_ELEMENTS (keyvals) ; j++) + { + has_entries = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), + keyvals[j], + &keys, + &n_keys); + if (has_entries) + { + gint i, j; + for (i = 0; i < n_keys; i++) + { + for (j = 0; j < n_screens; j++) + { + GdkScreen *screen; + Window xroot; + + screen = gdk_display_get_screen (display, j); + xroot = gdk_x11_window_get_xid (gdk_screen_get_root_window (screen)); + + gdk_x11_display_error_trap_push (display); + + XGrabKey (GDK_DISPLAY_XDISPLAY (display), + keys[i].keycode, + 0, + xroot, + False, + GrabModeAsync, + GrabModeSync); + XGrabKey (GDK_DISPLAY_XDISPLAY (display), + keys[i].keycode, + LockMask, + xroot, + False, + GrabModeAsync, + GrabModeSync); + XGrabKey (GDK_DISPLAY_XDISPLAY (display), + keys[i].keycode, + Mod2Mask, + xroot, + False, + GrabModeAsync, + GrabModeSync); + XGrabKey (GDK_DISPLAY_XDISPLAY (display), + keys[i].keycode, + Mod4Mask, + xroot, + False, + GrabModeAsync, + GrabModeSync); + + gdk_x11_display_error_trap_pop_ignored (display); + } + } + + g_free (keys); + + for (i = 0; i < n_screens; i++) + { + GdkScreen *screen; + + screen = gdk_display_get_screen (display, i); + gdk_window_add_filter (gdk_screen_get_root_window (screen), + filter, + screen); + } + } + } +} + + +int +main (int argc, char *argv[]) +{ + gdk_disable_multidevice (); + + gtk_init (&argc, &argv); + + set_locate_pointer (); + + gtk_main (); + + return 0; +} + diff --git a/plugins/mouse/gsd-locate-pointer.h b/plugins/mouse/gsd-locate-pointer.h new file mode 100644 index 00000000..3b261a53 --- /dev/null +++ b/plugins/mouse/gsd-locate-pointer.h @@ -0,0 +1,24 @@ +/* + * Copyright © 2001 Jonathan Blandford + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Red Hat not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Red Hat makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * Authors: Jonathan Blandford + */ + +#ifndef LOCATE_POINTER_H +#define LOCATE_POINTER_H + +#include + +void gsd_locate_pointer (GdkScreen *screen); + +#endif diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c new file mode 100644 index 00000000..b0a0dfd8 --- /dev/null +++ b/plugins/mouse/gsd-mouse-manager.c @@ -0,0 +1,1354 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#ifdef __linux +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-mouse-manager.h" +#include "gsd-input-helper.h" +#include "gsd-enums.h" + +#define GSD_MOUSE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerPrivate)) + +#define SETTINGS_MOUSE_DIR "org.gnome.settings-daemon.peripherals.mouse" +#define SETTINGS_TOUCHPAD_DIR "org.gnome.settings-daemon.peripherals.touchpad" + +/* Keys for both touchpad and mouse */ +#define KEY_LEFT_HANDED "left-handed" /* a boolean for mouse, an enum for touchpad */ +#define KEY_MOTION_ACCELERATION "motion-acceleration" +#define KEY_MOTION_THRESHOLD "motion-threshold" + +/* Touchpad settings */ +#define KEY_TOUCHPAD_DISABLE_W_TYPING "disable-while-typing" +#define KEY_PAD_HORIZ_SCROLL "horiz-scroll-enabled" +#define KEY_SCROLL_METHOD "scroll-method" +#define KEY_TAP_TO_CLICK "tap-to-click" +#define KEY_TOUCHPAD_ENABLED "touchpad-enabled" +#define KEY_NATURAL_SCROLL_ENABLED "natural-scroll" + +/* Mouse settings */ +#define KEY_LOCATE_POINTER "locate-pointer" +#define KEY_DWELL_CLICK_ENABLED "dwell-click-enabled" +#define KEY_SECONDARY_CLICK_ENABLED "secondary-click-enabled" +#define KEY_MIDDLE_BUTTON_EMULATION "middle-button-enabled" + +struct GsdMouseManagerPrivate +{ + guint start_idle_id; + GSettings *touchpad_settings; + GSettings *mouse_settings; + GSettings *mouse_a11y_settings; + GdkDeviceManager *device_manager; + guint device_added_id; + guint device_removed_id; + GHashTable *blacklist; + + gboolean mousetweaks_daemon_running; + gboolean syndaemon_spawned; + GPid syndaemon_pid; + gboolean locate_pointer_spawned; + GPid locate_pointer_pid; +}; + +static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass); +static void gsd_mouse_manager_init (GsdMouseManager *mouse_manager); +static void gsd_mouse_manager_finalize (GObject *object); +static void set_tap_to_click (GdkDevice *device, + gboolean state, + gboolean left_handed); +static void set_natural_scroll (GsdMouseManager *manager, + GdkDevice *device, + gboolean natural_scroll); + +G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + + +static GObject * +gsd_mouse_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdMouseManager *mouse_manager; + + mouse_manager = GSD_MOUSE_MANAGER (G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (mouse_manager); +} + +static void +gsd_mouse_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->dispose (object); +} + +static void +gsd_mouse_manager_class_init (GsdMouseManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_mouse_manager_constructor; + object_class->dispose = gsd_mouse_manager_dispose; + object_class->finalize = gsd_mouse_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdMouseManagerPrivate)); +} + +static XDevice * +open_gdk_device (GdkDevice *device) +{ + XDevice *xdevice; + int id; + + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + gdk_error_trap_push (); + + xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id); + + if (gdk_error_trap_pop () != 0) + return NULL; + + return xdevice; +} + +static gboolean +device_is_blacklisted (GsdMouseManager *manager, + GdkDevice *device) +{ + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + if (g_hash_table_lookup (manager->priv->blacklist, GINT_TO_POINTER (id)) != NULL) { + g_debug ("device %s (%d) is blacklisted", gdk_device_get_name (device), id); + return TRUE; + } + return FALSE; +} + +static gboolean +device_is_ignored (GsdMouseManager *manager, + GdkDevice *device) +{ + GdkInputSource source; + const char *name; + + if (device_is_blacklisted (manager, device)) + return TRUE; + + source = gdk_device_get_source (device); + if (source != GDK_SOURCE_MOUSE && + source != GDK_SOURCE_TOUCHPAD && + source != GDK_SOURCE_CURSOR) + return TRUE; + + name = gdk_device_get_name (device); + if (name != NULL && g_str_equal ("Virtual core XTEST pointer", name)) + return TRUE; + + return FALSE; +} + +static void +configure_button_layout (guchar *buttons, + gint n_buttons, + gboolean left_handed) +{ + const gint left_button = 1; + gint right_button; + gint i; + + /* if the button is higher than 2 (3rd button) then it's + * probably one direction of a scroll wheel or something else + * uninteresting + */ + right_button = MIN (n_buttons, 3); + + /* If we change things we need to make sure we only swap buttons. + * If we end up with multiple physical buttons assigned to the same + * logical button the server will complain. This code assumes physical + * button 0 is the physical left mouse button, and that the physical + * button other than 0 currently assigned left_button or right_button + * is the physical right mouse button. + */ + + /* check if the current mapping satisfies the above assumptions */ + if (buttons[left_button - 1] != left_button && + buttons[left_button - 1] != right_button) + /* The current mapping is weird. Swapping buttons is probably not a + * good idea. + */ + return; + + /* check if we are left_handed and currently not swapped */ + if (left_handed && buttons[left_button - 1] == left_button) { + /* find the right button */ + for (i = 0; i < n_buttons; i++) { + if (buttons[i] == right_button) { + buttons[i] = left_button; + break; + } + } + /* swap the buttons */ + buttons[left_button - 1] = right_button; + } + /* check if we are not left_handed but are swapped */ + else if (!left_handed && buttons[left_button - 1] == right_button) { + /* find the right button */ + for (i = 0; i < n_buttons; i++) { + if (buttons[i] == left_button) { + buttons[i] = right_button; + break; + } + } + /* swap the buttons */ + buttons[left_button - 1] = left_button; + } +} + +static gboolean +xinput_device_has_buttons (GdkDevice *device) +{ + int i; + XAnyClassInfo *class_info; + + /* FIXME can we use the XDevice's classes here instead? */ + XDeviceInfo *device_info, *info; + gint n_devices; + int id; + + /* Find the XDeviceInfo for the GdkDevice */ + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices); + if (device_info == NULL) + return FALSE; + + info = NULL; + for (i = 0; i < n_devices; i++) { + if (device_info[i].id == id) { + info = &device_info[i]; + break; + } + } + if (info == NULL) + goto bail; + + class_info = info->inputclassinfo; + for (i = 0; i < info->num_classes; i++) { + if (class_info->class == ButtonClass) { + XButtonInfo *button_info; + + button_info = (XButtonInfo *) class_info; + if (button_info->num_buttons > 0) { + XFreeDeviceList (device_info); + return TRUE; + } + } + + class_info = (XAnyClassInfo *) (((guchar *) class_info) + + class_info->length); + } + +bail: + XFreeDeviceList (device_info); + + return FALSE; +} + +static gboolean +touchpad_has_single_button (XDevice *device) +{ + Atom type, prop; + int format; + unsigned long nitems, bytes_after; + unsigned char *data; + gboolean is_single_button = FALSE; + int rc; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Capabilities", False); + if (!prop) + return FALSE; + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 1, False, + XA_INTEGER, &type, &format, &nitems, + &bytes_after, &data); + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 3) + is_single_button = (data[0] == 1 && data[1] == 0 && data[2] == 0); + + if (rc == Success) + XFree (data); + + gdk_error_trap_pop_ignored (); + + return is_single_button; +} + +static void +set_left_handed (GsdMouseManager *manager, + GdkDevice *device, + gboolean mouse_left_handed, + gboolean touchpad_left_handed) +{ + XDevice *xdevice; + guchar *buttons; + gsize buttons_capacity = 16; + gboolean left_handed; + gint n_buttons; + + if (!xinput_device_has_buttons (device)) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting handedness on %s", gdk_device_get_name (device)); + + buttons = g_new (guchar, buttons_capacity); + + /* If the device is a touchpad, swap tap buttons + * around too, otherwise a tap would be a right-click */ + if (device_is_touchpad (xdevice)) { + gboolean tap = g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TAP_TO_CLICK); + gboolean single_button = touchpad_has_single_button (xdevice); + + left_handed = touchpad_left_handed; + + if (tap && !single_button) + set_tap_to_click (device, tap, left_handed); + + if (single_button) + goto out; + } else { + left_handed = mouse_left_handed; + } + + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + buttons, + buttons_capacity); + + while (n_buttons > buttons_capacity) { + buttons_capacity = n_buttons; + buttons = (guchar *) g_realloc (buttons, + buttons_capacity * sizeof (guchar)); + + n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + buttons, + buttons_capacity); + } + + configure_button_layout (buttons, n_buttons, left_handed); + + gdk_error_trap_push (); + XSetDeviceButtonMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, buttons, n_buttons); + gdk_error_trap_pop_ignored (); + +out: + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + g_free (buttons); +} + +static void +set_motion (GsdMouseManager *manager, + GdkDevice *device) +{ + XDevice *xdevice; + XPtrFeedbackControl feedback; + XFeedbackState *states, *state; + int num_feedbacks; + int numerator, denominator; + gfloat motion_acceleration; + int motion_threshold; + GSettings *settings; + guint i; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting motion on %s", gdk_device_get_name (device)); + + if (device_is_touchpad (xdevice)) + settings = manager->priv->touchpad_settings; + else + settings = manager->priv->mouse_settings; + + /* Calculate acceleration */ + motion_acceleration = g_settings_get_double (settings, KEY_MOTION_ACCELERATION); + + if (motion_acceleration >= 1.0) { + /* we want to get the acceleration, with a resolution of 0.5 + */ + if ((motion_acceleration - floor (motion_acceleration)) < 0.25) { + numerator = floor (motion_acceleration); + denominator = 1; + } else if ((motion_acceleration - floor (motion_acceleration)) < 0.5) { + numerator = ceil (2.0 * motion_acceleration); + denominator = 2; + } else if ((motion_acceleration - floor (motion_acceleration)) < 0.75) { + numerator = floor (2.0 *motion_acceleration); + denominator = 2; + } else { + numerator = ceil (motion_acceleration); + denominator = 1; + } + } else if (motion_acceleration < 1.0 && motion_acceleration > 0) { + /* This we do to 1/10ths */ + numerator = floor (motion_acceleration * 10) + 1; + denominator= 10; + } else { + numerator = -1; + denominator = -1; + } + + /* And threshold */ + motion_threshold = g_settings_get_int (settings, KEY_MOTION_THRESHOLD); + + /* Get the list of feedbacks for the device */ + states = XGetFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, &num_feedbacks); + if (states == NULL) + goto out; + state = (XFeedbackState *) states; + for (i = 0; i < num_feedbacks; i++) { + if (state->class == PtrFeedbackClass) { + /* And tell the device */ + feedback.class = PtrFeedbackClass; + feedback.length = sizeof (XPtrFeedbackControl); + feedback.id = state->id; + feedback.threshold = motion_threshold; + feedback.accelNum = numerator; + feedback.accelDenom = denominator; + + g_debug ("Setting accel %d/%d, threshold %d for device '%s'", + numerator, denominator, motion_threshold, gdk_device_get_name (device)); + + XChangeFeedbackControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, + DvAccelNum | DvAccelDenom | DvThreshold, + (XFeedbackControl *) &feedback); + + break; + } + state = (XFeedbackState *) ((char *) state + state->length); + } + + XFreeFeedbackList (states); + + out: + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_middle_button (GsdMouseManager *manager, + GdkDevice *device, + gboolean middle_button) +{ + Atom prop; + XDevice *xdevice; + Atom type; + int format; + unsigned long nitems, bytes_after; + unsigned char *data; + int rc; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "Evdev Middle Button Emulation", True); + + if (!prop) /* no evdev devices */ + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + g_debug ("setting middle button on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, 0, 1, False, XA_INTEGER, &type, &format, + &nitems, &bytes_after, &data); + + if (rc == Success && format == 8 && type == XA_INTEGER && nitems == 1) { + data[0] = middle_button ? 1 : 0; + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + xdevice, prop, type, format, PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting middle button emulation on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +/* Ensure that syndaemon dies together with us, to avoid running several of + * them */ +static void +setup_syndaemon (gpointer user_data) +{ +#ifdef __linux + prctl (PR_SET_PDEATHSIG, SIGHUP); +#endif +} + +static gboolean +have_program_in_path (const char *name) +{ + gchar *path; + gboolean result; + + path = g_find_program_in_path (name); + result = (path != NULL); + g_free (path); + return result; +} + +static void +syndaemon_died (GPid pid, gint status, gpointer user_data) +{ + GsdMouseManager *manager = GSD_MOUSE_MANAGER (user_data); + + g_debug ("syndaemon stopped with status %i", status); + g_spawn_close_pid (pid); + manager->priv->syndaemon_spawned = FALSE; +} + +static int +set_disable_w_typing (GsdMouseManager *manager, gboolean state) +{ + if (state && touchpad_is_present ()) { + GError *error = NULL; + GPtrArray *args; + + if (manager->priv->syndaemon_spawned) + return 0; + + if (!have_program_in_path ("syndaemon")) + return 0; + + args = g_ptr_array_new (); + + g_ptr_array_add (args, "syndaemon"); + g_ptr_array_add (args, "-i"); + g_ptr_array_add (args, "1.0"); + g_ptr_array_add (args, "-t"); + g_ptr_array_add (args, "-K"); + g_ptr_array_add (args, "-R"); + g_ptr_array_add (args, NULL); + + /* we must use G_SPAWN_DO_NOT_REAP_CHILD to avoid + * double-forking, otherwise syndaemon will immediately get + * killed again through (PR_SET_PDEATHSIG when the intermediate + * process dies */ + g_spawn_async (g_get_home_dir (), (char **) args->pdata, NULL, + G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, setup_syndaemon, NULL, + &manager->priv->syndaemon_pid, &error); + + manager->priv->syndaemon_spawned = (error == NULL); + g_ptr_array_free (args, FALSE); + + if (error) { + g_warning ("Failed to launch syndaemon: %s", error->message); + g_settings_set_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE); + g_error_free (error); + } else { + g_child_watch_add (manager->priv->syndaemon_pid, syndaemon_died, manager); + g_debug ("Launched syndaemon"); + } + } else if (manager->priv->syndaemon_spawned) { + kill (manager->priv->syndaemon_pid, SIGHUP); + g_spawn_close_pid (manager->priv->syndaemon_pid); + manager->priv->syndaemon_spawned = FALSE; + g_debug ("Killed syndaemon"); + } + + return 0; +} + +static void +set_tap_to_click (GdkDevice *device, + gboolean state, + gboolean left_handed) +{ + int format, rc; + unsigned long nitems, bytes_after; + XDevice *xdevice; + unsigned char* data; + Atom prop, type; + + prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Tap Action", False); + if (!prop) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting tap to click on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, 0, 2, + False, XA_INTEGER, &type, &format, &nitems, + &bytes_after, &data); + + if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7) { + /* Set MR mapping for corner tapping on the right side*/ + data[0] = (state) ? 2 : 0; + data[1] = (state) ? 3 : 0; + + /* Set RLM mapping for 1/2/3 fingers*/ + data[4] = (state) ? ((left_handed) ? 3 : 1) : 0; + data[5] = (state) ? ((left_handed) ? 1 : 3) : 0; + data[6] = 0; /* Disable three touch tap so gestures work */ + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (rc == Success) + XFree (data); + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting tap to click on \"%s\"", gdk_device_get_name (device)); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_horiz_scroll (GdkDevice *device, + gboolean state) +{ + int rc; + XDevice *xdevice; + Atom act_type, prop_edge, prop_twofinger; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False); + + if (!prop_edge || !prop_twofinger) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting horiz scroll on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[1] = (state && data[0]); + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + XFree (data); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[1] = (state && data[0]); + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting horiz scroll on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + +} + +static void +set_edge_scroll (GdkDevice *device, + GsdTouchpadScrollMethod method) +{ + int rc; + XDevice *xdevice; + Atom act_type, prop_edge, prop_twofinger; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + + prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False); + prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False); + + if (!prop_edge || !prop_twofinger) + return; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("setting edge scroll on %s", gdk_device_get_name (device)); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[0] = (method == GSD_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING) ? 1 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_edge, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + XFree (data); + + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, 0, 1, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + if (rc == Success && act_type == XA_INTEGER && + act_format == 8 && nitems >= 2) { + data[0] = (method == GSD_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING) ? 1 : 0; + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + prop_twofinger, XA_INTEGER, 8, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error in setting edge scroll on \"%s\"", gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_touchpad_disabled (GdkDevice *device) +{ + int id; + XDevice *xdevice; + + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + + g_debug ("Trying to set device disabled for \"%s\" (%d)", gdk_device_get_name (device), id); + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + if (set_device_enabled (id, FALSE) == FALSE) + g_warning ("Error disabling device \"%s\" (%d)", gdk_device_get_name (device), id); + else + g_debug ("Disabled device \"%s\" (%d)", gdk_device_get_name (device), id); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_touchpad_enabled (int id) +{ + XDevice *xdevice; + + g_debug ("Trying to set device enabled for %d", id); + + gdk_error_trap_push (); + xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id); + if (gdk_error_trap_pop () != 0) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + if (set_device_enabled (id, TRUE) == FALSE) + g_warning ("Error enabling device \"%d\"", id); + else + g_debug ("Enabled device %d", id); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +set_locate_pointer (GsdMouseManager *manager, + gboolean state) +{ + if (state) { + GError *error = NULL; + char *args[2]; + + if (manager->priv->locate_pointer_spawned) + return; + + args[0] = LIBEXECDIR "/gsd-locate-pointer"; + args[1] = NULL; + + g_spawn_async (NULL, args, NULL, + 0, NULL, NULL, + &manager->priv->locate_pointer_pid, &error); + + manager->priv->locate_pointer_spawned = (error == NULL); + + if (error) { + g_settings_set_boolean (manager->priv->mouse_settings, KEY_LOCATE_POINTER, FALSE); + g_error_free (error); + } + + } else if (manager->priv->locate_pointer_spawned) { + kill (manager->priv->locate_pointer_pid, SIGHUP); + g_spawn_close_pid (manager->priv->locate_pointer_pid); + manager->priv->locate_pointer_spawned = FALSE; + } +} + +static void +set_mousetweaks_daemon (GsdMouseManager *manager, + gboolean dwell_click_enabled, + gboolean secondary_click_enabled) +{ + GError *error = NULL; + gchar *comm; + gboolean run_daemon = dwell_click_enabled || secondary_click_enabled; + + if (run_daemon || manager->priv->mousetweaks_daemon_running) + comm = g_strdup_printf ("mousetweaks %s", + run_daemon ? "" : "-s"); + else + return; + + if (run_daemon) + manager->priv->mousetweaks_daemon_running = TRUE; + + if (! g_spawn_command_line_async (comm, &error)) { + if (error->code == G_SPAWN_ERROR_NOENT && run_daemon) { + GtkWidget *dialog; + + if (dwell_click_enabled) { + g_settings_set_boolean (manager->priv->mouse_a11y_settings, + KEY_DWELL_CLICK_ENABLED, FALSE); + } else if (secondary_click_enabled) { + g_settings_set_boolean (manager->priv->mouse_a11y_settings, + KEY_SECONDARY_CLICK_ENABLED, FALSE); + } + + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + _("Could not enable mouse accessibility features")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + _("Mouse accessibility requires Mousetweaks " + "to be installed on your system.")); + gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), + "preferences-desktop-accessibility"); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + g_error_free (error); + } + g_free (comm); +} + +static gboolean +get_touchpad_handedness (GsdMouseManager *manager, gboolean mouse_left_handed) +{ + switch (g_settings_get_enum (manager->priv->touchpad_settings, KEY_LEFT_HANDED)) { + case GSD_TOUCHPAD_HANDEDNESS_RIGHT: + return FALSE; + case GSD_TOUCHPAD_HANDEDNESS_LEFT: + return TRUE; + case GSD_TOUCHPAD_HANDEDNESS_MOUSE: + return mouse_left_handed; + default: + g_assert_not_reached (); + } +} + +static void +set_mouse_settings (GsdMouseManager *manager, + GdkDevice *device) +{ + gboolean mouse_left_handed, touchpad_left_handed; + + mouse_left_handed = g_settings_get_boolean (manager->priv->mouse_settings, KEY_LEFT_HANDED); + touchpad_left_handed = get_touchpad_handedness (manager, mouse_left_handed); + set_left_handed (manager, device, mouse_left_handed, touchpad_left_handed); + + set_motion (manager, device); + set_middle_button (manager, device, g_settings_get_boolean (manager->priv->mouse_settings, KEY_MIDDLE_BUTTON_EMULATION)); + + set_tap_to_click (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TAP_TO_CLICK), touchpad_left_handed); + set_edge_scroll (device, g_settings_get_enum (manager->priv->touchpad_settings, KEY_SCROLL_METHOD)); + set_horiz_scroll (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_PAD_HORIZ_SCROLL)); + set_natural_scroll (manager, device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_NATURAL_SCROLL_ENABLED)); + if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED) == FALSE) + set_touchpad_disabled (device); +} + +static void +set_natural_scroll (GsdMouseManager *manager, + GdkDevice *device, + gboolean natural_scroll) +{ + XDevice *xdevice; + Atom scrolling_distance, act_type; + int rc, act_format; + unsigned long nitems, bytes_after; + unsigned char *data; + glong *ptr; + + xdevice = open_gdk_device (device); + if (xdevice == NULL) + return; + + if (!device_is_touchpad (xdevice)) { + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); + return; + } + + g_debug ("Trying to set %s for \"%s\"", + natural_scroll ? "natural (reverse) scroll" : "normal scroll", + gdk_device_get_name (device)); + + scrolling_distance = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + "Synaptics Scrolling Distance", False); + + gdk_error_trap_push (); + rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + scrolling_distance, 0, 2, False, + XA_INTEGER, &act_type, &act_format, &nitems, + &bytes_after, &data); + + if (rc == Success && act_type == XA_INTEGER && act_format == 32 && nitems >= 2) { + ptr = (glong *) data; + + if (natural_scroll) { + ptr[0] = -abs(ptr[0]); + ptr[1] = -abs(ptr[1]); + } else { + ptr[0] = abs(ptr[0]); + ptr[1] = abs(ptr[1]); + } + + XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, + scrolling_distance, XA_INTEGER, act_format, + PropModeReplace, data, nitems); + } + + if (gdk_error_trap_pop ()) + g_warning ("Error setting %s for \"%s\"", + natural_scroll ? "natural (reverse) scroll" : "normal scroll", + gdk_device_get_name (device)); + + if (rc == Success) + XFree (data); + + XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice); +} + +static void +mouse_callback (GSettings *settings, + const gchar *key, + GsdMouseManager *manager) +{ + GList *devices, *l; + + if (g_str_equal (key, KEY_DWELL_CLICK_ENABLED) || + g_str_equal (key, KEY_SECONDARY_CLICK_ENABLED)) { + set_mousetweaks_daemon (manager, + g_settings_get_boolean (settings, KEY_DWELL_CLICK_ENABLED), + g_settings_get_boolean (settings, KEY_SECONDARY_CLICK_ENABLED)); + return; + } else if (g_str_equal (key, KEY_LOCATE_POINTER)) { + set_locate_pointer (manager, g_settings_get_boolean (settings, KEY_LOCATE_POINTER)); + return; + } + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (g_str_equal (key, KEY_LEFT_HANDED)) { + gboolean mouse_left_handed; + mouse_left_handed = g_settings_get_boolean (settings, KEY_LEFT_HANDED); + set_left_handed (manager, device, mouse_left_handed, get_touchpad_handedness (manager, mouse_left_handed)); + } else if (g_str_equal (key, KEY_MOTION_ACCELERATION) || + g_str_equal (key, KEY_MOTION_THRESHOLD)) { + set_motion (manager, device); + } else if (g_str_equal (key, KEY_MIDDLE_BUTTON_EMULATION)) { + set_middle_button (manager, device, g_settings_get_boolean (settings, KEY_MIDDLE_BUTTON_EMULATION)); + } + } + g_list_free (devices); +} + +static void +touchpad_callback (GSettings *settings, + const gchar *key, + GsdMouseManager *manager) +{ + GList *devices, *l; + + if (g_str_equal (key, KEY_TOUCHPAD_DISABLE_W_TYPING)) { + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, key)); + return; + } + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (g_str_equal (key, KEY_TAP_TO_CLICK)) { + set_tap_to_click (device, g_settings_get_boolean (settings, key), + g_settings_get_boolean (manager->priv->touchpad_settings, KEY_LEFT_HANDED)); + } else if (g_str_equal (key, KEY_SCROLL_METHOD)) { + set_edge_scroll (device, g_settings_get_enum (settings, key)); + set_horiz_scroll (device, g_settings_get_boolean (settings, KEY_PAD_HORIZ_SCROLL)); + } else if (g_str_equal (key, KEY_PAD_HORIZ_SCROLL)) { + set_horiz_scroll (device, g_settings_get_boolean (settings, key)); + } else if (g_str_equal (key, KEY_TOUCHPAD_ENABLED)) { + if (g_settings_get_boolean (settings, key) == FALSE) + set_touchpad_disabled (device); + else + set_touchpad_enabled (gdk_x11_device_get_id (device)); + } else if (g_str_equal (key, KEY_MOTION_ACCELERATION) || + g_str_equal (key, KEY_MOTION_THRESHOLD)) { + set_motion (manager, device); + } else if (g_str_equal (key, KEY_LEFT_HANDED)) { + gboolean mouse_left_handed; + mouse_left_handed = g_settings_get_boolean (manager->priv->mouse_settings, KEY_LEFT_HANDED); + set_left_handed (manager, device, mouse_left_handed, get_touchpad_handedness (manager, mouse_left_handed)); + } else if (g_str_equal (key, KEY_NATURAL_SCROLL_ENABLED)) { + set_natural_scroll (manager, device, g_settings_get_boolean (settings, key)); + } + } + g_list_free (devices); + + if (g_str_equal (key, KEY_TOUCHPAD_ENABLED) && + g_settings_get_boolean (settings, key)) { + devices = get_disabled_devices (manager->priv->device_manager); + for (l = devices; l != NULL; l = l->next) { + int device_id; + + device_id = GPOINTER_TO_INT (l->data); + set_touchpad_enabled (device_id); + } + g_list_free (devices); + } +} + +static void +device_added_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdMouseManager *manager) +{ + if (device_is_ignored (manager, device) == FALSE) { + if (run_custom_command (device, COMMAND_DEVICE_ADDED) == FALSE) { + set_mouse_settings (manager, device); + } else { + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_insert (manager->priv->blacklist, + GINT_TO_POINTER (id), GINT_TO_POINTER (1)); + } + + /* If a touchpad was to appear... */ + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + } +} + +static void +device_removed_cb (GdkDeviceManager *device_manager, + GdkDevice *device, + GsdMouseManager *manager) +{ + int id; + + /* Remove the device from the hash table so that + * device_is_ignored () doesn't check for blacklisted devices */ + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_remove (manager->priv->blacklist, + GINT_TO_POINTER (id)); + + if (device_is_ignored (manager, device) == FALSE) { + run_custom_command (device, COMMAND_DEVICE_REMOVED); + + /* If a touchpad was to disappear... */ + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + } +} + +static void +set_devicepresence_handler (GsdMouseManager *manager) +{ + GdkDeviceManager *device_manager; + + device_manager = gdk_display_get_device_manager (gdk_display_get_default ()); + + manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added", + G_CALLBACK (device_added_cb), manager); + manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed", + G_CALLBACK (device_removed_cb), manager); + manager->priv->device_manager = device_manager; +} + +static void +gsd_mouse_manager_init (GsdMouseManager *manager) +{ + manager->priv = GSD_MOUSE_MANAGER_GET_PRIVATE (manager); + manager->priv->blacklist = g_hash_table_new (g_direct_hash, g_direct_equal); +} + +static gboolean +gsd_mouse_manager_idle_cb (GsdMouseManager *manager) +{ + GList *devices, *l; + + gnome_settings_profile_start (NULL); + + set_devicepresence_handler (manager); + + manager->priv->mouse_settings = g_settings_new (SETTINGS_MOUSE_DIR); + g_signal_connect (manager->priv->mouse_settings, "changed", + G_CALLBACK (mouse_callback), manager); + + manager->priv->mouse_a11y_settings = g_settings_new ("org.gnome.desktop.a11y.mouse"); + g_signal_connect (manager->priv->mouse_a11y_settings, "changed", + G_CALLBACK (mouse_callback), manager); + + manager->priv->touchpad_settings = g_settings_new (SETTINGS_TOUCHPAD_DIR); + g_signal_connect (manager->priv->touchpad_settings, "changed", + G_CALLBACK (touchpad_callback), manager); + + manager->priv->syndaemon_spawned = FALSE; + + set_locate_pointer (manager, g_settings_get_boolean (manager->priv->mouse_settings, KEY_LOCATE_POINTER)); + set_mousetweaks_daemon (manager, + g_settings_get_boolean (manager->priv->mouse_a11y_settings, KEY_DWELL_CLICK_ENABLED), + g_settings_get_boolean (manager->priv->mouse_a11y_settings, KEY_SECONDARY_CLICK_ENABLED)); + set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING)); + + devices = gdk_device_manager_list_devices (manager->priv->device_manager, GDK_DEVICE_TYPE_SLAVE); + for (l = devices; l != NULL; l = l->next) { + GdkDevice *device = l->data; + + if (device_is_ignored (manager, device)) + continue; + + if (run_custom_command (device, COMMAND_DEVICE_PRESENT) == FALSE) { + set_mouse_settings (manager, device); + } else { + int id; + g_object_get (G_OBJECT (device), "device-id", &id, NULL); + g_hash_table_insert (manager->priv->blacklist, + GINT_TO_POINTER (id), GINT_TO_POINTER (1)); + } + } + g_list_free (devices); + + if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED)) { + devices = get_disabled_devices (manager->priv->device_manager); + for (l = devices; l != NULL; l = l->next) { + int device_id; + + device_id = GPOINTER_TO_INT (l->data); + set_touchpad_enabled (device_id); + } + g_list_free (devices); + } + + gnome_settings_profile_end (NULL); + + manager->priv->start_idle_id = 0; + + return FALSE; +} + +gboolean +gsd_mouse_manager_start (GsdMouseManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + if (!supports_xinput_devices ()) { + g_debug ("XInput is not supported, not applying any settings"); + return TRUE; + } + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_mouse_manager_stop (GsdMouseManager *manager) +{ + GsdMouseManagerPrivate *p = manager->priv; + + g_debug ("Stopping mouse manager"); + + if (p->device_manager != NULL) { + g_signal_handler_disconnect (p->device_manager, p->device_added_id); + g_signal_handler_disconnect (p->device_manager, p->device_removed_id); + p->device_manager = NULL; + } + + if (p->mouse_a11y_settings != NULL) { + g_object_unref (p->mouse_a11y_settings); + p->mouse_a11y_settings = NULL; + } + + if (p->mouse_settings != NULL) { + g_object_unref (p->mouse_settings); + p->mouse_settings = NULL; + } + + if (p->touchpad_settings != NULL) { + g_object_unref (p->touchpad_settings); + p->touchpad_settings = NULL; + } + + set_locate_pointer (manager, FALSE); +} + +static void +gsd_mouse_manager_finalize (GObject *object) +{ + GsdMouseManager *mouse_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MOUSE_MANAGER (object)); + + mouse_manager = GSD_MOUSE_MANAGER (object); + + g_return_if_fail (mouse_manager->priv != NULL); + + if (mouse_manager->priv->blacklist != NULL) + g_hash_table_destroy (mouse_manager->priv->blacklist); + + if (mouse_manager->priv->start_idle_id != 0) + g_source_remove (mouse_manager->priv->start_idle_id); + + if (mouse_manager->priv->device_manager != NULL) { + g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_added_id); + g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_removed_id); + } + + if (mouse_manager->priv->mouse_settings != NULL) + g_object_unref (mouse_manager->priv->mouse_settings); + + if (mouse_manager->priv->mouse_a11y_settings != NULL) + g_object_unref (mouse_manager->priv->mouse_a11y_settings); + + if (mouse_manager->priv->touchpad_settings != NULL) + g_object_unref (mouse_manager->priv->touchpad_settings); + + G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->finalize (object); +} + +GsdMouseManager * +gsd_mouse_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_MOUSE_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_MOUSE_MANAGER (manager_object); +} diff --git a/plugins/mouse/gsd-mouse-manager.h b/plugins/mouse/gsd-mouse-manager.h new file mode 100644 index 00000000..96f571f9 --- /dev/null +++ b/plugins/mouse/gsd-mouse-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_MOUSE_MANAGER_H +#define __GSD_MOUSE_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_MOUSE_MANAGER (gsd_mouse_manager_get_type ()) +#define GSD_MOUSE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManager)) +#define GSD_MOUSE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerClass)) +#define GSD_IS_MOUSE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MOUSE_MANAGER)) +#define GSD_IS_MOUSE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MOUSE_MANAGER)) +#define GSD_MOUSE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerClass)) + +typedef struct GsdMouseManagerPrivate GsdMouseManagerPrivate; + +typedef struct +{ + GObject parent; + GsdMouseManagerPrivate *priv; +} GsdMouseManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdMouseManagerClass; + +GType gsd_mouse_manager_get_type (void); + +GsdMouseManager * gsd_mouse_manager_new (void); +gboolean gsd_mouse_manager_start (GsdMouseManager *manager, + GError **error); +void gsd_mouse_manager_stop (GsdMouseManager *manager); + +G_END_DECLS + +#endif /* __GSD_MOUSE_MANAGER_H */ diff --git a/plugins/mouse/gsd-mouse-plugin.c b/plugins/mouse/gsd-mouse-plugin.c new file mode 100644 index 00000000..3eca07e7 --- /dev/null +++ b/plugins/mouse/gsd-mouse-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-mouse-plugin.h" +#include "gsd-mouse-manager.h" + +struct GsdMousePluginPrivate { + GsdMouseManager *manager; +}; + +#define GSD_MOUSE_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_MOUSE_PLUGIN, GsdMousePluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdMousePlugin, gsd_mouse_plugin) + +static void +gsd_mouse_plugin_init (GsdMousePlugin *plugin) +{ + plugin->priv = GSD_MOUSE_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdMousePlugin initializing"); + + plugin->priv->manager = gsd_mouse_manager_new (); +} + +static void +gsd_mouse_plugin_finalize (GObject *object) +{ + GsdMousePlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_MOUSE_PLUGIN (object)); + + g_debug ("GsdMousePlugin finalizing"); + + plugin = GSD_MOUSE_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_mouse_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating mouse plugin"); + + error = NULL; + res = gsd_mouse_manager_start (GSD_MOUSE_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start mouse manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating mouse plugin"); + gsd_mouse_manager_stop (GSD_MOUSE_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_mouse_plugin_class_init (GsdMousePluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_mouse_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdMousePluginPrivate)); +} diff --git a/plugins/mouse/gsd-mouse-plugin.h b/plugins/mouse/gsd-mouse-plugin.h new file mode 100644 index 00000000..6c7b5b63 --- /dev/null +++ b/plugins/mouse/gsd-mouse-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_MOUSE_PLUGIN_H__ +#define __GSD_MOUSE_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_MOUSE_PLUGIN (gsd_mouse_plugin_get_type ()) +#define GSD_MOUSE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MOUSE_PLUGIN, GsdMousePlugin)) +#define GSD_MOUSE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MOUSE_PLUGIN, GsdMousePluginClass)) +#define GSD_IS_MOUSE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MOUSE_PLUGIN)) +#define GSD_IS_MOUSE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MOUSE_PLUGIN)) +#define GSD_MOUSE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MOUSE_PLUGIN, GsdMousePluginClass)) + +typedef struct GsdMousePluginPrivate GsdMousePluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdMousePluginPrivate *priv; +} GsdMousePlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdMousePluginClass; + +GType gsd_mouse_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_MOUSE_PLUGIN_H__ */ diff --git a/plugins/mouse/gsd-timeline.c b/plugins/mouse/gsd-timeline.c new file mode 100644 index 00000000..e7466315 --- /dev/null +++ b/plugins/mouse/gsd-timeline.c @@ -0,0 +1,846 @@ +/* gsd-timeline.c + * + * Copyright (C) 2008 Carlos Garnacho + * + * 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 +#include +#include +#include "gsd-timeline.h" + +#define GSD_TIMELINE_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GSD_TYPE_TIMELINE, GsdTimelinePriv)) +#define MSECS_PER_SEC 1000 +#define FRAME_INTERVAL(nframes) (MSECS_PER_SEC / nframes) +#define DEFAULT_FPS 30 + +typedef struct GsdTimelinePriv GsdTimelinePriv; + +struct GsdTimelinePriv +{ + guint duration; + guint fps; + guint source_id; + + GTimer *timer; + + GdkScreen *screen; + GsdTimelineProgressType progress_type; + GsdTimelineProgressFunc progress_func; + + guint loop : 1; + guint direction : 1; +}; + +enum { + PROP_0, + PROP_FPS, + PROP_DURATION, + PROP_LOOP, + PROP_DIRECTION, + PROP_SCREEN, + PROP_PROGRESS_TYPE, +}; + +enum { + STARTED, + PAUSED, + FINISHED, + FRAME, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + + +static void gsd_timeline_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gsd_timeline_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gsd_timeline_finalize (GObject *object); + + +G_DEFINE_TYPE (GsdTimeline, gsd_timeline, G_TYPE_OBJECT) + + +GType +gsd_timeline_direction_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GEnumValue values[] = { + { GSD_TIMELINE_DIRECTION_FORWARD, "GSD_TIMELINE_DIRECTION_FORWARD", "forward" }, + { GSD_TIMELINE_DIRECTION_BACKWARD, "GSD_TIMELINE_DIRECTION_BACKWARD", "backward" }, + { 0, NULL, NULL } + }; + + type = g_enum_register_static (g_intern_static_string ("GsdTimelineDirection"), values); + } + + return type; +} + +GType +gsd_timeline_progress_type_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GEnumValue values[] = { + { GSD_TIMELINE_PROGRESS_LINEAR, "GSD_TIMELINE_PROGRESS_LINEAR", "linear" }, + { GSD_TIMELINE_PROGRESS_SINUSOIDAL, "GSD_TIMELINE_PROGRESS_SINUSOIDAL", "sinusoidal" }, + { GSD_TIMELINE_PROGRESS_EXPONENTIAL, "GSD_TIMELINE_PROGRESS_EXPONENTIAL", "exponential" }, + { 0, NULL, NULL } + }; + + type = g_enum_register_static (g_intern_static_string ("GsdTimelineProgressType"), values); + } + + return type; +} + +static void +gsd_timeline_class_init (GsdTimelineClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + object_class->set_property = gsd_timeline_set_property; + object_class->get_property = gsd_timeline_get_property; + object_class->finalize = gsd_timeline_finalize; + + g_object_class_install_property (object_class, + PROP_FPS, + g_param_spec_uint ("fps", + "FPS", + "Frames per second for the timeline", + 1, + G_MAXUINT, + DEFAULT_FPS, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_DURATION, + g_param_spec_uint ("duration", + "Animation Duration", + "Animation Duration", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_LOOP, + g_param_spec_boolean ("loop", + "Loop", + "Whether the timeline loops or not", + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_DIRECTION, + g_param_spec_enum ("direction", + "Direction", + "Whether the timeline moves forward or backward in time", + GSD_TYPE_TIMELINE_DIRECTION, + GSD_TIMELINE_DIRECTION_FORWARD, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_DIRECTION, + g_param_spec_enum ("progress-type", + "Progress type", + "Type of progress through the timeline", + GSD_TYPE_TIMELINE_PROGRESS_TYPE, + GSD_TIMELINE_PROGRESS_LINEAR, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_SCREEN, + g_param_spec_object ("screen", + "Screen", + "Screen to get the settings from", + GDK_TYPE_SCREEN, + G_PARAM_READWRITE)); + + signals[STARTED] = + g_signal_new ("started", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdTimelineClass, started), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[PAUSED] = + g_signal_new ("paused", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdTimelineClass, paused), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[FINISHED] = + g_signal_new ("finished", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdTimelineClass, finished), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[FRAME] = + g_signal_new ("frame", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdTimelineClass, frame), + NULL, NULL, + g_cclosure_marshal_VOID__DOUBLE, + G_TYPE_NONE, 1, + G_TYPE_DOUBLE); + + g_type_class_add_private (class, sizeof (GsdTimelinePriv)); +} + +static void +gsd_timeline_init (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + priv->fps = DEFAULT_FPS; + priv->duration = 0; + priv->direction = GSD_TIMELINE_DIRECTION_FORWARD; + priv->screen = gdk_screen_get_default (); +} + +static void +gsd_timeline_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GsdTimeline *timeline; + + timeline = GSD_TIMELINE (object); + + switch (prop_id) + { + case PROP_FPS: + gsd_timeline_set_fps (timeline, g_value_get_uint (value)); + break; + case PROP_DURATION: + gsd_timeline_set_duration (timeline, g_value_get_uint (value)); + break; + case PROP_LOOP: + gsd_timeline_set_loop (timeline, g_value_get_boolean (value)); + break; + case PROP_DIRECTION: + gsd_timeline_set_direction (timeline, g_value_get_enum (value)); + break; + case PROP_SCREEN: + gsd_timeline_set_screen (timeline, + GDK_SCREEN (g_value_get_object (value))); + break; + case PROP_PROGRESS_TYPE: + gsd_timeline_set_progress_type (timeline, g_value_get_enum (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gsd_timeline_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GsdTimeline *timeline; + GsdTimelinePriv *priv; + + timeline = GSD_TIMELINE (object); + priv = GSD_TIMELINE_GET_PRIV (timeline); + + switch (prop_id) + { + case PROP_FPS: + g_value_set_uint (value, priv->fps); + break; + case PROP_DURATION: + g_value_set_uint (value, priv->duration); + break; + case PROP_LOOP: + g_value_set_boolean (value, priv->loop); + break; + case PROP_DIRECTION: + g_value_set_enum (value, priv->direction); + break; + case PROP_SCREEN: + g_value_set_object (value, priv->screen); + break; + case PROP_PROGRESS_TYPE: + g_value_set_enum (value, priv->progress_type); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gsd_timeline_finalize (GObject *object) +{ + GsdTimelinePriv *priv; + + priv = GSD_TIMELINE_GET_PRIV (object); + + if (priv->source_id) + { + g_source_remove (priv->source_id); + priv->source_id = 0; + } + + if (priv->timer) + g_timer_destroy (priv->timer); + + G_OBJECT_CLASS (gsd_timeline_parent_class)->finalize (object); +} + +/* Sinusoidal progress */ +static gdouble +sinusoidal_progress (gdouble progress) +{ + return (sinf ((progress * G_PI) / 2)); +} + +static gdouble +exponential_progress (gdouble progress) +{ + return progress * progress; +} + +static GsdTimelineProgressFunc +progress_type_to_func (GsdTimelineProgressType type) +{ + if (type == GSD_TIMELINE_PROGRESS_SINUSOIDAL) + return sinusoidal_progress; + else if (type == GSD_TIMELINE_PROGRESS_EXPONENTIAL) + return exponential_progress; + + return NULL; +} + +static gboolean +gsd_timeline_run_frame (GsdTimeline *timeline, + gboolean enable_animations) +{ + GsdTimelinePriv *priv; + gdouble linear_progress, progress; + guint elapsed_time; + GsdTimelineProgressFunc progress_func = NULL; + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + if (enable_animations) + { + elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000); + + linear_progress = (gdouble) elapsed_time / priv->duration; + + if (priv->direction == GSD_TIMELINE_DIRECTION_BACKWARD) + linear_progress = 1 - linear_progress; + + linear_progress = CLAMP (linear_progress, 0., 1.); + + if (priv->progress_func) + progress_func = priv->progress_func; + else if (priv->progress_type) + progress_func = progress_type_to_func (priv->progress_type); + + if (progress_func) + progress = (progress_func) (linear_progress); + else + progress = linear_progress; + } + else + progress = (priv->direction == GSD_TIMELINE_DIRECTION_FORWARD) ? 1.0 : 0.0; + + g_signal_emit (timeline, signals [FRAME], 0, + CLAMP (progress, 0.0, 1.0)); + + if ((priv->direction == GSD_TIMELINE_DIRECTION_FORWARD && progress >= 1.0) || + (priv->direction == GSD_TIMELINE_DIRECTION_BACKWARD && progress <= 0.0)) + { + if (!priv->loop) + { + if (priv->source_id) + { + g_source_remove (priv->source_id); + priv->source_id = 0; + } + + g_signal_emit (timeline, signals [FINISHED], 0); + return FALSE; + } + else + gsd_timeline_rewind (timeline); + } + + return TRUE; +} + +static gboolean +gsd_timeline_frame_idle_func (GsdTimeline *timeline) +{ + return gsd_timeline_run_frame (timeline, TRUE); +} + +/** + * gsd_timeline_new: + * @duration: duration in milliseconds for the timeline + * + * Creates a new #GsdTimeline with the specified number of frames. + * + * Return Value: the newly created #GsdTimeline + **/ +GsdTimeline * +gsd_timeline_new (guint duration) +{ + return g_object_new (GSD_TYPE_TIMELINE, + "duration", duration, + NULL); +} + +GsdTimeline * +gsd_timeline_new_for_screen (guint duration, + GdkScreen *screen) +{ + return g_object_new (GSD_TYPE_TIMELINE, + "duration", duration, + "screen", screen, + NULL); +} + +/** + * gsd_timeline_start: + * @timeline: A #GsdTimeline + * + * Runs the timeline from the current frame. + **/ +void +gsd_timeline_start (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + GtkSettings *settings; + gboolean enable_animations = FALSE; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + if (priv->screen) + { + settings = gtk_settings_get_for_screen (priv->screen); + g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL); + } + + if (enable_animations) + { + if (!priv->source_id) + { + if (priv->timer) + g_timer_continue (priv->timer); + else + priv->timer = g_timer_new (); + + /* sanity check */ + g_assert (priv->fps > 0); + + g_signal_emit (timeline, signals [STARTED], 0); + + priv->source_id = gdk_threads_add_timeout (FRAME_INTERVAL (priv->fps), + (GSourceFunc) gsd_timeline_frame_idle_func, + timeline); + } + } + else + { + /* If animations are not enabled, only run the last frame, + * it take us instantaneously to the last state of the animation. + * The only potential flaw happens when people use the ::finished + * signal to trigger another animation, or even worse, finally + * loop into this animation again. + */ + g_signal_emit (timeline, signals [STARTED], 0); + gsd_timeline_run_frame (timeline, FALSE); + } +} + +/** + * gsd_timeline_pause: + * @timeline: A #GsdTimeline + * + * Pauses the timeline. + **/ +void +gsd_timeline_pause (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + if (priv->source_id) + { + g_source_remove (priv->source_id); + priv->source_id = 0; + g_timer_stop (priv->timer); + g_signal_emit (timeline, signals [PAUSED], 0); + } +} + +/** + * gsd_timeline_rewind: + * @timeline: A #GsdTimeline + * + * Rewinds the timeline. + **/ +void +gsd_timeline_rewind (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + /* destroy and re-create timer if neccesary */ + if (priv->timer) + { + g_timer_destroy (priv->timer); + + if (gsd_timeline_is_running (timeline)) + priv->timer = g_timer_new (); + else + priv->timer = NULL; + } +} + +/** + * gsd_timeline_is_running: + * @timeline: A #GsdTimeline + * + * Returns whether the timeline is running or not. + * + * Return Value: %TRUE if the timeline is running + **/ +gboolean +gsd_timeline_is_running (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), FALSE); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + return (priv->source_id != 0); +} + +/** + * gsd_timeline_get_fps: + * @timeline: A #GsdTimeline + * + * Returns the number of frames per second. + * + * Return Value: frames per second + **/ +guint +gsd_timeline_get_fps (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), 1); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + return priv->fps; +} + +/** + * gsd_timeline_set_fps: + * @timeline: A #GsdTimeline + * @fps: frames per second + * + * Sets the number of frames per second that + * the timeline will play. + **/ +void +gsd_timeline_set_fps (GsdTimeline *timeline, + guint fps) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + g_return_if_fail (fps > 0); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + priv->fps = fps; + + if (gsd_timeline_is_running (timeline)) + { + g_source_remove (priv->source_id); + priv->source_id = gdk_threads_add_timeout (FRAME_INTERVAL (priv->fps), + (GSourceFunc) gsd_timeline_run_frame, + timeline); + } + + g_object_notify (G_OBJECT (timeline), "fps"); +} + +/** + * gsd_timeline_get_loop: + * @timeline: A #GsdTimeline + * + * Returns whether the timeline loops to the + * beginning when it has reached the end. + * + * Return Value: %TRUE if the timeline loops + **/ +gboolean +gsd_timeline_get_loop (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), FALSE); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + return priv->loop; +} + +/** + * gsd_timeline_set_loop: + * @timeline: A #GsdTimeline + * @loop: %TRUE to make the timeline loop + * + * Sets whether the timeline loops to the beginning + * when it has reached the end. + **/ +void +gsd_timeline_set_loop (GsdTimeline *timeline, + gboolean loop) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + priv->loop = loop; + + g_object_notify (G_OBJECT (timeline), "loop"); +} + +void +gsd_timeline_set_duration (GsdTimeline *timeline, + guint duration) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + priv->duration = duration; + + g_object_notify (G_OBJECT (timeline), "duration"); +} + +guint +gsd_timeline_get_duration (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), 0); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + return priv->duration; +} + +/** + * gsd_timeline_get_direction: + * @timeline: A #GsdTimeline + * + * Returns the direction of the timeline. + * + * Return Value: direction + **/ +GsdTimelineDirection +gsd_timeline_get_direction (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), GSD_TIMELINE_DIRECTION_FORWARD); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + return priv->direction; +} + +/** + * gsd_timeline_set_direction: + * @timeline: A #GsdTimeline + * @direction: direction + * + * Sets the direction of the timeline. + **/ +void +gsd_timeline_set_direction (GsdTimeline *timeline, + GsdTimelineDirection direction) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + priv->direction = direction; + + g_object_notify (G_OBJECT (timeline), "direction"); +} + +GdkScreen * +gsd_timeline_get_screen (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), NULL); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + return priv->screen; +} + +void +gsd_timeline_set_screen (GsdTimeline *timeline, + GdkScreen *screen) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + g_return_if_fail (GDK_IS_SCREEN (screen)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + if (priv->screen) + g_object_unref (priv->screen); + + priv->screen = g_object_ref (screen); + + g_object_notify (G_OBJECT (timeline), "screen"); +} + +void +gsd_timeline_set_progress_type (GsdTimeline *timeline, + GsdTimelineProgressType type) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + priv->progress_type = type; + + g_object_notify (G_OBJECT (timeline), "progress-type"); +} + +GsdTimelineProgressType +gsd_timeline_get_progress_type (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), GSD_TIMELINE_PROGRESS_LINEAR); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + if (priv->progress_func) + return GSD_TIMELINE_PROGRESS_LINEAR; + + return priv->progress_type; +} + +/** + * gsd_timeline_set_progress_func: + * @timeline: A #GsdTimeline + * @progress_func: progress function + * + * Sets the progress function. This function will be used to calculate + * a different progress to pass to the ::frame signal based on the + * linear progress through the timeline. Setting progress_func + * to %NULL will make the timeline use the default function, + * which is just a linear progress. + * + * All progresses are in the [0.0, 1.0] range. + **/ +void +gsd_timeline_set_progress_func (GsdTimeline *timeline, + GsdTimelineProgressFunc progress_func) +{ + GsdTimelinePriv *priv; + + g_return_if_fail (GSD_IS_TIMELINE (timeline)); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + priv->progress_func = progress_func; +} + +gdouble +gsd_timeline_get_progress (GsdTimeline *timeline) +{ + GsdTimelinePriv *priv; + GsdTimelineProgressFunc progress_func = NULL; + gdouble linear_progress, progress; + guint elapsed_time; + + g_return_val_if_fail (GSD_IS_TIMELINE (timeline), 0.0); + + priv = GSD_TIMELINE_GET_PRIV (timeline); + + if (!priv->timer) + return 0.; + + elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000); + + linear_progress = (gdouble) elapsed_time / priv->duration; + + if (priv->direction == GSD_TIMELINE_DIRECTION_BACKWARD) + linear_progress = 1 - linear_progress; + + linear_progress = CLAMP (linear_progress, 0., 1.); + + if (priv->progress_func) + progress_func = priv->progress_func; + else if (priv->progress_type) + progress_func = progress_type_to_func (priv->progress_type); + + if (progress_func) + progress = (progress_func) (linear_progress); + else + progress = linear_progress; + + return CLAMP (progress, 0., 1.); +} diff --git a/plugins/mouse/gsd-timeline.h b/plugins/mouse/gsd-timeline.h new file mode 100644 index 00000000..a86f1434 --- /dev/null +++ b/plugins/mouse/gsd-timeline.h @@ -0,0 +1,123 @@ +/* gsdtimeline.c + * + * Copyright (C) 2008 Carlos Garnacho + * + * 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_TIMELINE_H__ +#define __GSD_TIMELINE_H__ + +#include +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_TIMELINE_DIRECTION (gsd_timeline_direction_get_type ()) +#define GSD_TYPE_TIMELINE_PROGRESS_TYPE (gsd_timeline_progress_type_get_type ()) +#define GSD_TYPE_TIMELINE (gsd_timeline_get_type ()) +#define GSD_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_TIMELINE, GsdTimeline)) +#define GSD_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_TIMELINE, GsdTimelineClass)) +#define GSD_IS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_TIMELINE)) +#define GSD_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_TIMELINE)) +#define GSD_TIMELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_TIMELINE, GsdTimelineClass)) + +typedef enum { + GSD_TIMELINE_DIRECTION_FORWARD, + GSD_TIMELINE_DIRECTION_BACKWARD +} GsdTimelineDirection; + +typedef enum { + GSD_TIMELINE_PROGRESS_LINEAR, + GSD_TIMELINE_PROGRESS_SINUSOIDAL, + GSD_TIMELINE_PROGRESS_EXPONENTIAL +} GsdTimelineProgressType; + +typedef struct GsdTimeline GsdTimeline; +typedef struct GsdTimelineClass GsdTimelineClass; + +struct GsdTimeline +{ + GObject parent_instance; +}; + +struct GsdTimelineClass +{ + GObjectClass parent_class; + + void (* started) (GsdTimeline *timeline); + void (* finished) (GsdTimeline *timeline); + void (* paused) (GsdTimeline *timeline); + + void (* frame) (GsdTimeline *timeline, + gdouble progress); + + void (* __gsd_reserved1) (void); + void (* __gsd_reserved2) (void); + void (* __gsd_reserved3) (void); + void (* __gsd_reserved4) (void); +}; + +typedef gdouble (*GsdTimelineProgressFunc) (gdouble progress); + + +GType gsd_timeline_get_type (void) G_GNUC_CONST; +GType gsd_timeline_direction_get_type (void) G_GNUC_CONST; +GType gsd_timeline_progress_type_get_type (void) G_GNUC_CONST; + +GsdTimeline *gsd_timeline_new (guint duration); +GsdTimeline *gsd_timeline_new_for_screen (guint duration, + GdkScreen *screen); + +void gsd_timeline_start (GsdTimeline *timeline); +void gsd_timeline_pause (GsdTimeline *timeline); +void gsd_timeline_rewind (GsdTimeline *timeline); + +gboolean gsd_timeline_is_running (GsdTimeline *timeline); + +guint gsd_timeline_get_fps (GsdTimeline *timeline); +void gsd_timeline_set_fps (GsdTimeline *timeline, + guint fps); + +gboolean gsd_timeline_get_loop (GsdTimeline *timeline); +void gsd_timeline_set_loop (GsdTimeline *timeline, + gboolean loop); + +guint gsd_timeline_get_duration (GsdTimeline *timeline); +void gsd_timeline_set_duration (GsdTimeline *timeline, + guint duration); + +GdkScreen *gsd_timeline_get_screen (GsdTimeline *timeline); +void gsd_timeline_set_screen (GsdTimeline *timeline, + GdkScreen *screen); + +GsdTimelineDirection gsd_timeline_get_direction (GsdTimeline *timeline); +void gsd_timeline_set_direction (GsdTimeline *timeline, + GsdTimelineDirection direction); + +GsdTimelineProgressType gsd_timeline_get_progress_type (GsdTimeline *timeline); +void gsd_timeline_set_progress_type (GsdTimeline *timeline, + GsdTimelineProgressType type); +void gsd_timeline_get_progress_func (GsdTimeline *timeline); + +void gsd_timeline_set_progress_func (GsdTimeline *timeline, + GsdTimelineProgressFunc progress_func); + +gdouble gsd_timeline_get_progress (GsdTimeline *timeline); + + +G_END_DECLS + +#endif /* __GSD_TIMELINE_H__ */ diff --git a/plugins/mouse/mouse.gnome-settings-plugin.in b/plugins/mouse/mouse.gnome-settings-plugin.in new file mode 100644 index 00000000..60557f05 --- /dev/null +++ b/plugins/mouse/mouse.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=mouse +IAge=0 +_Name=Mouse +_Description=Mouse plugin +Authors= +Copyright=Copyright © 2007 +Website= diff --git a/plugins/mouse/test-mouse.c b/plugins/mouse/test-mouse.c new file mode 100644 index 00000000..d978dc9c --- /dev/null +++ b/plugins/mouse/test-mouse.c @@ -0,0 +1,7 @@ +#define NEW gsd_mouse_manager_new +#define START gsd_mouse_manager_start +#define STOP gsd_mouse_manager_stop +#define MANAGER GsdMouseManager +#include "gsd-mouse-manager.h" + +#include "test-plugin.h" diff --git a/plugins/orientation/Makefile.am b/plugins/orientation/Makefile.am new file mode 100644 index 00000000..56b0f9fb --- /dev/null +++ b/plugins/orientation/Makefile.am @@ -0,0 +1,63 @@ +plugin_name = orientation + +libexec_PROGRAMS = gsd-test-orientation + +gsd_test_orientation_SOURCES = \ + gsd-orientation-manager.h \ + gsd-orientation-manager.c \ + test-orientation.c + +gsd_test_orientation_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(ORIENTATION_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_orientation_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(ORIENTATION_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = liborientation.la + +liborientation_la_SOURCES = \ + gsd-orientation-plugin.h \ + gsd-orientation-plugin.c \ + gsd-orientation-manager.h \ + gsd-orientation-manager.c + +liborientation_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -I$(top_srcdir)/data/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +liborientation_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(ORIENTATION_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +liborientation_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +liborientation_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(ORIENTATION_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = orientation.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = $(plugin_in_files) +CLEANFILES = $(plugin_DATA) +DISTCLEANFILES = $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/orientation/Makefile.in b/plugins/orientation/Makefile.in new file mode 100644 index 00000000..f5f6ae1e --- /dev/null +++ b/plugins/orientation/Makefile.in @@ -0,0 +1,898 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-orientation$(EXEEXT) +subdir = plugins/orientation +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +liborientation_la_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_liborientation_la_OBJECTS = \ + liborientation_la-gsd-orientation-plugin.lo \ + liborientation_la-gsd-orientation-manager.lo +liborientation_la_OBJECTS = $(am_liborientation_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +liborientation_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(liborientation_la_CFLAGS) $(CFLAGS) \ + $(liborientation_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_test_orientation_OBJECTS = \ + gsd_test_orientation-gsd-orientation-manager.$(OBJEXT) \ + gsd_test_orientation-test-orientation.$(OBJEXT) +gsd_test_orientation_OBJECTS = $(am_gsd_test_orientation_OBJECTS) +gsd_test_orientation_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_orientation_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_orientation_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(liborientation_la_SOURCES) $(gsd_test_orientation_SOURCES) +DIST_SOURCES = $(liborientation_la_SOURCES) \ + $(gsd_test_orientation_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = orientation +gsd_test_orientation_SOURCES = \ + gsd-orientation-manager.h \ + gsd-orientation-manager.c \ + test-orientation.c + +gsd_test_orientation_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(ORIENTATION_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_orientation_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(ORIENTATION_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = liborientation.la +liborientation_la_SOURCES = \ + gsd-orientation-plugin.h \ + gsd-orientation-plugin.c \ + gsd-orientation-manager.h \ + gsd-orientation-manager.c + +liborientation_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -I$(top_srcdir)/data/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +liborientation_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(ORIENTATION_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +liborientation_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +liborientation_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(ORIENTATION_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = orientation.gnome-settings-plugin.in +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = $(plugin_in_files) +CLEANFILES = $(plugin_DATA) +DISTCLEANFILES = $(plugin_DATA) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/orientation/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/orientation/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +liborientation.la: $(liborientation_la_OBJECTS) $(liborientation_la_DEPENDENCIES) $(EXTRA_liborientation_la_DEPENDENCIES) + $(AM_V_CCLD)$(liborientation_la_LINK) -rpath $(plugindir) $(liborientation_la_OBJECTS) $(liborientation_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-orientation$(EXEEXT): $(gsd_test_orientation_OBJECTS) $(gsd_test_orientation_DEPENDENCIES) $(EXTRA_gsd_test_orientation_DEPENDENCIES) + @rm -f gsd-test-orientation$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_orientation_LINK) $(gsd_test_orientation_OBJECTS) $(gsd_test_orientation_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_orientation-test-orientation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liborientation_la-gsd-orientation-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liborientation_la-gsd-orientation-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +liborientation_la-gsd-orientation-plugin.lo: gsd-orientation-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liborientation_la_CPPFLAGS) $(CPPFLAGS) $(liborientation_la_CFLAGS) $(CFLAGS) -MT liborientation_la-gsd-orientation-plugin.lo -MD -MP -MF $(DEPDIR)/liborientation_la-gsd-orientation-plugin.Tpo -c -o liborientation_la-gsd-orientation-plugin.lo `test -f 'gsd-orientation-plugin.c' || echo '$(srcdir)/'`gsd-orientation-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liborientation_la-gsd-orientation-plugin.Tpo $(DEPDIR)/liborientation_la-gsd-orientation-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-orientation-plugin.c' object='liborientation_la-gsd-orientation-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liborientation_la_CPPFLAGS) $(CPPFLAGS) $(liborientation_la_CFLAGS) $(CFLAGS) -c -o liborientation_la-gsd-orientation-plugin.lo `test -f 'gsd-orientation-plugin.c' || echo '$(srcdir)/'`gsd-orientation-plugin.c + +liborientation_la-gsd-orientation-manager.lo: gsd-orientation-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liborientation_la_CPPFLAGS) $(CPPFLAGS) $(liborientation_la_CFLAGS) $(CFLAGS) -MT liborientation_la-gsd-orientation-manager.lo -MD -MP -MF $(DEPDIR)/liborientation_la-gsd-orientation-manager.Tpo -c -o liborientation_la-gsd-orientation-manager.lo `test -f 'gsd-orientation-manager.c' || echo '$(srcdir)/'`gsd-orientation-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liborientation_la-gsd-orientation-manager.Tpo $(DEPDIR)/liborientation_la-gsd-orientation-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-orientation-manager.c' object='liborientation_la-gsd-orientation-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liborientation_la_CPPFLAGS) $(CPPFLAGS) $(liborientation_la_CFLAGS) $(CFLAGS) -c -o liborientation_la-gsd-orientation-manager.lo `test -f 'gsd-orientation-manager.c' || echo '$(srcdir)/'`gsd-orientation-manager.c + +gsd_test_orientation-gsd-orientation-manager.o: gsd-orientation-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -MT gsd_test_orientation-gsd-orientation-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Tpo -c -o gsd_test_orientation-gsd-orientation-manager.o `test -f 'gsd-orientation-manager.c' || echo '$(srcdir)/'`gsd-orientation-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Tpo $(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-orientation-manager.c' object='gsd_test_orientation-gsd-orientation-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -c -o gsd_test_orientation-gsd-orientation-manager.o `test -f 'gsd-orientation-manager.c' || echo '$(srcdir)/'`gsd-orientation-manager.c + +gsd_test_orientation-gsd-orientation-manager.obj: gsd-orientation-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -MT gsd_test_orientation-gsd-orientation-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Tpo -c -o gsd_test_orientation-gsd-orientation-manager.obj `if test -f 'gsd-orientation-manager.c'; then $(CYGPATH_W) 'gsd-orientation-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-orientation-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Tpo $(DEPDIR)/gsd_test_orientation-gsd-orientation-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-orientation-manager.c' object='gsd_test_orientation-gsd-orientation-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -c -o gsd_test_orientation-gsd-orientation-manager.obj `if test -f 'gsd-orientation-manager.c'; then $(CYGPATH_W) 'gsd-orientation-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-orientation-manager.c'; fi` + +gsd_test_orientation-test-orientation.o: test-orientation.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -MT gsd_test_orientation-test-orientation.o -MD -MP -MF $(DEPDIR)/gsd_test_orientation-test-orientation.Tpo -c -o gsd_test_orientation-test-orientation.o `test -f 'test-orientation.c' || echo '$(srcdir)/'`test-orientation.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_orientation-test-orientation.Tpo $(DEPDIR)/gsd_test_orientation-test-orientation.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-orientation.c' object='gsd_test_orientation-test-orientation.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -c -o gsd_test_orientation-test-orientation.o `test -f 'test-orientation.c' || echo '$(srcdir)/'`test-orientation.c + +gsd_test_orientation-test-orientation.obj: test-orientation.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -MT gsd_test_orientation-test-orientation.obj -MD -MP -MF $(DEPDIR)/gsd_test_orientation-test-orientation.Tpo -c -o gsd_test_orientation-test-orientation.obj `if test -f 'test-orientation.c'; then $(CYGPATH_W) 'test-orientation.c'; else $(CYGPATH_W) '$(srcdir)/test-orientation.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_orientation-test-orientation.Tpo $(DEPDIR)/gsd_test_orientation-test-orientation.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-orientation.c' object='gsd_test_orientation-test-orientation.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_orientation_CFLAGS) $(CFLAGS) -c -o gsd_test_orientation-test-orientation.obj `if test -f 'test-orientation.c'; then $(CYGPATH_W) 'test-orientation.c'; else $(CYGPATH_W) '$(srcdir)/test-orientation.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/orientation/gsd-orientation-manager.c b/plugins/orientation/gsd-orientation-manager.c new file mode 100644 index 00000000..a331a18b --- /dev/null +++ b/plugins/orientation/gsd-orientation-manager.c @@ -0,0 +1,596 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2010,2011 Red Hat, Inc. + * + * Author: Bastien Nocera + * + * 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 +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gsd-input-helper.h" +#include "gnome-settings-profile.h" +#include "gsd-orientation-manager.h" + +typedef enum { + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP +} OrientationUp; + +#define GSD_ORIENTATION_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_ORIENTATION_MANAGER, GsdOrientationManagerPrivate)) + +struct GsdOrientationManagerPrivate +{ + guint start_idle_id; + + /* Accelerometer */ + char *sysfs_path; + OrientationUp prev_orientation; + + /* DBus */ + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GDBusProxy *xrandr_proxy; + GCancellable *cancellable; + + /* Notifications */ + GUdevClient *client; + GSettings *settings; + gboolean orientation_lock; +}; + +#define CONF_SCHEMA "org.gnome.settings-daemon.peripherals.touchscreen" +#define ORIENTATION_LOCK_KEY "orientation-lock" + +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_ORIENTATION_DBUS_PATH GSD_DBUS_PATH "/Orientation" + +static const gchar introspection_xml[] = +"" +" " +" " +" " +""; + +static void gsd_orientation_manager_class_init (GsdOrientationManagerClass *klass); +static void gsd_orientation_manager_init (GsdOrientationManager *orientation_manager); +static void gsd_orientation_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdOrientationManager, gsd_orientation_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define MPU_THRESHOLD 12000 +#define MPU_POLL_INTERVAL 1 + +static gboolean is_mpu6050 = FALSE; +static char *mpu6050_accel_x = NULL; +static char *mpu6050_accel_y = NULL; +static gboolean mpu_timer(GsdOrientationManager *manager); + +static GObject * +gsd_orientation_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdOrientationManager *orientation_manager; + + orientation_manager = GSD_ORIENTATION_MANAGER (G_OBJECT_CLASS (gsd_orientation_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (orientation_manager); +} + +static void +gsd_orientation_manager_dispose (GObject *object) +{ + G_OBJECT_CLASS (gsd_orientation_manager_parent_class)->dispose (object); +} + +static void +gsd_orientation_manager_class_init (GsdOrientationManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_orientation_manager_constructor; + object_class->dispose = gsd_orientation_manager_dispose; + object_class->finalize = gsd_orientation_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdOrientationManagerPrivate)); +} + +static void +gsd_orientation_manager_init (GsdOrientationManager *manager) +{ + manager->priv = GSD_ORIENTATION_MANAGER_GET_PRIVATE (manager); + manager->priv->prev_orientation = ORIENTATION_UNDEFINED; +} + +static GnomeRRRotation +orientation_to_rotation (OrientationUp orientation) +{ + switch (orientation) { + case ORIENTATION_NORMAL: + return GNOME_RR_ROTATION_0; + case ORIENTATION_BOTTOM_UP: + return GNOME_RR_ROTATION_180; + case ORIENTATION_LEFT_UP: + return GNOME_RR_ROTATION_90; + case ORIENTATION_RIGHT_UP: + return GNOME_RR_ROTATION_270; + default: + g_assert_not_reached (); + } +} + +static OrientationUp +orientation_from_string (const char *orientation) +{ + if (g_strcmp0 (orientation, "normal") == 0) + return ORIENTATION_NORMAL; + if (g_strcmp0 (orientation, "bottom-up") == 0) + return ORIENTATION_BOTTOM_UP; + if (g_strcmp0 (orientation, "left-up") == 0) + return ORIENTATION_LEFT_UP; + if (g_strcmp0 (orientation, "right-up") == 0) + return ORIENTATION_RIGHT_UP; + + return ORIENTATION_UNDEFINED; +} + +static const char * +orientation_to_string (OrientationUp o) +{ + switch (o) { + case ORIENTATION_UNDEFINED: + return "undefined"; + case ORIENTATION_NORMAL: + return "normal"; + case ORIENTATION_BOTTOM_UP: + return "bottom-up"; + case ORIENTATION_LEFT_UP: + return "left-up"; + case ORIENTATION_RIGHT_UP: + return "right-up"; + default: + g_assert_not_reached (); + } +} + +static OrientationUp +get_orientation_from_device (GUdevDevice *dev) +{ + const char *value; + + value = g_udev_device_get_property (dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) { + g_debug ("Couldn't find orientation for accelerometer %s", + g_udev_device_get_sysfs_path (dev)); + return ORIENTATION_UNDEFINED; + } + g_debug ("Found orientation '%s' for accelerometer %s", + value, g_udev_device_get_sysfs_path (dev)); + + return orientation_from_string (value); +} + +static void +on_xrandr_action_call_finished (GObject *source_object, + GAsyncResult *res, + GsdOrientationManager *manager) +{ + GError *error = NULL; + GVariant *variant; + + variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + + g_object_unref (manager->priv->cancellable); + manager->priv->cancellable = NULL; + + if (error != NULL) { + g_warning ("Unable to call 'RotateTo': %s", error->message); + g_error_free (error); + } else { + g_variant_unref (variant); + } +} + +static void +do_xrandr_action (GsdOrientationManager *manager, + GnomeRRRotation rotation) +{ + GsdOrientationManagerPrivate *priv = manager->priv; + GTimeVal tv; + gint64 timestamp; + + if (priv->connection == NULL || priv->xrandr_proxy == NULL) { + g_warning ("No existing D-Bus connection trying to handle XRANDR keys"); + return; + } + + if (priv->cancellable != NULL) { + g_debug ("xrandr action already in flight"); + return; + } + + g_get_current_time (&tv); + timestamp = tv.tv_sec * 1000 + tv.tv_usec / 1000; + + priv->cancellable = g_cancellable_new (); + + g_dbus_proxy_call (priv->xrandr_proxy, + "RotateTo", + g_variant_new ("(ix)", rotation, timestamp), + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->cancellable, + (GAsyncReadyCallback) on_xrandr_action_call_finished, + manager); +} + +static void +do_rotation (GsdOrientationManager *manager) +{ + GnomeRRRotation rotation; + + if (manager->priv->orientation_lock) { + g_debug ("Orientation changed, but we are locked"); + return; + } + if (manager->priv->prev_orientation == ORIENTATION_UNDEFINED) { + g_debug ("Not trying to rotate, orientation is undefined"); + return; + } + + rotation = orientation_to_rotation (manager->priv->prev_orientation); + + do_xrandr_action (manager, rotation); +} + +static void +client_uevent_cb (GUdevClient *client, + gchar *action, + GUdevDevice *device, + GsdOrientationManager *manager) +{ + const char *sysfs_path; + OrientationUp orientation; + + sysfs_path = g_udev_device_get_sysfs_path (device); + g_debug ("Received uevent '%s' from '%s'", action, sysfs_path); + + if (manager->priv->orientation_lock) + return; + + if (g_str_equal (action, "change") == FALSE) + return; + + if (g_strcmp0 (manager->priv->sysfs_path, sysfs_path) != 0) + return; + + g_debug ("Received an event from the accelerometer"); + + orientation = get_orientation_from_device (device); + if (orientation != manager->priv->prev_orientation) { + manager->priv->prev_orientation = orientation; + g_debug ("Orientation changed to '%s', switching screen rotation", + orientation_to_string (manager->priv->prev_orientation)); + + do_rotation (manager); + } +} + +static void +orientation_lock_changed_cb (GSettings *settings, + gchar *key, + GsdOrientationManager *manager) +{ + gboolean new; + + new = g_settings_get_boolean (settings, key); + if (new == manager->priv->orientation_lock) + return; + + manager->priv->orientation_lock = new; + + if (new == FALSE) { + if (is_mpu6050) { + g_timeout_add_seconds(MPU_POLL_INTERVAL, (GSourceFunc) mpu_timer, manager); + } + /* Handle the rotations that could have occurred while + * we were locked */ + do_rotation (manager); + } +} + +static void +xrandr_ready_cb (GObject *source_object, + GAsyncResult *res, + GsdOrientationManager *manager) +{ + GError *error = NULL; + + manager->priv->xrandr_proxy = g_dbus_proxy_new_finish (res, &error); + if (manager->priv->xrandr_proxy == NULL) { + g_warning ("Failed to get proxy for XRandR operations: %s", error->message); + g_error_free (error); + } +} + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdOrientationManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + GSD_ORIENTATION_DBUS_PATH, + manager->priv->introspection_data->interfaces[0], + NULL, + NULL, + NULL, + NULL); + + g_dbus_proxy_new (manager->priv->connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.gnome.SettingsDaemon", + "/org/gnome/SettingsDaemon/XRANDR", + "org.gnome.SettingsDaemon.XRANDR_2", + NULL, + (GAsyncReadyCallback) xrandr_ready_cb, + manager); +} + +static GUdevDevice * +get_accelerometer (GUdevClient *client) +{ + GList *list, *listiio, *l; + GUdevDevice *ret, *parent; + + /* Look for a device with the ID_INPUT_ACCELEROMETER=1 property */ + ret = NULL; + list = g_udev_client_query_by_subsystem (client, "input"); + listiio = g_udev_client_query_by_subsystem (client, "iio"); + list = g_list_concat(list, listiio); + for (l = list; l != NULL; l = l->next) { + GUdevDevice *dev; + + dev = l->data; + if (g_udev_device_get_property_as_boolean (dev, "ID_INPUT_ACCELEROMETER")) { + ret = dev; + continue; + } + g_object_unref (dev); + } + g_list_free (list); + + if (ret == NULL) + return NULL; + + /* Now walk up to the parent */ + parent = g_udev_device_get_parent (ret); + if (parent == NULL) + return ret; + + if (g_udev_device_get_property_as_boolean (parent, "ID_INPUT_ACCELEROMETER")) { + g_object_unref (ret); + ret = parent; + } else { + g_object_unref (parent); + } + + return ret; +} + +static int read_sysfs_attr_as_int(const char *filename) { + int i, c; + char buf[40]; + int fd = open(filename, O_RDONLY); + if (fd < 0) + return 0; + c = read(fd, buf, 40); + if (c < 0) + return 0; + close(fd); + sscanf(buf, "%d", &i); + + return i; +} + +static gboolean mpu_timer(GsdOrientationManager *manager) { + int x, y; + static gboolean first = TRUE; + OrientationUp orientation = manager->priv->prev_orientation; + + if (manager->priv->xrandr_proxy == NULL) + return TRUE; + + x = read_sysfs_attr_as_int(mpu6050_accel_x); + y = read_sysfs_attr_as_int(mpu6050_accel_y); + + if (x > MPU_THRESHOLD) + orientation = ORIENTATION_NORMAL; + if (x < -MPU_THRESHOLD) + orientation = ORIENTATION_BOTTOM_UP; + if (y > MPU_THRESHOLD) + orientation = ORIENTATION_RIGHT_UP; + if (y < -MPU_THRESHOLD) + orientation = ORIENTATION_LEFT_UP; + + if (orientation != manager->priv->prev_orientation || first) { + first = FALSE; + manager->priv->prev_orientation = orientation; + g_debug ("Orientation changed to '%s', switching screen rotation", + orientation_to_string (manager->priv->prev_orientation)); + + do_rotation (manager); + } + + return !manager->priv->orientation_lock; +} + +static gboolean +gsd_orientation_manager_idle_cb (GsdOrientationManager *manager) +{ + const char * const subsystems[] = { "input", NULL }; + GUdevDevice *dev; + + gnome_settings_profile_start (NULL); + + manager->priv->settings = g_settings_new (CONF_SCHEMA); + manager->priv->orientation_lock = g_settings_get_boolean (manager->priv->settings, ORIENTATION_LOCK_KEY); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed::orientation-lock", + G_CALLBACK (orientation_lock_changed_cb), manager); + + manager->priv->client = g_udev_client_new (subsystems); + dev = get_accelerometer (manager->priv->client); + if (dev == NULL) { + g_debug ("Did not find an accelerometer"); + gnome_settings_profile_end (NULL); + return FALSE; + } + manager->priv->sysfs_path = g_strdup (g_udev_device_get_sysfs_path (dev)); + g_debug ("Found accelerometer at sysfs path '%s'", manager->priv->sysfs_path); + + manager->priv->prev_orientation = get_orientation_from_device (dev); + + /* Poll the sysfs attributes exposed by MPU6050 as it is not an uevent based input driver */ + if (g_strcmp0 (g_udev_device_get_sysfs_attr (dev, "name"), "mpu6050") == 0) { + manager->priv->prev_orientation = ORIENTATION_NORMAL; + g_timeout_add_seconds(MPU_POLL_INTERVAL, (GSourceFunc) mpu_timer, manager); + mpu6050_accel_x = g_build_filename(manager->priv->sysfs_path, "in_accel_x_raw", NULL); + mpu6050_accel_y = g_build_filename(manager->priv->sysfs_path, "in_accel_y_raw", NULL); + is_mpu6050 = TRUE; + } + + g_object_unref (dev); + + /* Start process of owning a D-Bus name */ + g_bus_get (G_BUS_TYPE_SESSION, + NULL, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + g_signal_connect (G_OBJECT (manager->priv->client), "uevent", + G_CALLBACK (client_uevent_cb), manager); + + gnome_settings_profile_end (NULL); + + return FALSE; +} + +gboolean +gsd_orientation_manager_start (GsdOrientationManager *manager, + GError **error) +{ + gnome_settings_profile_start (NULL); + + manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_orientation_manager_idle_cb, manager); + + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + g_assert (manager->priv->introspection_data != NULL); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_orientation_manager_stop (GsdOrientationManager *manager) +{ + GsdOrientationManagerPrivate *p = manager->priv; + + g_debug ("Stopping orientation manager"); + + if (p->settings) { + g_object_unref (p->settings); + p->settings = NULL; + } + + if (p->sysfs_path) { + g_free (p->sysfs_path); + p->sysfs_path = NULL; + } + + if (p->introspection_data) { + g_dbus_node_info_unref (p->introspection_data); + p->introspection_data = NULL; + } + + if (p->client) { + g_object_unref (p->client); + p->client = NULL; + } +} + +static void +gsd_orientation_manager_finalize (GObject *object) +{ + GsdOrientationManager *orientation_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_ORIENTATION_MANAGER (object)); + + orientation_manager = GSD_ORIENTATION_MANAGER (object); + + g_return_if_fail (orientation_manager->priv != NULL); + + if (orientation_manager->priv->start_idle_id != 0) + g_source_remove (orientation_manager->priv->start_idle_id); + + G_OBJECT_CLASS (gsd_orientation_manager_parent_class)->finalize (object); +} + +GsdOrientationManager * +gsd_orientation_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_ORIENTATION_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_ORIENTATION_MANAGER (manager_object); +} diff --git a/plugins/orientation/gsd-orientation-manager.h b/plugins/orientation/gsd-orientation-manager.h new file mode 100644 index 00000000..0b637a25 --- /dev/null +++ b/plugins/orientation/gsd-orientation-manager.h @@ -0,0 +1,58 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2010 Red Hat, Inc. + * + * 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_ORIENTATION_MANAGER_H +#define __GSD_ORIENTATION_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_ORIENTATION_MANAGER (gsd_orientation_manager_get_type ()) +#define GSD_ORIENTATION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_ORIENTATION_MANAGER, GsdOrientationManager)) +#define GSD_ORIENTATION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_ORIENTATION_MANAGER, GsdOrientationManagerClass)) +#define GSD_IS_ORIENTATION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_ORIENTATION_MANAGER)) +#define GSD_IS_ORIENTATION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_ORIENTATION_MANAGER)) +#define GSD_ORIENTATION_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_ORIENTATION_MANAGER, GsdOrientationManagerClass)) + +typedef struct GsdOrientationManagerPrivate GsdOrientationManagerPrivate; + +typedef struct +{ + GObject parent; + GsdOrientationManagerPrivate *priv; +} GsdOrientationManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdOrientationManagerClass; + +GType gsd_orientation_manager_get_type (void); + +GsdOrientationManager * gsd_orientation_manager_new (void); +gboolean gsd_orientation_manager_start (GsdOrientationManager *manager, + GError **error); +void gsd_orientation_manager_stop (GsdOrientationManager *manager); + +G_END_DECLS + +#endif /* __GSD_ORIENTATION_MANAGER_H */ diff --git a/plugins/orientation/gsd-orientation-plugin.c b/plugins/orientation/gsd-orientation-plugin.c new file mode 100644 index 00000000..506302e2 --- /dev/null +++ b/plugins/orientation/gsd-orientation-plugin.c @@ -0,0 +1,105 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2010 Red Hat, Inc. + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-orientation-plugin.h" +#include "gsd-orientation-manager.h" + +struct GsdOrientationPluginPrivate { + GsdOrientationManager *manager; +}; + +#define GSD_ORIENTATION_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_ORIENTATION_PLUGIN, GsdOrientationPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdOrientationPlugin, gsd_orientation_plugin) + +static void +gsd_orientation_plugin_init (GsdOrientationPlugin *plugin) +{ + plugin->priv = GSD_ORIENTATION_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdOrientationPlugin initializing"); + + plugin->priv->manager = gsd_orientation_manager_new (); +} + +static void +gsd_orientation_plugin_finalize (GObject *object) +{ + GsdOrientationPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_ORIENTATION_PLUGIN (object)); + + g_debug ("GsdOrientationPlugin finalizing"); + + plugin = GSD_ORIENTATION_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_orientation_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating orientation plugin"); + + error = NULL; + res = gsd_orientation_manager_start (GSD_ORIENTATION_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start orientation manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating orientation plugin"); + gsd_orientation_manager_stop (GSD_ORIENTATION_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_orientation_plugin_class_init (GsdOrientationPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_orientation_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdOrientationPluginPrivate)); +} diff --git a/plugins/orientation/gsd-orientation-plugin.h b/plugins/orientation/gsd-orientation-plugin.h new file mode 100644 index 00000000..dffcb71e --- /dev/null +++ b/plugins/orientation/gsd-orientation-plugin.h @@ -0,0 +1,60 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2010 Red Hat, Inc. + * + * 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, 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_ORIENTATION_PLUGIN_H__ +#define __GSD_ORIENTATION_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_ORIENTATION_PLUGIN (gsd_orientation_plugin_get_type ()) +#define GSD_ORIENTATION_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_ORIENTATION_PLUGIN, GsdOrientationPlugin)) +#define GSD_ORIENTATION_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_ORIENTATION_PLUGIN, GsdOrientationPluginClass)) +#define GSD_IS_ORIENTATION_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_ORIENTATION_PLUGIN)) +#define GSD_IS_ORIENTATION_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_ORIENTATION_PLUGIN)) +#define GSD_ORIENTATION_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_ORIENTATION_PLUGIN, GsdOrientationPluginClass)) + +typedef struct GsdOrientationPluginPrivate GsdOrientationPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdOrientationPluginPrivate *priv; +} GsdOrientationPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdOrientationPluginClass; + +GType gsd_orientation_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_ORIENTATION_PLUGIN_H__ */ diff --git a/plugins/orientation/orientation.gnome-settings-plugin.in b/plugins/orientation/orientation.gnome-settings-plugin.in new file mode 100644 index 00000000..14386326 --- /dev/null +++ b/plugins/orientation/orientation.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=orientation +IAge=0 +_Name=Orientation +_Description=Orientation plugin +Authors=Peter Hutterer +Copyright=Copyright © 2010 +Website= diff --git a/plugins/orientation/test-orientation.c b/plugins/orientation/test-orientation.c new file mode 100644 index 00000000..766843a4 --- /dev/null +++ b/plugins/orientation/test-orientation.c @@ -0,0 +1,7 @@ +#define NEW gsd_orientation_manager_new +#define START gsd_orientation_manager_start +#define STOP gsd_orientation_manager_stop +#define MANAGER GsdOrientationManager +#include "gsd-orientation-manager.h" + +#include "test-plugin.h" diff --git a/plugins/power/Makefile.am b/plugins/power/Makefile.am new file mode 100644 index 00000000..6a449b75 --- /dev/null +++ b/plugins/power/Makefile.am @@ -0,0 +1,108 @@ +plugin_name = power + +plugin_LTLIBRARIES = \ + libpower.la + +libpower_la_SOURCES = \ + gpm-common.c \ + gpm-common.h \ + gpm-phone.c \ + gpm-phone.h \ + gpm-idletime.c \ + gpm-idletime.h \ + gsd-power-manager.c \ + gsd-power-manager.h \ + gsd-power-plugin.c \ + gsd-power-plugin.h + +libpower_la_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DSBINDIR=\"$(sbindir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + $(AM_CPPFLAGS) + +libpower_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(POWER_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libpower_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libpower_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(POWER_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + power.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +org.gnome.settings-daemon.plugins.power.policy.in: org.gnome.settings-daemon.plugins.power.policy.in.in Makefile + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + +@INTLTOOL_POLICY_RULE@ +polkit_policydir = $(datadir)/polkit-1/actions +polkit_policy_in_files = org.gnome.settings-daemon.plugins.power.policy.in +polkit_policy_DATA = $(polkit_policy_in_files:.policy.in=.policy) + +# so it always gets included in the tarball +gsd_backlight_helper_SOURCES = \ + gsd-backlight-helper.c + +libexec_PROGRAMS = gsd-test-power +gsd_test_power_SOURCES = \ + gpm-common.c \ + gpm-common.h \ + gpm-phone.c \ + gpm-phone.h \ + gpm-idletime.c \ + gpm-idletime.h \ + gsd-power-manager.c \ + gsd-power-manager.h \ + test-power.c + +gsd_test_power_CFLAGS = $(libpower_la_CFLAGS) +gsd_test_power_CPPFLAGS = $(libpower_la_CPPFLAGS) +gsd_test_power_LDADD = \ + -lm \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(POWER_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(gsd_backlight_helper_SOURCES) + +if HAVE_GUDEV +libexec_PROGRAMS += \ + gsd-backlight-helper + +gsd_backlight_helper_LDFLAGS = \ + $(BACKLIGHT_HELPER_LIBS) \ + -lm + +gsd_backlight_helper_CFLAGS = \ + $(BACKLIGHT_HELPER_CFLAGS) + +EXTRA_DIST += \ + org.gnome.settings-daemon.plugins.power.policy.in.in +endif + +clean-local: + rm -f *~ + +CLEANFILES = \ + $(plugin_DATA) \ + org.gnome.settings-daemon.plugins.power.policy \ + org.gnome.settings-daemon.plugins.power.policy.in + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/power/Makefile.in b/plugins/power/Makefile.in new file mode 100644 index 00000000..4cf3ca25 --- /dev/null +++ b/plugins/power/Makefile.in @@ -0,0 +1,1066 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-power$(EXEEXT) $(am__EXEEXT_1) +@HAVE_GUDEV_TRUE@am__append_1 = \ +@HAVE_GUDEV_TRUE@ gsd-backlight-helper + +@HAVE_GUDEV_TRUE@am__append_2 = \ +@HAVE_GUDEV_TRUE@ org.gnome.settings-daemon.plugins.power.policy.in.in + +subdir = plugins/power +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(polkit_policydir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libpower_la_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libpower_la_OBJECTS = libpower_la-gpm-common.lo \ + libpower_la-gpm-phone.lo libpower_la-gpm-idletime.lo \ + libpower_la-gsd-power-manager.lo \ + libpower_la-gsd-power-plugin.lo +libpower_la_OBJECTS = $(am_libpower_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libpower_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libpower_la_CFLAGS) \ + $(CFLAGS) $(libpower_la_LDFLAGS) $(LDFLAGS) -o $@ +@HAVE_GUDEV_TRUE@am__EXEEXT_1 = gsd-backlight-helper$(EXEEXT) +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_backlight_helper_OBJECTS = \ + gsd_backlight_helper-gsd-backlight-helper.$(OBJEXT) +gsd_backlight_helper_OBJECTS = $(am_gsd_backlight_helper_OBJECTS) +gsd_backlight_helper_LDADD = $(LDADD) +gsd_backlight_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_backlight_helper_CFLAGS) $(CFLAGS) \ + $(gsd_backlight_helper_LDFLAGS) $(LDFLAGS) -o $@ +am_gsd_test_power_OBJECTS = gsd_test_power-gpm-common.$(OBJEXT) \ + gsd_test_power-gpm-phone.$(OBJEXT) \ + gsd_test_power-gpm-idletime.$(OBJEXT) \ + gsd_test_power-gsd-power-manager.$(OBJEXT) \ + gsd_test_power-test-power.$(OBJEXT) +gsd_test_power_OBJECTS = $(am_gsd_test_power_OBJECTS) +gsd_test_power_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_power_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_power_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libpower_la_SOURCES) $(gsd_backlight_helper_SOURCES) \ + $(gsd_test_power_SOURCES) +DIST_SOURCES = $(libpower_la_SOURCES) $(gsd_backlight_helper_SOURCES) \ + $(gsd_test_power_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) $(polkit_policy_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = power +plugin_LTLIBRARIES = \ + libpower.la + +libpower_la_SOURCES = \ + gpm-common.c \ + gpm-common.h \ + gpm-phone.c \ + gpm-phone.h \ + gpm-idletime.c \ + gpm-idletime.h \ + gsd-power-manager.c \ + gsd-power-manager.h \ + gsd-power-plugin.c \ + gsd-power-plugin.h + +libpower_la_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DSBINDIR=\"$(sbindir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + $(AM_CPPFLAGS) + +libpower_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(POWER_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libpower_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libpower_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(POWER_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + power.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +polkit_policydir = $(datadir)/polkit-1/actions +polkit_policy_in_files = org.gnome.settings-daemon.plugins.power.policy.in +polkit_policy_DATA = $(polkit_policy_in_files:.policy.in=.policy) + +# so it always gets included in the tarball +gsd_backlight_helper_SOURCES = \ + gsd-backlight-helper.c + +gsd_test_power_SOURCES = \ + gpm-common.c \ + gpm-common.h \ + gpm-phone.c \ + gpm-phone.h \ + gpm-idletime.c \ + gpm-idletime.h \ + gsd-power-manager.c \ + gsd-power-manager.h \ + test-power.c + +gsd_test_power_CFLAGS = $(libpower_la_CFLAGS) +gsd_test_power_CPPFLAGS = $(libpower_la_CPPFLAGS) +gsd_test_power_LDADD = \ + -lm \ + $(top_builddir)/plugins/common/libcommon.la \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(POWER_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +EXTRA_DIST = $(plugin_in_files) $(gsd_backlight_helper_SOURCES) \ + $(am__append_2) +@HAVE_GUDEV_TRUE@gsd_backlight_helper_LDFLAGS = \ +@HAVE_GUDEV_TRUE@ $(BACKLIGHT_HELPER_LIBS) \ +@HAVE_GUDEV_TRUE@ -lm + +@HAVE_GUDEV_TRUE@gsd_backlight_helper_CFLAGS = \ +@HAVE_GUDEV_TRUE@ $(BACKLIGHT_HELPER_CFLAGS) + +CLEANFILES = \ + $(plugin_DATA) \ + org.gnome.settings-daemon.plugins.power.policy \ + org.gnome.settings-daemon.plugins.power.policy.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/power/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/power/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libpower.la: $(libpower_la_OBJECTS) $(libpower_la_DEPENDENCIES) $(EXTRA_libpower_la_DEPENDENCIES) + $(AM_V_CCLD)$(libpower_la_LINK) -rpath $(plugindir) $(libpower_la_OBJECTS) $(libpower_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-backlight-helper$(EXEEXT): $(gsd_backlight_helper_OBJECTS) $(gsd_backlight_helper_DEPENDENCIES) $(EXTRA_gsd_backlight_helper_DEPENDENCIES) + @rm -f gsd-backlight-helper$(EXEEXT) + $(AM_V_CCLD)$(gsd_backlight_helper_LINK) $(gsd_backlight_helper_OBJECTS) $(gsd_backlight_helper_LDADD) $(LIBS) +gsd-test-power$(EXEEXT): $(gsd_test_power_OBJECTS) $(gsd_test_power_DEPENDENCIES) $(EXTRA_gsd_test_power_DEPENDENCIES) + @rm -f gsd-test-power$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_power_LINK) $(gsd_test_power_OBJECTS) $(gsd_test_power_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_power-gpm-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_power-gpm-idletime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_power-gpm-phone.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_power-gsd-power-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_power-test-power.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpower_la-gpm-common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpower_la-gpm-idletime.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpower_la-gpm-phone.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpower_la-gsd-power-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpower_la-gsd-power-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libpower_la-gpm-common.lo: gpm-common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -MT libpower_la-gpm-common.lo -MD -MP -MF $(DEPDIR)/libpower_la-gpm-common.Tpo -c -o libpower_la-gpm-common.lo `test -f 'gpm-common.c' || echo '$(srcdir)/'`gpm-common.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpower_la-gpm-common.Tpo $(DEPDIR)/libpower_la-gpm-common.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-common.c' object='libpower_la-gpm-common.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -c -o libpower_la-gpm-common.lo `test -f 'gpm-common.c' || echo '$(srcdir)/'`gpm-common.c + +libpower_la-gpm-phone.lo: gpm-phone.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -MT libpower_la-gpm-phone.lo -MD -MP -MF $(DEPDIR)/libpower_la-gpm-phone.Tpo -c -o libpower_la-gpm-phone.lo `test -f 'gpm-phone.c' || echo '$(srcdir)/'`gpm-phone.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpower_la-gpm-phone.Tpo $(DEPDIR)/libpower_la-gpm-phone.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-phone.c' object='libpower_la-gpm-phone.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -c -o libpower_la-gpm-phone.lo `test -f 'gpm-phone.c' || echo '$(srcdir)/'`gpm-phone.c + +libpower_la-gpm-idletime.lo: gpm-idletime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -MT libpower_la-gpm-idletime.lo -MD -MP -MF $(DEPDIR)/libpower_la-gpm-idletime.Tpo -c -o libpower_la-gpm-idletime.lo `test -f 'gpm-idletime.c' || echo '$(srcdir)/'`gpm-idletime.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpower_la-gpm-idletime.Tpo $(DEPDIR)/libpower_la-gpm-idletime.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-idletime.c' object='libpower_la-gpm-idletime.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -c -o libpower_la-gpm-idletime.lo `test -f 'gpm-idletime.c' || echo '$(srcdir)/'`gpm-idletime.c + +libpower_la-gsd-power-manager.lo: gsd-power-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -MT libpower_la-gsd-power-manager.lo -MD -MP -MF $(DEPDIR)/libpower_la-gsd-power-manager.Tpo -c -o libpower_la-gsd-power-manager.lo `test -f 'gsd-power-manager.c' || echo '$(srcdir)/'`gsd-power-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpower_la-gsd-power-manager.Tpo $(DEPDIR)/libpower_la-gsd-power-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-power-manager.c' object='libpower_la-gsd-power-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -c -o libpower_la-gsd-power-manager.lo `test -f 'gsd-power-manager.c' || echo '$(srcdir)/'`gsd-power-manager.c + +libpower_la-gsd-power-plugin.lo: gsd-power-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -MT libpower_la-gsd-power-plugin.lo -MD -MP -MF $(DEPDIR)/libpower_la-gsd-power-plugin.Tpo -c -o libpower_la-gsd-power-plugin.lo `test -f 'gsd-power-plugin.c' || echo '$(srcdir)/'`gsd-power-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpower_la-gsd-power-plugin.Tpo $(DEPDIR)/libpower_la-gsd-power-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-power-plugin.c' object='libpower_la-gsd-power-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpower_la_CPPFLAGS) $(CPPFLAGS) $(libpower_la_CFLAGS) $(CFLAGS) -c -o libpower_la-gsd-power-plugin.lo `test -f 'gsd-power-plugin.c' || echo '$(srcdir)/'`gsd-power-plugin.c + +gsd_backlight_helper-gsd-backlight-helper.o: gsd-backlight-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_backlight_helper_CFLAGS) $(CFLAGS) -MT gsd_backlight_helper-gsd-backlight-helper.o -MD -MP -MF $(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Tpo -c -o gsd_backlight_helper-gsd-backlight-helper.o `test -f 'gsd-backlight-helper.c' || echo '$(srcdir)/'`gsd-backlight-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Tpo $(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-backlight-helper.c' object='gsd_backlight_helper-gsd-backlight-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_backlight_helper_CFLAGS) $(CFLAGS) -c -o gsd_backlight_helper-gsd-backlight-helper.o `test -f 'gsd-backlight-helper.c' || echo '$(srcdir)/'`gsd-backlight-helper.c + +gsd_backlight_helper-gsd-backlight-helper.obj: gsd-backlight-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_backlight_helper_CFLAGS) $(CFLAGS) -MT gsd_backlight_helper-gsd-backlight-helper.obj -MD -MP -MF $(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Tpo -c -o gsd_backlight_helper-gsd-backlight-helper.obj `if test -f 'gsd-backlight-helper.c'; then $(CYGPATH_W) 'gsd-backlight-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-backlight-helper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Tpo $(DEPDIR)/gsd_backlight_helper-gsd-backlight-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-backlight-helper.c' object='gsd_backlight_helper-gsd-backlight-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_backlight_helper_CFLAGS) $(CFLAGS) -c -o gsd_backlight_helper-gsd-backlight-helper.obj `if test -f 'gsd-backlight-helper.c'; then $(CYGPATH_W) 'gsd-backlight-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-backlight-helper.c'; fi` + +gsd_test_power-gpm-common.o: gpm-common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gpm-common.o -MD -MP -MF $(DEPDIR)/gsd_test_power-gpm-common.Tpo -c -o gsd_test_power-gpm-common.o `test -f 'gpm-common.c' || echo '$(srcdir)/'`gpm-common.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gpm-common.Tpo $(DEPDIR)/gsd_test_power-gpm-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-common.c' object='gsd_test_power-gpm-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gpm-common.o `test -f 'gpm-common.c' || echo '$(srcdir)/'`gpm-common.c + +gsd_test_power-gpm-common.obj: gpm-common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gpm-common.obj -MD -MP -MF $(DEPDIR)/gsd_test_power-gpm-common.Tpo -c -o gsd_test_power-gpm-common.obj `if test -f 'gpm-common.c'; then $(CYGPATH_W) 'gpm-common.c'; else $(CYGPATH_W) '$(srcdir)/gpm-common.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gpm-common.Tpo $(DEPDIR)/gsd_test_power-gpm-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-common.c' object='gsd_test_power-gpm-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gpm-common.obj `if test -f 'gpm-common.c'; then $(CYGPATH_W) 'gpm-common.c'; else $(CYGPATH_W) '$(srcdir)/gpm-common.c'; fi` + +gsd_test_power-gpm-phone.o: gpm-phone.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gpm-phone.o -MD -MP -MF $(DEPDIR)/gsd_test_power-gpm-phone.Tpo -c -o gsd_test_power-gpm-phone.o `test -f 'gpm-phone.c' || echo '$(srcdir)/'`gpm-phone.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gpm-phone.Tpo $(DEPDIR)/gsd_test_power-gpm-phone.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-phone.c' object='gsd_test_power-gpm-phone.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gpm-phone.o `test -f 'gpm-phone.c' || echo '$(srcdir)/'`gpm-phone.c + +gsd_test_power-gpm-phone.obj: gpm-phone.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gpm-phone.obj -MD -MP -MF $(DEPDIR)/gsd_test_power-gpm-phone.Tpo -c -o gsd_test_power-gpm-phone.obj `if test -f 'gpm-phone.c'; then $(CYGPATH_W) 'gpm-phone.c'; else $(CYGPATH_W) '$(srcdir)/gpm-phone.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gpm-phone.Tpo $(DEPDIR)/gsd_test_power-gpm-phone.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-phone.c' object='gsd_test_power-gpm-phone.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gpm-phone.obj `if test -f 'gpm-phone.c'; then $(CYGPATH_W) 'gpm-phone.c'; else $(CYGPATH_W) '$(srcdir)/gpm-phone.c'; fi` + +gsd_test_power-gpm-idletime.o: gpm-idletime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gpm-idletime.o -MD -MP -MF $(DEPDIR)/gsd_test_power-gpm-idletime.Tpo -c -o gsd_test_power-gpm-idletime.o `test -f 'gpm-idletime.c' || echo '$(srcdir)/'`gpm-idletime.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gpm-idletime.Tpo $(DEPDIR)/gsd_test_power-gpm-idletime.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-idletime.c' object='gsd_test_power-gpm-idletime.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gpm-idletime.o `test -f 'gpm-idletime.c' || echo '$(srcdir)/'`gpm-idletime.c + +gsd_test_power-gpm-idletime.obj: gpm-idletime.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gpm-idletime.obj -MD -MP -MF $(DEPDIR)/gsd_test_power-gpm-idletime.Tpo -c -o gsd_test_power-gpm-idletime.obj `if test -f 'gpm-idletime.c'; then $(CYGPATH_W) 'gpm-idletime.c'; else $(CYGPATH_W) '$(srcdir)/gpm-idletime.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gpm-idletime.Tpo $(DEPDIR)/gsd_test_power-gpm-idletime.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gpm-idletime.c' object='gsd_test_power-gpm-idletime.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gpm-idletime.obj `if test -f 'gpm-idletime.c'; then $(CYGPATH_W) 'gpm-idletime.c'; else $(CYGPATH_W) '$(srcdir)/gpm-idletime.c'; fi` + +gsd_test_power-gsd-power-manager.o: gsd-power-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gsd-power-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_power-gsd-power-manager.Tpo -c -o gsd_test_power-gsd-power-manager.o `test -f 'gsd-power-manager.c' || echo '$(srcdir)/'`gsd-power-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gsd-power-manager.Tpo $(DEPDIR)/gsd_test_power-gsd-power-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-power-manager.c' object='gsd_test_power-gsd-power-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gsd-power-manager.o `test -f 'gsd-power-manager.c' || echo '$(srcdir)/'`gsd-power-manager.c + +gsd_test_power-gsd-power-manager.obj: gsd-power-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-gsd-power-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_power-gsd-power-manager.Tpo -c -o gsd_test_power-gsd-power-manager.obj `if test -f 'gsd-power-manager.c'; then $(CYGPATH_W) 'gsd-power-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-power-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-gsd-power-manager.Tpo $(DEPDIR)/gsd_test_power-gsd-power-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-power-manager.c' object='gsd_test_power-gsd-power-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-gsd-power-manager.obj `if test -f 'gsd-power-manager.c'; then $(CYGPATH_W) 'gsd-power-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-power-manager.c'; fi` + +gsd_test_power-test-power.o: test-power.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-test-power.o -MD -MP -MF $(DEPDIR)/gsd_test_power-test-power.Tpo -c -o gsd_test_power-test-power.o `test -f 'test-power.c' || echo '$(srcdir)/'`test-power.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-test-power.Tpo $(DEPDIR)/gsd_test_power-test-power.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-power.c' object='gsd_test_power-test-power.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-test-power.o `test -f 'test-power.c' || echo '$(srcdir)/'`test-power.c + +gsd_test_power-test-power.obj: test-power.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -MT gsd_test_power-test-power.obj -MD -MP -MF $(DEPDIR)/gsd_test_power-test-power.Tpo -c -o gsd_test_power-test-power.obj `if test -f 'test-power.c'; then $(CYGPATH_W) 'test-power.c'; else $(CYGPATH_W) '$(srcdir)/test-power.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_power-test-power.Tpo $(DEPDIR)/gsd_test_power-test-power.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-power.c' object='gsd_test_power-test-power.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_power_CPPFLAGS) $(CPPFLAGS) $(gsd_test_power_CFLAGS) $(CFLAGS) -c -o gsd_test_power-test-power.obj `if test -f 'test-power.c'; then $(CYGPATH_W) 'test-power.c'; else $(CYGPATH_W) '$(srcdir)/test-power.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) +install-polkit_policyDATA: $(polkit_policy_DATA) + @$(NORMAL_INSTALL) + @list='$(polkit_policy_DATA)'; test -n "$(polkit_policydir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(polkit_policydir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(polkit_policydir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(polkit_policydir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(polkit_policydir)" || exit $$?; \ + done + +uninstall-polkit_policyDATA: + @$(NORMAL_UNINSTALL) + @list='$(polkit_policy_DATA)'; test -n "$(polkit_policydir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(polkit_policydir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(polkit_policydir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-local clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES \ + install-polkit_policyDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES uninstall-polkit_policyDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-local \ + clean-pluginLTLIBRARIES cscopelist ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libexecPROGRAMS install-man install-pdf install-pdf-am \ + install-pluginDATA install-pluginLTLIBRARIES \ + install-polkit_policyDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES uninstall-polkit_policyDATA + + +org.gnome.settings-daemon.plugins.power.policy.in: org.gnome.settings-daemon.plugins.power.policy.in.in Makefile + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + +@INTLTOOL_POLICY_RULE@ + +clean-local: + rm -f *~ + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c new file mode 100644 index 00000000..5e4b3ae2 --- /dev/null +++ b/plugins/power/gpm-common.c @@ -0,0 +1,958 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "gpm-common.h" + +#define GPM_UP_TIME_PRECISION 5*60 +#define GPM_UP_TEXT_MIN_TIME 120 + +/** + * Return value: The time string, e.g. "2 hours 3 minutes" + **/ +gchar * +gpm_get_timestring (guint time_secs) +{ + char* timestring = NULL; + gint hours; + gint minutes; + + /* Add 0.5 to do rounding */ + minutes = (int) ( ( time_secs / 60.0 ) + 0.5 ); + + if (minutes == 0) { + timestring = g_strdup (_("Unknown time")); + return timestring; + } + + if (minutes < 60) { + timestring = g_strdup_printf (ngettext ("%i minute", + "%i minutes", + minutes), minutes); + return timestring; + } + + hours = minutes / 60; + minutes = minutes % 60; + if (minutes == 0) + timestring = g_strdup_printf (ngettext ( + "%i hour", + "%i hours", + hours), hours); + else + /* TRANSLATOR: "%i %s %i %s" are "%i hours %i minutes" + * Swap order with "%2$s %2$i %1$s %1$i if needed */ + timestring = g_strdup_printf (_("%i %s %i %s"), + hours, ngettext ("hour", "hours", hours), + minutes, ngettext ("minute", "minutes", minutes)); + return timestring; +} + +static const gchar * +gpm_upower_get_device_icon_index (UpDevice *device) +{ + gdouble percentage; + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + if (percentage < 10) + return "000"; + else if (percentage < 30) + return "020"; + else if (percentage < 50) + return "040"; + else if (percentage < 70) + return "060"; + else if (percentage < 90) + return "080"; + return "100"; +} + +static const gchar * +gpm_upower_get_device_icon_suffix (UpDevice *device) +{ + gdouble percentage; + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + if (percentage < 10) + return "caution"; + else if (percentage < 30) + return "low"; + else if (percentage < 60) + return "good"; + return "full"; +} + +GIcon * +gpm_upower_get_device_icon (UpDevice *device, gboolean use_symbolic) +{ + GString *filename; + gchar **iconnames; + const gchar *kind_str; + const gchar *suffix_str; + const gchar *index_str; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + GIcon *icon = NULL; + + g_return_val_if_fail (device != NULL, NULL); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + /* get correct icon prefix */ + filename = g_string_new (NULL); + + /* get the icon from some simple rules */ + if (kind == UP_DEVICE_KIND_LINE_POWER) { + if (use_symbolic) + g_string_append (filename, "ac-adapter-symbolic;"); + g_string_append (filename, "ac-adapter;"); + + } else if (kind == UP_DEVICE_KIND_MONITOR) { + if (use_symbolic) + g_string_append (filename, "gpm-monitor-symbolic;"); + g_string_append (filename, "gpm-monitor;"); + + } else { + + kind_str = up_device_kind_to_string (kind); + if (!is_present) { + if (use_symbolic) + g_string_append (filename, "battery-missing-symbolic;"); + g_string_append_printf (filename, "gpm-%s-missing;", kind_str); + g_string_append_printf (filename, "gpm-%s-000;", kind_str); + g_string_append (filename, "battery-missing;"); + + } else { + switch (state) { + case UP_DEVICE_STATE_EMPTY: + if (use_symbolic) + g_string_append (filename, "battery-empty-symbolic;"); + g_string_append_printf (filename, "gpm-%s-empty;", kind_str); + g_string_append_printf (filename, "gpm-%s-000;", kind_str); + g_string_append (filename, "battery-empty;"); + break; + case UP_DEVICE_STATE_FULLY_CHARGED: + if (use_symbolic) { + g_string_append (filename, "battery-full-charged-symbolic;"); + g_string_append (filename, "battery-full-charging-symbolic;"); + } + g_string_append_printf (filename, "gpm-%s-full;", kind_str); + g_string_append_printf (filename, "gpm-%s-100;", kind_str); + g_string_append (filename, "battery-full-charged;"); + g_string_append (filename, "battery-full-charging;"); + break; + case UP_DEVICE_STATE_CHARGING: + case UP_DEVICE_STATE_PENDING_CHARGE: + suffix_str = gpm_upower_get_device_icon_suffix (device); + index_str = gpm_upower_get_device_icon_index (device); + if (use_symbolic) + g_string_append_printf (filename, "battery-%s-charging-symbolic;", suffix_str); + g_string_append_printf (filename, "gpm-%s-%s-charging;", kind_str, index_str); + g_string_append_printf (filename, "battery-%s-charging;", suffix_str); + break; + case UP_DEVICE_STATE_DISCHARGING: + case UP_DEVICE_STATE_PENDING_DISCHARGE: + suffix_str = gpm_upower_get_device_icon_suffix (device); + index_str = gpm_upower_get_device_icon_index (device); + if (use_symbolic) + g_string_append_printf (filename, "battery-%s-symbolic;", suffix_str); + g_string_append_printf (filename, "gpm-%s-%s;", kind_str, index_str); + g_string_append_printf (filename, "battery-%s;", suffix_str); + break; + default: + if (use_symbolic) + g_string_append (filename, "battery-missing-symbolic;"); + g_string_append (filename, "gpm-battery-missing;"); + g_string_append (filename, "battery-missing;"); + } + } + } + + /* nothing matched */ + if (filename->len == 0) { + g_warning ("nothing matched, falling back to default icon"); + g_string_append (filename, "dialog-warning;"); + } + + g_debug ("got filename: %s", filename->str); + + iconnames = g_strsplit (filename->str, ";", -1); + icon = g_themed_icon_new_from_names (iconnames, -1); + + g_strfreev (iconnames); + g_string_free (filename, TRUE); + return icon; +} + +/** + * gpm_precision_round_down: + * @value: The input value + * @smallest: The smallest increment allowed + * + * 101, 10 100 + * 95, 10 90 + * 0, 10 0 + * 112, 10 110 + * 100, 10 100 + **/ +static gint +gpm_precision_round_down (gfloat value, gint smallest) +{ + gfloat division; + if (fabs (value) < 0.01) + return 0; + if (smallest == 0) { + g_warning ("divisor zero"); + return 0; + } + division = (gfloat) value / (gfloat) smallest; + division = floorf (division); + division *= smallest; + return (gint) division; +} + +gchar * +gpm_upower_get_device_summary (UpDevice *device) +{ + const gchar *kind_desc = NULL; + const gchar *device_desc = NULL; + GString *description; + guint time_to_full_round; + guint time_to_empty_round; + gchar *time_to_full_str = NULL; + gchar *time_to_empty_str = NULL; + UpDeviceKind kind; + UpDeviceState state; + gdouble percentage; + gboolean is_present; + gint64 time_to_full; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + "time-to-full", &time_to_full, + "time-to-empty", &time_to_empty, + NULL); + + description = g_string_new (NULL); + kind_desc = gpm_device_kind_to_localised_string (kind, 1); + device_desc = gpm_device_to_localised_string (device); + + /* not installed */ + if (!is_present) { + g_string_append (description, device_desc); + goto out; + } + + /* don't display all the extra stuff for keyboards and mice */ + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD || + kind == UP_DEVICE_KIND_PDA) { + g_string_append (description, kind_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + goto out; + } + + /* we care if we are on AC */ + if (kind == UP_DEVICE_KIND_PHONE) { + if (state == UP_DEVICE_STATE_CHARGING || !(state == UP_DEVICE_STATE_DISCHARGING)) { + g_string_append (description, device_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + goto out; + } + g_string_append (description, kind_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + goto out; + } + + /* precalculate so we don't get Unknown time remaining */ + time_to_full_round = gpm_precision_round_down (time_to_full, GPM_UP_TIME_PRECISION); + time_to_empty_round = gpm_precision_round_down (time_to_empty, GPM_UP_TIME_PRECISION); + + /* we always display "Laptop battery 16 minutes remaining" as we need to clarify what device we are refering to */ + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + + g_string_append (description, device_desc); + + if (kind == UP_DEVICE_KIND_BATTERY && time_to_empty_round > GPM_UP_TEXT_MIN_TIME) { + time_to_empty_str = gpm_get_timestring (time_to_empty_round); + g_string_append (description, " - "); + /* TRANSLATORS: The laptop battery is charged, and we know a time. + * The parameter is the time, e.g. 7 hours 6 minutes */ + g_string_append_printf (description, _("provides %s laptop runtime"), time_to_empty_str); + } + goto out; + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + + if (time_to_empty_round > GPM_UP_TEXT_MIN_TIME) { + time_to_empty_str = gpm_get_timestring (time_to_empty_round); + /* TRANSLATORS: the device is discharging, and we have a time remaining + * The first parameter is the device type, e.g. "Laptop battery" and + * the second is the time, e.g. 7 hours 6 minutes */ + g_string_append_printf (description, _("%s %s remaining"), + kind_desc, time_to_empty_str); + g_string_append_printf (description, " (%.0f%%)", percentage); + } else { + g_string_append (description, device_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + } + goto out; + } + if (state == UP_DEVICE_STATE_CHARGING) { + + if (time_to_full_round > GPM_UP_TEXT_MIN_TIME && + time_to_empty_round > GPM_UP_TEXT_MIN_TIME) { + + /* display both discharge and charge time */ + time_to_full_str = gpm_get_timestring (time_to_full_round); + time_to_empty_str = gpm_get_timestring (time_to_empty_round); + + /* TRANSLATORS: device is charging, and we have a time to full and a percentage + * The first parameter is the device type, e.g. "Laptop battery" and + * the second is the time, e.g. "7 hours 6 minutes" */ + g_string_append_printf (description, _("%s %s until charged"), + kind_desc, time_to_full_str); + g_string_append_printf (description, " (%.0f%%)", percentage); + + g_string_append (description, " - "); + /* TRANSLATORS: the device is charging, and we have a time to full and empty. + * The parameter is a time string, e.g. "7 hours 6 minutes" */ + g_string_append_printf (description, _("provides %s battery runtime"), + time_to_empty_str); + } else if (time_to_full_round > GPM_UP_TEXT_MIN_TIME) { + + /* display only charge time */ + time_to_full_str = gpm_get_timestring (time_to_full_round); + + /* TRANSLATORS: device is charging, and we have a time to full and a percentage. + * The first parameter is the device type, e.g. "Laptop battery" and + * the second is the time, e.g. "7 hours 6 minutes" */ + g_string_append_printf (description, _("%s %s until charged"), + kind_desc, time_to_full_str); + g_string_append_printf (description, " (%.0f%%)", percentage); + } else { + g_string_append (description, device_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + } + goto out; + } + if (state == UP_DEVICE_STATE_PENDING_DISCHARGE) { + g_string_append (description, device_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + goto out; + } + if (state == UP_DEVICE_STATE_PENDING_CHARGE) { + g_string_append (description, device_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); + goto out; + } + if (state == UP_DEVICE_STATE_EMPTY) { + g_string_append (description, device_desc); + goto out; + } + + /* fallback */ + g_warning ("in an undefined state we are not charging or " + "discharging and the batteries are also not charged"); + g_string_append (description, device_desc); + g_string_append_printf (description, " (%.0f%%)", percentage); +out: + g_free (time_to_full_str); + g_free (time_to_empty_str); + return g_string_free (description, FALSE); +} + +gchar * +gpm_upower_get_device_description (UpDevice *device) +{ + GString *details; + const gchar *text; + gchar *time_str; + UpDeviceKind kind; + UpDeviceState state; + UpDeviceTechnology technology; + gdouble percentage; + gdouble capacity; + gdouble energy; + gdouble energy_full; + gdouble energy_full_design; + gdouble energy_rate; + gboolean is_present; + gint64 time_to_full; + gint64 time_to_empty; + gchar *vendor = NULL; + gchar *serial = NULL; + gchar *model = NULL; + + g_return_val_if_fail (device != NULL, NULL); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + "time-to-full", &time_to_full, + "time-to-empty", &time_to_empty, + "technology", &technology, + "capacity", &capacity, + "energy", &energy, + "energy-full", &energy_full, + "energy-full-design", &energy_full_design, + "energy-rate", &energy_rate, + "vendor", &vendor, + "serial", &serial, + "model", &model, + NULL); + + details = g_string_new (""); + text = gpm_device_kind_to_localised_string (kind, 1); + /* TRANSLATORS: the type of data, e.g. Laptop battery */ + g_string_append_printf (details, "%s %s\n", _("Product:"), text); + + if (!is_present) { + /* TRANSLATORS: device is missing */ + g_string_append_printf (details, "%s %s\n", _("Status:"), _("Missing")); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: device is charged */ + g_string_append_printf (details, "%s %s\n", _("Status:"), _("Charged")); + } else if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: device is charging */ + g_string_append_printf (details, "%s %s\n", _("Status:"), _("Charging")); + } else if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: device is discharging */ + g_string_append_printf (details, "%s %s\n", _("Status:"), _("Discharging")); + } + + if (percentage >= 0) { + /* TRANSLATORS: percentage */ + g_string_append_printf (details, "%s %.1f%%\n", _("Percentage charge:"), percentage); + } + if (vendor) { + /* TRANSLATORS: manufacturer */ + g_string_append_printf (details, "%s %s\n", _("Vendor:"), vendor); + } + if (technology != UP_DEVICE_TECHNOLOGY_UNKNOWN) { + text = gpm_device_technology_to_localised_string (technology); + /* TRANSLATORS: how the battery is made, e.g. Lithium Ion */ + g_string_append_printf (details, "%s %s\n", _("Technology:"), text); + } + if (serial) { + /* TRANSLATORS: serial number of the battery */ + g_string_append_printf (details, "%s %s\n", _("Serial number:"), serial); + } + if (model) { + /* TRANSLATORS: model number of the battery */ + g_string_append_printf (details, "%s %s\n", _("Model:"), model); + } + if (time_to_full > 0) { + time_str = gpm_get_timestring (time_to_full); + /* TRANSLATORS: time to fully charged */ + g_string_append_printf (details, "%s %s\n", _("Charge time:"), time_str); + g_free (time_str); + } + if (time_to_empty > 0) { + time_str = gpm_get_timestring (time_to_empty); + /* TRANSLATORS: time to empty */ + g_string_append_printf (details, "%s %s\n", _("Discharge time:"), time_str); + g_free (time_str); + } + if (capacity > 0) { + const gchar *condition; + if (capacity > 99) { + /* TRANSLATORS: Excellent, Good, Fair and Poor are all related to battery Capacity */ + condition = _("Excellent"); + } else if (capacity > 90) { + condition = _("Good"); + } else if (capacity > 70) { + condition = _("Fair"); + } else { + condition = _("Poor"); + } + /* TRANSLATORS: %.1f is a percentage and %s the condition (Excellent, Good, ...) */ + g_string_append_printf (details, "%s %.1f%% (%s)\n", + _("Capacity:"), capacity, condition); + } + if (kind == UP_DEVICE_KIND_BATTERY) { + if (energy > 0) { + /* TRANSLATORS: current charge */ + g_string_append_printf (details, "%s %.1f Wh\n", + _("Current charge:"), energy); + } + if (energy_full > 0 && + energy_full_design != energy_full) { + /* TRANSLATORS: last full is the charge the battery was seen to charge to */ + g_string_append_printf (details, "%s %.1f Wh\n", + _("Last full charge:"), energy_full); + } + if (energy_full_design > 0) { + /* Translators: */ + /* TRANSLATORS: Design charge is the amount of charge the battery is designed to have when brand new */ + g_string_append_printf (details, "%s %.1f Wh\n", + _("Design charge:"), energy_full_design); + } + if (energy_rate > 0) { + /* TRANSLATORS: the charge or discharge rate */ + g_string_append_printf (details, "%s %.1f W\n", + _("Charge rate:"), energy_rate); + } + } + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + if (energy > 0) { + /* TRANSLATORS: the current charge for CSR devices */ + g_string_append_printf (details, "%s %.0f/7\n", + _("Current charge:"), energy); + } + if (energy_full_design > 0) { + /* TRANSLATORS: the design charge for CSR devices */ + g_string_append_printf (details, "%s %.0f/7\n", + _("Design charge:"), energy_full_design); + } + } + /* remove the last \n */ + g_string_truncate (details, details->len-1); + + g_free (vendor); + g_free (serial); + g_free (model); + return g_string_free (details, FALSE); +} + +const gchar * +gpm_device_kind_to_localised_string (UpDeviceKind kind, guint number) +{ + const gchar *text = NULL; + switch (kind) { + case UP_DEVICE_KIND_LINE_POWER: + /* TRANSLATORS: system power cord */ + text = ngettext ("AC adapter", "AC adapters", number); + break; + case UP_DEVICE_KIND_BATTERY: + /* TRANSLATORS: laptop primary battery */ + text = ngettext ("Laptop battery", "Laptop batteries", number); + break; + case UP_DEVICE_KIND_UPS: + /* TRANSLATORS: battery-backed AC power source */ + text = ngettext ("UPS", "UPSs", number); + break; + case UP_DEVICE_KIND_MONITOR: + /* TRANSLATORS: a monitor is a device to measure voltage and current */ + text = ngettext ("Monitor", "Monitors", number); + break; + case UP_DEVICE_KIND_MOUSE: + /* TRANSLATORS: wireless mice with internal batteries */ + text = ngettext ("Mouse", "Mice", number); + break; + case UP_DEVICE_KIND_KEYBOARD: + /* TRANSLATORS: wireless keyboard with internal battery */ + text = ngettext ("Keyboard", "Keyboards", number); + break; + case UP_DEVICE_KIND_PDA: + /* TRANSLATORS: portable device */ + text = ngettext ("PDA", "PDAs", number); + break; + case UP_DEVICE_KIND_PHONE: + /* TRANSLATORS: cell phone (mobile...) */ + text = ngettext ("Cell phone", "Cell phones", number); + break; +#if UP_CHECK_VERSION(0,9,5) + case UP_DEVICE_KIND_MEDIA_PLAYER: + /* TRANSLATORS: media player, mp3 etc */ + text = ngettext ("Media player", "Media players", number); + break; + case UP_DEVICE_KIND_TABLET: + /* TRANSLATORS: tablet device */ + text = ngettext ("Tablet", "Tablets", number); + break; + case UP_DEVICE_KIND_COMPUTER: + /* TRANSLATORS: tablet device */ + text = ngettext ("Computer", "Computers", number); + break; +#endif + default: + g_warning ("enum unrecognised: %i", kind); + text = up_device_kind_to_string (kind); + } + return text; +} + +const gchar * +gpm_device_kind_to_icon (UpDeviceKind kind) +{ + const gchar *icon = NULL; + switch (kind) { + case UP_DEVICE_KIND_LINE_POWER: + icon = "ac-adapter"; + break; + case UP_DEVICE_KIND_BATTERY: + icon = "battery"; + break; + case UP_DEVICE_KIND_UPS: + icon = "network-wired"; + break; + case UP_DEVICE_KIND_MONITOR: + icon = "application-certificate"; + break; + case UP_DEVICE_KIND_MOUSE: + icon = "input-mouse"; + break; + case UP_DEVICE_KIND_KEYBOARD: + icon = "input-keyboard"; + break; + case UP_DEVICE_KIND_PDA: + icon = "pda"; + break; + case UP_DEVICE_KIND_PHONE: + icon = "phone"; + break; +#if UP_CHECK_VERSION(0,9,5) + case UP_DEVICE_KIND_MEDIA_PLAYER: + icon = "multimedia-player"; + break; + case UP_DEVICE_KIND_TABLET: + icon = "input-tablet"; + break; + case UP_DEVICE_KIND_COMPUTER: + icon = "computer-apple-ipad"; + break; +#endif + default: + g_warning ("enum unrecognised: %i", kind); + icon = "gtk-help"; + } + return icon; +} + +const gchar * +gpm_device_technology_to_localised_string (UpDeviceTechnology technology_enum) +{ + const gchar *technology = NULL; + switch (technology_enum) { + case UP_DEVICE_TECHNOLOGY_LITHIUM_ION: + /* TRANSLATORS: battery technology */ + technology = _("Lithium Ion"); + break; + case UP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER: + /* TRANSLATORS: battery technology */ + technology = _("Lithium Polymer"); + break; + case UP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE: + /* TRANSLATORS: battery technology */ + technology = _("Lithium Iron Phosphate"); + break; + case UP_DEVICE_TECHNOLOGY_LEAD_ACID: + /* TRANSLATORS: battery technology */ + technology = _("Lead acid"); + break; + case UP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM: + /* TRANSLATORS: battery technology */ + technology = _("Nickel Cadmium"); + break; + case UP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE: + /* TRANSLATORS: battery technology */ + technology = _("Nickel metal hydride"); + break; + case UP_DEVICE_TECHNOLOGY_UNKNOWN: + /* TRANSLATORS: battery technology */ + technology = _("Unknown technology"); + break; + default: + g_assert_not_reached (); + break; + } + return technology; +} + +const gchar * +gpm_device_state_to_localised_string (UpDeviceState state) +{ + const gchar *state_string = NULL; + + switch (state) { + case UP_DEVICE_STATE_CHARGING: + /* TRANSLATORS: battery state */ + state_string = _("Charging"); + break; + case UP_DEVICE_STATE_DISCHARGING: + /* TRANSLATORS: battery state */ + state_string = _("Discharging"); + break; + case UP_DEVICE_STATE_EMPTY: + /* TRANSLATORS: battery state */ + state_string = _("Empty"); + break; + case UP_DEVICE_STATE_FULLY_CHARGED: + /* TRANSLATORS: battery state */ + state_string = _("Charged"); + break; + case UP_DEVICE_STATE_PENDING_CHARGE: + /* TRANSLATORS: battery state */ + state_string = _("Waiting to charge"); + break; + case UP_DEVICE_STATE_PENDING_DISCHARGE: + /* TRANSLATORS: battery state */ + state_string = _("Waiting to discharge"); + break; + default: + g_assert_not_reached (); + break; + } + return state_string; +} + +const gchar * +gpm_device_to_localised_string (UpDevice *device) +{ + UpDeviceState state; + UpDeviceKind kind; + gboolean present; + + /* get device parameters */ + g_object_get (device, + "is-present", &present, + "kind", &kind, + "state", &state, + NULL); + + /* laptop battery */ + if (kind == UP_DEVICE_KIND_BATTERY) { + + if (!present) { + /* TRANSLATORS: device not present */ + return _("Laptop battery not present"); + } + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Laptop battery is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Laptop battery is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Laptop battery is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Laptop battery is charged"); + } + if (state == UP_DEVICE_STATE_PENDING_CHARGE) { + /* TRANSLATORS: battery state */ + return _("Laptop battery is waiting to charge"); + } + if (state == UP_DEVICE_STATE_PENDING_DISCHARGE) { + /* TRANSLATORS: battery state */ + return _("Laptop battery is waiting to discharge"); + } + } + + /* UPS */ + if (kind == UP_DEVICE_KIND_UPS) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("UPS is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("UPS is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("UPS is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("UPS is charged"); + } + } + + /* mouse */ + if (kind == UP_DEVICE_KIND_MOUSE) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Mouse is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Mouse is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Mouse is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Mouse is charged"); + } + } + + /* keyboard */ + if (kind == UP_DEVICE_KIND_KEYBOARD) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Keyboard is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Keyboard is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Keyboard is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Keyboard is charged"); + } + } + + /* PDA */ + if (kind == UP_DEVICE_KIND_PDA) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("PDA is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("PDA is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("PDA is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("PDA is charged"); + } + } + + /* phone */ + if (kind == UP_DEVICE_KIND_PHONE) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Cell phone is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Cell phone is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Cell phone is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Cell phone is charged"); + } + } +#if UP_CHECK_VERSION(0,9,5) + + /* media player */ + if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Media player is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Media player is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Media player is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Media player is charged"); + } + } + + /* tablet */ + if (kind == UP_DEVICE_KIND_TABLET) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Tablet is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Tablet is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Tablet is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Tablet is charged"); + } + } + + /* computer */ + if (kind == UP_DEVICE_KIND_COMPUTER) { + + if (state == UP_DEVICE_STATE_CHARGING) { + /* TRANSLATORS: battery state */ + return _("Computer is charging"); + } + if (state == UP_DEVICE_STATE_DISCHARGING) { + /* TRANSLATORS: battery state */ + return _("Computer is discharging"); + } + if (state == UP_DEVICE_STATE_EMPTY) { + /* TRANSLATORS: battery state */ + return _("Computer is empty"); + } + if (state == UP_DEVICE_STATE_FULLY_CHARGED) { + /* TRANSLATORS: battery state */ + return _("Computer is charged"); + } + } +#endif + + return gpm_device_kind_to_localised_string (kind, 1); +} diff --git a/plugins/power/gpm-common.h b/plugins/power/gpm-common.h new file mode 100644 index 00000000..d8a47582 --- /dev/null +++ b/plugins/power/gpm-common.h @@ -0,0 +1,44 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GPMCOMMON_H +#define __GPMCOMMON_H + +#include +#include + +G_BEGIN_DECLS + +gchar *gpm_get_timestring (guint time); +const gchar *gpm_device_to_localised_string (UpDevice *device); +const gchar *gpm_device_kind_to_localised_string (UpDeviceKind kind, + guint number); +const gchar *gpm_device_kind_to_icon (UpDeviceKind kind); +const gchar *gpm_device_technology_to_localised_string (UpDeviceTechnology technology_enum); +const gchar *gpm_device_state_to_localised_string (UpDeviceState state); +GIcon *gpm_upower_get_device_icon (UpDevice *device, + gboolean use_symbolic); +gchar *gpm_upower_get_device_summary (UpDevice *device); +gchar *gpm_upower_get_device_description (UpDevice *device); + +G_END_DECLS + +#endif /* __GPMCOMMON_H */ diff --git a/plugins/power/gpm-idletime.c b/plugins/power/gpm-idletime.c new file mode 100644 index 00000000..5e1e26bc --- /dev/null +++ b/plugins/power/gpm-idletime.c @@ -0,0 +1,483 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "gpm-idletime.h" + +static void gpm_idletime_finalize (GObject *object); + +#define GPM_IDLETIME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_IDLETIME_TYPE, GpmIdletimePrivate)) + +struct GpmIdletimePrivate +{ + gint sync_event; + gboolean reset_set; + XSyncCounter idle_counter; + GPtrArray *array; + Display *dpy; +}; + +typedef struct +{ + guint id; + XSyncValue timeout; + XSyncAlarm xalarm; + GpmIdletime *idletime; +} GpmIdletimeAlarm; + +enum { + SIGNAL_ALARM_EXPIRED, + SIGNAL_RESET, + LAST_SIGNAL +}; + +typedef enum { + GPM_IDLETIME_ALARM_TYPE_POSITIVE, + GPM_IDLETIME_ALARM_TYPE_NEGATIVE, + GPM_IDLETIME_ALARM_TYPE_DISABLED +} GpmIdletimeAlarmType; + +static guint signals [LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE (GpmIdletime, gpm_idletime, G_TYPE_OBJECT) + +static gint64 +gpm_idletime_xsyncvalue_to_int64 (XSyncValue value) +{ + return ((guint64) XSyncValueHigh32 (value)) << 32 | + (guint64) XSyncValueLow32 (value); +} + +/* gets the IDLETIME counter value, or 0 for invalid */ +gint64 +gpm_idletime_get_time (GpmIdletime *idletime) +{ + XSyncValue value; + + /* we don't have IDLETIME support */ + if (!idletime->priv->idle_counter) + return 0; + + /* NX explodes if you query the counter */ + gdk_error_trap_push (); + XSyncQueryCounter (idletime->priv->dpy, + idletime->priv->idle_counter, + &value); + if (gdk_error_trap_pop ()) + return 0; + return gpm_idletime_xsyncvalue_to_int64 (value); +} + +static void +gpm_idletime_xsync_alarm_set (GpmIdletime *idletime, + GpmIdletimeAlarm *alarm_item, + GpmIdletimeAlarmType alarm_type) +{ + XSyncAlarmAttributes attr; + XSyncValue delta; + unsigned int flags; + XSyncTestType test; + + /* just remove it */ + if (alarm_type == GPM_IDLETIME_ALARM_TYPE_DISABLED) { + if (alarm_item->xalarm) { + XSyncDestroyAlarm (idletime->priv->dpy, + alarm_item->xalarm); + alarm_item->xalarm = None; + } + return; + } + + /* which way do we do the test? */ + if (alarm_type == GPM_IDLETIME_ALARM_TYPE_POSITIVE) + test = XSyncPositiveTransition; + else + test = XSyncNegativeTransition; + + XSyncIntToValue (&delta, 0); + + attr.trigger.counter = idletime->priv->idle_counter; + attr.trigger.value_type = XSyncAbsolute; + attr.trigger.test_type = test; + attr.trigger.wait_value = alarm_item->timeout; + attr.delta = delta; + + flags = XSyncCACounter | + XSyncCAValueType | + XSyncCATestType | + XSyncCAValue | + XSyncCADelta; + + if (alarm_item->xalarm) { + XSyncChangeAlarm (idletime->priv->dpy, + alarm_item->xalarm, + flags, + &attr); + } else { + alarm_item->xalarm = XSyncCreateAlarm (idletime->priv->dpy, + flags, + &attr); + } +} + +void +gpm_idletime_alarm_reset_all (GpmIdletime *idletime) +{ + guint i; + GpmIdletimeAlarm *alarm_item; + + g_return_if_fail (GPM_IS_IDLETIME (idletime)); + + if (!idletime->priv->reset_set) + return; + + /* reset all the alarms (except the reset alarm) to their timeouts */ + for (i=1; i < idletime->priv->array->len; i++) { + alarm_item = g_ptr_array_index (idletime->priv->array, i); + gpm_idletime_xsync_alarm_set (idletime, + alarm_item, + GPM_IDLETIME_ALARM_TYPE_POSITIVE); + } + + /* set the reset alarm to be disabled */ + alarm_item = g_ptr_array_index (idletime->priv->array, 0); + gpm_idletime_xsync_alarm_set (idletime, + alarm_item, + GPM_IDLETIME_ALARM_TYPE_DISABLED); + + /* emit signal so say we've reset all timers */ + g_signal_emit (idletime, signals [SIGNAL_RESET], 0); + + /* we need to be reset again on the next event */ + idletime->priv->reset_set = FALSE; +} + +static GpmIdletimeAlarm * +gpm_idletime_alarm_find_id (GpmIdletime *idletime, guint id) +{ + guint i; + GpmIdletimeAlarm *alarm_item; + for (i = 0; i < idletime->priv->array->len; i++) { + alarm_item = g_ptr_array_index (idletime->priv->array, i); + if (alarm_item->id == id) + return alarm_item; + } + return NULL; +} + +static void +gpm_idletime_set_reset_alarm (GpmIdletime *idletime, + XSyncAlarmNotifyEvent *alarm_event) +{ + GpmIdletimeAlarm *alarm_item; + int overflow; + XSyncValue add; + gint64 current, reset_threshold; + + alarm_item = gpm_idletime_alarm_find_id (idletime, 0); + + if (!idletime->priv->reset_set) { + /* don't match on the current value because + * XSyncNegativeComparison means less or equal. */ + XSyncIntToValue (&add, -1); + XSyncValueAdd (&alarm_item->timeout, + alarm_event->counter_value, + add, + &overflow); + + /* set the reset alarm to fire the next time + * idletime->priv->idle_counter < the current counter value */ + gpm_idletime_xsync_alarm_set (idletime, + alarm_item, + GPM_IDLETIME_ALARM_TYPE_NEGATIVE); + + /* don't try to set this again if multiple timers are + * going off in sequence */ + idletime->priv->reset_set = TRUE; + + current = gpm_idletime_get_time (idletime); + reset_threshold = gpm_idletime_xsyncvalue_to_int64 (alarm_item->timeout); + if (current < reset_threshold) { + /* We've missed the alarm already */ + gpm_idletime_alarm_reset_all (idletime); + } + } +} + +static GpmIdletimeAlarm * +gpm_idletime_alarm_find_event (GpmIdletime *idletime, + XSyncAlarmNotifyEvent *alarm_event) +{ + guint i; + GpmIdletimeAlarm *alarm_item; + for (i = 0; i < idletime->priv->array->len; i++) { + alarm_item = g_ptr_array_index (idletime->priv->array, i); + if (alarm_event->alarm == alarm_item->xalarm) + return alarm_item; + } + return NULL; +} + +static GdkFilterReturn +gpm_idletime_event_filter_cb (GdkXEvent *gdkxevent, + GdkEvent *event, + gpointer data) +{ + GpmIdletimeAlarm *alarm_item; + XEvent *xevent = (XEvent *) gdkxevent; + GpmIdletime *idletime = (GpmIdletime *) data; + XSyncAlarmNotifyEvent *alarm_event; + + /* no point continuing */ + if (xevent->type != idletime->priv->sync_event + XSyncAlarmNotify) + return GDK_FILTER_CONTINUE; + + alarm_event = (XSyncAlarmNotifyEvent *) xevent; + + /* did we match one of our alarms? */ + alarm_item = gpm_idletime_alarm_find_event (idletime, alarm_event); + if (alarm_item == NULL) + return GDK_FILTER_CONTINUE; + + /* are we the reset alarm? */ + if (alarm_item->id == 0) { + gpm_idletime_alarm_reset_all (idletime); + goto out; + } + + /* emit */ + g_signal_emit (alarm_item->idletime, + signals[SIGNAL_ALARM_EXPIRED], + 0, alarm_item->id); + + /* we need the first alarm to go off to set the reset alarm */ + gpm_idletime_set_reset_alarm (idletime, alarm_event); +out: + /* don't propagate */ + return GDK_FILTER_REMOVE; +} + +static GpmIdletimeAlarm * +gpm_idletime_alarm_new (GpmIdletime *idletime, guint id) +{ + GpmIdletimeAlarm *alarm_item; + + /* create a new alarm */ + alarm_item = g_new0 (GpmIdletimeAlarm, 1); + + /* set the default values */ + alarm_item->id = id; + alarm_item->xalarm = None; + alarm_item->idletime = g_object_ref (idletime); + + return alarm_item; +} + +gboolean +gpm_idletime_alarm_set (GpmIdletime *idletime, + guint id, + guint timeout) +{ + GpmIdletimeAlarm *alarm_item; + + g_return_val_if_fail (GPM_IS_IDLETIME (idletime), FALSE); + g_return_val_if_fail (id != 0, FALSE); + + if (timeout == 0) { + gpm_idletime_alarm_remove (idletime, id); + return FALSE; + } + + /* see if we already created an alarm with this ID */ + alarm_item = gpm_idletime_alarm_find_id (idletime, id); + if (alarm_item == NULL) { + /* create a new alarm */ + alarm_item = gpm_idletime_alarm_new (idletime, id); + g_ptr_array_add (idletime->priv->array, alarm_item); + } + + /* set the timeout */ + XSyncIntToValue (&alarm_item->timeout, (gint)timeout); + + /* set, and start the timer */ + gpm_idletime_xsync_alarm_set (idletime, + alarm_item, + GPM_IDLETIME_ALARM_TYPE_POSITIVE); + return TRUE; +} + +static gboolean +gpm_idletime_alarm_free (GpmIdletime *idletime, + GpmIdletimeAlarm *alarm_item) +{ + g_return_val_if_fail (GPM_IS_IDLETIME (idletime), FALSE); + g_return_val_if_fail (alarm_item != NULL, FALSE); + + if (alarm_item->xalarm) { + XSyncDestroyAlarm (idletime->priv->dpy, + alarm_item->xalarm); + } + g_object_unref (alarm_item->idletime); + g_free (alarm_item); + g_ptr_array_remove (idletime->priv->array, alarm_item); + return TRUE; +} + +gboolean +gpm_idletime_alarm_remove (GpmIdletime *idletime, guint id) +{ + GpmIdletimeAlarm *alarm_item; + + g_return_val_if_fail (GPM_IS_IDLETIME (idletime), FALSE); + + alarm_item = gpm_idletime_alarm_find_id (idletime, id); + if (alarm_item == NULL) + return FALSE; + gpm_idletime_alarm_free (idletime, alarm_item); + return TRUE; +} + +static void +gpm_idletime_class_init (GpmIdletimeClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gpm_idletime_finalize; + g_type_class_add_private (klass, sizeof (GpmIdletimePrivate)); + + signals [SIGNAL_ALARM_EXPIRED] = + g_signal_new ("alarm-expired", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GpmIdletimeClass, alarm_expired), + NULL, NULL, g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + signals [SIGNAL_RESET] = + g_signal_new ("reset", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GpmIdletimeClass, reset), + NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +gpm_idletime_init (GpmIdletime *idletime) +{ + int sync_error; + int ncounters; + XSyncSystemCounter *counters; + GpmIdletimeAlarm *alarm_item; + gint major, minor; + guint i; + + idletime->priv = GPM_IDLETIME_GET_PRIVATE (idletime); + + idletime->priv->array = g_ptr_array_new (); + + idletime->priv->reset_set = FALSE; + idletime->priv->idle_counter = None; + idletime->priv->sync_event = 0; + idletime->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default()); + + /* get the sync event */ + if (!XSyncQueryExtension (idletime->priv->dpy, + &idletime->priv->sync_event, + &sync_error)) { + g_warning ("No Sync extension."); + return; + } + + /* check XSync is compatible with the server version */ + if (!XSyncInitialize (idletime->priv->dpy, &major, &minor)) { + g_warning ("Sync extension not compatible."); + return; + } + counters = XSyncListSystemCounters (idletime->priv->dpy, + &ncounters); + for (i = 0; i < ncounters && !idletime->priv->idle_counter; i++) { + if (strcmp(counters[i].name, "IDLETIME") == 0) + idletime->priv->idle_counter = counters[i].counter; + } + XSyncFreeSystemCounterList (counters); + + /* arh. we don't have IDLETIME support */ + if (!idletime->priv->idle_counter) { + g_warning ("No idle counter"); + return; + } + + /* catch the timer alarm */ + gdk_window_add_filter (NULL, + gpm_idletime_event_filter_cb, + idletime); + + /* create a reset alarm */ + alarm_item = gpm_idletime_alarm_new (idletime, 0); + g_ptr_array_add (idletime->priv->array, alarm_item); +} + +static void +gpm_idletime_finalize (GObject *object) +{ + guint i; + GpmIdletime *idletime; + GpmIdletimeAlarm *alarm_item; + + g_return_if_fail (object != NULL); + g_return_if_fail (GPM_IS_IDLETIME (object)); + + idletime = GPM_IDLETIME (object); + idletime->priv = GPM_IDLETIME_GET_PRIVATE (idletime); + + /* remove filter */ + gdk_window_remove_filter (NULL, + gpm_idletime_event_filter_cb, + idletime); + + /* free all counters, including reset counter */ + for (i = 0; i < idletime->priv->array->len; i++) { + alarm_item = g_ptr_array_index (idletime->priv->array, i); + gpm_idletime_alarm_free (idletime, alarm_item); + } + g_ptr_array_free (idletime->priv->array, TRUE); + + G_OBJECT_CLASS (gpm_idletime_parent_class)->finalize (object); +} + +GpmIdletime * +gpm_idletime_new (void) +{ + return g_object_new (GPM_IDLETIME_TYPE, NULL); +} + diff --git a/plugins/power/gpm-idletime.h b/plugins/power/gpm-idletime.h new file mode 100644 index 00000000..a61fe4b6 --- /dev/null +++ b/plugins/power/gpm-idletime.h @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GPM_IDLETIME_H +#define __GPM_IDLETIME_H + +#include + +G_BEGIN_DECLS + +#define GPM_IDLETIME_TYPE (gpm_idletime_get_type ()) +#define GPM_IDLETIME(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_IDLETIME_TYPE, GpmIdletime)) +#define GPM_IDLETIME_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPM_IDLETIME_TYPE, GpmIdletimeClass)) +#define GPM_IS_IDLETIME(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_IDLETIME_TYPE)) +#define GPM_IS_IDLETIME_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_IDLETIME_TYPE)) +#define GPM_IDLETIME_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_IDLETIME_TYPE, GpmIdletimeClass)) + +typedef struct GpmIdletimePrivate GpmIdletimePrivate; + +typedef struct +{ + GObject parent; + GpmIdletimePrivate *priv; +} GpmIdletime; + +typedef struct +{ + GObjectClass parent_class; + void (* alarm_expired) (GpmIdletime *idletime, + guint timer_id); + void (* reset) (GpmIdletime *idletime); +} GpmIdletimeClass; + +GType gpm_idletime_get_type (void); +GpmIdletime *gpm_idletime_new (void); + +void gpm_idletime_alarm_reset_all (GpmIdletime *idletime); +gboolean gpm_idletime_alarm_set (GpmIdletime *idletime, + guint alarm_id, + guint timeout); +gboolean gpm_idletime_alarm_remove (GpmIdletime *idletime, + guint alarm_id); +gint64 gpm_idletime_get_time (GpmIdletime *idletime); + +G_END_DECLS + +#endif /* __GPM_IDLETIME_H */ diff --git a/plugins/power/gpm-phone.c b/plugins/power/gpm-phone.c new file mode 100644 index 00000000..d2f0fd73 --- /dev/null +++ b/plugins/power/gpm-phone.c @@ -0,0 +1,332 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "gpm-phone.h" + +static void gpm_phone_finalize (GObject *object); + +#define GPM_PHONE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_PHONE, GpmPhonePrivate)) + +struct GpmPhonePrivate +{ + GDBusProxy *proxy; + GDBusConnection *connection; + guint watch_id; + gboolean present; + guint percentage; + gboolean onac; +}; + +enum { + DEVICE_ADDED, + DEVICE_REMOVED, + DEVICE_REFRESH, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0 }; +static gpointer gpm_phone_object = NULL; + +G_DEFINE_TYPE (GpmPhone, gpm_phone, G_TYPE_OBJECT) + +gboolean +gpm_phone_coldplug (GpmPhone *phone) +{ + GError *error = NULL; + GVariant *reply; + gboolean ret; + + g_return_val_if_fail (phone != NULL, FALSE); + g_return_val_if_fail (GPM_IS_PHONE (phone), FALSE); + + if (phone->priv->proxy == NULL) + return FALSE; + + reply = g_dbus_proxy_call_sync (phone->priv->proxy, "Coldplug", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); + if (error != NULL) { + g_warning ("DEBUG: ERROR: %s", error->message); + g_error_free (error); + } + + if (reply != NULL) { + ret = TRUE; + g_variant_unref (reply); + } else + ret = FALSE; + + return ret; +} + +gboolean +gpm_phone_get_present (GpmPhone *phone, guint idx) +{ + g_return_val_if_fail (phone != NULL, FALSE); + g_return_val_if_fail (GPM_IS_PHONE (phone), FALSE); + return phone->priv->present; +} + +guint +gpm_phone_get_percentage (GpmPhone *phone, guint idx) +{ + g_return_val_if_fail (phone != NULL, 0); + g_return_val_if_fail (GPM_IS_PHONE (phone), 0); + return phone->priv->percentage; +} + +gboolean +gpm_phone_get_on_ac (GpmPhone *phone, guint idx) +{ + g_return_val_if_fail (phone != NULL, FALSE); + g_return_val_if_fail (GPM_IS_PHONE (phone), FALSE); + return phone->priv->onac; +} + +guint +gpm_phone_get_num_batteries (GpmPhone *phone) +{ + g_return_val_if_fail (phone != NULL, 0); + g_return_val_if_fail (GPM_IS_PHONE (phone), 0); + if (phone->priv->present) + return 1; + return 0; +} + +static void +gpm_phone_battery_state_changed (GDBusProxy *proxy, + guint idx, + guint percentage, + gboolean on_ac, + GpmPhone *phone) +{ + g_return_if_fail (GPM_IS_PHONE (phone)); + + g_debug ("got BatteryStateChanged %i = %i (%i)", idx, percentage, on_ac); + phone->priv->percentage = percentage; + phone->priv->onac = on_ac; + phone->priv->present = TRUE; + g_debug ("emitting device-refresh : (%i)", idx); + g_signal_emit (phone, signals [DEVICE_REFRESH], 0, idx); +} + +static void +gpm_phone_num_batteries_changed (GDBusProxy *proxy, + guint number, + GpmPhone *phone) +{ + g_return_if_fail (GPM_IS_PHONE (phone)); + + g_debug ("got NumberBatteriesChanged %i", number); + if (number > 1) { + g_warning ("number not 0 or 1, not valid!"); + return; + } + + /* are we removed? */ + if (number == 0) { + phone->priv->present = FALSE; + phone->priv->percentage = 0; + phone->priv->onac = FALSE; + g_debug ("emitting device-removed : (%i)", 0); + g_signal_emit (phone, signals [DEVICE_REMOVED], 0, 0); + return; + } + + if (phone->priv->present) { + g_warning ("duplicate NumberBatteriesChanged with no change"); + return; + } + + /* reset to defaults until we get BatteryStateChanged */ + phone->priv->present = TRUE; + phone->priv->percentage = 0; + phone->priv->onac = FALSE; + g_debug ("emitting device-added : (%i)", 0); + g_signal_emit (phone, signals [DEVICE_ADDED], 0, 0); +} + +static void +gpm_phone_generic_signal_cb (GDBusProxy *proxy, + gchar *sender_name, gchar *signal_name, + GVariant *parameters, gpointer user_data) { + + GpmPhone *self = GPM_PHONE (user_data); + + if (!g_strcmp0 (signal_name, "BatteryStateChanged")) { + guint idx, percentage; + gboolean on_ac; + + g_variant_get (parameters, "(uub)", &idx, &percentage, &on_ac); + gpm_phone_battery_state_changed (proxy, idx, percentage, on_ac, self); + return; + } + + if (!g_strcmp0 (signal_name, "NumberBatteriesChanged")) { + guint number; + + g_variant_get (parameters, "(u)", &number); + gpm_phone_num_batteries_changed (proxy, number, self); + return; + } + + /* not a signal we're interested in */ +} + +static void +gpm_phone_class_init (GpmPhoneClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gpm_phone_finalize; + g_type_class_add_private (klass, sizeof (GpmPhonePrivate)); + + signals [DEVICE_ADDED] = + g_signal_new ("device-added", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GpmPhoneClass, device_added), + NULL, NULL, g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + + signals [DEVICE_REMOVED] = + g_signal_new ("device-removed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GpmPhoneClass, device_removed), + NULL, NULL, g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); + + signals [DEVICE_REFRESH] = + g_signal_new ("device-refresh", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GpmPhoneClass, device_refresh), + NULL, NULL, g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); +} + +static void +gpm_phone_service_appeared_cb (GDBusConnection *connection, + const gchar *name, const gchar *name_owner, + GpmPhone *phone) +{ + GError *error = NULL; + + g_return_if_fail (GPM_IS_PHONE (phone)); + + if (phone->priv->connection == NULL) { + g_debug ("get connection"); + g_clear_error (&error); + phone->priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + if (phone->priv->connection == NULL) { + g_warning ("Could not connect to DBUS daemon: %s", error->message); + g_error_free (error); + phone->priv->connection = NULL; + return; + } + } + if (phone->priv->proxy == NULL) { + g_debug ("get proxy"); + g_clear_error (&error); + phone->priv->proxy = g_dbus_proxy_new_sync (phone->priv->connection, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_PHONE_MANAGER_DBUS_SERVICE, + GNOME_PHONE_MANAGER_DBUS_PATH, + GNOME_PHONE_MANAGER_DBUS_INTERFACE, + NULL, &error); + if (phone->priv->proxy == NULL) { + g_warning ("Cannot connect, maybe the daemon is not running: %s", error->message); + g_error_free (error); + phone->priv->proxy = NULL; + return; + } + + g_signal_connect (phone->priv->proxy, "g-signal", G_CALLBACK(gpm_phone_generic_signal_cb), phone); + } +} + +static void +gpm_phone_service_vanished_cb (GDBusConnection *connection, + const gchar *name, + GpmPhone *phone) +{ + g_return_if_fail (GPM_IS_PHONE (phone)); + + if (phone->priv->proxy == NULL) + return; + g_debug ("removing proxy"); + g_object_unref (phone->priv->proxy); + phone->priv->proxy = NULL; + if (phone->priv->present) { + phone->priv->present = FALSE; + phone->priv->percentage = 0; + g_debug ("emitting device-removed : (%i)", 0); + g_signal_emit (phone, signals [DEVICE_REMOVED], 0, 0); + } +} + +static void +gpm_phone_init (GpmPhone *phone) +{ + phone->priv = GPM_PHONE_GET_PRIVATE (phone); + phone->priv->watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, + GNOME_PHONE_MANAGER_DBUS_SERVICE, + G_BUS_NAME_WATCHER_FLAGS_NONE, + (GBusNameAppearedCallback) gpm_phone_service_appeared_cb, + (GBusNameVanishedCallback) gpm_phone_service_vanished_cb, + phone, NULL); +} + +static void +gpm_phone_finalize (GObject *object) +{ + GpmPhone *phone; + g_return_if_fail (GPM_IS_PHONE (object)); + + phone = GPM_PHONE (object); + phone->priv = GPM_PHONE_GET_PRIVATE (phone); + + if (phone->priv->proxy != NULL) + g_object_unref (phone->priv->proxy); + g_bus_unwatch_name (phone->priv->watch_id); + + G_OBJECT_CLASS (gpm_phone_parent_class)->finalize (object); +} + +GpmPhone * +gpm_phone_new (void) +{ + if (gpm_phone_object != NULL) { + g_object_ref (gpm_phone_object); + } else { + gpm_phone_object = g_object_new (GPM_TYPE_PHONE, NULL); + g_object_add_weak_pointer (gpm_phone_object, &gpm_phone_object); + } + return GPM_PHONE (gpm_phone_object); +} + diff --git a/plugins/power/gpm-phone.h b/plugins/power/gpm-phone.h new file mode 100644 index 00000000..0843db9c --- /dev/null +++ b/plugins/power/gpm-phone.h @@ -0,0 +1,73 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GPMPHONE_H +#define __GPMPHONE_H + +#include + +G_BEGIN_DECLS + +#define GPM_TYPE_PHONE (gpm_phone_get_type ()) +#define GPM_PHONE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_TYPE_PHONE, GpmPhone)) +#define GPM_PHONE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPM_TYPE_PHONE, GpmPhoneClass)) +#define GPM_IS_PHONE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_TYPE_PHONE)) +#define GPM_IS_PHONE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_TYPE_PHONE)) +#define GPM_PHONE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_PHONE, GpmPhoneClass)) + +#define GNOME_PHONE_MANAGER_DBUS_SERVICE "org.gnome.phone" +#define GNOME_PHONE_MANAGER_DBUS_PATH "/org/gnome/phone/Manager" +#define GNOME_PHONE_MANAGER_DBUS_INTERFACE "org.gnome.phone.Manager" + +typedef struct GpmPhonePrivate GpmPhonePrivate; + +typedef struct +{ + GObject parent; + GpmPhonePrivate *priv; +} GpmPhone; + +typedef struct +{ + GObjectClass parent_class; + void (* device_added) (GpmPhone *phone, + guint idx); + void (* device_removed) (GpmPhone *phone, + guint idx); + void (* device_refresh) (GpmPhone *phone, + guint idx); +} GpmPhoneClass; + +GType gpm_phone_get_type (void); +GpmPhone *gpm_phone_new (void); + +gboolean gpm_phone_get_present (GpmPhone *phone, + guint idx); +guint gpm_phone_get_percentage (GpmPhone *phone, + guint idx); +gboolean gpm_phone_get_on_ac (GpmPhone *phone, + guint idx); +guint gpm_phone_get_num_batteries (GpmPhone *phone); +gboolean gpm_phone_coldplug (GpmPhone *phone); + +G_END_DECLS + +#endif /* __GPMPHONE_H */ diff --git a/plugins/power/gsd-backlight-helper.c b/plugins/power/gsd-backlight-helper.c new file mode 100644 index 00000000..9ccfba32 --- /dev/null +++ b/plugins/power/gsd-backlight-helper.c @@ -0,0 +1,248 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2010-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define GSD_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS 0 +#define GSD_BACKLIGHT_HELPER_EXIT_CODE_FAILED 1 +#define GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID 3 +#define GSD_BACKLIGHT_HELPER_EXIT_CODE_INVALID_USER 4 +#define GSD_BACKLIGHT_HELPER_EXIT_CODE_NO_DEVICES 5 + +static gchar * +gsd_backlight_helper_get_type (GList *devices, const gchar *type) +{ + const gchar *type_tmp; + GList *d; + + for (d = devices; d != NULL; d = d->next) { + type_tmp = g_udev_device_get_sysfs_attr (d->data, "type"); + if (g_strcmp0 (type_tmp, type) == 0) + return g_strdup (g_udev_device_get_sysfs_path (d->data)); + } + return NULL; +} + +static gchar * +gsd_backlight_helper_get_best_backlight () +{ + gchar *path = NULL; + GList *devices; + GUdevClient *client; + + client = g_udev_client_new (NULL); + devices = g_udev_client_query_by_subsystem (client, "backlight"); + if (devices == NULL) + goto out; + + /* search the backlight devices and prefer the types: + * firmware -> platform -> raw */ + path = gsd_backlight_helper_get_type (devices, "firmware"); + if (path != NULL) + goto out; + path = gsd_backlight_helper_get_type (devices, "platform"); + if (path != NULL) + goto out; + path = gsd_backlight_helper_get_type (devices, "raw"); + if (path != NULL) + goto out; +out: + g_object_unref (client); + g_list_foreach (devices, (GFunc) g_object_unref, NULL); + g_list_free (devices); + return path; +} + +static gboolean +gsd_backlight_helper_write (const gchar *filename, gint value, GError **error) +{ + gchar *text = NULL; + gint retval; + gint length; + gint fd = -1; + gboolean ret = TRUE; + + fd = open (filename, O_WRONLY); + if (fd < 0) { + ret = FALSE; + g_set_error (error, 1, 0, "failed to open filename: %s", filename); + goto out; + } + + /* convert to text */ + text = g_strdup_printf ("%i", value); + length = strlen (text); + + /* write to device file */ + retval = write (fd, text, length); + if (retval != length) { + ret = FALSE; + g_set_error (error, 1, 0, "writing '%s' to %s failed", text, filename); + goto out; + } +out: + if (fd >= 0) + close (fd); + g_free (text); + return ret; +} + +int +main (int argc, char *argv[]) +{ + GOptionContext *context; + gint uid; + gint euid; + guint retval = 0; + GError *error = NULL; + gboolean ret = FALSE; + gint set_brightness = -1; + gboolean get_brightness = FALSE; + gboolean get_max_brightness = FALSE; + gchar *filename = NULL; + gchar *filename_file = NULL; + gchar *contents = NULL; + + const GOptionEntry options[] = { + { "set-brightness", '\0', 0, G_OPTION_ARG_INT, &set_brightness, + /* command line argument */ + "Set the current brightness", NULL }, + { "get-brightness", '\0', 0, G_OPTION_ARG_NONE, &get_brightness, + /* command line argument */ + "Get the current brightness", NULL }, + { "get-max-brightness", '\0', 0, G_OPTION_ARG_NONE, &get_max_brightness, + /* command line argument */ + "Get the number of brightness levels supported", NULL }, + { NULL} + }; + + /* setup type system */ + g_type_init (); + + context = g_option_context_new (NULL); + g_option_context_set_summary (context, "GNOME Settings Daemon Backlight Helper"); + g_option_context_add_main_entries (context, options, NULL); + g_option_context_parse (context, &argc, &argv, NULL); + g_option_context_free (context); + +#ifndef __linux__ + /* the g-s-d plugin should only call this helper on linux */ + g_critical ("Attempting to call gsb-backlight-helper on non-Linux"); + g_assert_not_reached (); +#endif + + /* no input */ + if (set_brightness == -1 && !get_brightness && !get_max_brightness) { + g_print ("%s\n", "No valid option was specified"); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID; + goto out; + } + + /* find device */ + filename = gsd_backlight_helper_get_best_backlight (); + if (filename == NULL) { + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_NO_DEVICES; + g_print ("%s: %s\n", + "Could not get or set the value of the backlight", + "No backlight devices present"); + goto out; + } + + /* GetBrightness */ + if (get_brightness) { + filename_file = g_build_filename (filename, "brightness", NULL); + ret = g_file_get_contents (filename_file, &contents, NULL, &error); + if (!ret) { + g_print ("%s: %s\n", + "Could not get the value of the backlight", + error->message); + g_error_free (error); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID; + goto out; + } + + /* just print the contents to stdout */ + g_print ("%s", contents); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS; + goto out; + } + + /* GetSteps */ + if (get_max_brightness) { + filename_file = g_build_filename (filename, "max_brightness", NULL); + ret = g_file_get_contents (filename_file, &contents, NULL, &error); + if (!ret) { + g_print ("%s: %s\n", + "Could not get the maximum value of the backlight", + error->message); + g_error_free (error); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID; + goto out; + } + + /* just print the contents to stdout */ + g_print ("%s", contents); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS; + goto out; + } + + /* check calling UID */ + uid = getuid (); + euid = geteuid (); + if (uid != 0 || euid != 0) { + g_print ("%s\n", + "This program can only be used by the root user"); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID; + goto out; + } + + /* SetBrightness */ + if (set_brightness != -1) { + filename_file = g_build_filename (filename, "brightness", NULL); + ret = gsd_backlight_helper_write (filename_file, set_brightness, &error); + if (!ret) { + g_print ("%s: %s\n", + "Could not set the value of the backlight", + error->message); + g_error_free (error); + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID; + goto out; + } + } + + /* success */ + retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS; +out: + g_free (filename); + g_free (filename_file); + g_free (contents); + return retval; +} + diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c new file mode 100644 index 00000000..e0ea8f24 --- /dev/null +++ b/plugins/power/gsd-power-manager.c @@ -0,0 +1,4397 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * Copyright (C) 2011 Richard Hughes + * Copyright (C) 2011 Ritesh Khadgaray + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include + +#include "gpm-common.h" +#include "gpm-phone.h" +#include "gpm-idletime.h" +#include "gnome-settings-profile.h" +#include "gnome-settings-session.h" +#include "gsd-enums.h" +#include "gsd-power-manager.h" +#include "gsd-power-helper.h" + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_PATH_PRESENCE "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE_PRESENCE "org.gnome.SessionManager.Presence" + +#define UPOWER_DBUS_NAME "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_PATH_KBDBACKLIGHT "/org/freedesktop/UPower/KbdBacklight" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DBUS_INTERFACE_KBDBACKLIGHT "org.freedesktop.UPower.KbdBacklight" + +#define GSD_POWER_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.power" + +#define GSD_DBUS_SERVICE "org.gnome.SettingsDaemon" +#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" +#define GSD_POWER_DBUS_PATH GSD_DBUS_PATH "/Power" +#define GSD_POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#define GSD_POWER_DBUS_INTERFACE_SCREEN "org.gnome.SettingsDaemon.Power.Screen" +#define GSD_POWER_DBUS_INTERFACE_KEYBOARD "org.gnome.SettingsDaemon.Power.Keyboard" + +#define GS_DBUS_NAME "org.gnome.ScreenSaver" +#define GS_DBUS_PATH "/org/gnome/ScreenSaver" +#define GS_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_NEVER 0 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */ +#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */ + +#define GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */ +#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */ +#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */ + +/* Keep this in sync with gnome-shell */ +#define SCREENSAVER_FADE_TIME 10 /* seconds */ + +#define XSCREENSAVER_WATCHDOG_TIMEOUT 120 /* seconds */ + +enum { + GSD_POWER_IDLETIME_NULL_ID, + GSD_POWER_IDLETIME_DIM_ID, + GSD_POWER_IDLETIME_BLANK_ID, + GSD_POWER_IDLETIME_SLEEP_ID +}; + +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; + +/* on ACPI machines we have 4-16 levels, on others it's ~150 */ +#define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) + +/* take a discrete value with offset and convert to percentage */ +static int +abs_to_percentage (int min, int max, int value) +{ + g_return_val_if_fail (max > min, -1); + g_return_val_if_fail (value >= min, -1); + g_return_val_if_fail (value <= max, -1); + return (((value - min) * 100) / (max - min)); +} +#define ABS_TO_PERCENTAGE(min, max, value) abs_to_percentage(min, max, value) +#define PERCENTAGE_TO_ABS(min, max, value) (min + (((max - min) * value) / 100)) + +#define GSD_POWER_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerPrivate)) + +typedef enum { + GSD_POWER_IDLE_MODE_NORMAL, + GSD_POWER_IDLE_MODE_DIM, + GSD_POWER_IDLE_MODE_BLANK, + GSD_POWER_IDLE_MODE_SLEEP +} GsdPowerIdleMode; + +struct GsdPowerManagerPrivate +{ + GnomeSettingsSession *session; + gboolean lid_is_closed; + GSettings *settings; + GSettings *settings_screensaver; + UpClient *up_client; + GDBusNodeInfo *introspection_data; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusProxy *upower_proxy; + GDBusProxy *upower_kdb_proxy; + gint kbd_brightness_now; + gint kbd_brightness_max; + gint kbd_brightness_old; + gint kbd_brightness_pre_dim; + GnomeRRScreen *x11_screen; + gboolean use_time_primary; + gchar *previous_summary; + GIcon *previous_icon; + GpmPhone *phone; + GPtrArray *devices_array; + guint action_percentage; + guint action_time; + guint critical_percentage; + guint critical_time; + guint low_percentage; + guint low_time; + gint pre_dim_brightness; /* level, not percentage */ + UpDevice *device_composite; + NotifyNotification *notification_discharging; + NotifyNotification *notification_low; + ca_context *canberra_context; + ca_proplist *critical_alert_loop_props; + guint32 critical_alert_timeout_id; + GDBusProxy *screensaver_proxy; + GDBusProxy *session_proxy; + GDBusProxy *session_presence_proxy; + GpmIdletime *idletime; + GsdPowerIdleMode current_idle_mode; + guint lid_close_safety_timer_id; + GtkStatusIcon *status_icon; + guint xscreensaver_watchdog_timer_id; + gboolean is_virtual_machine; +}; + +enum { + PROP_0, +}; + +static void gsd_power_manager_class_init (GsdPowerManagerClass *klass); +static void gsd_power_manager_init (GsdPowerManager *power_manager); +static void gsd_power_manager_finalize (GObject *object); + +static UpDevice *engine_get_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static UpDevice *engine_update_composite_device (GsdPowerManager *manager, UpDevice *original_device); +static GIcon *engine_get_icon (GsdPowerManager *manager); +static gchar *engine_get_summary (GsdPowerManager *manager); +static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type); +static void do_lid_closed_action (GsdPowerManager *manager); +static void lock_screensaver (GsdPowerManager *manager); +static void kill_lid_close_safety_timer (GsdPowerManager *manager); + +G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +gsd_power_manager_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("gsd_power_manager_error"); + return quark; +} + +static gboolean +play_loop_timeout_cb (GsdPowerManager *manager) +{ + ca_context *context; + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play_full (context, 0, + manager->priv->critical_alert_loop_props, + NULL, + NULL); + return TRUE; +} + +static gboolean +play_loop_stop (GsdPowerManager *manager) +{ + if (manager->priv->critical_alert_timeout_id == 0) { + g_warning ("no sound loop present to stop"); + return FALSE; + } + + g_source_remove (manager->priv->critical_alert_timeout_id); + ca_proplist_destroy (manager->priv->critical_alert_loop_props); + + manager->priv->critical_alert_loop_props = NULL; + manager->priv->critical_alert_timeout_id = 0; + + return TRUE; +} + +static gboolean +play_loop_start (GsdPowerManager *manager, + const gchar *id, + const gchar *desc, + gboolean force, + guint timeout) +{ + ca_context *context; + + if (timeout == 0) { + g_warning ("received invalid timeout"); + return FALSE; + } + + /* if a sound loop is already running, stop the existing loop */ + if (manager->priv->critical_alert_timeout_id != 0) { + g_warning ("was instructed to play a sound loop with one already playing"); + play_loop_stop (manager); + } + + ca_proplist_create (&(manager->priv->critical_alert_loop_props)); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_ID, id); + ca_proplist_sets (manager->priv->critical_alert_loop_props, + CA_PROP_EVENT_DESCRIPTION, desc); + + manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout, + (GSourceFunc) play_loop_timeout_cb, + manager); + g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, + "[GsdPowerManager] play-loop"); + + /* play the sound, using sounds from the naming spec */ + context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + ca_context_play (context, 0, + CA_PROP_EVENT_ID, id, + CA_PROP_EVENT_DESCRIPTION, desc, NULL); + return TRUE; +} + +static void +notify_close_if_showing (NotifyNotification *notification) +{ + gboolean ret; + GError *error = NULL; + + if (notification == NULL) + return; + ret = notify_notification_close (notification, &error); + if (!ret) { + g_warning ("failed to close notification: %s", + error->message); + g_error_free (error); + } +} + +static const gchar * +get_first_themed_icon_name (GIcon *icon) +{ + const gchar* const *icon_names; + const gchar *icon_name = NULL; + + /* no icon */ + if (icon == NULL) + goto out; + + /* just use the first icon */ + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); + if (icon_names != NULL) + icon_name = icon_names[0]; +out: + return icon_name; +} + +typedef enum { + WARNING_NONE = 0, + WARNING_DISCHARGING = 1, + WARNING_LOW = 2, + WARNING_CRITICAL = 3, + WARNING_ACTION = 4 +} GsdPowerManagerWarning; + +static GVariant * +engine_get_icon_property_variant (GsdPowerManager *manager) +{ + GIcon *icon; + GVariant *retval; + + icon = engine_get_icon (manager); + if (icon != NULL) { + char *str; + str = g_icon_to_string (icon); + g_object_unref (icon); + retval = g_variant_new_string (str); + g_free (str); + } else { + retval = g_variant_new_string (""); + } + return retval; +} + +static GVariant * +engine_get_tooltip_property_variant (GsdPowerManager *manager) +{ + char *tooltip; + GVariant *retval; + + tooltip = engine_get_summary (manager); + retval = g_variant_new_string (tooltip != NULL ? tooltip : ""); + g_free (tooltip); + + return retval; +} + +static void +engine_emit_changed (GsdPowerManager *manager, + gboolean icon_changed, + gboolean state_changed) +{ + GVariantBuilder props_builder; + GVariant *props_changed = NULL; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + + g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}")); + + if (icon_changed) + g_variant_builder_add (&props_builder, "{sv}", "Icon", + engine_get_icon_property_variant (manager)); + if (state_changed) + g_variant_builder_add (&props_builder, "{sv}", "Tooltip", + engine_get_tooltip_property_variant (manager)); + + props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE, + g_variant_builder_end (&props_builder), + g_variant_new_strv (NULL, 0)); + g_variant_ref_sink (props_changed); + + if (!g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + GSD_POWER_DBUS_PATH, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + props_changed, + &error)) + goto out; + + out: + if (error) { + g_warning ("%s", error->message); + g_clear_error (&error); + } + if (props_changed) + g_variant_unref (props_changed); +} + +static GsdPowerManagerWarning +engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage < 26.0f) + return WARNING_LOW; + else if (percentage < 13.0f) + return WARNING_CRITICAL; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device) +{ + gdouble percentage; + + /* get device properties */ + g_object_get (device, "percentage", &percentage, NULL); + + if (percentage <= manager->priv->action_percentage) + return WARNING_ACTION; + if (percentage <= manager->priv->critical_percentage) + return WARNING_CRITICAL; + if (percentage <= manager->priv->low_percentage) + return WARNING_LOW; + return WARNING_NONE; +} + +static GsdPowerManagerWarning +engine_get_warning_time (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gint64 time_to_empty; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "time-to-empty", &time_to_empty, + NULL); + + /* this is probably an error condition */ + if (time_to_empty == 0) { + g_debug ("time zero, falling back to percentage for %s", + up_device_kind_to_string (kind)); + return engine_get_warning_percentage (manager, device); + } + + if (time_to_empty <= manager->priv->action_time) + return WARNING_ACTION; + if (time_to_empty <= manager->priv->critical_time) + return WARNING_CRITICAL; + if (time_to_empty <= manager->priv->low_time) + return WARNING_LOW; + return WARNING_NONE; +} + +/** + * This gets the possible engine state for the device according to the + * policy, which could be per-percent, or per-time. + **/ +static GsdPowerManagerWarning +engine_get_warning (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + UpDeviceState state; + GsdPowerManagerWarning warning_type; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + NULL); + + /* default to no engine */ + warning_type = WARNING_NONE; + + /* if the device in question is on ac, don't give a warning */ + if (state == UP_DEVICE_STATE_CHARGING) + goto out; + + if (kind == UP_DEVICE_KIND_MOUSE || + kind == UP_DEVICE_KIND_KEYBOARD) { + + warning_type = engine_get_warning_csr (manager, device); + + } else if (kind == UP_DEVICE_KIND_UPS || +#if UP_CHECK_VERSION(0,9,5) + kind == UP_DEVICE_KIND_MEDIA_PLAYER || + kind == UP_DEVICE_KIND_TABLET || + kind == UP_DEVICE_KIND_COMPUTER || +#endif + kind == UP_DEVICE_KIND_PDA) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + warning_type = engine_get_warning_percentage (manager, device); + + } else if (kind == UP_DEVICE_KIND_BATTERY) { + /* only use the time when it is accurate, and settings is not disabled */ + if (manager->priv->use_time_primary) + warning_type = engine_get_warning_time (manager, device); + else + warning_type = engine_get_warning_percentage (manager, device); + } + + /* If we have no important engines, we should test for discharging */ + if (warning_type == WARNING_NONE) { + if (state == UP_DEVICE_STATE_DISCHARGING) + warning_type = WARNING_DISCHARGING; + } + + out: + return warning_type; +} + +static gchar * +engine_get_summary (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + GString *tooltip = NULL; + gchar *part; + gboolean is_present; + + + /* need to get AC state */ + tooltip = g_string_new (""); + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "is-present", &is_present, + "state", &state, + NULL); + if (!is_present) + continue; + if (state == UP_DEVICE_STATE_EMPTY) + continue; + part = gpm_upower_get_device_summary (device); + if (part != NULL) + g_string_append_printf (tooltip, "%s\n", part); + g_free (part); + } + + /* remove the last \n */ + g_string_truncate (tooltip, tooltip->len-1); + + g_debug ("tooltip: %s", tooltip->str); + + return g_string_free (tooltip, FALSE); +} + +static GIcon * +engine_get_icon_priv (GsdPowerManager *manager, + UpDeviceKind device_kind, + GsdPowerManagerWarning warning, + gboolean use_state) +{ + guint i; + GPtrArray *array; + UpDevice *device; + GsdPowerManagerWarning warning_temp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + /* do we have specific device types? */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) + device = engine_get_composite_device (manager, device); + + warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), + "engine-warning-old")); + if (kind == device_kind && is_present) { + if (warning != WARNING_NONE) { + if (warning_temp == warning) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + if (use_state) { + if (state == UP_DEVICE_STATE_CHARGING || + state == UP_DEVICE_STATE_DISCHARGING) + return gpm_upower_get_device_icon (device, TRUE); + continue; + } + return gpm_upower_get_device_icon (device, TRUE); + } + } + return NULL; +} + +static GIcon * +engine_get_icon (GsdPowerManager *manager) +{ + GIcon *icon = NULL; + + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_CRITICAL, FALSE); + if (icon != NULL) + return icon; + + /* we try CRITICAL: BATTERY, UPS, MOUSE, KEYBOARD */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_MOUSE, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_KEYBOARD, WARNING_LOW, FALSE); + if (icon != NULL) + return icon; + + /* we try (DIS)CHARGING: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE); + if (icon != NULL) + return icon; + + /* we try PRESENT: BATTERY, UPS */ + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE); + if (icon != NULL) + return icon; + + /* do not show an icon */ + return NULL; +} + +static gboolean +engine_recalculate_state_icon (GsdPowerManager *manager) +{ + GIcon *icon; + + /* show a different icon if we are disconnected */ + icon = engine_get_icon (manager); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + if (icon == NULL) { + /* none before, now none */ + if (manager->priv->previous_icon == NULL) + return FALSE; + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = NULL; + return TRUE; + } + + /* no icon before, now icon */ + if (manager->priv->previous_icon == NULL) { + + /* set fallback icon */ + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + /* icon before, now different */ + if (!g_icon_equal (manager->priv->previous_icon, icon)) { + + /* set fallback icon */ + gtk_status_icon_set_from_gicon (manager->priv->status_icon, icon); + + g_object_unref (manager->priv->previous_icon); + manager->priv->previous_icon = icon; + return TRUE; + } + + g_debug ("no change"); + /* nothing to do */ + g_object_unref (icon); + return FALSE; +} + +static gboolean +engine_recalculate_state_summary (GsdPowerManager *manager) +{ + gchar *summary; + + summary = engine_get_summary (manager); + if (manager->priv->previous_summary == NULL) { + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + + if (strcmp (manager->priv->previous_summary, summary) != 0) { + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = summary; + + /* set fallback tooltip */ + gtk_status_icon_set_tooltip_text (manager->priv->status_icon, + summary); + + return TRUE; + } + g_debug ("no change"); + /* nothing to do */ + g_free (summary); + return FALSE; +} + +static void +engine_recalculate_state (GsdPowerManager *manager) +{ + gboolean icon_changed = FALSE; + gboolean state_changed = FALSE; + + icon_changed = engine_recalculate_state_icon (manager); + state_changed = engine_recalculate_state_summary (manager); + + /* only emit if the icon or summary has changed */ + if (icon_changed || state_changed) + engine_emit_changed (manager, icon_changed, state_changed); +} + +static UpDevice * +engine_get_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint battery_devices = 0; + GPtrArray *array; + UpDevice *device; + UpDeviceKind kind; + UpDeviceKind original_kind; + guint i; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* find out how many batteries in the system */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + NULL); + if (kind == original_kind) + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices <= 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use the composite device */ + device = manager->priv->device_composite; +out: + /* return composite device or original device */ + return device; +} + +static UpDevice * +engine_update_composite_device (GsdPowerManager *manager, + UpDevice *original_device) +{ + guint i; + gdouble percentage = 0.0; + gdouble energy = 0.0; + gdouble energy_full = 0.0; + gdouble energy_rate = 0.0; + gdouble energy_total = 0.0; + gdouble energy_full_total = 0.0; + gdouble energy_rate_total = 0.0; + gint64 time_to_empty = 0; + gint64 time_to_full = 0; + guint battery_devices = 0; + gboolean is_charging = FALSE; + gboolean is_discharging = FALSE; + gboolean is_fully_charged = TRUE; + GPtrArray *array; + UpDevice *device; + UpDeviceState state; + UpDeviceKind kind; + UpDeviceKind original_kind; + + /* get the type of the original device */ + g_object_get (original_device, + "kind", &original_kind, + NULL); + + /* update the composite device */ + array = manager->priv->devices_array; + for (i=0;ilen;i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, + "kind", &kind, + "state", &state, + "energy", &energy, + "energy-full", &energy_full, + "energy-rate", &energy_rate, + NULL); + if (kind != original_kind) + continue; + + /* one of these will be charging or discharging */ + if (state == UP_DEVICE_STATE_CHARGING) + is_charging = TRUE; + if (state == UP_DEVICE_STATE_DISCHARGING) + is_discharging = TRUE; + if (state != UP_DEVICE_STATE_FULLY_CHARGED) + is_fully_charged = FALSE; + + /* sum up composite */ + energy_total += energy; + energy_full_total += energy_full; + energy_rate_total += energy_rate; + battery_devices++; + } + + /* just use the original device if only one primary battery */ + if (battery_devices == 1) { + g_debug ("using original device as only one primary battery"); + device = original_device; + goto out; + } + + /* use percentage weighted for each battery capacity */ + if (energy_full_total > 0.0) + percentage = 100.0 * energy_total / energy_full_total; + + /* set composite state */ + if (is_charging) + state = UP_DEVICE_STATE_CHARGING; + else if (is_discharging) + state = UP_DEVICE_STATE_DISCHARGING; + else if (is_fully_charged) + state = UP_DEVICE_STATE_FULLY_CHARGED; + else + state = UP_DEVICE_STATE_UNKNOWN; + + /* calculate a quick and dirty time remaining value */ + if (energy_rate_total > 0) { + if (state == UP_DEVICE_STATE_DISCHARGING) + time_to_empty = 3600 * (energy_total / energy_rate_total); + else if (state == UP_DEVICE_STATE_CHARGING) + time_to_full = 3600 * ((energy_full_total - energy_total) / energy_rate_total); + } + + /* okay, we can use the composite device */ + device = manager->priv->device_composite; + + g_debug ("printing composite device"); + g_object_set (device, + "energy", energy, + "energy-full", energy_full, + "energy-rate", energy_rate, + "time-to-empty", time_to_empty, + "time-to-full", time_to_full, + "percentage", percentage, + "state", state, + NULL); + + /* force update of icon */ + if (engine_recalculate_state_icon (manager)) + engine_emit_changed (manager, TRUE, FALSE); +out: + /* return composite device or original device */ + return device; +} + +typedef struct { + GsdPowerManager *manager; + UpDevice *device; +} GsdPowerManagerRecallData; + +static void +device_perhaps_recall_response_cb (GtkDialog *dialog, + gint response_id, + GsdPowerManagerRecallData *recall_data) +{ + GdkScreen *screen; + GtkWidget *dialog_error; + GError *error = NULL; + gboolean ret; + gchar *website = NULL; + + /* don't show this again */ + if (response_id == GTK_RESPONSE_CANCEL) { + g_settings_set_boolean (recall_data->manager->priv->settings, + "notify-perhaps-recall", + FALSE); + goto out; + } + + /* visit recall website */ + if (response_id == GTK_RESPONSE_OK) { + + g_object_get (recall_data->device, + "recall-url", &website, + NULL); + + screen = gdk_screen_get_default(); + ret = gtk_show_uri (screen, + website, + gtk_get_current_event_time (), + &error); + if (!ret) { + dialog_error = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Failed to show url %s", + error->message); + gtk_dialog_run (GTK_DIALOG (dialog_error)); + g_error_free (error); + } + } +out: + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (recall_data->device); + g_object_unref (recall_data->manager); + g_free (recall_data); + g_free (website); + return; +} + +static gboolean +device_perhaps_recall_delay_cb (gpointer user_data) +{ + gchar *vendor; + const gchar *title = NULL; + GString *message = NULL; + GtkWidget *dialog; + GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data; + + g_object_get (recall_data->device, + "recall-vendor", &vendor, + NULL); + + /* TRANSLATORS: the battery may be recalled by its vendor */ + title = _("Battery may be recalled"); + message = g_string_new (""); + g_string_append_printf (message, + _("A battery in your computer may have been " + "recalled by %s and you may be at risk."), vendor); + g_string_append (message, "\n\n"); + g_string_append (message, _("For more information visit the battery recall website.")); + dialog = gtk_message_dialog_new_with_markup (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + title); + gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), + "%s", message->str); + + /* TRANSLATORS: button text, visit the manufacturers recall website */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), + GTK_RESPONSE_OK); + + /* TRANSLATORS: button text, do not show this bubble again */ + gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), + GTK_RESPONSE_CANCEL); + + gtk_widget_show (dialog); + g_signal_connect (dialog, "response", + G_CALLBACK (device_perhaps_recall_response_cb), + recall_data); + + g_string_free (message, TRUE); + g_free (vendor); + return FALSE; +} + +static void +device_perhaps_recall (GsdPowerManager *manager, UpDevice *device) +{ + gboolean ret; + guint timer_id; + GsdPowerManagerRecallData *recall_data; + + /* don't show when running under GDM */ + if (g_getenv ("RUNNING_UNDER_GDM") != NULL) { + g_debug ("running under gdm, so no notification"); + return; + } + + /* already shown, and dismissed */ + ret = g_settings_get_boolean (manager->priv->settings, + "notify-perhaps-recall"); + if (!ret) { + g_debug ("settings prevents recall notification"); + return; + } + + recall_data = g_new0 (GsdPowerManagerRecallData, 1); + recall_data->manager = g_object_ref (manager); + recall_data->device = g_object_ref (device); + + /* delay by a few seconds so the session can load */ + timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY, + device_perhaps_recall_delay_cb, + recall_data); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall"); +} + +static void +engine_device_add (GsdPowerManager *manager, UpDevice *device) +{ + gboolean recall_notice; + GsdPowerManagerWarning warning; + UpDeviceState state; + UpDeviceKind kind; + UpDevice *composite; + + /* assign warning */ + warning = engine_get_warning (manager, device); + g_object_set_data (G_OBJECT(device), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "recall-notice", &recall_notice, + NULL); + + /* add old state for transitions */ + g_debug ("adding %s with state %s", + up_device_get_object_path (device), up_device_state_to_string (state)); + g_object_set_data (G_OBJECT(device), + "engine-state-old", + GUINT_TO_POINTER(state)); + + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because we added a device"); + composite = engine_update_composite_device (manager, device); + + /* get the same values for the composite device */ + warning = engine_get_warning (manager, composite); + g_object_set_data (G_OBJECT(composite), + "engine-warning-old", + GUINT_TO_POINTER(warning)); + g_object_get (composite, "state", &state, NULL); + g_object_set_data (G_OBJECT(composite), + "engine-state-old", + GUINT_TO_POINTER(state)); + } + + /* the device is recalled */ + if (recall_notice) + device_perhaps_recall (manager, device); +} + +static gboolean +engine_check_recall (GsdPowerManager *manager, UpDevice *device) +{ + UpDeviceKind kind; + gboolean recall_notice = FALSE; + gchar *recall_vendor = NULL; + gchar *recall_url = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "recall-notice", &recall_notice, + "recall-vendor", &recall_vendor, + "recall-url", &recall_url, + NULL); + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + goto out; + + /* no recall data */ + if (!recall_notice) + goto out; + + /* emit signal for manager */ + g_debug ("** EMIT: perhaps-recall"); + g_debug ("%s-%s", recall_vendor, recall_url); +out: + g_free (recall_vendor); + g_free (recall_url); + return recall_notice; +} + +static gboolean +engine_coldplug (GsdPowerManager *manager) +{ + guint i; + GPtrArray *array = NULL; + UpDevice *device; + gboolean ret; + GError *error = NULL; + + /* get devices from UPower */ + ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error); + if (!ret) { + g_warning ("failed to get device list: %s", error->message); + g_error_free (error); + goto out; + } + + /* connected mobile phones */ + gpm_phone_coldplug (manager->priv->phone); + + engine_recalculate_state (manager); + + /* add to database */ + array = up_client_get_devices (manager->priv->up_client); + for (i = 0; array != NULL && i < array->len; i++) { + device = g_ptr_array_index (array, i); + engine_device_add (manager, device); + engine_check_recall (manager, device); + } +out: + if (array != NULL) + g_ptr_array_unref (array); + /* never repeat */ + return FALSE; +} + +static void +engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + /* add to list */ + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_check_recall (manager, device); + + engine_recalculate_state (manager); +} + +static void +engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + gboolean ret; + ret = g_ptr_array_remove (manager->priv->devices_array, device); + if (!ret) + return; + engine_recalculate_state (manager); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +create_notification (const char *summary, + const char *body, + const char *icon, + NotifyNotification **weak_pointer_location) +{ + NotifyNotification *notification; + + notification = notify_notification_new (summary, body, icon); + *weak_pointer_location = notification; + g_object_add_weak_pointer (G_OBJECT (notification), + (gpointer *) weak_pointer_location); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); +} + +static void +engine_ups_discharging (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title; + gboolean ret; + gchar *remaining_text = NULL; + gdouble percentage; + GError *error = NULL; + GIcon *icon = NULL; + gint64 time_to_empty; + GString *message; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + if (kind != UP_DEVICE_KIND_UPS) + return; + + /* only show text if there is a valid time */ + if (time_to_empty > 0) + remaining_text = gpm_get_timestring (time_to_empty); + + /* TRANSLATORS: UPS is now discharging */ + title = _("UPS Discharging"); + + message = g_string_new (""); + if (remaining_text != NULL) { + /* TRANSLATORS: tell the user how much time they have got */ + g_string_append_printf (message, _("%s of UPS backup power remaining"), + remaining_text); + } else { + g_string_append (message, gpm_device_to_localised_string (device)); + } + g_string_append_printf (message, " (%.0f%%)", percentage); + + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_discharging); + + /* create a new notification */ + create_notification (title, message->str, + get_first_themed_icon_name (icon), + &manager->priv->notification_discharging); + notify_notification_set_timeout (manager->priv->notification_discharging, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_discharging, + NOTIFY_URGENCY_NORMAL); + /* TRANSLATORS: this is the notification application name */ + notify_notification_set_app_name (manager->priv->notification_discharging, _("Power")); + notify_notification_set_hint (manager->priv->notification_discharging, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_discharging, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_discharging); + } + g_string_free (message, TRUE); + if (icon != NULL) + g_object_unref (icon); + g_free (remaining_text); +} + +static GsdPowerActionType +manager_critical_action_get (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType policy; + + policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action"); + if (policy == GSD_POWER_ACTION_SUSPEND) { + if (is_ups == FALSE && + up_client_get_can_suspend (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_can_hibernate (manager->priv->up_client)) + return policy; + return GSD_POWER_ACTION_SHUTDOWN; + } + + return policy; +} + +static gboolean +manager_critical_action_do (GsdPowerManager *manager, + gboolean is_ups) +{ + GsdPowerActionType action_type; + + /* stop playing the alert as it's too late to do anything now */ + if (manager->priv->critical_alert_timeout_id > 0) + play_loop_stop (manager); + + action_type = manager_critical_action_get (manager, is_ups); + do_power_action_type (manager, action_type); + + return FALSE; +} + +static gboolean +manager_critical_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, FALSE); + return FALSE; +} + +static gboolean +manager_critical_ups_action_do_cb (GsdPowerManager *manager) +{ + manager_critical_action_do (manager, TRUE); + return FALSE; +} + +static gboolean +engine_just_laptop_battery (GsdPowerManager *manager) +{ + UpDevice *device; + UpDeviceKind kind; + GPtrArray *array; + gboolean ret = TRUE; + guint i; + + /* find if there are any other device types that mean we have to + * be more specific in our wording */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + g_object_get (device, "kind", &kind, NULL); + if (kind != UP_DEVICE_KIND_BATTERY) { + ret = FALSE; + break; + } + } + return ret; +} + +static void +engine_charge_low (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gchar *tmp; + gchar *remaining_text; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery low, and we only have one battery */ + title = _("Battery low"); + } else { + /* TRANSLATORS: laptop battery low, and we have more than one kind of battery */ + title = _("Laptop battery low"); + } + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage); + g_free (remaining_text); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is starting to get a little low */ + title = _("UPS low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: tell the user how much time they have got */ + message = g_strdup_printf (_("Approximately %s of remaining UPS backup power (%.0f%%)"), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: mouse is getting a little low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless mouse is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: keyboard is getting a little low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Wireless keyboard is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PDA) { + /* TRANSLATORS: PDA is getting a little low */ + title = _("PDA battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("PDA is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + /* TRANSLATORS: cell phone (mobile) is getting a little low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + /* TRANSLATORS: media player, e.g. mp3 is getting a little low */ + title = _("Media player battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_TABLET) { + /* TRANSLATORS: graphics tablet, e.g. wacom is getting a little low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage); + + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + /* TRANSLATORS: computer, e.g. ipad is getting a little low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: tell user more details */ + message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_NORMAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + notify_notification_set_hint (manager->priv->notification_low, + "transient", g_variant_new_boolean (TRUE)); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-low", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL); + +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_critical (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + gdouble percentage; + GIcon *icon = NULL; + gint64 time_to_empty; + GsdPowerActionType policy; + UpDeviceKind kind; + GError *error = NULL; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "time-to-empty", &time_to_empty, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* if the user has no other batteries, drop the "Laptop" wording */ + ret = engine_just_laptop_battery (manager); + if (ret) { + /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */ + title = _("Battery critically low"); + } else { + /* TRANSLATORS: laptop battery critically low, and we have more than one type of battery */ + title = _("Laptop battery critically low"); + } + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */ + message = g_strdup (_("Plug in your AC adapter to avoid losing data.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in.")); + } + + } else if (kind == UP_DEVICE_KIND_UPS) { + gchar *remaining_text; + gchar *tmp; + + /* TRANSLATORS: the UPS is very low */ + title = _("UPS critically low"); + tmp = gpm_get_timestring (time_to_empty); + remaining_text = g_strconcat ("", tmp, "", NULL); + g_free (tmp); + + /* TRANSLATORS: give the user a ultimatum */ + message = g_strdup_printf (_("Approximately %s of remaining UPS power (%.0f%%). " + "Restore AC power to your computer to avoid losing data."), + remaining_text, percentage); + g_free (remaining_text); + } else if (kind == UP_DEVICE_KIND_MOUSE) { + /* TRANSLATORS: the mouse battery is very low */ + title = _("Mouse battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless mouse is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_KEYBOARD) { + /* TRANSLATORS: the keyboard battery is very low */ + title = _("Keyboard battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Wireless keyboard is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_PDA) { + + /* TRANSLATORS: the PDA battery is very low */ + title = _("PDA battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("PDA is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + + } else if (kind == UP_DEVICE_KIND_PHONE) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + +#if UP_CHECK_VERSION(0,9,5) + } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Cell phone battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Media player is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_TABLET) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Tablet battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). " + "This device will soon stop functioning if not charged."), + percentage); + } else if (kind == UP_DEVICE_KIND_COMPUTER) { + + /* TRANSLATORS: the cell battery is very low */ + title = _("Attached computer battery low"); + + /* TRANSLATORS: the device is just going to stop working */ + message = g_strdup_printf (_("Attached computer is very low in power (%.0f%%). " + "The device will soon shutdown if not charged."), + percentage); +#endif + } + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + switch (kind) { + + case UP_DEVICE_KIND_BATTERY: + case UP_DEVICE_KIND_UPS: + g_debug ("critical charge level reached, starting sound loop"); + play_loop_start (manager, + "battery-caution", + _("Battery is critically low"), + TRUE, + GSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT); + break; + + default: + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); + break; + } +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_charge_action (GsdPowerManager *manager, UpDevice *device) +{ + const gchar *title = NULL; + gboolean ret; + gchar *message = NULL; + GError *error = NULL; + GIcon *icon = NULL; + GsdPowerActionType policy; + guint timer_id; + UpDeviceKind kind; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* check to see if the batteries have not noticed we are on AC */ + if (kind == UP_DEVICE_KIND_BATTERY) { + if (!up_client_get_on_battery (manager->priv->up_client)) { + g_warning ("ignoring critically low message as we are not on battery power"); + goto out; + } + } + + if (kind == UP_DEVICE_KIND_BATTERY) { + + /* TRANSLATORS: laptop battery is really, really, low */ + title = _("Laptop battery critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, FALSE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("The battery is below the critical level and " + "this computer will power-off when the " + "battery becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_SUSPEND) { + /* TRANSLATORS: computer will suspend */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to suspend.\n" + "NOTE: A small amount of power is required " + "to keep your computer in a suspended state.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("The battery is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action"); + + } else if (kind == UP_DEVICE_KIND_UPS) { + /* TRANSLATORS: UPS is really, really, low */ + title = _("UPS critically low"); + + /* we have to do different warnings depending on the policy */ + policy = manager_critical_action_get (manager, TRUE); + + /* use different text for different actions */ + if (policy == GSD_POWER_ACTION_NOTHING) { + /* TRANSLATORS: computer will shutdown without saving data */ + message = g_strdup (_("UPS is below the critical level and " + "this computer will power-off when the " + "UPS becomes completely empty.")); + + } else if (policy == GSD_POWER_ACTION_HIBERNATE) { + /* TRANSLATORS: computer will hibernate */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to hibernate.")); + + } else if (policy == GSD_POWER_ACTION_SHUTDOWN) { + /* TRANSLATORS: computer will just shutdown */ + message = g_strdup (_("UPS is below the critical level and " + "this computer is about to shutdown.")); + } + + /* wait 20 seconds for user-panic */ + timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_ups_action_do_cb, manager); + g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action"); + } + + /* not all types have actions */ + if (title == NULL) + return; + + /* get correct icon */ + icon = gpm_upower_get_device_icon (device, TRUE); + + /* close any existing notification of this class */ + notify_close_if_showing (manager->priv->notification_low); + + /* create a new notification */ + create_notification (title, message, + get_first_themed_icon_name (icon), + &manager->priv->notification_low); + notify_notification_set_timeout (manager->priv->notification_low, + GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG); + notify_notification_set_urgency (manager->priv->notification_low, + NOTIFY_URGENCY_CRITICAL); + notify_notification_set_app_name (manager->priv->notification_low, _("Power")); + + /* try to show */ + ret = notify_notification_show (manager->priv->notification_low, + &error); + if (!ret) { + g_warning ("failed to show notification: %s", error->message); + g_error_free (error); + g_object_unref (manager->priv->notification_low); + } + + /* play the sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "battery-caution", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL); +out: + if (icon != NULL) + g_object_unref (icon); + g_free (message); +} + +static void +engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager) +{ + UpDeviceKind kind; + UpDeviceState state; + UpDeviceState state_old; + GsdPowerManagerWarning warning_old; + GsdPowerManagerWarning warning; + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + /* if battery then use composite device to cope with multiple batteries */ + if (kind == UP_DEVICE_KIND_BATTERY) { + g_debug ("updating because %s changed", up_device_get_object_path (device)); + device = engine_update_composite_device (manager, device); + } + + /* get device properties (may be composite) */ + g_object_get (device, + "state", &state, + NULL); + + g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state)); + + /* see if any interesting state changes have happened */ + state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old")); + if (state_old != state) { + if (state == UP_DEVICE_STATE_DISCHARGING) { + g_debug ("discharging"); + engine_ups_discharging (manager, device); + } else if (state == UP_DEVICE_STATE_FULLY_CHARGED || + state == UP_DEVICE_STATE_CHARGING) { + g_debug ("fully charged or charging, hiding notifications if any"); + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + } + + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state)); + } + + /* check the warning state has not changed */ + warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old")); + warning = engine_get_warning (manager, device); + if (warning != warning_old) { + if (warning == WARNING_LOW) { + g_debug ("** EMIT: charge-low"); + engine_charge_low (manager, device); + } else if (warning == WARNING_CRITICAL) { + g_debug ("** EMIT: charge-critical"); + engine_charge_critical (manager, device); + } else if (warning == WARNING_ACTION) { + g_debug ("charge-action"); + engine_charge_action (manager, device); + } + /* save new state */ + g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning)); + } + + engine_recalculate_state (manager); +} + +static UpDevice * +engine_get_primary_device (GsdPowerManager *manager) +{ + guint i; + UpDevice *device = NULL; + UpDevice *device_tmp; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + + for (i=0; ipriv->devices_array->len; i++) { + device_tmp = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device_tmp, + "kind", &kind, + "state", &state, + "is-present", &is_present, + NULL); + + /* not present */ + if (!is_present) + continue; + + /* not discharging */ + if (state != UP_DEVICE_STATE_DISCHARGING) + continue; + + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + + /* use composite device to cope with multiple batteries */ + device = g_object_ref (engine_get_composite_device (manager, device_tmp)); + break; + } + return device; +} + +static void +phone_device_added_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + UpDevice *device; + device = up_device_new (); + + g_debug ("phone added %i", idx); + + /* get device properties */ + g_object_set (device, + "kind", UP_DEVICE_KIND_PHONE, + "is-rechargeable", TRUE, + "native-path", g_strdup_printf ("dummy:phone_%i", idx), + "is-present", TRUE, + NULL); + + /* state changed */ + engine_device_add (manager, device); + g_ptr_array_add (manager->priv->devices_array, g_object_ref (device)); + engine_recalculate_state (manager); +} + +static void +phone_device_removed_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + + g_debug ("phone removed %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + g_ptr_array_remove_index (manager->priv->devices_array, i); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +phone_device_refresh_cb (GpmPhone *phone, guint idx, GsdPowerManager *manager) +{ + guint i; + UpDevice *device; + UpDeviceKind kind; + UpDeviceState state; + gboolean is_present; + gdouble percentage; + + g_debug ("phone refresh %i", idx); + + for (i=0; ipriv->devices_array->len; i++) { + device = g_ptr_array_index (manager->priv->devices_array, i); + + /* get device properties */ + g_object_get (device, + "kind", &kind, + "state", &state, + "percentage", &percentage, + "is-present", &is_present, + NULL); + + if (kind == UP_DEVICE_KIND_PHONE) { + is_present = gpm_phone_get_present (phone, idx); + state = gpm_phone_get_on_ac (phone, idx) ? UP_DEVICE_STATE_CHARGING : UP_DEVICE_STATE_DISCHARGING; + percentage = gpm_phone_get_percentage (phone, idx); + break; + } + } + + /* state changed */ + engine_recalculate_state (manager); +} + +static void +gnome_session_shutdown_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *result; + GError *error = NULL; + + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), + res, + &error); + if (result == NULL) { + g_warning ("couldn't shutdown using gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_variant_unref (result); + } +} + +static void +gnome_session_shutdown (void) +{ + GError *error = NULL; + GDBusProxy *proxy; + + /* ask gnome-session to show the shutdown dialog with a timeout */ + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, &error); + if (proxy == NULL) { + g_warning ("cannot connect to gnome-session: %s", + error->message); + g_error_free (error); + return; + } + g_dbus_proxy_call (proxy, + "Shutdown", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + gnome_session_shutdown_cb, NULL); + g_object_unref (proxy); +} + +static void +do_power_action_type (GsdPowerManager *manager, + GsdPowerActionType action_type) +{ + gboolean ret; + GError *error = NULL; + + switch (action_type) { + case GSD_POWER_ACTION_SUSPEND: + gsd_power_suspend (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_INTERACTIVE: + gnome_session_shutdown (); + break; + case GSD_POWER_ACTION_HIBERNATE: + gsd_power_hibernate (manager->priv->upower_proxy); + break; + case GSD_POWER_ACTION_SHUTDOWN: + /* this is only used on critically low battery where + * hibernate is not available and is marginally better + * than just powering down the computer mid-write */ + gsd_power_poweroff (); + break; + case GSD_POWER_ACTION_BLANK: + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off for policy action: %s", + error->message); + g_error_free (error); + } + break; + case GSD_POWER_ACTION_NOTHING: + break; + } +} + +static gboolean +upower_kbd_set_brightness (GsdPowerManager *manager, guint value, GError **error) +{ + GVariant *retval; + + /* same as before */ + if (manager->priv->kbd_brightness_now == value) + return TRUE; + + /* update h/w value */ + retval = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "SetBrightness", + g_variant_new ("(i)", (gint) value), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + error); + if (retval == NULL) + return FALSE; + + /* save new value */ + manager->priv->kbd_brightness_now = value; + g_variant_unref (retval); + return TRUE; +} + +static gboolean +upower_kbd_toggle (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + if (manager->priv->kbd_brightness_old >= 0) { + g_debug ("keyboard toggle off"); + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_old, + error); + if (ret) { + /* succeeded, set to -1 since now no old value */ + manager->priv->kbd_brightness_old = -1; + } + } else { + g_debug ("keyboard toggle on"); + /* save the current value to restore later when untoggling */ + manager->priv->kbd_brightness_old = manager->priv->kbd_brightness_now; + ret = upower_kbd_set_brightness (manager, 0, error); + if (!ret) { + /* failed, reset back to -1 */ + manager->priv->kbd_brightness_old = -1; + } + } + + return ret; +} + +static void +do_lid_open_action (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-open", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been opened"), + NULL); + + /* ensure we turn the panel back on after lid open */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after lid open: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy != NULL && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_error_free (error); + } + } + + kill_lid_close_safety_timer (manager); +} + +static gboolean +is_on (GnomeRROutput *output) +{ + GnomeRRCrtc *crtc; + + crtc = gnome_rr_output_get_crtc (output); + if (!crtc) + return FALSE; + return gnome_rr_crtc_get_current_mode (crtc) != NULL; +} + +static gboolean +non_laptop_outputs_are_all_off (GnomeRRScreen *screen) +{ + GnomeRROutput **outputs; + int i; + + outputs = gnome_rr_screen_list_outputs (screen); + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_laptop (outputs[i])) + continue; + + if (is_on (outputs[i])) + return FALSE; + } + + return TRUE; +} + +/* Timeout callback used to check conditions when the laptop's lid is closed but + * the machine is not suspended yet. We try to suspend again, so that the laptop + * won't overheat if placed in a backpack. + */ +static gboolean +lid_close_safety_timer_cb (GsdPowerManager *manager) +{ + manager->priv->lid_close_safety_timer_id = 0; + + g_debug ("lid has been closed for a while; trying to suspend again"); + do_lid_closed_action (manager); + + return FALSE; +} + +/* Sets up a timer to be triggered some seconds after closing the laptop lid + * when the laptop is *not* suspended for some reason. We'll check conditions + * again in the timeout handler to see if we can suspend then. + */ +static void +setup_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) + return; + + manager->priv->lid_close_safety_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT, + (GSourceFunc) lid_close_safety_timer_cb, + manager); + g_source_set_name_by_id (manager->priv->lid_close_safety_timer_id, "[GsdPowerManager] lid close safety timer"); +} + +static void +kill_lid_close_safety_timer (GsdPowerManager *manager) +{ + if (manager->priv->lid_close_safety_timer_id != 0) { + g_source_remove (manager->priv->lid_close_safety_timer_id); + manager->priv->lid_close_safety_timer_id = 0; + } +} + +static void +suspend_with_lid_closed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + GsdPowerActionType action_type; + + /* we have different settings depending on AC state */ + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-battery-action"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "lid-close-ac-action"); + } + + /* check we won't melt when the lid is closed */ + if (action_type != GSD_POWER_ACTION_SUSPEND && + action_type != GSD_POWER_ACTION_HIBERNATE) { + if (up_client_get_lid_force_sleep (manager->priv->up_client)) { + g_warning ("to prevent damage, now forcing suspend"); + do_power_action_type (manager, GSD_POWER_ACTION_SUSPEND); + return; + } else { + /* maybe lock the screen if the lid is closed */ + lock_screensaver (manager); + } + } + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off after lid close: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + do_power_action_type (manager, action_type); +} + +static void +do_lid_closed_action (GsdPowerManager *manager) +{ + /* play a sound, using sounds from the naming spec */ + ca_context_play (manager->priv->canberra_context, 0, + CA_PROP_EVENT_ID, "lid-close", + /* TRANSLATORS: this is the sound description */ + CA_PROP_EVENT_DESCRIPTION, _("Lid has been closed"), + NULL); + + /* refresh RANDR so we get an accurate view of what monitors are plugged in when the lid is closed */ + gnome_rr_screen_refresh (manager->priv->x11_screen, NULL); /* NULL-GError */ + + /* perform policy action */ + if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor") + || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) { + g_debug ("lid is closed; suspending or hibernating"); + suspend_with_lid_closed (manager); + } else { + g_debug ("lid is closed; not suspending nor hibernating since some external monitor outputs are still active"); + setup_lid_close_safety_timer (manager); + } +} + + +static void +up_client_changed_cb (UpClient *client, GsdPowerManager *manager) +{ + gboolean tmp; + + if (!up_client_get_on_battery (client)) { + /* if we are playing a critical charge sound loop on AC, stop it */ + if (manager->priv->critical_alert_timeout_id > 0) { + g_debug ("stopping alert loop due to ac being present"); + play_loop_stop (manager); + } + notify_close_if_showing (manager->priv->notification_low); + } + + /* same state */ + tmp = up_client_get_lid_is_closed (manager->priv->up_client); + if (manager->priv->lid_is_closed == tmp) + return; + manager->priv->lid_is_closed = tmp; + + /* fake a keypress */ + if (tmp) + do_lid_closed_action (manager); + else + do_lid_open_action (manager); +} + +typedef enum { + SESSION_STATUS_CODE_AVAILABLE = 0, + SESSION_STATUS_CODE_INVISIBLE, + SESSION_STATUS_CODE_BUSY, + SESSION_STATUS_CODE_IDLE, + SESSION_STATUS_CODE_UNKNOWN +} SessionStatusCode; + +typedef enum { + SESSION_INHIBIT_MASK_LOGOUT = 1, + SESSION_INHIBIT_MASK_SWITCH = 2, + SESSION_INHIBIT_MASK_SUSPEND = 4, + SESSION_INHIBIT_MASK_IDLE = 8 +} SessionInhibitMask; + +static const gchar * +idle_mode_to_string (GsdPowerIdleMode mode) +{ + if (mode == GSD_POWER_IDLE_MODE_NORMAL) + return "normal"; + if (mode == GSD_POWER_IDLE_MODE_DIM) + return "dim"; + if (mode == GSD_POWER_IDLE_MODE_BLANK) + return "blank"; + if (mode == GSD_POWER_IDLE_MODE_SLEEP) + return "sleep"; + return "unknown"; +} + +static GnomeRROutput * +get_primary_output (GsdPowerManager *manager) +{ + GnomeRROutput *output = NULL; + GnomeRROutput **outputs; + guint i; + + /* search all X11 outputs for the device id */ + outputs = gnome_rr_screen_list_outputs (manager->priv->x11_screen); + if (outputs == NULL) + goto out; + + for (i = 0; outputs[i] != NULL; i++) { + if (gnome_rr_output_is_connected (outputs[i]) && + gnome_rr_output_is_laptop (outputs[i]) && + gnome_rr_output_get_backlight_min (outputs[i]) >= 0 && + gnome_rr_output_get_backlight_max (outputs[i]) > 0) { + output = outputs[i]; + break; + } + } +out: + return output; +} + +/** + * backlight_helper_get_value: + * + * Gets a brightness value from the PolicyKit helper. + * + * Return value: the signed integer value from the helper, or -1 + * for failure. If -1 then @error is set. + **/ +static gint64 +backlight_helper_get_value (const gchar *argument, GError **error) +{ + gboolean ret; + gchar *stdout_data = NULL; + gint exit_status = 0; + gint64 value = -1; + gchar *command = NULL; + gchar *endptr = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf (LIBEXECDIR "/gsd-backlight-helper --%s", + argument); + ret = g_spawn_command_line_sync (command, + &stdout_data, + NULL, + &exit_status, + error); + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret) + goto out; + + if (WEXITSTATUS (exit_status) != 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "gsd-backlight-helper failed: %s", + stdout_data ? stdout_data : "No reason"); + goto out; + } + + /* parse */ + value = g_ascii_strtoll (stdout_data, &endptr, 10); + + /* parsing error */ + if (endptr == stdout_data) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to parse value: %s", + stdout_data); + goto out; + } + + /* out of range */ + if (value > G_MAXINT) { + value = -1; + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value out of range: %s", + stdout_data); + goto out; + } + + /* Fetching the value failed, for some other reason */ + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "value negative, but helper did not fail: %s", + stdout_data); + goto out; + } + +out: + g_free (command); + g_free (stdout_data); + return value; +} + +/** + * backlight_helper_set_value: + * + * Sets a brightness value using the PolicyKit helper. + * + * Return value: Success. If FALSE then @error is set. + **/ +static gboolean +backlight_helper_set_value (const gchar *argument, + gint value, + GError **error) +{ + gboolean ret; + gint exit_status = 0; + gchar *command = NULL; + +#ifndef __linux__ + /* non-Linux platforms won't have /sys/class/backlight */ + g_set_error_literal (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "The sysfs backlight helper is only for Linux"); + goto out; +#endif + + /* get the data */ + command = g_strdup_printf ("pkexec " LIBEXECDIR "/gsd-backlight-helper --%s %i", + argument, value); + ret = g_spawn_command_line_sync (command, + NULL, + NULL, + &exit_status, + error); + + g_debug ("executed %s retval: %i", command, exit_status); + + if (!ret || WEXITSTATUS (exit_status) != 0) + goto out; + +out: + g_free (command); + return ret; +} + +static gint +backlight_get_abs (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + return gnome_rr_output_get_backlight (output, + error); + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-brightness", error); +} + +static gint +backlight_get_percentage (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gint now; + gint value = -1; + gint min = 0; + gint max; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + value = ABS_TO_PERCENTAGE (min, max, now); +out: + return value; +} + +static gint +backlight_get_min (GsdPowerManager *manager) +{ + GnomeRROutput *output; + + /* if we have no xbacklight device, then hardcode zero as sysfs + * offsets everything to 0 as min */ + output = get_primary_output (manager); + if (output == NULL) + return 0; + + /* get xbacklight value, which maybe non-zero */ + return gnome_rr_output_get_backlight_min (output); +} + +static gint +backlight_get_max (GsdPowerManager *manager, GError **error) +{ + gint value; + GnomeRROutput *output; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + value = gnome_rr_output_get_backlight_max (output); + if (value < 0) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "failed to get backlight max"); + } + return value; + } + + /* fall back to the polkit helper */ + return backlight_helper_get_value ("get-max-brightness", error); +} + +static void +backlight_emit_changed (GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* not yet connected to the bus */ + if (manager->priv->connection == NULL) + return; + ret = g_dbus_connection_emit_signal (manager->priv->connection, + GSD_DBUS_SERVICE, + GSD_POWER_DBUS_PATH, + GSD_POWER_DBUS_INTERFACE_SCREEN, + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit Changed: %s", error->message); + g_error_free (error); + } +} + +static gboolean +backlight_set_percentage (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint min = 0; + gint max; + guint discrete; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + if (min < 0 || max < 0) { + g_warning ("no xrandr backlight capability"); + goto out; + } + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + goto out; + } + + /* fall back to the polkit helper */ + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + discrete = PERCENTAGE_TO_ABS (min, max, value); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gint +backlight_step_up (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MIN (now + step, max); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_step_down (GsdPowerManager *manager, GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + gint percentage_value = -1; + gint min = 0; + gint max; + gint now; + gint step; + guint discrete; + GnomeRRCrtc *crtc; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + + crtc = gnome_rr_output_get_crtc (output); + if (crtc == NULL) { + g_set_error (error, + GSD_POWER_MANAGER_ERROR, + GSD_POWER_MANAGER_ERROR_FAILED, + "no crtc for %s", + gnome_rr_output_get_name (output)); + goto out; + } + min = gnome_rr_output_get_backlight_min (output); + max = gnome_rr_output_get_backlight_max (output); + now = gnome_rr_output_get_backlight (output, error); + if (now < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = gnome_rr_output_set_backlight (output, + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); + goto out; + } + + /* fall back to the polkit helper */ + now = backlight_helper_get_value ("get-brightness", error); + if (now < 0) + goto out; + max = backlight_helper_get_value ("get-max-brightness", error); + if (max < 0) + goto out; + step = BRIGHTNESS_STEP_AMOUNT (max - min + 1); + discrete = MAX (now - step, 0); + ret = backlight_helper_set_value ("set-brightness", + discrete, + error); + if (ret) + percentage_value = ABS_TO_PERCENTAGE (min, max, discrete); +out: + if (ret) + backlight_emit_changed (manager); + return percentage_value; +} + +static gint +backlight_set_abs (GsdPowerManager *manager, + guint value, + gboolean emit_changed, + GError **error) +{ + GnomeRROutput *output; + gboolean ret = FALSE; + + /* prefer xbacklight */ + output = get_primary_output (manager); + if (output != NULL) { + ret = gnome_rr_output_set_backlight (output, + value, + error); + goto out; + } + + /* fall back to the polkit helper */ + ret = backlight_helper_set_value ("set-brightness", + value, + error); +out: + if (ret && emit_changed) + backlight_emit_changed (manager); + return ret; +} + +static gboolean +display_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gint min; + gint max; + gint now; + gint idle; + gboolean ret = FALSE; + + now = backlight_get_abs (manager, error); + if (now < 0) { + goto out; + } + + /* is the dim brightness actually *dimmer* than the + * brightness we have now? */ + min = backlight_get_min (manager); + max = backlight_get_max (manager, error); + if (max < 0) { + goto out; + } + idle = PERCENTAGE_TO_ABS (min, max, idle_percentage); + if (idle > now) { + g_debug ("brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + ret = TRUE; + goto out; + } + ret = backlight_set_abs (manager, + idle, + FALSE, + error); + if (!ret) { + goto out; + } + + /* save for undim */ + manager->priv->pre_dim_brightness = now; + +out: + return ret; +} + +static gboolean +kbd_backlight_dim (GsdPowerManager *manager, + gint idle_percentage, + GError **error) +{ + gboolean ret; + gint idle; + gint max; + gint now; + + if (manager->priv->upower_kdb_proxy == NULL) + return TRUE; + + now = manager->priv->kbd_brightness_now; + max = manager->priv->kbd_brightness_max; + idle = PERCENTAGE_TO_ABS (0, max, idle_percentage); + if (idle > now) { + g_debug ("kbd brightness already now %i/%i, so " + "ignoring dim to %i/%i", + now, max, idle, max); + return TRUE; + } + ret = upower_kbd_set_brightness (manager, idle, error); + if (!ret) + return FALSE; + + /* save for undim */ + manager->priv->kbd_brightness_pre_dim = now; + return TRUE; +} + +static void +idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode) +{ + gboolean ret = FALSE; + GError *error = NULL; + gint idle_percentage; + GsdPowerActionType action_type; + GnomeSettingsSessionState state; + + if (mode == manager->priv->current_idle_mode) + return; + + /* Ignore attempts to set "less idle" modes */ + if (mode < manager->priv->current_idle_mode && + mode != GSD_POWER_IDLE_MODE_NORMAL) + return; + + /* ensure we're still on an active console */ + state = gnome_settings_session_get_state (manager->priv->session); + if (state == GNOME_SETTINGS_SESSION_STATE_INACTIVE) { + g_debug ("ignoring state transition to %s as inactive", + idle_mode_to_string (mode)); + return; + } + + manager->priv->current_idle_mode = mode; + g_debug ("Doing a state transition: %s", idle_mode_to_string (mode)); + + /* don't do any power saving if we're a VM */ + if (manager->priv->is_virtual_machine) { + g_debug ("ignoring state transition to %s as virtual machine", + idle_mode_to_string (mode)); + return; + } + + /* save current brightness, and set dim level */ + if (mode == GSD_POWER_IDLE_MODE_DIM) { + + /* have we disabled the action */ + if (up_client_get_on_battery (manager->priv->up_client)) { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-battery"); + } else { + ret = g_settings_get_boolean (manager->priv->settings, + "idle-dim-ac"); + } + if (!ret) { + g_debug ("not dimming due to policy"); + return; + } + + /* display backlight */ + idle_percentage = g_settings_get_int (manager->priv->settings, + "idle-brightness"); + ret = display_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* keyboard backlight */ + ret = kbd_backlight_dim (manager, idle_percentage, &error); + if (!ret) { + g_warning ("failed to set dim kbd backlight to %i%%: %s", + idle_percentage, + error->message); + g_clear_error (&error); + } + + /* turn off screen and kbd */ + } else if (mode == GSD_POWER_IDLE_MODE_BLANK) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_OFF, + &error); + if (!ret) { + g_warning ("failed to turn the panel off: %s", + error->message); + g_clear_error (&error); + } + + /* only toggle keyboard if present and not already toggled */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old == -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight off: %s", + error->message); + g_error_free (error); + } + } + + /* sleep */ + } else if (mode == GSD_POWER_IDLE_MODE_SLEEP) { + + if (up_client_get_on_battery (manager->priv->up_client)) { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-battery-type"); + } else { + action_type = g_settings_get_enum (manager->priv->settings, + "sleep-inactive-ac-type"); + } + do_power_action_type (manager, action_type); + + /* turn on screen and restore user-selected brightness level */ + } else if (mode == GSD_POWER_IDLE_MODE_NORMAL) { + + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on: %s", + error->message); + g_clear_error (&error); + } + + /* reset brightness if we dimmed */ + if (manager->priv->pre_dim_brightness >= 0) { + ret = backlight_set_abs (manager, + manager->priv->pre_dim_brightness, + FALSE, + &error); + if (!ret) { + g_warning ("failed to restore backlight to %i: %s", + manager->priv->pre_dim_brightness, + error->message); + g_clear_error (&error); + } else { + manager->priv->pre_dim_brightness = -1; + } + } + + /* only toggle keyboard if present and already toggled off */ + if (manager->priv->upower_kdb_proxy && + manager->priv->kbd_brightness_old != -1) { + ret = upower_kbd_toggle (manager, &error); + if (!ret) { + g_warning ("failed to turn the kbd backlight on: %s", + error->message); + g_clear_error (&error); + } + } + + /* reset kbd brightness if we dimmed */ + if (manager->priv->kbd_brightness_pre_dim >= 0) { + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_pre_dim, + &error); + if (!ret) { + g_warning ("failed to restore kbd backlight to %i: %s", + manager->priv->kbd_brightness_pre_dim, + error->message); + g_error_free (error); + } + manager->priv->kbd_brightness_pre_dim = -1; + } + + } +} + +static gboolean +idle_is_session_idle (GsdPowerManager *manager) +{ + gboolean ret; + GVariant *result; + guint status; + + /* not yet connected to gnome-session */ + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("session idleness not available, gnome-session is not available"); + return FALSE; + } + + /* get the session status */ + result = g_dbus_proxy_get_cached_property (manager->priv->session_presence_proxy, + "status"); + if (result == NULL) { + g_warning ("no readable status property on %s", + g_dbus_proxy_get_interface_name (manager->priv->session_presence_proxy)); + return FALSE; + } + + g_variant_get (result, "u", &status); + ret = (status == SESSION_STATUS_CODE_IDLE); + g_variant_unref (result); + + return ret; +} + +static gboolean +idle_is_session_inhibited (GsdPowerManager *manager, guint mask) +{ + gboolean ret; + GVariant *retval = NULL; + GError *error = NULL; + + /* not yet connected to gnome-session */ + if (manager->priv->session_proxy == NULL) { + g_warning ("session inhibition not available, gnome-session is not available"); + return FALSE; + } + + retval = g_dbus_proxy_call_sync (manager->priv->session_proxy, + "IsInhibited", + g_variant_new ("(u)", + mask), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, + &error); + if (retval == NULL) { + /* abort as the DBUS method failed */ + g_warning ("IsInhibited failed: %s", error->message); + g_error_free (error); + return FALSE; + } + + g_variant_get (retval, "(b)", &ret); + g_variant_unref (retval); + + return ret; +} + +/** + * idle_adjust_timeout: + * @idle_time: Current idle time, in seconds. + * @timeout: The new timeout we want to set, in seconds. + * + * On slow machines, or machines that have lots to load duing login, + * the current idle time could be bigger than the requested timeout. + * In this case the scheduled idle timeout will never fire, unless + * some user activity (keyboard, mouse) resets the current idle time. + * Instead of relying on user activity to correct this issue, we need + * to adjust timeout, as related to current idle time, so the idle + * timeout will fire as designed. + * + * Return value: timeout to set, adjusted acccording to current idle time. + **/ +static guint +idle_adjust_timeout (guint idle_time, guint timeout) +{ + /* allow 2 sec margin for messaging delay. */ + idle_time += 2; + + /* Double timeout until it's larger than current idle time. + * Give up for ultra slow machines. (86400 sec = 24 hours) */ + while (timeout < idle_time && + timeout < 86400 && + timeout > 0) { + timeout *= 2; + } + return timeout; +} + +/** + * idle_adjust_timeout_blank: + * @idle_time: current idle time, in seconds. + * @timeout: the new timeout we want to set, in seconds. + * + * Same as idle_adjust_timeout(), but also accounts for the duration + * of the fading animation in the screensaver (so that blanking happens + * exactly at the end of it, if configured with the same timeouts) + */ +static guint +idle_adjust_timeout_blank (guint idle_time, guint timeout) +{ + return idle_adjust_timeout (idle_time, + timeout + SCREENSAVER_FADE_TIME); +} + +static void +idle_configure (GsdPowerManager *manager) +{ + gboolean is_idle_inhibited; + guint current_idle_time; + guint timeout_blank; + guint timeout_sleep; + gboolean on_battery; + + /* are we inhibited from going idle */ + is_idle_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_IDLE); + if (is_idle_inhibited) { + g_debug ("inhibited, so using normal state"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); + + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + return; + } + + current_idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + + /* set up blank callback even when session is not idle, + * but only if we actually want to blank. */ + on_battery = up_client_get_on_battery (manager->priv->up_client); + if (on_battery) { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-battery"); + } else { + timeout_blank = g_settings_get_int (manager->priv->settings, + "sleep-display-ac"); + } + if (timeout_blank != 0) { + g_debug ("setting up blank callback for %is", timeout_blank); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID, + idle_adjust_timeout_blank (current_idle_time, timeout_blank) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_BLANK_ID); + } + + /* only do the sleep timeout when the session is idle + * and we aren't inhibited from sleeping */ + if (on_battery) { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-battery-timeout"); + } else { + timeout_sleep = g_settings_get_int (manager->priv->settings, + "sleep-inactive-ac-timeout"); + } + if (timeout_sleep != 0) { + g_debug ("setting up sleep callback %is", timeout_sleep); + + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID, + idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_SLEEP_ID); + } +} + +/** + * @timeout: The new timeout we want to set, in seconds + **/ +static gboolean +idle_set_timeout_dim (GsdPowerManager *manager, guint timeout) +{ + guint idle_time; + + idle_time = gpm_idletime_get_time (manager->priv->idletime) / 1000; + if (idle_time == 0) + return FALSE; + + g_debug ("Setting dim idle timeout: %ds", timeout); + if (timeout > 0) { + gpm_idletime_alarm_set (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID, + idle_adjust_timeout (idle_time, timeout) * 1000); + } else { + gpm_idletime_alarm_remove (manager->priv->idletime, + GSD_POWER_IDLETIME_DIM_ID); + } + return TRUE; +} + +static void +refresh_idle_dim_settings (GsdPowerManager *manager) +{ + gint timeout_dim; + timeout_dim = g_settings_get_int (manager->priv->settings, + "idle-dim-time"); + g_debug ("idle dim set with timeout %i", timeout_dim); + idle_set_timeout_dim (manager, timeout_dim); +} + +static void +gsd_power_manager_class_init (GsdPowerManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_power_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPowerManagerPrivate)); +} + +static void +sleep_cb_screensaver_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->screensaver_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->screensaver_proxy == NULL) { + g_warning ("Could not connect to gnome-screensaver: %s", + error->message); + g_error_free (error); + return; + } + + /* Finish the upower_notify_sleep_cb() call by locking the screen */ + g_debug ("gnome-screensaver activated, doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); +} + +static void +idle_dbus_signal_cb (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + if (g_strcmp0 (signal_name, "InhibitorAdded") == 0 || + g_strcmp0 (signal_name, "InhibitorRemoved") == 0) { + g_debug ("Received gnome session inhibitor change"); + idle_configure (manager); + } + if (g_strcmp0 (signal_name, "StatusChanged") == 0) { + guint status; + + g_variant_get (parameters, "(u)", &status); + g_dbus_proxy_set_cached_property (proxy, "status", + g_variant_new ("u", status)); + g_debug ("Received gnome session status change"); + idle_configure (manager); + } +} + +static void +session_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_proxy == NULL) { + g_warning ("Could not connect to gnome-session: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (manager->priv->session_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); + } + + idle_configure (manager); +} + +static void +session_presence_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->session_presence_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->session_presence_proxy == NULL) { + g_warning ("Could not connect to gnome-sesson: %s", + error->message); + g_error_free (error); + return; + } + g_signal_connect (manager->priv->session_presence_proxy, "g-signal", + G_CALLBACK (idle_dbus_signal_cb), manager); +} + +static void +power_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + } +} + +static void +power_keyboard_proxy_ready_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GVariant *k_now = NULL; + GVariant *k_max = NULL; + GError *error = NULL; + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + manager->priv->upower_kdb_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + if (manager->priv->upower_kdb_proxy == NULL) { + g_warning ("Could not connect to UPower: %s", + error->message); + g_error_free (error); + goto out; + } + + k_now = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_now == NULL) { + if (error->domain != G_DBUS_ERROR || + error->code != G_DBUS_ERROR_UNKNOWN_METHOD) { + g_warning ("Failed to get brightness: %s", + error->message); + } + g_error_free (error); + goto out; + } + + k_max = g_dbus_proxy_call_sync (manager->priv->upower_kdb_proxy, + "GetMaxBrightness", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (k_max == NULL) { + g_warning ("Failed to get max brightness: %s", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (k_now, "(i)", &manager->priv->kbd_brightness_now); + g_variant_get (k_max, "(i)", &manager->priv->kbd_brightness_max); + + /* set brightness to max if not currently set so is something + * sensible */ + if (manager->priv->kbd_brightness_now <= 0) { + gboolean ret; + ret = upower_kbd_set_brightness (manager, + manager->priv->kbd_brightness_max, + &error); + if (!ret) { + g_warning ("failed to initialize kbd backlight to %i: %s", + manager->priv->kbd_brightness_max, + error->message); + g_error_free (error); + } + } +out: + if (k_now != NULL) + g_variant_unref (k_now); + if (k_max != NULL) + g_variant_unref (k_max); +} + +static void +lock_screensaver (GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "lock-enabled"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_sleep_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean do_lock; + + do_lock = g_settings_get_boolean (manager->priv->settings_screensaver, + "ubuntu-lock-on-suspend"); + if (!do_lock) + return; + + if (manager->priv->screensaver_proxy != NULL) { + g_debug ("doing gnome-screensaver lock"); + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, -1, + NULL, NULL, NULL); + } else { + /* connect to the screensaver first */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GS_DBUS_NAME, + GS_DBUS_PATH, + GS_DBUS_INTERFACE, + NULL, + sleep_cb_screensaver_proxy_ready_cb, + manager); + } +} + +static void +upower_notify_resume_cb (UpClient *client, + UpSleepKind sleep_kind, + GsdPowerManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* this displays the unlock dialogue so the user doesn't have + * to move the mouse or press any key before the window comes up */ + if (manager->priv->screensaver_proxy != NULL) { + g_dbus_proxy_call (manager->priv->screensaver_proxy, + "SimulateUserActivity", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + } + + /* close existing notifications on resume, the system power + * state is probably different now */ + notify_close_if_showing (manager->priv->notification_low); + notify_close_if_showing (manager->priv->notification_discharging); + + /* ensure we turn the panel back on after resume */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + &error); + if (!ret) { + g_warning ("failed to turn the panel on after resume: %s", + error->message); + g_error_free (error); + } +} + +static void +idle_send_to_sleep (GsdPowerManager *manager) +{ + gboolean is_inhibited; + gboolean is_idle; + + /* check the session is not now inhibited */ + is_inhibited = idle_is_session_inhibited (manager, + SESSION_INHIBIT_MASK_SUSPEND); + if (is_inhibited) { + g_debug ("suspend inhibited"); + return; + } + + /* check the session is really idle*/ + is_idle = idle_is_session_idle (manager); + if (!is_idle) { + g_debug ("session is not idle, cannot SLEEP"); + return; + } + + /* send to sleep, and cancel timeout */ + g_debug ("sending to SLEEP"); + idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP); +} + +static void +idle_idletime_alarm_expired_cb (GpmIdletime *idletime, + guint alarm_id, + GsdPowerManager *manager) +{ + g_debug ("idletime alarm: %i", alarm_id); + + switch (alarm_id) { + case GSD_POWER_IDLETIME_DIM_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM); + break; + case GSD_POWER_IDLETIME_BLANK_ID: + idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK); + break; + case GSD_POWER_IDLETIME_SLEEP_ID: + idle_send_to_sleep (manager); + break; + } +} + +static void +idle_idletime_reset_cb (GpmIdletime *idletime, + GsdPowerManager *manager) +{ + g_debug ("idletime reset"); + + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +static void +engine_settings_key_changed_cb (GSettings *settings, + const gchar *key, + GsdPowerManager *manager) +{ + if (g_strcmp0 (key, "use-time-for-policy") == 0) { + manager->priv->use_time_primary = g_settings_get_boolean (settings, key); + return; + } + if (g_strcmp0 (key, "idle-dim-time") == 0) { + refresh_idle_dim_settings (manager); + return; + } + if (g_str_has_prefix (key, "sleep-inactive") || + g_str_has_prefix (key, "sleep-display")) { + idle_configure (manager); + return; + } +} + +static void +engine_session_active_changed_cb (GnomeSettingsSession *session, + GParamSpec *pspec, + GsdPowerManager *manager) +{ + /* when doing the fast-user-switch into a new account, + * ensure the new account is undimmed and with the backlight on */ + idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL); +} + +/* This timer goes off every few minutes, whether the user is idle or not, + to try and clean up anything that has gone wrong. + + It calls disable_builtin_screensaver() so that if xset has been used, + or some other program (like xlock) has messed with the XSetScreenSaver() + settings, they will be set back to sensible values (if a server extension + is in use, messing with xlock can cause the screensaver to never get a wakeup + event, and could cause monitor power-saving to occur, and all manner of + heinousness.) + + This code was originally part of gnome-screensaver, see + http://git.gnome.org/browse/gnome-screensaver/tree/src/gs-watcher-x11.c?id=fec00b12ec46c86334cfd36b37771cc4632f0d4d#n530 + */ +static gboolean +disable_builtin_screensaver (gpointer unused) +{ + int current_server_timeout, current_server_interval; + int current_prefer_blank, current_allow_exp; + int desired_server_timeout, desired_server_interval; + int desired_prefer_blank, desired_allow_exp; + + XGetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + ¤t_server_timeout, + ¤t_server_interval, + ¤t_prefer_blank, + ¤t_allow_exp); + + desired_server_timeout = current_server_timeout; + desired_server_interval = current_server_interval; + desired_prefer_blank = current_prefer_blank; + desired_allow_exp = current_allow_exp; + + desired_server_interval = 0; + + /* I suspect (but am not sure) that DontAllowExposures might have + something to do with powering off the monitor as well, at least + on some systems that don't support XDPMS? Who know... */ + desired_allow_exp = AllowExposures; + + /* When we're not using an extension, set the server-side timeout to 0, + so that the server never gets involved with screen blanking, and we + do it all ourselves. (However, when we *are* using an extension, + we tell the server when to notify us, and rather than blanking the + screen, the server will send us an X event telling us to blank.) + */ + desired_server_timeout = 0; + + if (desired_server_timeout != current_server_timeout + || desired_server_interval != current_server_interval + || desired_prefer_blank != current_prefer_blank + || desired_allow_exp != current_allow_exp) { + + g_debug ("disabling server builtin screensaver:" + " (xset s %d %d; xset s %s; xset s %s)", + desired_server_timeout, + desired_server_interval, + (desired_prefer_blank ? "blank" : "noblank"), + (desired_allow_exp ? "expose" : "noexpose")); + + XSetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + desired_server_timeout, + desired_server_interval, + desired_prefer_blank, + desired_allow_exp); + + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE); + } + + return TRUE; +} + +static gboolean +is_hardware_a_virtual_machine (void) +{ + const gchar *str; + gboolean ret = FALSE; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.systemd1", + "/org/freedesktop/systemd1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.systemd1.Manager", + "Virtualization"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Virtualization", error->message); + g_error_free (error); + goto out; + } + + /* on bare-metal hardware this is the empty string, + * otherwise an identifier such as "kvm", "vmware", etc. */ + g_variant_get (variant, "(v)", &inner); + str = g_variant_get_string (inner, NULL); + if (str != NULL && str[0] != '\0') + ret = TRUE; +out: + if (connection != NULL) + g_object_unref (connection); + if (variant != NULL) + g_variant_unref (variant); + return ret; +} + +gboolean +gsd_power_manager_start (GsdPowerManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting power manager"); + gnome_settings_profile_start (NULL); + + /* coldplug the list of screens */ + manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error); + if (manager->priv->x11_screen == NULL) + return FALSE; + + /* track the active session */ + manager->priv->session = gnome_settings_session_new (); + g_signal_connect (manager->priv->session, "notify::state", + G_CALLBACK (engine_session_active_changed_cb), + manager); + + manager->priv->kbd_brightness_old = -1; + manager->priv->kbd_brightness_pre_dim = -1; + manager->priv->pre_dim_brightness = -1; + manager->priv->settings = g_settings_new (GSD_POWER_SETTINGS_SCHEMA); + g_signal_connect (manager->priv->settings, "changed", + G_CALLBACK (engine_settings_key_changed_cb), manager); + manager->priv->settings_screensaver = g_settings_new ("org.gnome.desktop.screensaver"); + manager->priv->up_client = up_client_new (); + g_signal_connect (manager->priv->up_client, "notify-sleep", + G_CALLBACK (upower_notify_sleep_cb), manager); + g_signal_connect (manager->priv->up_client, "notify-resume", + G_CALLBACK (upower_notify_resume_cb), manager); + manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client); + g_signal_connect (manager->priv->up_client, "device-added", + G_CALLBACK (engine_device_added_cb), manager); + g_signal_connect (manager->priv->up_client, "device-removed", + G_CALLBACK (engine_device_removed_cb), manager); + g_signal_connect (manager->priv->up_client, "device-changed", + G_CALLBACK (engine_device_changed_cb), manager); + g_signal_connect_after (manager->priv->up_client, "changed", + G_CALLBACK (up_client_changed_cb), manager); + + /* use the fallback name from gnome-power-manager so the shell + * blocks this, and uses the power extension instead */ + manager->priv->status_icon = gtk_status_icon_new (); + gtk_status_icon_set_name (manager->priv->status_icon, + "gnome-power-manager"); + /* TRANSLATORS: this is the title of the power manager status icon + * that is only shown in fallback mode */ + gtk_status_icon_set_title (manager->priv->status_icon, _("Power Manager")); + gtk_status_icon_set_visible (manager->priv->status_icon, FALSE); + + /* connect to UPower for async power operations */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH, + UPOWER_DBUS_INTERFACE, + NULL, + power_proxy_ready_cb, + manager); + + /* connect to UPower for keyboard backlight control */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + UPOWER_DBUS_NAME, + UPOWER_DBUS_PATH_KBDBACKLIGHT, + UPOWER_DBUS_INTERFACE_KBDBACKLIGHT, + NULL, + power_keyboard_proxy_ready_cb, + manager); + + /* connect to the session */ + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + session_proxy_ready_cb, + manager); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + 0, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH_PRESENCE, + GNOME_SESSION_DBUS_INTERFACE_PRESENCE, + NULL, + session_presence_proxy_ready_cb, + manager); + + manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref); + manager->priv->canberra_context = ca_gtk_context_get_for_screen (gdk_screen_get_default ()); + + manager->priv->phone = gpm_phone_new (); + g_signal_connect (manager->priv->phone, "device-added", + G_CALLBACK (phone_device_added_cb), manager); + g_signal_connect (manager->priv->phone, "device-removed", + G_CALLBACK (phone_device_removed_cb), manager); + g_signal_connect (manager->priv->phone, "device-refresh", + G_CALLBACK (phone_device_refresh_cb), manager); + + /* create a fake virtual composite battery */ + manager->priv->device_composite = up_device_new (); + g_object_set (manager->priv->device_composite, + "kind", UP_DEVICE_KIND_BATTERY, + "is-rechargeable", TRUE, + "native-path", "dummy:composite_battery", + "power-supply", TRUE, + "is-present", TRUE, + NULL); + + /* get percentage policy */ + manager->priv->low_percentage = g_settings_get_int (manager->priv->settings, + "percentage-low"); + manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings, + "percentage-critical"); + manager->priv->action_percentage = g_settings_get_int (manager->priv->settings, + "percentage-action"); + + /* get time policy */ + manager->priv->low_time = g_settings_get_int (manager->priv->settings, + "time-low"); + manager->priv->critical_time = g_settings_get_int (manager->priv->settings, + "time-critical"); + manager->priv->action_time = g_settings_get_int (manager->priv->settings, + "time-action"); + + /* we can disable this if the time remaining is inaccurate or just plain wrong */ + manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings, + "use-time-for-policy"); + + /* create IDLETIME watcher */ + manager->priv->idletime = gpm_idletime_new (); + g_signal_connect (manager->priv->idletime, "reset", + G_CALLBACK (idle_idletime_reset_cb), manager); + g_signal_connect (manager->priv->idletime, "alarm-expired", + G_CALLBACK (idle_idletime_alarm_expired_cb), manager); + + /* ensure the default dpms timeouts are cleared */ + ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen, + GNOME_RR_DPMS_ON, + error); + if (!ret) { + g_warning ("Failed set DPMS mode: %s", (*error)->message); + g_clear_error (error); + } + + /* coldplug the engine */ + engine_coldplug (manager); + + /* set the initial dim time that can adapt for the user */ + refresh_idle_dim_settings (manager); + + manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT, + disable_builtin_screensaver, + NULL); + /* don't blank inside a VM */ + manager->priv->is_virtual_machine = is_hardware_a_virtual_machine (); + + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_power_manager_stop (GsdPowerManager *manager) +{ + g_debug ("Stopping power manager"); + + if (manager->priv->bus_cancellable != NULL) { + g_cancellable_cancel (manager->priv->bus_cancellable); + g_object_unref (manager->priv->bus_cancellable); + manager->priv->bus_cancellable = NULL; + } + + if (manager->priv->introspection_data) { + g_dbus_node_info_unref (manager->priv->introspection_data); + manager->priv->introspection_data = NULL; + } + + kill_lid_close_safety_timer (manager); + + g_signal_handlers_disconnect_by_data (manager->priv->up_client, manager); + + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->session); + g_clear_object (&manager->priv->settings); + g_clear_object (&manager->priv->settings_screensaver); + g_clear_object (&manager->priv->up_client); + g_clear_object (&manager->priv->x11_screen); + + g_ptr_array_unref (manager->priv->devices_array); + manager->priv->devices_array = NULL; + g_clear_object (&manager->priv->phone); + g_clear_object (&manager->priv->device_composite); + g_clear_object (&manager->priv->previous_icon); + + g_free (manager->priv->previous_summary); + manager->priv->previous_summary = NULL; + + g_clear_object (&manager->priv->upower_proxy); + g_clear_object (&manager->priv->session_proxy); + g_clear_object (&manager->priv->session_presence_proxy); + + if (manager->priv->critical_alert_timeout_id > 0) { + g_source_remove (manager->priv->critical_alert_timeout_id); + manager->priv->critical_alert_timeout_id = 0; + } + g_signal_handlers_disconnect_by_func (manager->priv->idletime, + idle_idletime_reset_cb, + manager); + g_signal_handlers_disconnect_by_func (manager->priv->idletime, + idle_idletime_alarm_expired_cb, + manager); + + g_clear_object (&manager->priv->idletime); + g_clear_object (&manager->priv->status_icon); + + if (manager->priv->xscreensaver_watchdog_timer_id > 0) { + g_source_remove (manager->priv->xscreensaver_watchdog_timer_id); + manager->priv->xscreensaver_watchdog_timer_id = 0; + } +} + +static void +gsd_power_manager_init (GsdPowerManager *manager) +{ + manager->priv = GSD_POWER_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_power_manager_finalize (GObject *object) +{ + GsdPowerManager *manager; + + manager = GSD_POWER_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + + G_OBJECT_CLASS (gsd_power_manager_parent_class)->finalize (object); +} + +/* returns new level */ +static void +handle_method_call_keyboard (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gint step; + gint value = -1; + gboolean ret; + guint percentage; + GError *error = NULL; + + if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("keyboard step up"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MIN (manager->priv->kbd_brightness_now + step, + manager->priv->kbd_brightness_max); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("keyboard step down"); + step = BRIGHTNESS_STEP_AMOUNT (manager->priv->kbd_brightness_max); + value = MAX (manager->priv->kbd_brightness_now - step, 0); + ret = upower_kbd_set_brightness (manager, value, &error); + + } else if (g_strcmp0 (method_name, "Toggle") == 0) { + ret = upower_kbd_toggle (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (!ret) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + percentage = ABS_TO_PERCENTAGE (0, + manager->priv->kbd_brightness_max, + value); + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + percentage)); + } +} + +static void +handle_method_call_screen (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + gboolean ret = FALSE; + gint value = -1; + guint value_tmp; + GError *error = NULL; + + if (g_strcmp0 (method_name, "GetPercentage") == 0) { + g_debug ("screen get percentage"); + value = backlight_get_percentage (manager, &error); + + } else if (g_strcmp0 (method_name, "SetPercentage") == 0) { + g_debug ("screen set percentage"); + g_variant_get (parameters, "(u)", &value_tmp); + ret = backlight_set_percentage (manager, value_tmp, TRUE, &error); + if (ret) + value = value_tmp; + + } else if (g_strcmp0 (method_name, "StepUp") == 0) { + g_debug ("screen step up"); + value = backlight_step_up (manager, &error); + } else if (g_strcmp0 (method_name, "StepDown") == 0) { + g_debug ("screen step down"); + value = backlight_step_down (manager, &error); + } else { + g_assert_not_reached (); + } + + /* return value */ + if (value < 0) { + g_dbus_method_invocation_return_gerror (invocation, + error); + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(u)", + value)); + } +} + +static GVariant * +device_to_variant_blob (UpDevice *device) +{ + const gchar *object_path; + gchar *device_icon; + gdouble percentage; + GIcon *icon; + guint64 time_empty, time_full; + guint64 time_state = 0; + GVariant *value; + UpDeviceKind kind; + UpDeviceState state; + + icon = gpm_upower_get_device_icon (device, TRUE); + device_icon = g_icon_to_string (icon); + g_object_get (device, + "kind", &kind, + "percentage", &percentage, + "state", &state, + "time-to-empty", &time_empty, + "time-to-full", &time_full, + NULL); + + /* only return time for these simple states */ + if (state == UP_DEVICE_STATE_DISCHARGING) + time_state = time_empty; + else if (state == UP_DEVICE_STATE_CHARGING) + time_state = time_full; + + /* get an object path, even for the composite device */ + object_path = up_device_get_object_path (device); + if (object_path == NULL) + object_path = GSD_DBUS_PATH; + + /* format complex object */ + value = g_variant_new ("(susdut)", + object_path, + kind, + device_icon, + percentage, + state, + time_state); + g_free (device_icon); + g_object_unref (icon); + return value; +} + +static void +handle_method_call_main (GsdPowerManager *manager, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GPtrArray *array; + guint i; + GVariantBuilder *builder; + GVariant *tuple = NULL; + GVariant *value = NULL; + UpDevice *device; + + /* return object */ + if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) { + + /* get the virtual device */ + device = engine_get_primary_device (manager); + if (device == NULL) { + g_dbus_method_invocation_return_dbus_error (invocation, + "org.gnome.SettingsDaemon.Power.Failed", + "There is no primary device."); + return; + } + + /* return the value */ + value = device_to_variant_blob (device); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_object_unref (device); + return; + } + + /* return array */ + if (g_strcmp0 (method_name, "GetDevices") == 0) { + + /* create builder */ + builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)")); + + /* add each tuple to the array */ + array = manager->priv->devices_array; + for (i=0; ilen; i++) { + device = g_ptr_array_index (array, i); + value = device_to_variant_blob (device); + g_variant_builder_add_value (builder, value); + } + + /* return the value */ + value = g_variant_builder_end (builder); + tuple = g_variant_new_tuple (&value, 1); + g_dbus_method_invocation_return_value (invocation, tuple); + g_variant_builder_unref (builder); + return; + } + + g_assert_not_reached (); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for Power", + interface_name, method_name); + + if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE) == 0) { + handle_method_call_main (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_SCREEN) == 0) { + handle_method_call_screen (manager, + method_name, + parameters, + invocation); + } else if (g_strcmp0 (interface_name, GSD_POWER_DBUS_INTERFACE_KEYBOARD) == 0) { + handle_method_call_keyboard (manager, + method_name, + parameters, + invocation); + } else { + g_warning ("not recognised interface: %s", interface_name); + } +} + +static GVariant * +handle_get_property (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, gpointer user_data) +{ + GsdPowerManager *manager = GSD_POWER_MANAGER (user_data); + GVariant *retval = NULL; + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return NULL; + } + + if (g_strcmp0 (property_name, "Icon") == 0) { + retval = engine_get_icon_property_variant (manager); + } else if (g_strcmp0 (property_name, "Tooltip") == 0) { + retval = engine_get_tooltip_property_variant (manager); + } + + return retval; +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdPowerManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + guint i; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + for (i = 0; infos[i] != NULL; i++) { + g_dbus_connection_register_object (connection, + GSD_POWER_DBUS_PATH, + infos[i], + &interface_vtable, + manager, + NULL, + NULL); + } +} + +static void +register_manager_dbus (GsdPowerManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +GsdPowerManager * +gsd_power_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_POWER_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + return GSD_POWER_MANAGER (manager_object); +} diff --git a/plugins/power/gsd-power-manager.h b/plugins/power/gsd-power-manager.h new file mode 100644 index 00000000..3440faf0 --- /dev/null +++ b/plugins/power/gsd-power-manager.h @@ -0,0 +1,64 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_POWER_MANAGER_H +#define __GSD_POWER_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_POWER_MANAGER (gsd_power_manager_get_type ()) +#define GSD_POWER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManager)) +#define GSD_POWER_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_POWER_MANAGER, GsdPowerManagerClass)) +#define GSD_IS_POWER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_POWER_MANAGER)) +#define GSD_IS_POWER_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_POWER_MANAGER)) +#define GSD_POWER_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_POWER_MANAGER, GsdPowerManagerClass)) +#define GSD_POWER_MANAGER_ERROR (gsd_power_manager_error_quark ()) + +typedef struct GsdPowerManagerPrivate GsdPowerManagerPrivate; + +typedef struct +{ + GObject parent; + GsdPowerManagerPrivate *priv; +} GsdPowerManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdPowerManagerClass; + +enum +{ + GSD_POWER_MANAGER_ERROR_FAILED +}; + +GType gsd_power_manager_get_type (void); +GQuark gsd_power_manager_error_quark (void); + +GsdPowerManager * gsd_power_manager_new (void); +gboolean gsd_power_manager_start (GsdPowerManager *manager, + GError **error); +void gsd_power_manager_stop (GsdPowerManager *manager); + +G_END_DECLS + +#endif /* __GSD_POWER_MANAGER_H */ diff --git a/plugins/power/gsd-power-plugin.c b/plugins/power/gsd-power-plugin.c new file mode 100644 index 00000000..66260878 --- /dev/null +++ b/plugins/power/gsd-power-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-power-plugin.h" +#include "gsd-power-manager.h" + +struct GsdPowerPluginPrivate { + GsdPowerManager *manager; +}; + +#define GSD_POWER_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_POWER_PLUGIN, GsdPowerPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdPowerPlugin, gsd_power_plugin) + +static void +gsd_power_plugin_init (GsdPowerPlugin *plugin) +{ + plugin->priv = GSD_POWER_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdPowerPlugin initializing"); + + plugin->priv->manager = gsd_power_manager_new (); +} + +static void +gsd_power_plugin_finalize (GObject *object) +{ + GsdPowerPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_POWER_PLUGIN (object)); + + g_debug ("GsdPowerPlugin finalizing"); + + plugin = GSD_POWER_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_power_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating power plugin"); + + error = NULL; + res = gsd_power_manager_start (GSD_POWER_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start power manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating power plugin"); + gsd_power_manager_stop (GSD_POWER_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_power_plugin_class_init (GsdPowerPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_power_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdPowerPluginPrivate)); +} diff --git a/plugins/power/gsd-power-plugin.h b/plugins/power/gsd-power-plugin.h new file mode 100644 index 00000000..1fc3aefc --- /dev/null +++ b/plugins/power/gsd-power-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_POWER_PLUGIN_H__ +#define __GSD_POWER_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_POWER_PLUGIN (gsd_power_plugin_get_type ()) +#define GSD_POWER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_POWER_PLUGIN, GsdPowerPlugin)) +#define GSD_POWER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_POWER_PLUGIN, GsdPowerPluginClass)) +#define GSD_IS_POWER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_POWER_PLUGIN)) +#define GSD_IS_POWER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_POWER_PLUGIN)) +#define GSD_POWER_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_POWER_PLUGIN, GsdPowerPluginClass)) + +typedef struct GsdPowerPluginPrivate GsdPowerPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdPowerPluginPrivate *priv; +} GsdPowerPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdPowerPluginClass; + +GType gsd_power_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_POWER_PLUGIN_H__ */ diff --git a/plugins/power/org.gnome.settings-daemon.plugins.power.policy.in.in b/plugins/power/org.gnome.settings-daemon.plugins.power.policy.in.in new file mode 100644 index 00000000..5adbc419 --- /dev/null +++ b/plugins/power/org.gnome.settings-daemon.plugins.power.policy.in.in @@ -0,0 +1,32 @@ + + + + + + + GNOME Settings Daemon + http://git.gnome.org/browse/gnome-settings-daemon + battery + + + + <_description>Modify the laptop brightness + <_message>Authentication is required to modify the laptop brightness + + no + no + yes + + @libexecdir@/gsd-backlight-helper + + + + diff --git a/plugins/power/power.gnome-settings-plugin.in b/plugins/power/power.gnome-settings-plugin.in new file mode 100644 index 00000000..8c39e7b7 --- /dev/null +++ b/plugins/power/power.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=power +IAge=0 +_Name=Power +_Description=Power plugin +Authors=Richard Hughes +Copyright=Copyright © 2011 Richard Hughes +Website= diff --git a/plugins/power/test-power.c b/plugins/power/test-power.c new file mode 100644 index 00000000..b4f54e34 --- /dev/null +++ b/plugins/power/test-power.c @@ -0,0 +1,7 @@ +#define NEW gsd_power_manager_new +#define START gsd_power_manager_start +#define STOP gsd_power_manager_stop +#define MANAGER GsdPowerManager +#include "gsd-power-manager.h" + +#include "test-plugin.h" diff --git a/plugins/print-notifications/Makefile.am b/plugins/print-notifications/Makefile.am new file mode 100644 index 00000000..4fc0d058 --- /dev/null +++ b/plugins/print-notifications/Makefile.am @@ -0,0 +1,86 @@ +plugin_name = print-notifications + +plugin_LTLIBRARIES = \ + libprint-notifications.la + +libprint_notifications_la_SOURCES = \ + gsd-print-notifications-manager.c \ + gsd-print-notifications-manager.h \ + gsd-print-notifications-plugin.c \ + gsd-print-notifications-plugin.h + +libprint_notifications_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +libprint_notifications_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libprint_notifications_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libprint_notifications_la_LIBADD = \ + $(CUPS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + print-notifications.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +libexec_PROGRAMS = gsd-printer + +gsd_printer_SOURCES = \ + gsd-printer.c + +gsd_printer_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CFLAGS) + +gsd_printer_LDADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(CUPS_LIBS) \ + $(LIBNOTIFY_LIBS) + +libexec_PROGRAMS += gsd-test-print-notifications + +gsd_test_print_notifications_SOURCES = \ + gsd-print-notifications-manager.c \ + gsd-print-notifications-manager.h \ + test-print-notifications.c + +gsd_test_print_notifications_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +gsd_test_print_notifications_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_print_notifications_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(CUPS_LIBS) \ + $(LIBNOTIFY_LIBS) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/print-notifications/Makefile.in b/plugins/print-notifications/Makefile.in new file mode 100644 index 00000000..727cb443 --- /dev/null +++ b/plugins/print-notifications/Makefile.in @@ -0,0 +1,949 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-printer$(EXEEXT) \ + gsd-test-print-notifications$(EXEEXT) +subdir = plugins/print-notifications +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libprint_notifications_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libprint_notifications_la_OBJECTS = \ + libprint_notifications_la-gsd-print-notifications-manager.lo \ + libprint_notifications_la-gsd-print-notifications-plugin.lo +libprint_notifications_la_OBJECTS = \ + $(am_libprint_notifications_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libprint_notifications_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libprint_notifications_la_CFLAGS) $(CFLAGS) \ + $(libprint_notifications_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_printer_OBJECTS = gsd_printer-gsd-printer.$(OBJEXT) +gsd_printer_OBJECTS = $(am_gsd_printer_OBJECTS) +gsd_printer_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_printer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(gsd_printer_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_gsd_test_print_notifications_OBJECTS = gsd_test_print_notifications-gsd-print-notifications-manager.$(OBJEXT) \ + gsd_test_print_notifications-test-print-notifications.$(OBJEXT) +gsd_test_print_notifications_OBJECTS = \ + $(am_gsd_test_print_notifications_OBJECTS) +gsd_test_print_notifications_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_print_notifications_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libprint_notifications_la_SOURCES) $(gsd_printer_SOURCES) \ + $(gsd_test_print_notifications_SOURCES) +DIST_SOURCES = $(libprint_notifications_la_SOURCES) \ + $(gsd_printer_SOURCES) $(gsd_test_print_notifications_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = print-notifications +plugin_LTLIBRARIES = \ + libprint-notifications.la + +libprint_notifications_la_SOURCES = \ + gsd-print-notifications-manager.c \ + gsd-print-notifications-manager.h \ + gsd-print-notifications-plugin.c \ + gsd-print-notifications-plugin.h + +libprint_notifications_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +libprint_notifications_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libprint_notifications_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libprint_notifications_la_LIBADD = \ + $(CUPS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = \ + print-notifications.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +gsd_printer_SOURCES = \ + gsd-printer.c + +gsd_printer_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(LIBNOTIFY_CFLAGS) \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CFLAGS) + +gsd_printer_LDADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(CUPS_LIBS) \ + $(LIBNOTIFY_LIBS) + +gsd_test_print_notifications_SOURCES = \ + gsd-print-notifications-manager.c \ + gsd-print-notifications-manager.h \ + test-print-notifications.c + +gsd_test_print_notifications_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +gsd_test_print_notifications_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_print_notifications_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(CUPS_LIBS) \ + $(LIBNOTIFY_LIBS) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/print-notifications/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/print-notifications/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libprint-notifications.la: $(libprint_notifications_la_OBJECTS) $(libprint_notifications_la_DEPENDENCIES) $(EXTRA_libprint_notifications_la_DEPENDENCIES) + $(AM_V_CCLD)$(libprint_notifications_la_LINK) -rpath $(plugindir) $(libprint_notifications_la_OBJECTS) $(libprint_notifications_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-printer$(EXEEXT): $(gsd_printer_OBJECTS) $(gsd_printer_DEPENDENCIES) $(EXTRA_gsd_printer_DEPENDENCIES) + @rm -f gsd-printer$(EXEEXT) + $(AM_V_CCLD)$(gsd_printer_LINK) $(gsd_printer_OBJECTS) $(gsd_printer_LDADD) $(LIBS) +gsd-test-print-notifications$(EXEEXT): $(gsd_test_print_notifications_OBJECTS) $(gsd_test_print_notifications_DEPENDENCIES) $(EXTRA_gsd_test_print_notifications_DEPENDENCIES) + @rm -f gsd-test-print-notifications$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_print_notifications_LINK) $(gsd_test_print_notifications_OBJECTS) $(gsd_test_print_notifications_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_printer-gsd-printer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprint_notifications_la-gsd-print-notifications-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprint_notifications_la-gsd-print-notifications-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libprint_notifications_la-gsd-print-notifications-manager.lo: gsd-print-notifications-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libprint_notifications_la_CPPFLAGS) $(CPPFLAGS) $(libprint_notifications_la_CFLAGS) $(CFLAGS) -MT libprint_notifications_la-gsd-print-notifications-manager.lo -MD -MP -MF $(DEPDIR)/libprint_notifications_la-gsd-print-notifications-manager.Tpo -c -o libprint_notifications_la-gsd-print-notifications-manager.lo `test -f 'gsd-print-notifications-manager.c' || echo '$(srcdir)/'`gsd-print-notifications-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libprint_notifications_la-gsd-print-notifications-manager.Tpo $(DEPDIR)/libprint_notifications_la-gsd-print-notifications-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-print-notifications-manager.c' object='libprint_notifications_la-gsd-print-notifications-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libprint_notifications_la_CPPFLAGS) $(CPPFLAGS) $(libprint_notifications_la_CFLAGS) $(CFLAGS) -c -o libprint_notifications_la-gsd-print-notifications-manager.lo `test -f 'gsd-print-notifications-manager.c' || echo '$(srcdir)/'`gsd-print-notifications-manager.c + +libprint_notifications_la-gsd-print-notifications-plugin.lo: gsd-print-notifications-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libprint_notifications_la_CPPFLAGS) $(CPPFLAGS) $(libprint_notifications_la_CFLAGS) $(CFLAGS) -MT libprint_notifications_la-gsd-print-notifications-plugin.lo -MD -MP -MF $(DEPDIR)/libprint_notifications_la-gsd-print-notifications-plugin.Tpo -c -o libprint_notifications_la-gsd-print-notifications-plugin.lo `test -f 'gsd-print-notifications-plugin.c' || echo '$(srcdir)/'`gsd-print-notifications-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libprint_notifications_la-gsd-print-notifications-plugin.Tpo $(DEPDIR)/libprint_notifications_la-gsd-print-notifications-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-print-notifications-plugin.c' object='libprint_notifications_la-gsd-print-notifications-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libprint_notifications_la_CPPFLAGS) $(CPPFLAGS) $(libprint_notifications_la_CFLAGS) $(CFLAGS) -c -o libprint_notifications_la-gsd-print-notifications-plugin.lo `test -f 'gsd-print-notifications-plugin.c' || echo '$(srcdir)/'`gsd-print-notifications-plugin.c + +gsd_printer-gsd-printer.o: gsd-printer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_printer_CFLAGS) $(CFLAGS) -MT gsd_printer-gsd-printer.o -MD -MP -MF $(DEPDIR)/gsd_printer-gsd-printer.Tpo -c -o gsd_printer-gsd-printer.o `test -f 'gsd-printer.c' || echo '$(srcdir)/'`gsd-printer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_printer-gsd-printer.Tpo $(DEPDIR)/gsd_printer-gsd-printer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-printer.c' object='gsd_printer-gsd-printer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_printer_CFLAGS) $(CFLAGS) -c -o gsd_printer-gsd-printer.o `test -f 'gsd-printer.c' || echo '$(srcdir)/'`gsd-printer.c + +gsd_printer-gsd-printer.obj: gsd-printer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_printer_CFLAGS) $(CFLAGS) -MT gsd_printer-gsd-printer.obj -MD -MP -MF $(DEPDIR)/gsd_printer-gsd-printer.Tpo -c -o gsd_printer-gsd-printer.obj `if test -f 'gsd-printer.c'; then $(CYGPATH_W) 'gsd-printer.c'; else $(CYGPATH_W) '$(srcdir)/gsd-printer.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_printer-gsd-printer.Tpo $(DEPDIR)/gsd_printer-gsd-printer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-printer.c' object='gsd_printer-gsd-printer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_printer_CFLAGS) $(CFLAGS) -c -o gsd_printer-gsd-printer.obj `if test -f 'gsd-printer.c'; then $(CYGPATH_W) 'gsd-printer.c'; else $(CYGPATH_W) '$(srcdir)/gsd-printer.c'; fi` + +gsd_test_print_notifications-gsd-print-notifications-manager.o: gsd-print-notifications-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -MT gsd_test_print_notifications-gsd-print-notifications-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Tpo -c -o gsd_test_print_notifications-gsd-print-notifications-manager.o `test -f 'gsd-print-notifications-manager.c' || echo '$(srcdir)/'`gsd-print-notifications-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Tpo $(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-print-notifications-manager.c' object='gsd_test_print_notifications-gsd-print-notifications-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -c -o gsd_test_print_notifications-gsd-print-notifications-manager.o `test -f 'gsd-print-notifications-manager.c' || echo '$(srcdir)/'`gsd-print-notifications-manager.c + +gsd_test_print_notifications-gsd-print-notifications-manager.obj: gsd-print-notifications-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -MT gsd_test_print_notifications-gsd-print-notifications-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Tpo -c -o gsd_test_print_notifications-gsd-print-notifications-manager.obj `if test -f 'gsd-print-notifications-manager.c'; then $(CYGPATH_W) 'gsd-print-notifications-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-print-notifications-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Tpo $(DEPDIR)/gsd_test_print_notifications-gsd-print-notifications-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-print-notifications-manager.c' object='gsd_test_print_notifications-gsd-print-notifications-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -c -o gsd_test_print_notifications-gsd-print-notifications-manager.obj `if test -f 'gsd-print-notifications-manager.c'; then $(CYGPATH_W) 'gsd-print-notifications-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-print-notifications-manager.c'; fi` + +gsd_test_print_notifications-test-print-notifications.o: test-print-notifications.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -MT gsd_test_print_notifications-test-print-notifications.o -MD -MP -MF $(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Tpo -c -o gsd_test_print_notifications-test-print-notifications.o `test -f 'test-print-notifications.c' || echo '$(srcdir)/'`test-print-notifications.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Tpo $(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-print-notifications.c' object='gsd_test_print_notifications-test-print-notifications.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -c -o gsd_test_print_notifications-test-print-notifications.o `test -f 'test-print-notifications.c' || echo '$(srcdir)/'`test-print-notifications.c + +gsd_test_print_notifications-test-print-notifications.obj: test-print-notifications.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -MT gsd_test_print_notifications-test-print-notifications.obj -MD -MP -MF $(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Tpo -c -o gsd_test_print_notifications-test-print-notifications.obj `if test -f 'test-print-notifications.c'; then $(CYGPATH_W) 'test-print-notifications.c'; else $(CYGPATH_W) '$(srcdir)/test-print-notifications.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Tpo $(DEPDIR)/gsd_test_print_notifications-test-print-notifications.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-print-notifications.c' object='gsd_test_print_notifications-test-print-notifications.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_print_notifications_CPPFLAGS) $(CPPFLAGS) $(gsd_test_print_notifications_CFLAGS) $(CFLAGS) -c -o gsd_test_print_notifications-test-print-notifications.obj `if test -f 'test-print-notifications.c'; then $(CYGPATH_W) 'test-print-notifications.c'; else $(CYGPATH_W) '$(srcdir)/test-print-notifications.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c new file mode 100644 index 00000000..dc15941d --- /dev/null +++ b/plugins/print-notifications/gsd-print-notifications-manager.c @@ -0,0 +1,1231 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Red Hat, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include "gnome-settings-profile.h" +#include "gsd-print-notifications-manager.h" + +#define GSD_PRINT_NOTIFICATIONS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerPrivate)) + +#define CUPS_DBUS_NAME "org.cups.cupsd.Notifier" +#define CUPS_DBUS_PATH "/org/cups/cupsd/Notifier" +#define CUPS_DBUS_INTERFACE "org.cups.cupsd.Notifier" + +#define RENEW_INTERVAL 3500 +#define SUBSCRIPTION_DURATION 3600 +#define CONNECTING_TIMEOUT 60 +#define REASON_TIMEOUT 15000 +#define CUPS_CONNECTION_TEST_INTERVAL 300 + +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) +#define HAVE_CUPS_1_6 1 +#endif + +#ifndef HAVE_CUPS_1_6 +#define ippGetStatusCode(ipp) ipp->request.status.status_code +#define ippGetInteger(attr, element) attr->values[element].integer +#define ippGetString(attr, element, language) attr->values[element].string.text +#endif + +struct GsdPrintNotificationsManagerPrivate +{ + GDBusConnection *cups_bus_connection; + gint subscription_id; + cups_dest_t *dests; + gint num_dests; + gboolean scp_handler_spawned; + GPid scp_handler_pid; + GList *timeouts; + GHashTable *printing_printers; + GList *active_notifications; + guint cups_connection_timeout_id; +}; + +enum { + PROP_0, +}; + +static void gsd_print_notifications_manager_class_init (GsdPrintNotificationsManagerClass *klass); +static void gsd_print_notifications_manager_init (GsdPrintNotificationsManager *print_notifications_manager); +static void gsd_print_notifications_manager_finalize (GObject *object); +static gboolean cups_connection_test (gpointer user_data); + +G_DEFINE_TYPE (GsdPrintNotificationsManager, gsd_print_notifications_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static char * +get_dest_attr (const char *dest_name, + const char *attr, + cups_dest_t *dests, + int num_dests) +{ + cups_dest_t *dest; + const char *value; + char *ret; + + if (dest_name == NULL) + return NULL; + + ret = NULL; + + dest = cupsGetDest (dest_name, NULL, num_dests, dests); + if (dest == NULL) { + g_debug ("Unable to find a printer named '%s'", dest_name); + goto out; + } + + value = cupsGetOption (attr, dest->num_options, dest->options); + if (value == NULL) { + g_debug ("Unable to get %s for '%s'", attr, dest_name); + goto out; + } + ret = g_strdup (value); + out: + return ret; +} + +static gboolean +is_local_dest (const char *name, + cups_dest_t *dests, + int num_dests) +{ + char *type_str; + cups_ptype_t type; + gboolean is_remote; + + is_remote = TRUE; + + type_str = get_dest_attr (name, "printer-type", dests, num_dests); + if (type_str == NULL) { + goto out; + } + + type = atoi (type_str); + is_remote = type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT); + g_free (type_str); + out: + return !is_remote; +} + +static int +strcmp0(const void *a, const void *b) +{ + return g_strcmp0 (*((gchar **) a), *((gchar **) b)); +} + +struct +{ + gchar *printer_name; + gchar *primary_text; + gchar *secondary_text; + guint timeout_id; + GsdPrintNotificationsManager *manager; +} typedef TimeoutData; + +struct +{ + gchar *printer_name; + gchar *reason; + NotifyNotification *notification; + gulong notification_close_id; + GsdPrintNotificationsManager *manager; +} typedef ReasonData; + +static void +free_timeout_data (gpointer user_data) +{ + TimeoutData *data = (TimeoutData *) user_data; + + if (data) { + g_free (data->printer_name); + g_free (data->primary_text); + g_free (data->secondary_text); + g_free (data); + } +} + +static void +free_reason_data (gpointer user_data) +{ + ReasonData *data = (ReasonData *) user_data; + + if (data) { + if (data->notification_close_id > 0 && + g_signal_handler_is_connected (data->notification, + data->notification_close_id)) + g_signal_handler_disconnect (data->notification, data->notification_close_id); + + g_object_unref (data->notification); + + g_free (data->printer_name); + g_free (data->reason); + + g_free (data); + } +} + +static void +notification_closed_cb (NotifyNotification *notification, + gpointer user_data) +{ + ReasonData *data = (ReasonData *) user_data; + + if (data) { + data->manager->priv->active_notifications = + g_list_remove (data->manager->priv->active_notifications, data); + + free_reason_data (data); + } +} + +static gboolean +show_notification (gpointer user_data) +{ + NotifyNotification *notification; + TimeoutData *data = (TimeoutData *) user_data; + ReasonData *reason_data; + GList *tmp; + + if (!data) + return FALSE; + + notification = notify_notification_new (data->primary_text, + data->secondary_text, + "printer-symbolic"); + + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, + "resident", + g_variant_new_boolean (TRUE)); + notify_notification_set_timeout (notification, REASON_TIMEOUT); + + reason_data = g_new0 (ReasonData, 1); + reason_data->printer_name = g_strdup (data->printer_name); + reason_data->reason = g_strdup ("connecting-to-device"); + reason_data->notification = notification; + reason_data->manager = data->manager; + + reason_data->notification_close_id = + g_signal_connect (notification, + "closed", + G_CALLBACK (notification_closed_cb), + reason_data); + + reason_data->manager->priv->active_notifications = + g_list_append (reason_data->manager->priv->active_notifications, reason_data); + + notify_notification_show (notification, NULL); + + tmp = g_list_find (data->manager->priv->timeouts, data); + if (tmp) { + data->manager->priv->timeouts = g_list_remove_link (data->manager->priv->timeouts, tmp); + g_list_free_full (tmp, free_timeout_data); + } + + return FALSE; +} + +static gboolean +reason_is_blacklisted (const gchar *reason) { + if (g_str_equal (reason, "none")) + return TRUE; + if (g_str_equal (reason, "other")) + return TRUE; + if (g_str_equal (reason, "com.apple.print.recoverable")) + return TRUE; + /* https://bugzilla.redhat.com/show_bug.cgi?id=883401 */ + if (g_str_has_prefix (reason, "cups-remote-")) + return TRUE; + return FALSE; +} + +static void +on_cups_notification (GDBusConnection *connection, + const char *sender_name, + const char *object_path, + const char *interface_name, + const char *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; + gboolean printer_is_accepting_jobs; + gboolean my_job = FALSE; + gboolean known_reason; + http_t *http; + gchar *printer_name = NULL; + gchar *primary_text = NULL; + gchar *secondary_text = NULL; + gchar *text = NULL; + gchar *printer_uri = NULL; + gchar *printer_state_reasons = NULL; + gchar *job_state_reasons = NULL; + gchar *job_name = NULL; + gchar *job_uri = NULL; + guint job_id; + ipp_t *request, *response; + gint printer_state; + gint job_state; + gint job_impressions_completed; + static const char * const reasons[] = { + "toner-low", + "toner-empty", + /*"connecting-to-device",*/ + "cover-open", + "cups-missing-filter", + "door-open", + "marker-supply-low", + "marker-supply-empty", + "media-low", + "media-empty", + "offline", + "other"}; + + static const char * statuses_first[] = { + /* Translators: The printer is low on toner (same as in system-config-printer) */ + N_("Toner low"), + /* Translators: The printer has no toner left (same as in system-config-printer) */ + N_("Toner empty"), + /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ + /*N_("Not connected?"),*/ + /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ + N_("Cover open"), + /* Translators: A filter or backend is not installed (same as in system-config-printer) */ + N_("Printer configuration error"), + /* Translators: One or more doors on the printer are open (same as in system-config-printer) */ + N_("Door open"), + /* Translators: "marker" is one color bin of the printer */ + N_("Marker supply low"), + /* Translators: "marker" is one color bin of the printer */ + N_("Out of a marker supply"), + /* Translators: At least one input tray is low on media (same as in system-config-printer) */ + N_("Paper low"), + /* Translators: At least one input tray is empty (same as in system-config-printer) */ + N_("Out of paper"), + /* Translators: The printer is offline (same as in system-config-printer) */ + N_("Printer off-line"), + /* Translators: The printer has detected an error (same as in system-config-printer) */ + N_("Printer error") }; + + static const char * statuses_second[] = { + /* Translators: The printer is low on toner (same as in system-config-printer) */ + N_("Printer '%s' is low on toner."), + /* Translators: The printer has no toner left (same as in system-config-printer) */ + N_("Printer '%s' has no toner left."), + /* Translators: The printer is in the process of connecting to a shared network output device (same as in system-config-printer) */ + /*N_("Printer '%s' may not be connected."),*/ + /* Translators: One or more covers on the printer are open (same as in system-config-printer) */ + N_("The cover is open on printer '%s'."), + /* Translators: A filter or backend is not installed (same as in system-config-printer) */ + N_("There is a missing print filter for " + "printer '%s'."), + /* Translators: One or more doors on the printer are open (same as in system-config-printer) */ + N_("The door is open on printer '%s'."), + /* Translators: "marker" is one color bin of the printer */ + N_("Printer '%s' is low on a marker supply."), + /* Translators: "marker" is one color bin of the printer */ + N_("Printer '%s' is out of a marker supply."), + /* Translators: At least one input tray is low on media (same as in system-config-printer) */ + N_("Printer '%s' is low on paper."), + /* Translators: At least one input tray is empty (same as in system-config-printer) */ + N_("Printer '%s' is out of paper."), + /* Translators: The printer is offline (same as in system-config-printer) */ + N_("Printer '%s' is currently off-line."), + /* Translators: The printer has detected an error (same as in system-config-printer) */ + N_("There is a problem on printer '%s'.") }; + + if (g_strcmp0 (signal_name, "PrinterAdded") != 0 && + g_strcmp0 (signal_name, "PrinterDeleted") != 0 && + g_strcmp0 (signal_name, "PrinterStateChanged") != 0 && + g_strcmp0 (signal_name, "JobCompleted") != 0 && + g_strcmp0 (signal_name, "JobState") != 0 && + g_strcmp0 (signal_name, "JobCreated") != 0) + return; + + if (g_variant_n_children (parameters) == 1) { + g_variant_get (parameters, "(&s)", &text); + } else if (g_variant_n_children (parameters) == 6) { + g_variant_get (parameters, "(&s&s&su&sb)", + &text, + &printer_uri, + &printer_name, + &printer_state, + &printer_state_reasons, + &printer_is_accepting_jobs); + } else if (g_variant_n_children (parameters) == 11) { + ipp_attribute_t *attr; + + g_variant_get (parameters, "(&s&s&su&sbuu&s&su)", + &text, + &printer_uri, + &printer_name, + &printer_state, + &printer_state_reasons, + &printer_is_accepting_jobs, + &job_id, + &job_state, + &job_state_reasons, + &job_name, + &job_impressions_completed); + + if ((http = httpConnectEncrypt (cupsServer (), ippPort (), + cupsEncryption ())) == NULL) { + g_debug ("Connection to CUPS server \'%s\' failed.", cupsServer ()); + } + else { + job_uri = g_strdup_printf ("ipp://localhost/jobs/%d", job_id); + + request = ippNewRequest (IPP_GET_JOB_ATTRIBUTES); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "job-uri", NULL, job_uri); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "job-originating-user-name"); + response = cupsDoRequest (http, request, "/"); + + if (response) { + if (ippGetStatusCode (response) <= IPP_OK_CONFLICT && + (attr = ippFindAttribute(response, "job-originating-user-name", + IPP_TAG_NAME))) { + if (g_strcmp0 (ippGetString (attr, 0, NULL), cupsUser ()) == 0) + my_job = TRUE; + } + ippDelete(response); + } + g_free (job_uri); + } + } + else { + g_warning ("Invalid number of parameters for signal '%s'", signal_name); + return; + } + + if (g_strcmp0 (signal_name, "PrinterAdded") == 0) { + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + + /* Translators: New printer has been added */ + if (is_local_dest (printer_name, + manager->priv->dests, + manager->priv->num_dests)) { + primary_text = g_strdup (_("Printer added")); + secondary_text = g_strdup (printer_name); + } + } else if (g_strcmp0 (signal_name, "PrinterDeleted") == 0) { + /* Translators: A printer has been removed */ + if (is_local_dest (printer_name, + manager->priv->dests, + manager->priv->num_dests)) { + primary_text = g_strdup (_("Printer removed")); + secondary_text = g_strdup (printer_name); + } + + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + } else if (g_strcmp0 (signal_name, "JobCompleted") == 0 && my_job) { + g_hash_table_remove (manager->priv->printing_printers, + printer_name); + + switch (job_state) { + case IPP_JOB_PENDING: + case IPP_JOB_HELD: + case IPP_JOB_PROCESSING: + break; + case IPP_JOB_STOPPED: + /* Translators: A print job has been stopped */ + primary_text = g_strdup (_("Printing stopped")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_CANCELED: + /* Translators: A print job has been canceled */ + primary_text = g_strdup (_("Printing canceled")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_ABORTED: + /* Translators: A print job has been aborted */ + primary_text = g_strdup (_("Printing aborted")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_COMPLETED: + /* Translators: A print job has been completed */ + primary_text = g_strdup (_("Printing completed")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + } + } else if (g_strcmp0 (signal_name, "JobState") == 0 && my_job) { + switch (job_state) { + case IPP_JOB_PROCESSING: + g_hash_table_insert (manager->priv->printing_printers, + g_strdup (printer_name), NULL); + + /* Translators: A job is printing */ + primary_text = g_strdup (_("Printing")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + break; + case IPP_JOB_STOPPED: + case IPP_JOB_CANCELED: + case IPP_JOB_ABORTED: + case IPP_JOB_COMPLETED: + g_hash_table_remove (manager->priv->printing_printers, + printer_name); + break; + default: + break; + } + } else if (g_strcmp0 (signal_name, "JobCreated") == 0 && my_job) { + if (job_state == IPP_JOB_PROCESSING) { + g_hash_table_insert (manager->priv->printing_printers, + g_strdup (printer_name), NULL); + + /* Translators: A job is printing */ + primary_text = g_strdup (_("Printing")); + /* Translators: "print-job xy" on a printer */ + secondary_text = g_strdup_printf (_("\"%s\" on %s"), job_name, printer_name); + } + } else if (g_strcmp0 (signal_name, "PrinterStateChanged") == 0) { + cups_dest_t *dest = NULL; + const gchar *tmp_printer_state_reasons = NULL; + GSList *added_reasons = NULL; + GSList *tmp_list = NULL; + GList *tmp; + gchar **old_state_reasons = NULL; + gchar **new_state_reasons = NULL; + gint i, j; + + /* Remove timeout which shows notification about possible disconnection of printer + * if "connecting-to-device" has vanished. + */ + if (printer_state_reasons == NULL || + g_strrstr (printer_state_reasons, "connecting-to-device") == NULL) { + TimeoutData *data; + + for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) { + data = (TimeoutData *) tmp->data; + if (g_strcmp0 (printer_name, data->printer_name) == 0) { + g_source_remove (data->timeout_id); + manager->priv->timeouts = g_list_remove_link (manager->priv->timeouts, tmp); + g_list_free_full (tmp, free_timeout_data); + break; + } + } + } + + for (tmp = manager->priv->active_notifications; tmp; tmp = g_list_next (tmp)) { + ReasonData *reason_data = (ReasonData *) tmp->data; + GList *remove_list; + + if (printer_state_reasons == NULL || + (g_strcmp0 (printer_name, reason_data->printer_name) == 0 && + g_strrstr (printer_state_reasons, reason_data->reason) == NULL)) { + + if (reason_data->notification_close_id > 0 && + g_signal_handler_is_connected (reason_data->notification, + reason_data->notification_close_id)) { + g_signal_handler_disconnect (reason_data->notification, + reason_data->notification_close_id); + reason_data->notification_close_id = 0; + } + + notify_notification_close (reason_data->notification, NULL); + + remove_list = tmp; + tmp = g_list_next (tmp); + manager->priv->active_notifications = + g_list_remove_link (manager->priv->active_notifications, remove_list); + + g_list_free_full (remove_list, free_reason_data); + } + } + + /* Check whether we are printing on this printer right now. */ + if (g_hash_table_lookup_extended (manager->priv->printing_printers, printer_name, NULL, NULL)) { + dest = cupsGetDest (printer_name, + NULL, + manager->priv->num_dests, + manager->priv->dests); + if (dest) + tmp_printer_state_reasons = cupsGetOption ("printer-state-reasons", + dest->num_options, + dest->options); + + if (tmp_printer_state_reasons) + old_state_reasons = g_strsplit (tmp_printer_state_reasons, ",", -1); + + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + + dest = cupsGetDest (printer_name, + NULL, + manager->priv->num_dests, + manager->priv->dests); + if (dest) + tmp_printer_state_reasons = cupsGetOption ("printer-state-reasons", + dest->num_options, + dest->options); + + if (tmp_printer_state_reasons) + new_state_reasons = g_strsplit (tmp_printer_state_reasons, ",", -1); + + if (new_state_reasons) + qsort (new_state_reasons, + g_strv_length (new_state_reasons), + sizeof (gchar *), + strcmp0); + + if (old_state_reasons) { + qsort (old_state_reasons, + g_strv_length (old_state_reasons), + sizeof (gchar *), + strcmp0); + + j = 0; + for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) { + while (old_state_reasons[j] && + g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) < 0) + j++; + + if (old_state_reasons[j] == NULL || + g_strcmp0 (old_state_reasons[j], new_state_reasons[i]) != 0) + added_reasons = g_slist_append (added_reasons, + new_state_reasons[i]); + } + } + else { + for (i = 0; new_state_reasons && i < g_strv_length (new_state_reasons); i++) { + added_reasons = g_slist_append (added_reasons, + new_state_reasons[i]); + } + } + + for (tmp_list = added_reasons; tmp_list; tmp_list = tmp_list->next) { + gchar *data = (gchar *) tmp_list->data; + known_reason = FALSE; + for (j = 0; j < G_N_ELEMENTS (reasons); j++) { + if (strncmp (data, + reasons[j], + strlen (reasons[j])) == 0) { + NotifyNotification *notification; + known_reason = TRUE; + + if (g_strcmp0 (reasons[j], "connecting-to-device") == 0) { + TimeoutData *data; + + data = g_new0 (TimeoutData, 1); + data->printer_name = g_strdup (printer_name); + data->primary_text = g_strdup (statuses_first[j]); + data->secondary_text = g_strdup_printf (statuses_second[j], printer_name); + data->manager = manager; + + data->timeout_id = g_timeout_add_seconds (CONNECTING_TIMEOUT, show_notification, data); + manager->priv->timeouts = g_list_append (manager->priv->timeouts, data); + } + else { + ReasonData *reason_data; + gchar *second_row = g_strdup_printf (statuses_second[j], printer_name); + + notification = notify_notification_new (statuses_first[j], + second_row, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, + "resident", + g_variant_new_boolean (TRUE)); + notify_notification_set_timeout (notification, REASON_TIMEOUT); + + reason_data = g_new0 (ReasonData, 1); + reason_data->printer_name = g_strdup (printer_name); + reason_data->reason = g_strdup (reasons[j]); + reason_data->notification = notification; + reason_data->manager = manager; + + reason_data->notification_close_id = + g_signal_connect (notification, + "closed", + G_CALLBACK (notification_closed_cb), + reason_data); + + manager->priv->active_notifications = + g_list_append (manager->priv->active_notifications, reason_data); + + notify_notification_show (notification, NULL); + + g_free (second_row); + } + } + } + + if (!known_reason && + !reason_is_blacklisted (data)) { + NotifyNotification *notification; + ReasonData *reason_data; + gchar *first_row; + gchar *second_row; + gchar *text = NULL; + gchar *ppd_file_name; + ppd_file_t *ppd_file; + char buffer[8192]; + + ppd_file_name = g_strdup (cupsGetPPD (printer_name)); + if (ppd_file_name) { + ppd_file = ppdOpenFile (ppd_file_name); + if (ppd_file) { + gchar **tmpv; + static const char * const schemes[] = { + "text", "http", "help", "file" + }; + + tmpv = g_new0 (gchar *, G_N_ELEMENTS (schemes) + 1); + i = 0; + for (j = 0; j < G_N_ELEMENTS (schemes); j++) { + if (ppdLocalizeIPPReason (ppd_file, data, schemes[j], buffer, sizeof (buffer))) { + tmpv[i++] = g_strdup (buffer); + } + } + + if (i > 0) + text = g_strjoinv (", ", tmpv); + g_strfreev (tmpv); + + ppdClose (ppd_file); + } + + g_unlink (ppd_file_name); + g_free (ppd_file_name); + } + + + if (g_str_has_suffix (data, "-report")) + /* Translators: This is a title of a report notification for a printer */ + first_row = g_strdup (_("Printer report")); + else if (g_str_has_suffix (data, "-warning")) + /* Translators: This is a title of a warning notification for a printer */ + first_row = g_strdup (_("Printer warning")); + else + /* Translators: This is a title of an error notification for a printer */ + first_row = g_strdup (_("Printer error")); + + + if (text == NULL) + text = g_strdup (data); + + /* Translators: "Printer 'MyPrinterName': 'Description of the report/warning/error from a PPD file'." */ + second_row = g_strdup_printf (_("Printer '%s': '%s'."), printer_name, text); + g_free (text); + + + notification = notify_notification_new (first_row, + second_row, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, + "resident", + g_variant_new_boolean (TRUE)); + notify_notification_set_timeout (notification, REASON_TIMEOUT); + + reason_data = g_new0 (ReasonData, 1); + reason_data->printer_name = g_strdup (printer_name); + reason_data->reason = g_strdup (data); + reason_data->notification = notification; + reason_data->manager = manager; + + reason_data->notification_close_id = + g_signal_connect (notification, + "closed", + G_CALLBACK (notification_closed_cb), + reason_data); + + manager->priv->active_notifications = + g_list_append (manager->priv->active_notifications, reason_data); + + notify_notification_show (notification, NULL); + + g_free (first_row); + g_free (second_row); + } + } + g_slist_free (added_reasons); + } + + if (new_state_reasons) + g_strfreev (new_state_reasons); + + if (old_state_reasons) + g_strfreev (old_state_reasons); + } + + + if (primary_text) { + NotifyNotification *notification; + notification = notify_notification_new (primary_text, + secondary_text, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); + notify_notification_show (notification, NULL); + g_object_unref (notification); + g_free (primary_text); + g_free (secondary_text); + } +} + +static void +scp_handler (GsdPrintNotificationsManager *manager, + gboolean start) +{ + if (start) { + GError *error = NULL; + char *args[2]; + + if (manager->priv->scp_handler_spawned) + return; + + args[0] = LIBEXECDIR "/gsd-printer"; + args[1] = NULL; + + g_spawn_async (NULL, args, NULL, + 0, NULL, NULL, + &manager->priv->scp_handler_pid, &error); + + manager->priv->scp_handler_spawned = (error == NULL); + + if (error) { + g_warning ("Could not execute system-config-printer-udev handler: %s", + error->message); + g_error_free (error); + } + } + else if (manager->priv->scp_handler_spawned) { + kill (manager->priv->scp_handler_pid, SIGHUP); + g_spawn_close_pid (manager->priv->scp_handler_pid); + manager->priv->scp_handler_spawned = FALSE; + } +} + +static void +cancel_subscription (gint id) +{ + http_t *http; + ipp_t *request; + + if (id >= 0 && + ((http = httpConnectEncrypt (cupsServer (), ippPort (), + cupsEncryption ())) != NULL)) { + request = ippNewRequest (IPP_CANCEL_SUBSCRIPTION); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, "/"); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, + "notify-subscription-id", id); + ippDelete (cupsDoRequest (http, request, "/")); + } +} + +static gboolean +renew_subscription (gpointer data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) data; + ipp_attribute_t *attr = NULL; + http_t *http; + ipp_t *request; + ipp_t *response; + gint num_events = 7; + static const char * const events[] = { + "job-created", + "job-completed", + "job-state-changed", + "job-state", + "printer-added", + "printer-deleted", + "printer-state-changed"}; + + if ((http = httpConnectEncrypt (cupsServer (), ippPort (), + cupsEncryption ())) == NULL) { + g_debug ("Connection to CUPS server \'%s\' failed.", cupsServer ()); + } + else { + if (manager->priv->subscription_id >= 0) { + request = ippNewRequest (IPP_RENEW_SUBSCRIPTION); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, "/"); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, + "notify-subscription-id", manager->priv->subscription_id); + ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, + "notify-lease-duration", SUBSCRIPTION_DURATION); + ippDelete (cupsDoRequest (http, request, "/")); + } + else { + request = ippNewRequest (IPP_CREATE_PRINTER_SUBSCRIPTION); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, + "printer-uri", NULL, + "/"); + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser ()); + ippAddStrings (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, + "notify-events", num_events, NULL, events); + ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, + "notify-pull-method", NULL, "ippget"); + ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI, + "notify-recipient-uri", NULL, "dbus://"); + ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER, + "notify-lease-duration", SUBSCRIPTION_DURATION); + response = cupsDoRequest (http, request, "/"); + + if (response != NULL && ippGetStatusCode (response) <= IPP_OK_CONFLICT) { + if ((attr = ippFindAttribute (response, "notify-subscription-id", + IPP_TAG_INTEGER)) == NULL) + g_debug ("No notify-subscription-id in response!\n"); + else + manager->priv->subscription_id = ippGetInteger (attr, 0); + } + + if (response) + ippDelete (response); + } + httpClose (http); + } + return TRUE; +} + +static void +renew_subscription_with_connection_test_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GSocketConnection *connection; + GError *error = NULL; + + connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object), + res, + &error); + + if (connection) { + g_debug ("Test connection to CUPS server \'%s:%d\' succeeded.", cupsServer (), ippPort ()); + + g_io_stream_close (G_IO_STREAM (connection), NULL, NULL); + g_object_unref (connection); + + renew_subscription (user_data); + } + else { + g_debug ("Test connection to CUPS server \'%s:%d\' failed.", cupsServer (), ippPort ()); + } +} + +static gboolean +renew_subscription_with_connection_test (gpointer user_data) +{ + GSocketClient *client; + gchar *address; + + address = g_strdup_printf ("%s:%d", cupsServer (), ippPort ()); + + if (address && address[0] != '/') { + client = g_socket_client_new (); + + g_debug ("Initiating test connection to CUPS server \'%s:%d\'.", cupsServer (), ippPort ()); + + g_socket_client_connect_to_host_async (client, + address, + 631, + NULL, + renew_subscription_with_connection_test_cb, + user_data); + + g_object_unref (client); + } + else { + renew_subscription (user_data); + } + + g_free (address); + + return TRUE; +} + +static void +cups_connection_test_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; + GSocketConnection *connection; + GError *error = NULL; + + connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object), + res, + &error); + + if (connection) { + g_debug ("Test connection to CUPS server \'%s:%d\' succeeded.", cupsServer (), ippPort ()); + + g_io_stream_close (G_IO_STREAM (connection), NULL, NULL); + g_object_unref (connection); + + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + gnome_settings_profile_msg ("got dests"); + + renew_subscription (user_data); + g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription_with_connection_test, manager); + } + else { + g_debug ("Test connection to CUPS server \'%s:%d\' failed.", cupsServer (), ippPort ()); + if (manager->priv->cups_connection_timeout_id == 0) + manager->priv->cups_connection_timeout_id = + g_timeout_add_seconds (CUPS_CONNECTION_TEST_INTERVAL, cups_connection_test, manager); + } +} + +static gboolean +cups_connection_test (gpointer user_data) +{ + GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data; + GSocketClient *client; + gchar *address; + + if (!manager->priv->dests) { + address = g_strdup_printf ("%s:%d", cupsServer (), ippPort ()); + + if (address && address[0] != '/') { + client = g_socket_client_new (); + + g_debug ("Initiating test connection to CUPS server \'%s:%d\'.", cupsServer (), ippPort ()); + + g_socket_client_connect_to_host_async (client, + address, + 631, + NULL, + cups_connection_test_cb, + manager); + + g_object_unref (client); + } + else { + manager->priv->num_dests = cupsGetDests (&manager->priv->dests); + gnome_settings_profile_msg ("got dests"); + + renew_subscription (user_data); + g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription_with_connection_test, manager); + } + + g_free (address); + } + + if (manager->priv->dests) { + manager->priv->cups_connection_timeout_id = 0; + + return FALSE; + } + else { + return TRUE; + } +} + +static gboolean +gsd_print_notifications_manager_start_idle (gpointer data) +{ + GsdPrintNotificationsManager *manager = data; + + gnome_settings_profile_start (NULL); + + manager->priv->printing_printers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + + cups_connection_test (manager); + + manager->priv->cups_bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + + g_dbus_connection_signal_subscribe (manager->priv->cups_bus_connection, + NULL, + CUPS_DBUS_INTERFACE, + NULL, + CUPS_DBUS_PATH, + NULL, + 0, + on_cups_notification, + manager, + NULL); + + scp_handler (manager, TRUE); + + gnome_settings_profile_end (NULL); + + return G_SOURCE_REMOVE; +} + +gboolean +gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager, + GError **error) +{ + g_debug ("Starting print-notifications manager"); + + gnome_settings_profile_start (NULL); + + manager->priv->subscription_id = -1; + manager->priv->dests = NULL; + manager->priv->num_dests = 0; + manager->priv->scp_handler_spawned = FALSE; + manager->priv->timeouts = NULL; + manager->priv->printing_printers = NULL; + manager->priv->active_notifications = NULL; + manager->priv->cups_bus_connection = NULL; + manager->priv->cups_connection_timeout_id = 0; + + g_idle_add (gsd_print_notifications_manager_start_idle, manager); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager) +{ + TimeoutData *data; + ReasonData *reason_data; + GList *tmp; + + g_debug ("Stopping print-notifications manager"); + + cupsFreeDests (manager->priv->num_dests, manager->priv->dests); + manager->priv->num_dests = 0; + manager->priv->dests = NULL; + + if (manager->priv->subscription_id >= 0) + cancel_subscription (manager->priv->subscription_id); + + if (manager->priv->printing_printers) + g_hash_table_destroy (manager->priv->printing_printers); + + g_clear_object (&manager->priv->cups_bus_connection); + + for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) { + data = (TimeoutData *) tmp->data; + if (data) + g_source_remove (data->timeout_id); + } + g_list_free_full (manager->priv->timeouts, free_timeout_data); + + for (tmp = manager->priv->active_notifications; tmp; tmp = g_list_next (tmp)) { + reason_data = (ReasonData *) tmp->data; + if (reason_data) { + if (reason_data->notification_close_id > 0 && + g_signal_handler_is_connected (reason_data->notification, + reason_data->notification_close_id)) { + g_signal_handler_disconnect (reason_data->notification, + reason_data->notification_close_id); + reason_data->notification_close_id = 0; + } + + notify_notification_close (reason_data->notification, NULL); + } + } + g_list_free_full (manager->priv->active_notifications, free_reason_data); + + scp_handler (manager, FALSE); +} + +static GObject * +gsd_print_notifications_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdPrintNotificationsManager *print_notifications_manager; + + print_notifications_manager = GSD_PRINT_NOTIFICATIONS_MANAGER (G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (print_notifications_manager); +} + +static void +gsd_print_notifications_manager_class_init (GsdPrintNotificationsManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_print_notifications_manager_constructor; + object_class->finalize = gsd_print_notifications_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdPrintNotificationsManagerPrivate)); +} + +static void +gsd_print_notifications_manager_init (GsdPrintNotificationsManager *manager) +{ + manager->priv = GSD_PRINT_NOTIFICATIONS_MANAGER_GET_PRIVATE (manager); + +} + +static void +gsd_print_notifications_manager_finalize (GObject *object) +{ + GsdPrintNotificationsManager *manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_PRINT_NOTIFICATIONS_MANAGER (object)); + + manager = GSD_PRINT_NOTIFICATIONS_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->finalize (object); +} + +GsdPrintNotificationsManager * +gsd_print_notifications_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_PRINT_NOTIFICATIONS_MANAGER (manager_object); +} diff --git a/plugins/print-notifications/gsd-print-notifications-manager.h b/plugins/print-notifications/gsd-print-notifications-manager.h new file mode 100644 index 00000000..0e58f0ca --- /dev/null +++ b/plugins/print-notifications/gsd-print-notifications-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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_PRINT_NOTIFICATIONS_MANAGER_H +#define __GSD_PRINT_NOTIFICATIONS_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER (gsd_print_notifications_manager_get_type ()) +#define GSD_PRINT_NOTIFICATIONS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManager)) +#define GSD_PRINT_NOTIFICATIONS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerClass)) +#define GSD_IS_PRINT_NOTIFICATIONS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER)) +#define GSD_IS_PRINT_NOTIFICATIONS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER)) +#define GSD_PRINT_NOTIFICATIONS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_PRINT_NOTIFICATIONS_MANAGER, GsdPrintNotificationsManagerClass)) + +typedef struct GsdPrintNotificationsManagerPrivate GsdPrintNotificationsManagerPrivate; + +typedef struct +{ + GObject parent; + GsdPrintNotificationsManagerPrivate *priv; +} GsdPrintNotificationsManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdPrintNotificationsManagerClass; + +GType gsd_print_notifications_manager_get_type (void); + +GsdPrintNotificationsManager *gsd_print_notifications_manager_new (void); +gboolean gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager, + GError **error); +void gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager); + +G_END_DECLS + +#endif /* __GSD_PRINT_NOTIFICATIONS_MANAGER_H */ diff --git a/plugins/print-notifications/gsd-print-notifications-plugin.c b/plugins/print-notifications/gsd-print-notifications-plugin.c new file mode 100644 index 00000000..a91cff88 --- /dev/null +++ b/plugins/print-notifications/gsd-print-notifications-plugin.c @@ -0,0 +1,123 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Red Hat, Inc. + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-print-notifications-plugin.h" +#include "gsd-print-notifications-manager.h" + +struct GsdPrintNotificationsPluginPrivate { + GsdPrintNotificationsManager *manager; +}; + +#define GSD_PRINT_NOTIFICATIONS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN, GsdPrintNotificationsPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdPrintNotificationsPlugin, gsd_print_notifications_plugin) + +static void +gsd_print_notifications_plugin_init (GsdPrintNotificationsPlugin *plugin) +{ + if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) { + plugin->priv = NULL; + g_debug ("GsdPrintNotificationsPlugin: Disabling for Unity, using system-config-printer"); + return; + } + + plugin->priv = GSD_PRINT_NOTIFICATIONS_PLUGIN_GET_PRIVATE (plugin); + + plugin->priv->manager = gsd_print_notifications_manager_new (); +} + +static void +gsd_print_notifications_plugin_finalize (GObject *object) +{ + GsdPrintNotificationsPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_PRINT_NOTIFICATIONS_PLUGIN (object)); + + g_debug ("GsdPrintNotificationsPlugin finalizing"); + + plugin = GSD_PRINT_NOTIFICATIONS_PLUGIN (object); + + if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) { + G_OBJECT_CLASS (gsd_print_notifications_plugin_parent_class)->finalize (object); + return; + } + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_print_notifications_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + if (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv == NULL) { + g_debug ("Not activating disabled print-notifications plugin"); + return; + } + + g_debug ("Activating print-notifications plugin"); + + error = NULL; + res = gsd_print_notifications_manager_start (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start print-notifications manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + if (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv == NULL) { + g_debug ("Not deactivating disabled print-notifications plugin"); + return; + } + + g_debug ("Deactivating print_notifications plugin"); + gsd_print_notifications_manager_stop (GSD_PRINT_NOTIFICATIONS_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_print_notifications_plugin_class_init (GsdPrintNotificationsPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_print_notifications_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdPrintNotificationsPluginPrivate)); +} diff --git a/plugins/print-notifications/gsd-print-notifications-plugin.h b/plugins/print-notifications/gsd-print-notifications-plugin.h new file mode 100644 index 00000000..c3e18e12 --- /dev/null +++ b/plugins/print-notifications/gsd-print-notifications-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * 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, 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_PRINT_NOTIFICATIONS_PLUGIN_H__ +#define __GSD_PRINT_NOTIFICATIONS_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN (gsd_print_notifications_plugin_get_type ()) +#define GSD_PRINT_NOTIFICATIONS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN, GsdPrintNotificationsPlugin)) +#define GSD_PRINT_NOTIFICATIONS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN, GsdPrintNotificationsPluginClass)) +#define GSD_IS_PRINT_NOTIFICATIONS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN)) +#define GSD_IS_PRINT_NOTIFICATIONS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN)) +#define GSD_PRINT_NOTIFICATIONS_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_PRINT_NOTIFICATIONS_PLUGIN, GsdPrintNotificationsPluginClass)) + +typedef struct GsdPrintNotificationsPluginPrivate GsdPrintNotificationsPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdPrintNotificationsPluginPrivate *priv; +} GsdPrintNotificationsPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdPrintNotificationsPluginClass; + +GType gsd_print_notifications_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_PRINT_NOTIFICATIONS_PLUGIN_H__ */ diff --git a/plugins/print-notifications/gsd-printer.c b/plugins/print-notifications/gsd-printer.c new file mode 100644 index 00000000..26dbb6d7 --- /dev/null +++ b/plugins/print-notifications/gsd-printer.c @@ -0,0 +1,1405 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Red Hat, Inc. + * + * 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, 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 +#include +#include +#include +#include +#include +#include +#include + +static GDBusNodeInfo *npn_introspection_data = NULL; +static GDBusNodeInfo *pdi_introspection_data = NULL; + +#define SCP_DBUS_NPN_NAME "com.redhat.NewPrinterNotification" +#define SCP_DBUS_NPN_PATH "/com/redhat/NewPrinterNotification" +#define SCP_DBUS_NPN_INTERFACE "com.redhat.NewPrinterNotification" + +#define SCP_DBUS_PDI_NAME "com.redhat.PrinterDriversInstaller" +#define SCP_DBUS_PDI_PATH "/com/redhat/PrinterDriversInstaller" +#define SCP_DBUS_PDI_INTERFACE "com.redhat.PrinterDriversInstaller" + +#define PACKAGE_KIT_BUS "org.freedesktop.PackageKit" +#define PACKAGE_KIT_PATH "/org/freedesktop/PackageKit" +#define PACKAGE_KIT_MODIFY_IFACE "org.freedesktop.PackageKit.Modify" +#define PACKAGE_KIT_QUERY_IFACE "org.freedesktop.PackageKit.Query" + +#define SCP_BUS "org.fedoraproject.Config.Printing" +#define SCP_PATH "/org/fedoraproject/Config/Printing" +#define SCP_IFACE "org.fedoraproject.Config.Printing" + +#define MECHANISM_BUS "org.opensuse.CupsPkHelper.Mechanism" + +#define ALLOWED_CHARACTERS "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_" + +#define DBUS_TIMEOUT 60000 +#define DBUS_INSTALL_TIMEOUT 3600000 + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_IFACE "org.gnome.SessionManager" +#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_IFACE "org.gnome.SessionManager.ClientPrivate" + +#define GNOME_SESSION_PRESENCE_DBUS_PATH "/org/gnome/SessionManager/Presence" +#define GNOME_SESSION_PRESENCE_DBUS_IFACE "org.gnome.SessionManager.Presence" + +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) +#define HAVE_CUPS_1_6 1 +#endif + +#ifndef HAVE_CUPS_1_6 +#define ippGetState(ipp) ipp->state +#endif + +enum { + PRESENCE_STATUS_AVAILABLE = 0, + PRESENCE_STATUS_INVISIBLE, + PRESENCE_STATUS_BUSY, + PRESENCE_STATUS_IDLE, + PRESENCE_STATUS_UNKNOWN +}; + +static const gchar npn_introspection_xml[] = + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; + +static const gchar pdi_introspection_xml[] = + "" + " " + " " + " " + " " + " " + " " + " " + ""; + +static GMainLoop *main_loop; +static guint npn_registration_id; +static guint pdi_registration_id; +static guint npn_owner_id; +static guint pdi_owner_id; + +static GHashTable * +get_missing_executables (const gchar *ppd_file_name) +{ + GHashTable *executables = NULL; + GDBusProxy *proxy; + GVariant *output; + GVariant *array; + GError *error = NULL; + gint i; + + if (!ppd_file_name) + return NULL; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + SCP_BUS, + SCP_PATH, + SCP_IFACE, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return NULL; + } + + output = g_dbus_proxy_call_sync (proxy, + "MissingExecutables", + g_variant_new ("(s)", + ppd_file_name), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output && g_variant_n_children (output) == 1) { + array = g_variant_get_child_value (output, 0); + if (array) { + executables = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, NULL); + for (i = 0; i < g_variant_n_children (array); i++) { + g_hash_table_insert (executables, + g_strdup (g_variant_get_string ( + g_variant_get_child_value (array, i), + NULL)), + NULL); + } + } + } + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); + + return executables; +} + +static GHashTable * +find_packages_for_executables (GHashTable *executables) +{ + GHashTableIter exec_iter; + GHashTable *packages = NULL; + GDBusProxy *proxy; + GVariant *output; + gpointer key, value; + GError *error = NULL; + + if (!executables || g_hash_table_size (executables) <= 0) + return NULL; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + PACKAGE_KIT_BUS, + PACKAGE_KIT_PATH, + PACKAGE_KIT_QUERY_IFACE, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return NULL; + } + + packages = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, NULL); + + g_hash_table_iter_init (&exec_iter, executables); + while (g_hash_table_iter_next (&exec_iter, &key, &value)) { + output = g_dbus_proxy_call_sync (proxy, + "SearchFile", + g_variant_new ("(ss)", + (gchar *) key, + ""), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output) { + gboolean installed; + gchar *package; + + g_variant_get (output, + "(bs)", + &installed, + &package); + if (!installed) + g_hash_table_insert (packages, g_strdup (package), NULL); + + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + } + + g_object_unref (proxy); + + return packages; +} + +static void +install_packages (GHashTable *packages) +{ + GVariantBuilder array_builder; + GHashTableIter pkg_iter; + GDBusProxy *proxy; + GVariant *output; + gpointer key, value; + GError *error = NULL; + + if (!packages || g_hash_table_size (packages) <= 0) + return; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + PACKAGE_KIT_BUS, + PACKAGE_KIT_PATH, + PACKAGE_KIT_MODIFY_IFACE, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return; + } + + g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("as")); + + g_hash_table_iter_init (&pkg_iter, packages); + while (g_hash_table_iter_next (&pkg_iter, &key, &value)) { + g_variant_builder_add (&array_builder, + "s", + (gchar *) key); + } + + output = g_dbus_proxy_call_sync (proxy, + "InstallPackageNames", + g_variant_new ("(uass)", + 0, + &array_builder, + "hide-finished"), + G_DBUS_CALL_FLAGS_NONE, + DBUS_INSTALL_TIMEOUT, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); +} + +static gchar * +get_best_ppd (gchar *device_id, + gchar *device_make_and_model, + gchar *device_uri) +{ + GDBusProxy *proxy; + GVariant *output; + GVariant *array; + GVariant *tuple; + GError *error = NULL; + gchar *ppd_name = NULL; + gint i, j; + static const char * const match_levels[] = { + "exact-cmd", + "exact", + "close", + "generic", + "none"}; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + SCP_BUS, + SCP_PATH, + SCP_IFACE, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return NULL; + } + + output = g_dbus_proxy_call_sync (proxy, + "GetBestDrivers", + g_variant_new ("(sss)", + device_id ? device_id : "", + device_make_and_model ? device_make_and_model : "", + device_uri ? device_uri : ""), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output && g_variant_n_children (output) >= 1) { + array = g_variant_get_child_value (output, 0); + if (array) + for (j = 0; j < G_N_ELEMENTS (match_levels) && ppd_name == NULL; j++) + for (i = 0; i < g_variant_n_children (array) && ppd_name == NULL; i++) { + tuple = g_variant_get_child_value (array, i); + if (tuple && g_variant_n_children (tuple) == 2) { + if (g_strcmp0 (g_variant_get_string ( + g_variant_get_child_value (tuple, 1), + NULL), match_levels[j]) == 0) + ppd_name = g_strdup (g_variant_get_string ( + g_variant_get_child_value (tuple, 0), + NULL)); + } + } + } + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); + + return ppd_name; +} + +static gchar * +get_tag_value (const gchar *tag_string, + const gchar *tag_name) +{ + gchar **tag_string_splitted; + gchar *tag_value = NULL; + gint tag_name_length; + gint i; + + if (!tag_string || + !tag_name) + return NULL; + + tag_name_length = strlen (tag_name); + tag_string_splitted = g_strsplit (tag_string, ";", 0); + if (tag_string_splitted) { + for (i = 0; i < g_strv_length (tag_string_splitted); i++) + if (g_ascii_strncasecmp (tag_string_splitted[i], tag_name, tag_name_length) == 0) + if (strlen (tag_string_splitted[i]) > tag_name_length + 1) + tag_value = g_strdup (tag_string_splitted[i] + tag_name_length + 1); + + g_strfreev (tag_string_splitted); + } + + return tag_value; +} + +static gchar * +create_name (gchar *device_id) +{ + cups_dest_t *dests; + gboolean already_present = FALSE; + gchar *name = NULL; + gchar *new_name = NULL; + gint num_dests; + gint name_index = 2; + gint j; + + g_return_val_if_fail (device_id != NULL, NULL); + + name = get_tag_value (device_id, "mdl"); + if (!name) + name = get_tag_value (device_id, "model"); + + if (name) + name = g_strcanon (name, ALLOWED_CHARACTERS, '-'); + + num_dests = cupsGetDests (&dests); + do { + if (already_present) { + new_name = g_strdup_printf ("%s-%d", name, name_index); + name_index++; + } else { + new_name = g_strdup (name); + } + + already_present = FALSE; + for (j = 0; j < num_dests; j++) + if (g_strcmp0 (dests[j].name, new_name) == 0) + already_present = TRUE; + + if (already_present) { + g_free (new_name); + } else { + g_free (name); + name = new_name; + } + } while (already_present); + cupsFreeDests (num_dests, dests); + + return name; +} + +static gboolean +add_printer (gchar *printer_name, + gchar *device_uri, + gchar *ppd_name, + gchar *info, + gchar *location) +{ + cups_dest_t *dests; + GDBusProxy *proxy; + gboolean success = FALSE; + GVariant *output; + GError *error = NULL; + gint num_dests; + gint i; + + if (!printer_name || !device_uri || !ppd_name) + return FALSE; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + MECHANISM_BUS, + "/", + MECHANISM_BUS, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return FALSE; + } + + output = g_dbus_proxy_call_sync (proxy, + "PrinterAdd", + g_variant_new ("(sssss)", + printer_name ? printer_name : "", + device_uri ? device_uri : "", + ppd_name ? ppd_name : "", + info ? info : "", + location ? location : ""), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); + + num_dests = cupsGetDests (&dests); + for (i = 0; i < num_dests; i++) + if (g_strcmp0 (dests[i].name, printer_name) == 0) + success = TRUE; + cupsFreeDests (num_dests, dests); + + return success; +} + +static gboolean +printer_set_enabled (const gchar *printer_name, + gboolean enabled) +{ + GDBusProxy *proxy; + gboolean result = TRUE; + GVariant *output; + GError *error = NULL; + + if (!printer_name) + return FALSE; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + MECHANISM_BUS, + "/", + MECHANISM_BUS, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return FALSE; + } + + output = g_dbus_proxy_call_sync (proxy, + "PrinterSetEnabled", + g_variant_new ("(sb)", + printer_name, + enabled), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + result = FALSE; + } + + g_object_unref (proxy); + + return result; +} + +static gboolean +printer_set_accepting_jobs (const gchar *printer_name, + gboolean accepting_jobs, + const gchar *reason) +{ + GDBusProxy *proxy; + gboolean result = TRUE; + GVariant *output; + GError *error = NULL; + + if (!printer_name) + return FALSE; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + MECHANISM_BUS, + "/", + MECHANISM_BUS, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return FALSE; + } + + output = g_dbus_proxy_call_sync (proxy, + "PrinterSetAcceptJobs", + g_variant_new ("(sbs)", + printer_name, + accepting_jobs, + reason ? reason : ""), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + result = FALSE; + } + + g_object_unref (proxy); + + return result; +} + +static ipp_t * +execute_maintenance_command (const char *printer_name, + const char *command, + const char *title) +{ + http_t *http; + GError *error = NULL; + ipp_t *request = NULL; + ipp_t *response = NULL; + gchar *file_name = NULL; + char *uri; + int fd = -1; + + http = httpConnectEncrypt (cupsServer (), + ippPort (), + cupsEncryption ()); + + if (!http) + return NULL; + + request = ippNewRequest (IPP_PRINT_JOB); + + uri = g_strdup_printf ("ipp://localhost/printers/%s", + printer_name); + + ippAddString (request, + IPP_TAG_OPERATION, + IPP_TAG_URI, + "printer-uri", + NULL, + uri); + + g_free (uri); + + ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", + NULL, title); + + ippAddString (request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format", + NULL, "application/vnd.cups-command"); + + fd = g_file_open_tmp ("ccXXXXXX", &file_name, &error); + + if (fd != -1) { + FILE *file; + + file = fdopen (fd, "w"); + fprintf (file, "#CUPS-COMMAND\n"); + fprintf (file, "%s\n", command); + fclose (file); + + response = cupsDoFileRequest (http, request, "/", file_name); + g_unlink (file_name); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_free (file_name); + httpClose (http); + + return response; +} + +static char * +get_dest_attr (const char *dest_name, + const char *attr) +{ + cups_dest_t *dests; + int num_dests; + cups_dest_t *dest; + const char *value; + char *ret; + + if (dest_name == NULL) + return NULL; + + ret = NULL; + + num_dests = cupsGetDests (&dests); + if (num_dests < 1) { + g_debug ("Unable to get printer destinations"); + return NULL; + } + + dest = cupsGetDest (dest_name, NULL, num_dests, dests); + if (dest == NULL) { + g_debug ("Unable to find a printer named '%s'", dest_name); + goto out; + } + + value = cupsGetOption (attr, dest->num_options, dest->options); + if (value == NULL) { + g_debug ("Unable to get %s for '%s'", attr, dest_name); + goto out; + } + ret = g_strdup (value); +out: + cupsFreeDests (num_dests, dests); + + return ret; +} + +static void +printer_autoconfigure (gchar *printer_name) +{ + gchar *commands; + gchar *commands_lowercase; + ipp_t *response = NULL; + + if (!printer_name) + return; + + commands = get_dest_attr (printer_name, "printer-commands"); + commands_lowercase = g_ascii_strdown (commands, -1); + + if (g_strrstr (commands_lowercase, "autoconfigure")) { + response = execute_maintenance_command (printer_name, + "AutoConfigure", + ("Automatic configuration")); + if (response) { + if (ippGetState (response) == IPP_ERROR) + g_warning ("An error has occured during automatic configuration of new printer."); + ippDelete (response); + } + } + g_free (commands); + g_free (commands_lowercase); +} + +/* Return default media size for current locale */ +static const gchar * +get_paper_size_from_locale () +{ + if (g_str_equal (gtk_paper_size_get_default (), GTK_PAPER_NAME_LETTER)) + return "na-letter"; + else + return "iso-a4"; +} + +static void +set_default_paper_size (const gchar *printer_name, + const gchar *ppd_file_name) +{ + GDBusProxy *proxy; + GVariant *output; + GError *error = NULL; + GVariantBuilder *builder; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + MECHANISM_BUS, + "/", + MECHANISM_BUS, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + return; + } + + /* Set default media size according to the locale + * FIXME: Handle more than A4 and Letter: + * https://bugzilla.gnome.org/show_bug.cgi?id=660769 */ + builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + g_variant_builder_add (builder, "s", get_paper_size_from_locale ()); + + output = g_dbus_proxy_call_sync (proxy, + "PrinterAddOption", + g_variant_new ("(ssas)", + printer_name ? printer_name : "", + "media", + builder), + G_DBUS_CALL_FLAGS_NONE, + DBUS_TIMEOUT, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } else { + if (!(error->domain == G_DBUS_ERROR && + (error->code == G_DBUS_ERROR_SERVICE_UNKNOWN || + error->code == G_DBUS_ERROR_UNKNOWN_METHOD))) + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); +} + +/* + * Setup new printer and returns TRUE if successful. + */ +static gboolean +setup_printer (gchar *device_id, + gchar *device_make_and_model, + gchar *device_uri) +{ + gboolean success = FALSE; + gchar *ppd_name; + gchar *printer_name; + + ppd_name = get_best_ppd (device_id, device_make_and_model, device_uri); + printer_name = create_name (device_id); + + if (!ppd_name || !printer_name || !device_uri) { + g_free (ppd_name); + g_free (printer_name); + return FALSE; + } + + success = add_printer (printer_name, device_uri, + ppd_name, NULL, NULL); + + /* Set some options of the new printer */ + if (success) { + const char *ppd_file_name; + + printer_set_accepting_jobs (printer_name, TRUE, NULL); + printer_set_enabled (printer_name, TRUE); + printer_autoconfigure (printer_name); + + ppd_file_name = cupsGetPPD (printer_name); + + if (ppd_file_name) { + GHashTable *executables; + GHashTable *packages; + + set_default_paper_size (printer_name, ppd_file_name); + + executables = get_missing_executables (ppd_file_name); + packages = find_packages_for_executables (executables); + install_packages (packages); + + if (executables) + g_hash_table_destroy (executables); + if (packages) + g_hash_table_destroy (packages); + g_unlink (ppd_file_name); + } + } + + g_free (printer_name); + g_free (ppd_name); + + return success; +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + gchar *primary_text = NULL; + gchar *secondary_text = NULL; + gchar *name = NULL; + gchar *mfg = NULL; + gchar *mdl = NULL; + gchar *des = NULL; + gchar *cmd = NULL; + gchar *device = NULL; + gchar *device_id; + gchar *make_and_model; + gint status = 0; + + if (g_strcmp0 (method_name, "GetReady") == 0) { + /* Translators: We are configuring new printer */ + primary_text = g_strdup (_("Configuring new printer")); + /* Translators: Just wait */ + secondary_text = g_strdup (_("Please wait...")); + + g_dbus_method_invocation_return_value (invocation, + NULL); + } + else if (g_strcmp0 (method_name, "NewPrinter") == 0) { + if (g_variant_n_children (parameters) == 6) { + g_variant_get (parameters, "(i&s&s&s&s&s)", + &status, + &name, + &mfg, + &mdl, + &des, + &cmd); + } + + if (g_strrstr (name, "/")) { + /* name is a URI, no queue was generated, because no suitable + * driver was found + */ + + device_id = g_strdup_printf ("MFG:%s;MDL:%s;DES:%s;CMD:%s;", mfg, mdl, des, cmd); + make_and_model = g_strdup_printf ("%s %s", mfg, mdl); + + if (!setup_printer (device_id, make_and_model, name)) { + + /* Translators: We have no driver installed for this printer */ + primary_text = g_strdup (_("Missing printer driver")); + + if ((mfg && mdl) || des) { + if (mfg && mdl) + device = g_strdup_printf ("%s %s", mfg, mdl); + else + device = g_strdup (des); + + /* Translators: We have no driver installed for the device */ + secondary_text = g_strdup_printf (_("No printer driver for %s."), device); + g_free (device); + } + else + /* Translators: We have no driver installed for this printer */ + secondary_text = g_strdup (_("No driver for this printer.")); + } + + g_free (make_and_model); + g_free (device_id); + } + else { + /* name is the name of the queue which hal_lpadmin has set up + * automatically. + */ + + const char *ppd_file_name; + + ppd_file_name = cupsGetPPD (name); + if (ppd_file_name) { + GHashTable *executables; + GHashTable *packages; + + executables = get_missing_executables (ppd_file_name); + packages = find_packages_for_executables (executables); + install_packages (packages); + + if (executables) + g_hash_table_destroy (executables); + if (packages) + g_hash_table_destroy (packages); + g_unlink (ppd_file_name); + } + } + + g_dbus_method_invocation_return_value (invocation, + NULL); + } + else if (g_strcmp0 (method_name, "InstallDrivers") == 0) { + GDBusProxy *proxy; + GError *error = NULL; + + if (g_variant_n_children (parameters) == 3) { + g_variant_get (parameters, "(&s&s&s)", + &mfg, + &mdl, + &cmd); + } + + if (mfg && mdl) + device = g_strdup_printf ("MFG:%s;MDL:%s;", mfg, mdl); + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + PACKAGE_KIT_BUS, + PACKAGE_KIT_PATH, + PACKAGE_KIT_MODIFY_IFACE, + NULL, + &error); + + if (!proxy) { + g_warning ("%s", error->message); + g_error_free (error); + } + + if (proxy && device) { + GVariantBuilder *builder; + GVariant *output; + + builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + g_variant_builder_add (builder, "s", device); + + output = g_dbus_proxy_call_sync (proxy, + "InstallPrinterDrivers", + g_variant_new ("(uass)", + 0, + builder, + "hide-finished"), + G_DBUS_CALL_FLAGS_NONE, + DBUS_INSTALL_TIMEOUT, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); + } + + g_dbus_method_invocation_return_value (invocation, + NULL); + } + + if (primary_text) { + NotifyNotification *notification; + notification = notify_notification_new (primary_text, + secondary_text, + "printer-symbolic"); + notify_notification_set_app_name (notification, _("Printers")); + notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE)); + + notify_notification_show (notification, NULL); + g_object_unref (notification); + g_free (primary_text); + g_free (secondary_text); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, + NULL +}; + +static void +unregister_objects () +{ + GDBusConnection *system_connection; + GError *error = NULL; + + system_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); + + if (npn_registration_id > 0) { + g_dbus_connection_unregister_object (system_connection, npn_registration_id); + npn_registration_id = 0; + } + + if (pdi_registration_id > 0) { + g_dbus_connection_unregister_object (system_connection, pdi_registration_id); + pdi_registration_id = 0; + } +} + +static void +unown_names () +{ + if (npn_owner_id > 0) { + g_bus_unown_name (npn_owner_id); + npn_owner_id = 0; + } + + if (pdi_owner_id > 0) { + g_bus_unown_name (pdi_owner_id); + pdi_owner_id = 0; + } +} + +static void +on_npn_bus_acquired (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + GError *error = NULL; + + npn_registration_id = g_dbus_connection_register_object (connection, + SCP_DBUS_NPN_PATH, + npn_introspection_data->interfaces[0], + &interface_vtable, + NULL, + NULL, + &error); + + if (npn_registration_id == 0) { + g_warning ("Failed to register object: %s\n", error->message); + g_error_free (error); + } +} + +static void +on_pdi_bus_acquired (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + GError *error = NULL; + + pdi_registration_id = g_dbus_connection_register_object (connection, + SCP_DBUS_PDI_PATH, + pdi_introspection_data->interfaces[0], + &interface_vtable, + NULL, + NULL, + &error); + + if (pdi_registration_id == 0) { + g_warning ("Failed to register object: %s\n", error->message); + g_error_free (error); + } +} + +static void +on_name_acquired (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ +} + +static void +on_name_lost (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + unregister_objects (); +} + +static void +session_signal_handler (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + guint new_status; + + g_variant_get (parameters, "(u)", &new_status); + + if (new_status == PRESENCE_STATUS_IDLE || + new_status == PRESENCE_STATUS_AVAILABLE) { + unregister_objects (); + unown_names (); + + if (new_status == PRESENCE_STATUS_AVAILABLE) { + npn_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, + SCP_DBUS_NPN_NAME, + G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | + G_BUS_NAME_OWNER_FLAGS_REPLACE, + on_npn_bus_acquired, + on_name_acquired, + on_name_lost, + NULL, + NULL); + + pdi_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, + SCP_DBUS_PDI_NAME, + G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | + G_BUS_NAME_OWNER_FLAGS_REPLACE, + on_pdi_bus_acquired, + on_name_acquired, + on_name_lost, + NULL, + NULL); + } + } +} + +static void +client_signal_handler (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + GDBusProxy *proxy; + GError *error = NULL; + GVariant *output; + + if (g_strcmp0 (signal_name, "QueryEndSession") == 0 || + g_strcmp0 (signal_name, "EndSession") == 0) { + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + sender_name, + object_path, + interface_name, + NULL, + &error); + + if (proxy) { + output = g_dbus_proxy_call_sync (proxy, + "EndSessionResponse", + g_variant_new ("(bs)", TRUE, ""), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (output) { + g_variant_unref (output); + } + else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); + } + else { + g_warning ("%s", error->message); + g_error_free (error); + } + + if (g_strcmp0 (signal_name, "EndSession") == 0) { + g_main_loop_quit (main_loop); + g_debug ("Exiting gsd-printer"); + } + } +} + +static gchar * +register_gnome_session_client (const gchar *app_id, + const gchar *client_startup_id) +{ + GDBusProxy *proxy; + GVariant *output = NULL; + GError *error = NULL; + const gchar *client_id = NULL; + gchar *result = NULL; + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_PATH, + GNOME_SESSION_DBUS_IFACE, + NULL, + &error); + + if (proxy) { + output = g_dbus_proxy_call_sync (proxy, + "RegisterClient", + g_variant_new ("(ss)", app_id, client_startup_id), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (output) { + g_variant_get (output, "(o)", &client_id); + if (client_id) + result = g_strdup (client_id); + g_variant_unref (output); + } + else { + g_warning ("%s", error->message); + g_error_free (error); + } + + g_object_unref (proxy); + } + else { + g_warning ("%s", error->message); + g_error_free (error); + } + + return result; +} + +int +main (int argc, char *argv[]) +{ + GDBusConnection *connection; + gboolean client_signal_subscription_set = FALSE; + GError *error = NULL; + guint client_signal_subscription_id; + guint session_signal_subscription_id; + gchar *object_path; + + bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + setlocale (LC_ALL, ""); + + npn_registration_id = 0; + pdi_registration_id = 0; + npn_owner_id = 0; + pdi_owner_id = 0; + + g_type_init (); + + notify_init ("gnome-settings-daemon-printer"); + + npn_introspection_data = + g_dbus_node_info_new_for_xml (npn_introspection_xml, &error); + + if (npn_introspection_data == NULL) { + g_warning ("Error parsing introspection XML: %s\n", error->message); + g_error_free (error); + goto error; + } + + pdi_introspection_data = + g_dbus_node_info_new_for_xml (pdi_introspection_xml, &error); + + if (pdi_introspection_data == NULL) { + g_warning ("Error parsing introspection XML: %s\n", error->message); + g_error_free (error); + goto error; + } + + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + + session_signal_subscription_id = + g_dbus_connection_signal_subscribe (connection, + NULL, + GNOME_SESSION_PRESENCE_DBUS_IFACE, + "StatusChanged", + GNOME_SESSION_PRESENCE_DBUS_PATH, + NULL, + G_DBUS_SIGNAL_FLAGS_NONE, + session_signal_handler, + NULL, + NULL); + + object_path = register_gnome_session_client ("gsd-printer", ""); + if (object_path) { + client_signal_subscription_id = + g_dbus_connection_signal_subscribe (connection, + NULL, + GNOME_SESSION_CLIENT_PRIVATE_DBUS_IFACE, + NULL, + object_path, + NULL, + G_DBUS_SIGNAL_FLAGS_NONE, + client_signal_handler, + NULL, + NULL); + client_signal_subscription_set = TRUE; + } + + if (npn_owner_id == 0) + npn_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, + SCP_DBUS_NPN_NAME, + G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | + G_BUS_NAME_OWNER_FLAGS_REPLACE, + on_npn_bus_acquired, + on_name_acquired, + on_name_lost, + NULL, + NULL); + + if (pdi_owner_id == 0) + pdi_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, + SCP_DBUS_PDI_NAME, + G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | + G_BUS_NAME_OWNER_FLAGS_REPLACE, + on_pdi_bus_acquired, + on_name_acquired, + on_name_lost, + NULL, + NULL); + + main_loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (main_loop); + + unregister_objects (); + unown_names (); + + if (client_signal_subscription_set) + g_dbus_connection_signal_unsubscribe (connection, client_signal_subscription_id); + g_dbus_connection_signal_unsubscribe (connection, session_signal_subscription_id); + + g_free (object_path); + + g_dbus_node_info_unref (npn_introspection_data); + g_dbus_node_info_unref (pdi_introspection_data); + + return 0; + +error: + + if (npn_introspection_data) + g_dbus_node_info_unref (npn_introspection_data); + + if (pdi_introspection_data) + g_dbus_node_info_unref (pdi_introspection_data); + + return 1; +} diff --git a/plugins/print-notifications/print-notifications.gnome-settings-plugin.in b/plugins/print-notifications/print-notifications.gnome-settings-plugin.in new file mode 100644 index 00000000..f5f5aefd --- /dev/null +++ b/plugins/print-notifications/print-notifications.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=print-notifications +IAge=0 +_Name=Print-notifications +_Description=Print-notifications plugin +Authors=AUTHOR +Copyright=Copyright © 2011 AUTHOR +Website= diff --git a/plugins/print-notifications/test-print-notifications.c b/plugins/print-notifications/test-print-notifications.c new file mode 100644 index 00000000..e90d367e --- /dev/null +++ b/plugins/print-notifications/test-print-notifications.c @@ -0,0 +1,7 @@ +#define NEW gsd_print_notifications_manager_new +#define START gsd_print_notifications_manager_start +#define STOP gsd_print_notifications_manager_stop +#define MANAGER GsdPrintNotificationsManager +#include "gsd-print-notifications-manager.h" + +#include "test-plugin.h" diff --git a/plugins/screensaver-proxy/Makefile.am b/plugins/screensaver-proxy/Makefile.am new file mode 100644 index 00000000..38d908bf --- /dev/null +++ b/plugins/screensaver-proxy/Makefile.am @@ -0,0 +1,61 @@ +plugin_name = screensaver-proxy + +plugin_LTLIBRARIES = libscreensaver-proxy.la + +libscreensaver_proxy_la_SOURCES = \ + gsd-screensaver-proxy-manager.c \ + gsd-screensaver-proxy-manager.h \ + gsd-screensaver-proxy-plugin.c \ + gsd-screensaver-proxy-plugin.h + +libscreensaver_proxy_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libscreensaver_proxy_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libscreensaver_proxy_la_LDFLAGS = $(GSD_PLUGIN_LDFLAGS) + +libscreensaver_proxy_la_LIBADD = $(SETTINGS_PLUGIN_LIBS) + +libexec_PROGRAMS = gsd-test-screensaver-proxy + +gsd_test_screensaver_proxy_SOURCES = \ + test-screensaver-proxy.c \ + gsd-screensaver-proxy-manager.c \ + gsd-screensaver-proxy-manager.h + +gsd_test_screensaver_proxy_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +gsd_test_screensaver_proxy_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_screensaver_proxy_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = screensaver-proxy.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = $(plugin_in_files) + +CLEANFILES = $(plugin_DATA) + +DISTCLEANFILES = $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/screensaver-proxy/Makefile.in b/plugins/screensaver-proxy/Makefile.in new file mode 100644 index 00000000..6cadb4e5 --- /dev/null +++ b/plugins/screensaver-proxy/Makefile.in @@ -0,0 +1,893 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-screensaver-proxy$(EXEEXT) +subdir = plugins/screensaver-proxy +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libscreensaver_proxy_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libscreensaver_proxy_la_OBJECTS = \ + libscreensaver_proxy_la-gsd-screensaver-proxy-manager.lo \ + libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.lo +libscreensaver_proxy_la_OBJECTS = \ + $(am_libscreensaver_proxy_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libscreensaver_proxy_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libscreensaver_proxy_la_CFLAGS) $(CFLAGS) \ + $(libscreensaver_proxy_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_test_screensaver_proxy_OBJECTS = \ + gsd_test_screensaver_proxy-test-screensaver-proxy.$(OBJEXT) \ + gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.$(OBJEXT) +gsd_test_screensaver_proxy_OBJECTS = \ + $(am_gsd_test_screensaver_proxy_OBJECTS) +gsd_test_screensaver_proxy_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_screensaver_proxy_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libscreensaver_proxy_la_SOURCES) \ + $(gsd_test_screensaver_proxy_SOURCES) +DIST_SOURCES = $(libscreensaver_proxy_la_SOURCES) \ + $(gsd_test_screensaver_proxy_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = screensaver-proxy +plugin_LTLIBRARIES = libscreensaver-proxy.la +libscreensaver_proxy_la_SOURCES = \ + gsd-screensaver-proxy-manager.c \ + gsd-screensaver-proxy-manager.h \ + gsd-screensaver-proxy-plugin.c \ + gsd-screensaver-proxy-plugin.h + +libscreensaver_proxy_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libscreensaver_proxy_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libscreensaver_proxy_la_LDFLAGS = $(GSD_PLUGIN_LDFLAGS) +libscreensaver_proxy_la_LIBADD = $(SETTINGS_PLUGIN_LIBS) +gsd_test_screensaver_proxy_SOURCES = \ + test-screensaver-proxy.c \ + gsd-screensaver-proxy-manager.c \ + gsd-screensaver-proxy-manager.h + +gsd_test_screensaver_proxy_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +gsd_test_screensaver_proxy_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_screensaver_proxy_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_in_files = screensaver-proxy.gnome-settings-plugin.in +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = $(plugin_in_files) +CLEANFILES = $(plugin_DATA) +DISTCLEANFILES = $(plugin_DATA) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/screensaver-proxy/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/screensaver-proxy/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libscreensaver-proxy.la: $(libscreensaver_proxy_la_OBJECTS) $(libscreensaver_proxy_la_DEPENDENCIES) $(EXTRA_libscreensaver_proxy_la_DEPENDENCIES) + $(AM_V_CCLD)$(libscreensaver_proxy_la_LINK) -rpath $(plugindir) $(libscreensaver_proxy_la_OBJECTS) $(libscreensaver_proxy_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-screensaver-proxy$(EXEEXT): $(gsd_test_screensaver_proxy_OBJECTS) $(gsd_test_screensaver_proxy_DEPENDENCIES) $(EXTRA_gsd_test_screensaver_proxy_DEPENDENCIES) + @rm -f gsd-test-screensaver-proxy$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_screensaver_proxy_LINK) $(gsd_test_screensaver_proxy_OBJECTS) $(gsd_test_screensaver_proxy_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libscreensaver_proxy_la-gsd-screensaver-proxy-manager.lo: gsd-screensaver-proxy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscreensaver_proxy_la_CPPFLAGS) $(CPPFLAGS) $(libscreensaver_proxy_la_CFLAGS) $(CFLAGS) -MT libscreensaver_proxy_la-gsd-screensaver-proxy-manager.lo -MD -MP -MF $(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-manager.Tpo -c -o libscreensaver_proxy_la-gsd-screensaver-proxy-manager.lo `test -f 'gsd-screensaver-proxy-manager.c' || echo '$(srcdir)/'`gsd-screensaver-proxy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-manager.Tpo $(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-screensaver-proxy-manager.c' object='libscreensaver_proxy_la-gsd-screensaver-proxy-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscreensaver_proxy_la_CPPFLAGS) $(CPPFLAGS) $(libscreensaver_proxy_la_CFLAGS) $(CFLAGS) -c -o libscreensaver_proxy_la-gsd-screensaver-proxy-manager.lo `test -f 'gsd-screensaver-proxy-manager.c' || echo '$(srcdir)/'`gsd-screensaver-proxy-manager.c + +libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.lo: gsd-screensaver-proxy-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscreensaver_proxy_la_CPPFLAGS) $(CPPFLAGS) $(libscreensaver_proxy_la_CFLAGS) $(CFLAGS) -MT libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.lo -MD -MP -MF $(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.Tpo -c -o libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.lo `test -f 'gsd-screensaver-proxy-plugin.c' || echo '$(srcdir)/'`gsd-screensaver-proxy-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.Tpo $(DEPDIR)/libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-screensaver-proxy-plugin.c' object='libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscreensaver_proxy_la_CPPFLAGS) $(CPPFLAGS) $(libscreensaver_proxy_la_CFLAGS) $(CFLAGS) -c -o libscreensaver_proxy_la-gsd-screensaver-proxy-plugin.lo `test -f 'gsd-screensaver-proxy-plugin.c' || echo '$(srcdir)/'`gsd-screensaver-proxy-plugin.c + +gsd_test_screensaver_proxy-test-screensaver-proxy.o: test-screensaver-proxy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -MT gsd_test_screensaver_proxy-test-screensaver-proxy.o -MD -MP -MF $(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Tpo -c -o gsd_test_screensaver_proxy-test-screensaver-proxy.o `test -f 'test-screensaver-proxy.c' || echo '$(srcdir)/'`test-screensaver-proxy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Tpo $(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-screensaver-proxy.c' object='gsd_test_screensaver_proxy-test-screensaver-proxy.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -c -o gsd_test_screensaver_proxy-test-screensaver-proxy.o `test -f 'test-screensaver-proxy.c' || echo '$(srcdir)/'`test-screensaver-proxy.c + +gsd_test_screensaver_proxy-test-screensaver-proxy.obj: test-screensaver-proxy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -MT gsd_test_screensaver_proxy-test-screensaver-proxy.obj -MD -MP -MF $(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Tpo -c -o gsd_test_screensaver_proxy-test-screensaver-proxy.obj `if test -f 'test-screensaver-proxy.c'; then $(CYGPATH_W) 'test-screensaver-proxy.c'; else $(CYGPATH_W) '$(srcdir)/test-screensaver-proxy.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Tpo $(DEPDIR)/gsd_test_screensaver_proxy-test-screensaver-proxy.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-screensaver-proxy.c' object='gsd_test_screensaver_proxy-test-screensaver-proxy.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -c -o gsd_test_screensaver_proxy-test-screensaver-proxy.obj `if test -f 'test-screensaver-proxy.c'; then $(CYGPATH_W) 'test-screensaver-proxy.c'; else $(CYGPATH_W) '$(srcdir)/test-screensaver-proxy.c'; fi` + +gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.o: gsd-screensaver-proxy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -MT gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Tpo -c -o gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.o `test -f 'gsd-screensaver-proxy-manager.c' || echo '$(srcdir)/'`gsd-screensaver-proxy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Tpo $(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-screensaver-proxy-manager.c' object='gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -c -o gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.o `test -f 'gsd-screensaver-proxy-manager.c' || echo '$(srcdir)/'`gsd-screensaver-proxy-manager.c + +gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.obj: gsd-screensaver-proxy-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -MT gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Tpo -c -o gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.obj `if test -f 'gsd-screensaver-proxy-manager.c'; then $(CYGPATH_W) 'gsd-screensaver-proxy-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-screensaver-proxy-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Tpo $(DEPDIR)/gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-screensaver-proxy-manager.c' object='gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_screensaver_proxy_CPPFLAGS) $(CPPFLAGS) $(gsd_test_screensaver_proxy_CFLAGS) $(CFLAGS) -c -o gsd_test_screensaver_proxy-gsd-screensaver-proxy-manager.obj `if test -f 'gsd-screensaver-proxy-manager.c'; then $(CYGPATH_W) 'gsd-screensaver-proxy-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-screensaver-proxy-manager.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/screensaver-proxy/gsd-screensaver-proxy-manager.c b/plugins/screensaver-proxy/gsd-screensaver-proxy-manager.c new file mode 100644 index 00000000..60ce94ff --- /dev/null +++ b/plugins/screensaver-proxy/gsd-screensaver-proxy-manager.c @@ -0,0 +1,410 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Bastien Nocera + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "gnome-settings-session.h" +#include "gnome-settings-profile.h" +#include "gsd-screensaver-proxy-manager.h" + +#define GSD_SCREENSAVER_PROXY_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_SCREENSAVER_PROXY_MANAGER, GsdScreensaverProxyManagerPrivate)) + +/* As available in: + * https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml + * and documented in: + * https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/ksmserver/screenlocker/interface.h */ +static const gchar introspection_xml[] = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + + "" + "" + "" + "" +""; + +#define GSD_SCREENSAVER_PROXY_DBUS_SERVICE "org.freedesktop.ScreenSaver" +#define GSD_SCREENSAVER_PROXY_DBUS_PATH "/org/freedesktop/ScreenSaver" +#define GSD_SCREENSAVER_PROXY_DBUS_INTERFACE "org.freedesktop.ScreenSaver" + +#define GSM_INHIBITOR_FLAG_IDLE 1 << 3 + +struct GsdScreensaverProxyManagerPrivate +{ + GDBusProxy *session; + GDBusConnection *connection; + GCancellable *bus_cancellable; + GDBusNodeInfo *introspection_data; + guint name_id; + + GHashTable *watch_ht; /* key = sender, value = name watch id */ + GHashTable *cookie_ht; /* key = cookie, value = sender */ +}; + +static void gsd_screensaver_proxy_manager_class_init (GsdScreensaverProxyManagerClass *klass); +static void gsd_screensaver_proxy_manager_init (GsdScreensaverProxyManager *screensaver_proxy_manager); +static void gsd_screensaver_proxy_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdScreensaverProxyManager, gsd_screensaver_proxy_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" +#define GNOME_SESSION_DBUS_OBJECT "/org/gnome/SessionManager" +#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager" + +static GDBusProxy * +gnome_settings_session_get_session_proxy (void) +{ + static GDBusProxy *session_proxy; + GError *error = NULL; + + if (session_proxy != NULL) { + g_object_ref (session_proxy); + } else { + session_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + GNOME_SESSION_DBUS_NAME, + GNOME_SESSION_DBUS_OBJECT, + GNOME_SESSION_DBUS_INTERFACE, + NULL, + &error); + if (error) { + g_warning ("Failed to connect to the session manager: %s", error->message); + g_error_free (error); + } else { + g_object_add_weak_pointer (G_OBJECT (session_proxy), (gpointer*)&session_proxy); + } + } + + return session_proxy; +} + +static void +name_vanished_cb (GDBusConnection *connection, + const gchar *name, + GsdScreensaverProxyManager *manager) +{ + GHashTableIter iter; + gpointer cookie_ptr; + const char *sender; + + /* Look for all the cookies under that name, + * and call uninhibit for them */ + g_hash_table_iter_init (&iter, manager->priv->cookie_ht); + while (g_hash_table_iter_next (&iter, &cookie_ptr, (gpointer *) &sender)) { + if (g_strcmp0 (sender, name) == 0) { + guint cookie = GPOINTER_TO_UINT (cookie_ptr); + + g_dbus_proxy_call_sync (manager->priv->session, + "Uninhibit", + g_variant_new ("(u)", cookie), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL); + g_debug ("Removing cookie %u for sender %s", + cookie, sender); + g_hash_table_iter_remove (&iter); + } + } + + g_hash_table_remove (manager->priv->watch_ht, sender); +} + +static void +handle_method_call (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GsdScreensaverProxyManager *manager = GSD_SCREENSAVER_PROXY_MANAGER (user_data); + + /* Check session pointer as a proxy for whether the manager is in the + start or stop state */ + if (manager->priv->session == NULL) { + return; + } + + g_debug ("Calling method '%s.%s' for ScreenSaver Proxy", + interface_name, method_name); + + if (g_strcmp0 (method_name, "Inhibit") == 0) { + GVariant *ret; + const char *app_id; + const char *reason; + guint cookie; + + g_variant_get (parameters, + "(ss)", &app_id, &reason); + + ret = g_dbus_proxy_call_sync (manager->priv->session, + "Inhibit", + g_variant_new ("(susu)", + app_id, 0, reason, GSM_INHIBITOR_FLAG_IDLE), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL); + g_variant_get (ret, "(u)", &cookie); + g_hash_table_insert (manager->priv->cookie_ht, + GUINT_TO_POINTER (cookie), + g_strdup (sender)); + if (g_hash_table_lookup (manager->priv->watch_ht, sender) == NULL) { + guint watch_id; + + watch_id = g_bus_watch_name_on_connection (manager->priv->connection, + sender, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, + (GBusNameVanishedCallback) name_vanished_cb, + manager, + NULL); + g_hash_table_insert (manager->priv->watch_ht, + g_strdup (sender), + GUINT_TO_POINTER (watch_id)); + } + g_dbus_method_invocation_return_value (invocation, ret); + } else if (g_strcmp0 (method_name, "UnInhibit") == 0) { + guint cookie; + + g_variant_get (parameters, "(u)", &cookie); + g_dbus_proxy_call_sync (manager->priv->session, + "Uninhibit", + parameters, + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL); + g_debug ("Removing cookie %u from the list for %s", cookie, sender); + g_hash_table_remove (manager->priv->cookie_ht, GUINT_TO_POINTER (cookie)); + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "Throttle") == 0) { + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "UnThrottle") == 0) { + g_dbus_method_invocation_return_value (invocation, NULL); + } else if (g_strcmp0 (method_name, "Lock") == 0) { + goto unimplemented; + } else if (g_strcmp0 (method_name, "SimulateUserActivity") == 0) { + goto unimplemented; + } else if (g_strcmp0 (method_name, "GetActive") == 0) { + goto unimplemented; + } else if (g_strcmp0 (method_name, "GetActiveTime") == 0) { + goto unimplemented; + } else if (g_strcmp0 (method_name, "GetSessionIdleTime") == 0) { + goto unimplemented; + } else if (g_strcmp0 (method_name, "SetActive") == 0) { + goto unimplemented; + } + + return; + +unimplemented: + g_dbus_method_invocation_return_dbus_error (invocation, + "org.freedesktop.DBus.Error.NotSupported", + "This method is not implemented"); +} + +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + NULL, /* GetProperty */ + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdScreensaverProxyManager *manager) +{ + GDBusConnection *connection; + GDBusInterfaceInfo **infos; + GError *error = NULL; + + if (manager->priv->bus_cancellable == NULL || + g_cancellable_is_cancelled (manager->priv->bus_cancellable)) { + g_warning ("Operation has been cancelled, so not retrieving session bus"); + return; + } + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + infos = manager->priv->introspection_data->interfaces; + g_dbus_connection_register_object (connection, + GSD_SCREENSAVER_PROXY_DBUS_PATH, + infos[0], + &interface_vtable, + manager, + NULL, + NULL); + + manager->priv->name_id = g_bus_own_name_on_connection (manager->priv->connection, + GSD_SCREENSAVER_PROXY_DBUS_SERVICE, + G_BUS_NAME_OWNER_FLAGS_NONE, + NULL, + NULL, + NULL, + NULL); +} + +static void +register_manager_dbus (GsdScreensaverProxyManager *manager) +{ + manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + manager->priv->bus_cancellable = g_cancellable_new (); + g_assert (manager->priv->introspection_data != NULL); + + g_bus_get (G_BUS_TYPE_SESSION, + manager->priv->bus_cancellable, + (GAsyncReadyCallback) on_bus_gotten, + manager); +} + +gboolean +gsd_screensaver_proxy_manager_start (GsdScreensaverProxyManager *manager, + GError **error) +{ + g_debug ("Starting screensaver-proxy manager"); + gnome_settings_profile_start (NULL); + manager->priv->session = + gnome_settings_session_get_session_proxy (); + manager->priv->watch_ht = g_hash_table_new_full (g_str_hash, + g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_bus_unwatch_name); + manager->priv->cookie_ht = g_hash_table_new_full (g_direct_hash, + g_direct_equal, + NULL, + (GDestroyNotify) g_free); + gnome_settings_profile_end (NULL); + return TRUE; +} + +void +gsd_screensaver_proxy_manager_stop (GsdScreensaverProxyManager *manager) +{ + g_debug ("Stopping screensaver_proxy manager"); + g_clear_object (&manager->priv->session); + g_clear_pointer (&manager->priv->watch_ht, g_hash_table_destroy); + g_clear_pointer (&manager->priv->cookie_ht, g_hash_table_destroy); +} + +static void +gsd_screensaver_proxy_manager_class_init (GsdScreensaverProxyManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gsd_screensaver_proxy_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdScreensaverProxyManagerPrivate)); +} + +static void +gsd_screensaver_proxy_manager_init (GsdScreensaverProxyManager *manager) +{ + manager->priv = GSD_SCREENSAVER_PROXY_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_screensaver_proxy_manager_finalize (GObject *object) +{ + GsdScreensaverProxyManager *manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SCREENSAVER_PROXY_MANAGER (object)); + + manager = GSD_SCREENSAVER_PROXY_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + if (manager->priv->name_id != 0) { + g_bus_unown_name (manager->priv->name_id); + manager->priv->name_id = 0; + } + g_clear_object (&manager->priv->connection); + g_clear_object (&manager->priv->bus_cancellable); + g_clear_pointer (&manager->priv->introspection_data, g_dbus_node_info_unref); + + G_OBJECT_CLASS (gsd_screensaver_proxy_manager_parent_class)->finalize (object); +} + +GsdScreensaverProxyManager * +gsd_screensaver_proxy_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_SCREENSAVER_PROXY_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + register_manager_dbus (manager_object); + } + + return GSD_SCREENSAVER_PROXY_MANAGER (manager_object); +} diff --git a/plugins/screensaver-proxy/gsd-screensaver-proxy-manager.h b/plugins/screensaver-proxy/gsd-screensaver-proxy-manager.h new file mode 100644 index 00000000..b5295934 --- /dev/null +++ b/plugins/screensaver-proxy/gsd-screensaver-proxy-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Bastien Nocera + * + * 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_SCREENSAVER_PROXY_MANAGER_H +#define __GSD_SCREENSAVER_PROXY_MANAGER_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_SCREENSAVER_PROXY_MANAGER (gsd_screensaver_proxy_manager_get_type ()) +#define GSD_SCREENSAVER_PROXY_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SCREENSAVER_PROXY_MANAGER, GsdScreensaverProxyManager)) +#define GSD_SCREENSAVER_PROXY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_SCREENSAVER_PROXY_MANAGER, GsdScreensaverProxyManagerClass)) +#define GSD_IS_SCREENSAVER_PROXY_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SCREENSAVER_PROXY_MANAGER)) +#define GSD_IS_SCREENSAVER_PROXY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SCREENSAVER_PROXY_MANAGER)) +#define GSD_SCREENSAVER_PROXY_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SCREENSAVER_PROXY_MANAGER, GsdScreensaverProxyManagerClass)) + +typedef struct GsdScreensaverProxyManagerPrivate GsdScreensaverProxyManagerPrivate; + +typedef struct +{ + GObject parent; + GsdScreensaverProxyManagerPrivate *priv; +} GsdScreensaverProxyManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdScreensaverProxyManagerClass; + +GType gsd_screensaver_proxy_manager_get_type (void); + +GsdScreensaverProxyManager *gsd_screensaver_proxy_manager_new (void); +gboolean gsd_screensaver_proxy_manager_start (GsdScreensaverProxyManager *manager, + GError **error); +void gsd_screensaver_proxy_manager_stop (GsdScreensaverProxyManager *manager); + +G_END_DECLS + +#endif /* __GSD_SCREENSAVER_PROXY_MANAGER_H */ diff --git a/plugins/screensaver-proxy/gsd-screensaver-proxy-plugin.c b/plugins/screensaver-proxy/gsd-screensaver-proxy-plugin.c new file mode 100644 index 00000000..d5218436 --- /dev/null +++ b/plugins/screensaver-proxy/gsd-screensaver-proxy-plugin.c @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Bastien Nocera + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-screensaver-proxy-plugin.h" +#include "gsd-screensaver-proxy-manager.h" + +struct GsdScreensaverProxyPluginPrivate { + GsdScreensaverProxyManager *manager; +}; + +#define GSD_SCREENSAVER_PROXY_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_SCREENSAVER_PROXY_PLUGIN, GsdScreensaverProxyPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdScreensaverProxyPlugin, gsd_screensaver_proxy_plugin) + +static void +gsd_screensaver_proxy_plugin_init (GsdScreensaverProxyPlugin *plugin) +{ + plugin->priv = GSD_SCREENSAVER_PROXY_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdScreensaverProxyPlugin initializing"); + + plugin->priv->manager = gsd_screensaver_proxy_manager_new (); +} + +static void +gsd_screensaver_proxy_plugin_finalize (GObject *object) +{ + GsdScreensaverProxyPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SCREENSAVER_PROXY_PLUGIN (object)); + + g_debug ("GsdScreensaverProxyPlugin finalizing"); + + plugin = GSD_SCREENSAVER_PROXY_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_screensaver_proxy_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating screensaver-proxy plugin"); + + error = NULL; + res = gsd_screensaver_proxy_manager_start (GSD_SCREENSAVER_PROXY_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start screensaver-proxy manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating screensaver-proxy plugin"); + gsd_screensaver_proxy_manager_stop (GSD_SCREENSAVER_PROXY_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_screensaver_proxy_plugin_class_init (GsdScreensaverProxyPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_screensaver_proxy_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdScreensaverProxyPluginPrivate)); +} diff --git a/plugins/screensaver-proxy/gsd-screensaver-proxy-plugin.h b/plugins/screensaver-proxy/gsd-screensaver-proxy-plugin.h new file mode 100644 index 00000000..13c3050a --- /dev/null +++ b/plugins/screensaver-proxy/gsd-screensaver-proxy-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Bastien Nocera + * + * 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, 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_SCREENSAVER_PROXY_PLUGIN_H__ +#define __GSD_SCREENSAVER_PROXY_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_SCREENSAVER_PROXY_PLUGIN (gsd_screensaver_proxy_plugin_get_type ()) +#define GSD_SCREENSAVER_PROXY_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SCREENSAVER_PROXY_PLUGIN, GsdScreensaverProxyPlugin)) +#define GSD_SCREENSAVER_PROXY_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_SCREENSAVER_PROXY_PLUGIN, GsdScreensaverProxyPluginClass)) +#define GSD_IS_SCREENSAVER_PROXY_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SCREENSAVER_PROXY_PLUGIN)) +#define GSD_IS_SCREENSAVER_PROXY_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SCREENSAVER_PROXY_PLUGIN)) +#define GSD_SCREENSAVER_PROXY_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SCREENSAVER_PROXY_PLUGIN, GsdScreensaverProxyPluginClass)) + +typedef struct GsdScreensaverProxyPluginPrivate GsdScreensaverProxyPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdScreensaverProxyPluginPrivate *priv; +} GsdScreensaverProxyPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdScreensaverProxyPluginClass; + +GType gsd_screensaver_proxy_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_SCREENSAVER_PROXY_PLUGIN_H__ */ diff --git a/plugins/screensaver-proxy/screensaver-proxy.gnome-settings-plugin.in b/plugins/screensaver-proxy/screensaver-proxy.gnome-settings-plugin.in new file mode 100644 index 00000000..c1bd4ac4 --- /dev/null +++ b/plugins/screensaver-proxy/screensaver-proxy.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=screensaver-proxy +IAge=0 +_Name=Screensaver Proxy +_Description=Proxy FreeDesktop screensaver inhibition to gnome-session +Authors=AUTHOR +Copyright=Copyright © 2012 Bastien Nocera +Website= diff --git a/plugins/screensaver-proxy/test-screensaver-proxy.c b/plugins/screensaver-proxy/test-screensaver-proxy.c new file mode 100644 index 00000000..d5d9268e --- /dev/null +++ b/plugins/screensaver-proxy/test-screensaver-proxy.c @@ -0,0 +1,7 @@ +#define NEW gsd_screensaver_proxy_manager_new +#define START gsd_screensaver_proxy_manager_start +#define STOP gsd_screensaver_proxy_manager_stop +#define MANAGER GsdScreensaverProxyManager +#include "gsd-screensaver-proxy-manager.h" + +#include "test-plugin.h" diff --git a/plugins/smartcard/Makefile.am b/plugins/smartcard/Makefile.am new file mode 100644 index 00000000..e2a0addb --- /dev/null +++ b/plugins/smartcard/Makefile.am @@ -0,0 +1,75 @@ +plugin_name = smartcard + +libexec_PROGRAMS = gsd-test-smartcard + +gsd_test_smartcard_SOURCES = \ + gsd-smartcard-manager.h \ + gsd-smartcard-manager.c \ + gsd-smartcard.h \ + gsd-smartcard.c \ + test-smartcard.c + +gsd_test_smartcard_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(NSS_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_smartcard_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(NSS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = \ + libsmartcard.la + +libsmartcard_la_SOURCES = \ + gsd-smartcard-plugin.h \ + gsd-smartcard-plugin.c \ + gsd-smartcard.h \ + gsd-smartcard.c \ + gsd-smartcard-manager.h \ + gsd-smartcard-manager.c + +libsmartcard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DGSD_SMARTCARD_MANAGER_NSS_DB=\""$(NSS_DATABASE)"\" \ + $(AM_CPPFLAGS) + +libsmartcard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(NSS_CFLAGS) \ + $(AM_CFLAGS) + +libsmartcard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libsmartcard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NSS_LIBS) + +@GSD_INTLTOOL_PLUGIN_RULE@ + +plugin_in_files = \ + smartcard.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) diff --git a/plugins/smartcard/Makefile.in b/plugins/smartcard/Makefile.in new file mode 100644 index 00000000..960569e3 --- /dev/null +++ b/plugins/smartcard/Makefile.in @@ -0,0 +1,936 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-smartcard$(EXEEXT) +subdir = plugins/smartcard +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libsmartcard_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libsmartcard_la_OBJECTS = libsmartcard_la-gsd-smartcard-plugin.lo \ + libsmartcard_la-gsd-smartcard.lo \ + libsmartcard_la-gsd-smartcard-manager.lo +libsmartcard_la_OBJECTS = $(am_libsmartcard_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libsmartcard_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libsmartcard_la_CFLAGS) $(CFLAGS) $(libsmartcard_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_test_smartcard_OBJECTS = \ + gsd_test_smartcard-gsd-smartcard-manager.$(OBJEXT) \ + gsd_test_smartcard-gsd-smartcard.$(OBJEXT) \ + gsd_test_smartcard-test-smartcard.$(OBJEXT) +gsd_test_smartcard_OBJECTS = $(am_gsd_test_smartcard_OBJECTS) +gsd_test_smartcard_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_smartcard_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_smartcard_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libsmartcard_la_SOURCES) $(gsd_test_smartcard_SOURCES) +DIST_SOURCES = $(libsmartcard_la_SOURCES) \ + $(gsd_test_smartcard_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = smartcard +gsd_test_smartcard_SOURCES = \ + gsd-smartcard-manager.h \ + gsd-smartcard-manager.c \ + gsd-smartcard.h \ + gsd-smartcard.c \ + test-smartcard.c + +gsd_test_smartcard_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(NSS_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_smartcard_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(NSS_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = \ + libsmartcard.la + +libsmartcard_la_SOURCES = \ + gsd-smartcard-plugin.h \ + gsd-smartcard-plugin.c \ + gsd-smartcard.h \ + gsd-smartcard.c \ + gsd-smartcard-manager.h \ + gsd-smartcard-manager.c + +libsmartcard_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DGSD_SMARTCARD_MANAGER_NSS_DB=\""$(NSS_DATABASE)"\" \ + $(AM_CPPFLAGS) + +libsmartcard_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(NSS_CFLAGS) \ + $(AM_CFLAGS) + +libsmartcard_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libsmartcard_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NSS_LIBS) + +plugin_in_files = \ + smartcard.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/smartcard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/smartcard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libsmartcard.la: $(libsmartcard_la_OBJECTS) $(libsmartcard_la_DEPENDENCIES) $(EXTRA_libsmartcard_la_DEPENDENCIES) + $(AM_V_CCLD)$(libsmartcard_la_LINK) -rpath $(plugindir) $(libsmartcard_la_OBJECTS) $(libsmartcard_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-smartcard$(EXEEXT): $(gsd_test_smartcard_OBJECTS) $(gsd_test_smartcard_DEPENDENCIES) $(EXTRA_gsd_test_smartcard_DEPENDENCIES) + @rm -f gsd-test-smartcard$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_smartcard_LINK) $(gsd_test_smartcard_OBJECTS) $(gsd_test_smartcard_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_smartcard-test-smartcard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmartcard_la-gsd-smartcard-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmartcard_la-gsd-smartcard-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmartcard_la-gsd-smartcard.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libsmartcard_la-gsd-smartcard-plugin.lo: gsd-smartcard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsmartcard_la_CPPFLAGS) $(CPPFLAGS) $(libsmartcard_la_CFLAGS) $(CFLAGS) -MT libsmartcard_la-gsd-smartcard-plugin.lo -MD -MP -MF $(DEPDIR)/libsmartcard_la-gsd-smartcard-plugin.Tpo -c -o libsmartcard_la-gsd-smartcard-plugin.lo `test -f 'gsd-smartcard-plugin.c' || echo '$(srcdir)/'`gsd-smartcard-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsmartcard_la-gsd-smartcard-plugin.Tpo $(DEPDIR)/libsmartcard_la-gsd-smartcard-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard-plugin.c' object='libsmartcard_la-gsd-smartcard-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsmartcard_la_CPPFLAGS) $(CPPFLAGS) $(libsmartcard_la_CFLAGS) $(CFLAGS) -c -o libsmartcard_la-gsd-smartcard-plugin.lo `test -f 'gsd-smartcard-plugin.c' || echo '$(srcdir)/'`gsd-smartcard-plugin.c + +libsmartcard_la-gsd-smartcard.lo: gsd-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsmartcard_la_CPPFLAGS) $(CPPFLAGS) $(libsmartcard_la_CFLAGS) $(CFLAGS) -MT libsmartcard_la-gsd-smartcard.lo -MD -MP -MF $(DEPDIR)/libsmartcard_la-gsd-smartcard.Tpo -c -o libsmartcard_la-gsd-smartcard.lo `test -f 'gsd-smartcard.c' || echo '$(srcdir)/'`gsd-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsmartcard_la-gsd-smartcard.Tpo $(DEPDIR)/libsmartcard_la-gsd-smartcard.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard.c' object='libsmartcard_la-gsd-smartcard.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsmartcard_la_CPPFLAGS) $(CPPFLAGS) $(libsmartcard_la_CFLAGS) $(CFLAGS) -c -o libsmartcard_la-gsd-smartcard.lo `test -f 'gsd-smartcard.c' || echo '$(srcdir)/'`gsd-smartcard.c + +libsmartcard_la-gsd-smartcard-manager.lo: gsd-smartcard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsmartcard_la_CPPFLAGS) $(CPPFLAGS) $(libsmartcard_la_CFLAGS) $(CFLAGS) -MT libsmartcard_la-gsd-smartcard-manager.lo -MD -MP -MF $(DEPDIR)/libsmartcard_la-gsd-smartcard-manager.Tpo -c -o libsmartcard_la-gsd-smartcard-manager.lo `test -f 'gsd-smartcard-manager.c' || echo '$(srcdir)/'`gsd-smartcard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsmartcard_la-gsd-smartcard-manager.Tpo $(DEPDIR)/libsmartcard_la-gsd-smartcard-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard-manager.c' object='libsmartcard_la-gsd-smartcard-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsmartcard_la_CPPFLAGS) $(CPPFLAGS) $(libsmartcard_la_CFLAGS) $(CFLAGS) -c -o libsmartcard_la-gsd-smartcard-manager.lo `test -f 'gsd-smartcard-manager.c' || echo '$(srcdir)/'`gsd-smartcard-manager.c + +gsd_test_smartcard-gsd-smartcard-manager.o: gsd-smartcard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -MT gsd_test_smartcard-gsd-smartcard-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Tpo -c -o gsd_test_smartcard-gsd-smartcard-manager.o `test -f 'gsd-smartcard-manager.c' || echo '$(srcdir)/'`gsd-smartcard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Tpo $(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard-manager.c' object='gsd_test_smartcard-gsd-smartcard-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -c -o gsd_test_smartcard-gsd-smartcard-manager.o `test -f 'gsd-smartcard-manager.c' || echo '$(srcdir)/'`gsd-smartcard-manager.c + +gsd_test_smartcard-gsd-smartcard-manager.obj: gsd-smartcard-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -MT gsd_test_smartcard-gsd-smartcard-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Tpo -c -o gsd_test_smartcard-gsd-smartcard-manager.obj `if test -f 'gsd-smartcard-manager.c'; then $(CYGPATH_W) 'gsd-smartcard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-smartcard-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Tpo $(DEPDIR)/gsd_test_smartcard-gsd-smartcard-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard-manager.c' object='gsd_test_smartcard-gsd-smartcard-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -c -o gsd_test_smartcard-gsd-smartcard-manager.obj `if test -f 'gsd-smartcard-manager.c'; then $(CYGPATH_W) 'gsd-smartcard-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-smartcard-manager.c'; fi` + +gsd_test_smartcard-gsd-smartcard.o: gsd-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -MT gsd_test_smartcard-gsd-smartcard.o -MD -MP -MF $(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Tpo -c -o gsd_test_smartcard-gsd-smartcard.o `test -f 'gsd-smartcard.c' || echo '$(srcdir)/'`gsd-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Tpo $(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard.c' object='gsd_test_smartcard-gsd-smartcard.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -c -o gsd_test_smartcard-gsd-smartcard.o `test -f 'gsd-smartcard.c' || echo '$(srcdir)/'`gsd-smartcard.c + +gsd_test_smartcard-gsd-smartcard.obj: gsd-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -MT gsd_test_smartcard-gsd-smartcard.obj -MD -MP -MF $(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Tpo -c -o gsd_test_smartcard-gsd-smartcard.obj `if test -f 'gsd-smartcard.c'; then $(CYGPATH_W) 'gsd-smartcard.c'; else $(CYGPATH_W) '$(srcdir)/gsd-smartcard.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Tpo $(DEPDIR)/gsd_test_smartcard-gsd-smartcard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-smartcard.c' object='gsd_test_smartcard-gsd-smartcard.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -c -o gsd_test_smartcard-gsd-smartcard.obj `if test -f 'gsd-smartcard.c'; then $(CYGPATH_W) 'gsd-smartcard.c'; else $(CYGPATH_W) '$(srcdir)/gsd-smartcard.c'; fi` + +gsd_test_smartcard-test-smartcard.o: test-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -MT gsd_test_smartcard-test-smartcard.o -MD -MP -MF $(DEPDIR)/gsd_test_smartcard-test-smartcard.Tpo -c -o gsd_test_smartcard-test-smartcard.o `test -f 'test-smartcard.c' || echo '$(srcdir)/'`test-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_smartcard-test-smartcard.Tpo $(DEPDIR)/gsd_test_smartcard-test-smartcard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-smartcard.c' object='gsd_test_smartcard-test-smartcard.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -c -o gsd_test_smartcard-test-smartcard.o `test -f 'test-smartcard.c' || echo '$(srcdir)/'`test-smartcard.c + +gsd_test_smartcard-test-smartcard.obj: test-smartcard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -MT gsd_test_smartcard-test-smartcard.obj -MD -MP -MF $(DEPDIR)/gsd_test_smartcard-test-smartcard.Tpo -c -o gsd_test_smartcard-test-smartcard.obj `if test -f 'test-smartcard.c'; then $(CYGPATH_W) 'test-smartcard.c'; else $(CYGPATH_W) '$(srcdir)/test-smartcard.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_smartcard-test-smartcard.Tpo $(DEPDIR)/gsd_test_smartcard-test-smartcard.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-smartcard.c' object='gsd_test_smartcard-test-smartcard.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_smartcard_CFLAGS) $(CFLAGS) -c -o gsd_test_smartcard-test-smartcard.obj `if test -f 'test-smartcard.c'; then $(CYGPATH_W) 'test-smartcard.c'; else $(CYGPATH_W) '$(srcdir)/test-smartcard.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c new file mode 100644 index 00000000..03c8f794 --- /dev/null +++ b/plugins/smartcard/gsd-smartcard-manager.c @@ -0,0 +1,1521 @@ +/* gsd-smartcard-manager.c - object for monitoring smartcard insertion and + * removal events + * + * Copyright (C) 2006, 2009 Red Hat, Inc. + * + * 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, 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. + * + * Written By: Ray Strode + */ +#include "config.h" + +#include "gsd-smartcard-manager.h" + +#define SMARTCARD_ENABLE_INTERNAL_API +#include "gsd-smartcard.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifndef GSD_SMARTCARD_MANAGER_DRIVER +#define GSD_SMARTCARD_MANAGER_DRIVER LIBDIR"/pkcs11/libcoolkeypk11.so" +#endif + +#ifndef GSD_SMARTCARD_MANAGER_NSS_DB +#define GSD_SMARTCARD_MANAGER_NSS_DB SYSCONFDIR"/pki/nssdb" +#endif + +#ifndef GSD_MAX_OPEN_FILE_DESCRIPTORS +#define GSD_MAX_OPEN_FILE_DESCRIPTORS 1024 +#endif + +#ifndef GSD_OPEN_FILE_DESCRIPTORS_DIR +#define GSD_OPEN_FILE_DESCRIPTORS_DIR "/proc/self/fd" +#endif + +typedef enum _GsdSmartcardManagerState GsdSmartcardManagerState; +typedef struct _GsdSmartcardManagerWorker GsdSmartcardManagerWorker; + +enum _GsdSmartcardManagerState { + GSD_SMARTCARD_MANAGER_STATE_STOPPED = 0, + GSD_SMARTCARD_MANAGER_STATE_STARTING, + GSD_SMARTCARD_MANAGER_STATE_STARTED, + GSD_SMARTCARD_MANAGER_STATE_STOPPING, +}; + +struct _GsdSmartcardManagerPrivate { + GsdSmartcardManagerState state; + GList *modules; + char *module_path; + + GList *workers; + + GPid smartcard_event_watcher_pid; + GHashTable *smartcards; + + guint poll_timeout_id; + + guint32 is_unstoppable : 1; + guint32 nss_is_loaded : 1; +}; + +struct _GsdSmartcardManagerWorker { + GsdSmartcardManager *manager; + int manager_fd; + + GThread *thread; + SECMODModule *module; + GHashTable *smartcards; + int fd; + GSource *event_source; + + guint32 nss_is_loaded : 1; +}; + +static void gsd_smartcard_manager_finalize (GObject *object); +static void gsd_smartcard_manager_class_install_signals (GsdSmartcardManagerClass *service_class); +static void gsd_smartcard_manager_class_install_properties (GsdSmartcardManagerClass *service_class); +static void gsd_smartcard_manager_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gsd_smartcard_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gsd_smartcard_manager_set_module_path (GsdSmartcardManager *manager, + const char *module_path); +static void gsd_smartcard_manager_card_removed_handler (GsdSmartcardManager *manager, + GsdSmartcard *card); +static void gsd_smartcard_manager_card_inserted_handler (GsdSmartcardManager *manager_class, + GsdSmartcard *card); +static gboolean gsd_smartcard_manager_stop_now (GsdSmartcardManager *manager); +static void gsd_smartcard_manager_queue_stop (GsdSmartcardManager *manager); + +static GsdSmartcardManagerWorker *gsd_smartcard_manager_create_worker (GsdSmartcardManager *manager, + SECMODModule *module); + +static GsdSmartcardManagerWorker * gsd_smartcard_manager_worker_new (GsdSmartcardManager *manager, + int worker_fd, + int manager_fd, + SECMODModule *module); +static void gsd_smartcard_manager_worker_free (GsdSmartcardManagerWorker *worker); +static gboolean open_pipe (int *write_fd, int *read_fd); +static gboolean read_bytes (int fd, gpointer bytes, gsize num_bytes); +static gboolean write_bytes (int fd, gconstpointer bytes, gsize num_bytes); +static GsdSmartcard *read_smartcard (int fd, SECMODModule *module); +static gboolean write_smartcard (int fd, GsdSmartcard *card); + +enum { + PROP_0 = 0, + PROP_MODULE_PATH, + NUMBER_OF_PROPERTIES +}; + +enum { + SMARTCARD_INSERTED = 0, + SMARTCARD_REMOVED, + ERROR, + NUMBER_OF_SIGNALS +}; + +static guint gsd_smartcard_manager_signals[NUMBER_OF_SIGNALS]; + +G_DEFINE_TYPE (GsdSmartcardManager, + gsd_smartcard_manager, + G_TYPE_OBJECT); + +static void +gsd_smartcard_manager_class_init (GsdSmartcardManagerClass *manager_class) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (manager_class); + + gobject_class->finalize = gsd_smartcard_manager_finalize; + + gsd_smartcard_manager_class_install_signals (manager_class); + gsd_smartcard_manager_class_install_properties (manager_class); + + g_type_class_add_private (manager_class, + sizeof (GsdSmartcardManagerPrivate)); +} + +static void +gsd_smartcard_manager_class_install_properties (GsdSmartcardManagerClass *card_class) +{ + GObjectClass *object_class; + GParamSpec *param_spec; + + object_class = G_OBJECT_CLASS (card_class); + object_class->set_property = gsd_smartcard_manager_set_property; + object_class->get_property = gsd_smartcard_manager_get_property; + + param_spec = g_param_spec_string ("module-path", "Module Path", + "path to smartcard PKCS #11 driver", + NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_MODULE_PATH, param_spec); +} + +static void +gsd_smartcard_manager_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GsdSmartcardManager *manager = GSD_SMARTCARD_MANAGER (object); + + switch (prop_id) { + case PROP_MODULE_PATH: + gsd_smartcard_manager_set_module_path (manager, + g_value_get_string (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_smartcard_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GsdSmartcardManager *manager = GSD_SMARTCARD_MANAGER (object); + char *module_path; + + switch (prop_id) { + case PROP_MODULE_PATH: + module_path = gsd_smartcard_manager_get_module_path (manager); + g_value_set_string (value, module_path); + g_free (module_path); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +char * +gsd_smartcard_manager_get_module_path (GsdSmartcardManager *manager) +{ + return manager->priv->module_path; +} + +static void +gsd_smartcard_manager_set_module_path (GsdSmartcardManager *manager, + const char *module_path) +{ + if ((manager->priv->module_path == NULL) && (module_path == NULL)) { + return; + } + + if (((manager->priv->module_path == NULL) || + (module_path == NULL) || + (strcmp (manager->priv->module_path, module_path) != 0))) { + g_free (manager->priv->module_path); + manager->priv->module_path = g_strdup (module_path); + g_object_notify (G_OBJECT (manager), "module-path"); + } +} + +static void +gsd_smartcard_manager_card_removed_handler (GsdSmartcardManager *manager, + GsdSmartcard *card) +{ + g_debug ("informing smartcard of its removal"); + _gsd_smartcard_set_state (card, GSD_SMARTCARD_STATE_REMOVED); + g_debug ("done"); +} + +static void +gsd_smartcard_manager_card_inserted_handler (GsdSmartcardManager *manager, + GsdSmartcard *card) +{ + g_debug ("informing smartcard of its insertion"); + + _gsd_smartcard_set_state (card, GSD_SMARTCARD_STATE_INSERTED); + g_debug ("done"); + +} + +static void +gsd_smartcard_manager_class_install_signals (GsdSmartcardManagerClass *manager_class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (manager_class); + + gsd_smartcard_manager_signals[SMARTCARD_INSERTED] = + g_signal_new ("smartcard-inserted", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GsdSmartcardManagerClass, + smartcard_inserted), + NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); + manager_class->smartcard_inserted = gsd_smartcard_manager_card_inserted_handler; + + gsd_smartcard_manager_signals[SMARTCARD_REMOVED] = + g_signal_new ("smartcard-removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GsdSmartcardManagerClass, + smartcard_removed), + NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); + manager_class->smartcard_removed = gsd_smartcard_manager_card_removed_handler; + + gsd_smartcard_manager_signals[ERROR] = + g_signal_new ("error", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdSmartcardManagerClass, error), + NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); + manager_class->error = NULL; +} + +static gboolean +slot_id_equal (CK_SLOT_ID *slot_id_1, + CK_SLOT_ID *slot_id_2) +{ + g_assert (slot_id_1 != NULL); + g_assert (slot_id_2 != NULL); + + return *slot_id_1 == *slot_id_2; +} + +static gboolean +slot_id_hash (CK_SLOT_ID *slot_id) +{ + guint32 upper_bits, lower_bits; + int temp; + + if (sizeof (CK_SLOT_ID) == sizeof (int)) { + return g_int_hash (slot_id); + } + + upper_bits = ((*slot_id) >> 31) - 1; + lower_bits = (*slot_id) & 0xffffffff; + + /* The upper bits are almost certainly always zero, + * so let's degenerate to g_int_hash for the + * (very) common case + */ + temp = lower_bits + upper_bits; + return upper_bits + g_int_hash (&temp); +} + +static void +gsd_smartcard_manager_init (GsdSmartcardManager *manager) +{ + g_debug ("initializing smartcard manager"); + + manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, + GSD_TYPE_SMARTCARD_MANAGER, + GsdSmartcardManagerPrivate); + manager->priv->poll_timeout_id = 0; + manager->priv->is_unstoppable = FALSE; + + manager->priv->smartcards = + g_hash_table_new_full (g_str_hash, + g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_object_unref); +} + +static void +gsd_smartcard_manager_finalize (GObject *object) +{ + GsdSmartcardManager *manager; + GObjectClass *gobject_class; + + manager = GSD_SMARTCARD_MANAGER (object); + gobject_class = + G_OBJECT_CLASS (gsd_smartcard_manager_parent_class); + + gsd_smartcard_manager_stop_now (manager); + + g_hash_table_destroy (manager->priv->smartcards); + manager->priv->smartcards = NULL; + + gobject_class->finalize (object); +} + +GQuark +gsd_smartcard_manager_error_quark (void) +{ + static GQuark error_quark = 0; + + if (error_quark == 0) { + error_quark = g_quark_from_static_string ("gsd-smartcard-manager-error-quark"); + } + + return error_quark; +} + +GsdSmartcardManager * +gsd_smartcard_manager_new_default (void) +{ + return gsd_smartcard_manager_new (NULL); +} + +GsdSmartcardManager * +gsd_smartcard_manager_new (const char *module_path) +{ + GsdSmartcardManager *instance; + + instance = GSD_SMARTCARD_MANAGER (g_object_new (GSD_TYPE_SMARTCARD_MANAGER, + "module-path", module_path, + NULL)); + + return instance; +} + +static void +gsd_smartcard_manager_emit_error (GsdSmartcardManager *manager, + GError *error) +{ + manager->priv->is_unstoppable = TRUE; + g_signal_emit (manager, gsd_smartcard_manager_signals[ERROR], 0, + error); + manager->priv->is_unstoppable = FALSE; +} + +static void +gsd_smartcard_manager_emit_smartcard_inserted (GsdSmartcardManager *manager, + GsdSmartcard *card) +{ + manager->priv->is_unstoppable = TRUE; + g_signal_emit (manager, gsd_smartcard_manager_signals[SMARTCARD_INSERTED], 0, + card); + manager->priv->is_unstoppable = FALSE; +} + +static void +gsd_smartcard_manager_emit_smartcard_removed (GsdSmartcardManager *manager, + GsdSmartcard *card) +{ + manager->priv->is_unstoppable = TRUE; + g_signal_emit (manager, gsd_smartcard_manager_signals[SMARTCARD_REMOVED], 0, + card); + manager->priv->is_unstoppable = FALSE; +} + +static gboolean +gsd_smartcard_manager_check_for_and_process_events (GIOChannel *io_channel, + GIOCondition condition, + GsdSmartcardManagerWorker *worker) +{ + GsdSmartcard *card; + GsdSmartcardManager *manager; + gboolean should_stop; + guchar event_type; + char *card_name; + int fd; + + manager = worker->manager; + + g_debug ("event!"); + card = NULL; + should_stop = (condition & G_IO_HUP) || (condition & G_IO_ERR); + + if (should_stop) { + g_debug ("received %s on event socket, stopping " + "manager...", + (condition & G_IO_HUP) && (condition & G_IO_ERR)? + "error and hangup" : + (condition & G_IO_HUP)? + "hangup" : "error"); + } + + if (!(condition & G_IO_IN)) { + g_debug ("nevermind outta here!"); + goto out; + } + + fd = g_io_channel_unix_get_fd (io_channel); + + event_type = '\0'; + if (!read_bytes (fd, &event_type, 1)) { + g_debug ("could not read event type, stopping"); + should_stop = TRUE; + goto out; + } + + card = read_smartcard (fd, worker->module); + + if (card == NULL) { + g_debug ("could not read card, stopping"); + should_stop = TRUE; + goto out; + } + + card_name = gsd_smartcard_get_name (card); + g_debug ("card '%s' had event %c", card_name, event_type); + + switch (event_type) { + case 'I': + g_hash_table_replace (manager->priv->smartcards, + card_name, card); + card_name = NULL; + + gsd_smartcard_manager_emit_smartcard_inserted (manager, card); + card = NULL; + break; + + case 'R': + gsd_smartcard_manager_emit_smartcard_removed (manager, card); + if (!g_hash_table_remove (manager->priv->smartcards, card_name)) { + g_debug ("got removal event of unknown card!"); + } + g_free (card_name); + card_name = NULL; + card = NULL; + break; + + default: + g_free (card_name); + card_name = NULL; + g_object_unref (card); + + should_stop = TRUE; + break; + } + +out: + if (should_stop) { + GError *error; + + error = g_error_new (GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_WATCHING_FOR_EVENTS, + "%s", (condition & G_IO_IN) ? g_strerror (errno) : _("received error or hang up from event source")); + + gsd_smartcard_manager_emit_error (manager, error); + g_error_free (error); + gsd_smartcard_manager_stop_now (manager); + return FALSE; + } + + return TRUE; +} + +static void +stop_manager (GsdSmartcardManager *manager) +{ + manager->priv->state = GSD_SMARTCARD_MANAGER_STATE_STOPPED; + + if (manager->priv->nss_is_loaded) { + NSS_Shutdown (); + manager->priv->nss_is_loaded = FALSE; + } + g_debug ("smartcard manager stopped"); +} + +static void +stop_worker (GsdSmartcardManagerWorker *worker) +{ + GsdSmartcardManager *manager; + + manager = worker->manager; + + if (worker->event_source != NULL) { + g_source_destroy (worker->event_source); + worker->event_source = NULL; + } + + if (worker->thread != NULL) { + SECMOD_CancelWait (worker->module); + worker->thread = NULL; + } + + SECMOD_DestroyModule (worker->module); + manager->priv->workers = g_list_remove (manager->priv->workers, worker); + + if (manager->priv->workers == NULL && manager->priv->state != GSD_SMARTCARD_MANAGER_STATE_STOPPED) { + stop_manager (manager); + } +} + +static void +gsd_smartcard_manager_event_processing_stopped_handler (GsdSmartcardManagerWorker *worker) +{ + worker->event_source = NULL; + + stop_worker (worker); +} + +static gboolean +open_pipe (int *write_fd, + int *read_fd) +{ + int pipe_fds[2] = { -1, -1 }; + + g_assert (write_fd != NULL); + g_assert (read_fd != NULL); + + if (pipe (pipe_fds) < 0) { + return FALSE; + } + + if (fcntl (pipe_fds[0], F_SETFD, FD_CLOEXEC) < 0) { + close (pipe_fds[0]); + close (pipe_fds[1]); + return FALSE; + } + + if (fcntl (pipe_fds[1], F_SETFD, FD_CLOEXEC) < 0) { + close (pipe_fds[0]); + close (pipe_fds[1]); + return FALSE; + } + + *read_fd = pipe_fds[0]; + *write_fd = pipe_fds[1]; + + return TRUE; +} + +static void +gsd_smartcard_manager_stop_watching_for_events (GsdSmartcardManager *manager) +{ + GList *node; + + node = manager->priv->workers; + while (node != NULL) { + GsdSmartcardManagerWorker *worker; + GList *next_node; + + worker = (GsdSmartcardManagerWorker *) node->data; + next_node = node->next; + + stop_worker (worker); + + node = next_node; + } +} + +static gboolean +load_nss (GError **error) +{ + SECStatus status = SECSuccess; + static const guint32 flags = + NSS_INIT_READONLY | + NSS_INIT_FORCEOPEN | NSS_INIT_NOROOTINIT | + NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD; + + g_debug ("attempting to load NSS database '%s'", + GSD_SMARTCARD_MANAGER_NSS_DB); + + PR_Init (PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); + + status = NSS_Initialize (GSD_SMARTCARD_MANAGER_NSS_DB, + "", "", SECMOD_DB, flags); + + if (status != SECSuccess) { + gsize error_message_size; + char *error_message; + + error_message_size = PR_GetErrorTextLength (); + + if (error_message_size == 0) { + g_debug ("NSS security system could not be initialized"); + g_set_error (error, + GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_WITH_NSS, + _("NSS security system could not be initialized")); + goto out; + } + + error_message = g_slice_alloc0 (error_message_size); + PR_GetErrorText (error_message); + + g_set_error (error, + GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_WITH_NSS, + "%s", error_message); + g_debug ("NSS security system could not be initialized - %s", + error_message); + + g_slice_free1 (error_message_size, error_message); + + goto out; + } + + g_debug ("NSS database sucessfully loaded"); + return TRUE; + +out: + g_debug ("NSS database couldn't be sucessfully loaded"); + return FALSE; +} + +static GList * +get_available_modules (GsdSmartcardManager *manager) +{ + SECMODModuleList *module_list, *tmp; + GList *modules; + + g_debug ("Getting list of suitable modules"); + + module_list = SECMOD_GetDefaultModuleList (); + modules = NULL; + for (tmp = module_list; tmp != NULL; tmp = tmp->next) { + if (!SECMOD_HasRemovableSlots (tmp->module) || + !tmp->module->loaded) + continue; + + g_debug ("Using module '%s'", tmp->module->commonName); + + modules = g_list_prepend (modules, + SECMOD_ReferenceModule (tmp->module)); + } + + return modules; +} + +static gboolean +load_driver (GsdSmartcardManager *manager, + char *module_path, + GError **error) +{ + GList *modules; + char *module_spec; + gboolean module_explicitly_specified; + + g_debug ("attempting to load driver..."); + + modules = NULL; + module_explicitly_specified = module_path != NULL; + if (module_explicitly_specified) { + SECMODModule *module; + + module_spec = g_strdup_printf ("library=\"%s\"", module_path); + g_debug ("loading smartcard driver using spec '%s'", + module_spec); + + module = SECMOD_LoadUserModule (module_spec, + NULL /* parent */, + FALSE /* recurse */); + g_free (module_spec); + module_spec = NULL; + + if (SECMOD_HasRemovableSlots (module) && + module->loaded) { + modules = g_list_prepend (modules, module); + } else { + g_debug ("fallback module found but not %s", + SECMOD_HasRemovableSlots (module)? + "removable" : "loaded"); + SECMOD_DestroyModule (module); + } + + } else { + SECMODListLock *lock; + + lock = SECMOD_GetDefaultModuleListLock (); + + if (lock != NULL) { + SECMOD_GetReadLock (lock); + modules = get_available_modules (manager); + SECMOD_ReleaseReadLock (lock); + } + + /* fallback to compiled in driver path + */ + if (modules == NULL) { + SECMODModule *module; + module_path = GSD_SMARTCARD_MANAGER_DRIVER; + module_spec = g_strdup_printf ("library=\"%s\"", module_path); + g_debug ("loading smartcard driver using spec '%s'", + module_spec); + + module = SECMOD_LoadUserModule (module_spec, + NULL /* parent */, + FALSE /* recurse */); + g_free (module_spec); + module_spec = NULL; + + if (SECMOD_HasRemovableSlots (module) && + module->loaded) { + modules = g_list_prepend (modules, module); + } else { + g_debug ("fallback module found but not loaded"); + SECMOD_DestroyModule (module); + } + } + + } + + if (!module_explicitly_specified && modules == NULL) { + g_set_error (error, + GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_LOADING_DRIVER, + _("no suitable smartcard driver could be found")); + } else if (modules == NULL) { + + gsize error_message_size; + char *error_message; + + error_message_size = PR_GetErrorTextLength (); + + if (error_message_size == 0) { + g_debug ("smartcard driver '%s' could not be loaded", + module_path); + g_set_error (error, + GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_LOADING_DRIVER, + _("smartcard driver '%s' could not be " + "loaded"), module_path); + goto out; + } + + error_message = g_slice_alloc0 (error_message_size); + PR_GetErrorText (error_message); + + g_set_error (error, + GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_LOADING_DRIVER, + "%s", error_message); + + g_debug ("smartcard driver '%s' could not be loaded - %s", + module_path, error_message); + g_slice_free1 (error_message_size, error_message); + } + + manager->priv->modules = modules; +out: + return manager->priv->modules != NULL; +} + +static void +gsd_smartcard_manager_get_all_cards (GsdSmartcardManager *manager) +{ + GList *node; + int i; + + node = manager->priv->workers; + while (node != NULL) { + + GsdSmartcardManagerWorker *worker; + + worker = (GsdSmartcardManagerWorker *) node->data; + + for (i = 0; i < worker->module->slotCount; i++) { + GsdSmartcard *card; + CK_SLOT_ID slot_id; + int slot_series; + char *card_name; + + slot_id = PK11_GetSlotID (worker->module->slots[i]); + slot_series = PK11_GetSlotSeries (worker->module->slots[i]); + + card = _gsd_smartcard_new (worker->module, + slot_id, slot_series); + + card_name = gsd_smartcard_get_name (card); + + g_hash_table_replace (manager->priv->smartcards, + card_name, card); + } + node = node->next; + } +} + +static GsdSmartcardManagerWorker * +start_worker (GsdSmartcardManager *manager, + SECMODModule *module, + GError **error) +{ + GIOChannel *io_channel; + GSource *source; + GsdSmartcardManagerWorker *worker; + + worker = gsd_smartcard_manager_create_worker (manager, module); + + if (worker == NULL) { + g_set_error (error, + GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_WATCHING_FOR_EVENTS, + _("could not watch for incoming card events - %s"), + g_strerror (errno)); + + goto out; + } + + io_channel = g_io_channel_unix_new (worker->manager_fd); + + source = g_io_create_watch (io_channel, G_IO_IN | G_IO_HUP); + g_io_channel_unref (io_channel); + io_channel = NULL; + + worker->event_source = source; + + g_source_set_callback (worker->event_source, + (GSourceFunc) (GIOFunc) + gsd_smartcard_manager_check_for_and_process_events, + worker, + (GDestroyNotify) + gsd_smartcard_manager_event_processing_stopped_handler); + g_source_attach (worker->event_source, NULL); + g_source_unref (worker->event_source); +out: + return worker; +} + +static void +start_workers (GsdSmartcardManager *manager) +{ + GList *node; + + node = manager->priv->modules; + while (node != NULL) { + SECMODModule *module; + GsdSmartcardManagerWorker *worker; + GError *error; + + module = (SECMODModule *) node->data; + + error = NULL; + worker = start_worker (manager, module, &error); + if (worker == NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } else { + manager->priv->workers = g_list_prepend (manager->priv->workers, + worker); + } + node = node->next; + } +} + +gboolean +gsd_smartcard_manager_start (GsdSmartcardManager *manager, + GError **error) +{ + GError *nss_error; + + if (manager->priv->state == GSD_SMARTCARD_MANAGER_STATE_STARTED) { + g_debug ("smartcard manager already started"); + return TRUE; + } + + manager->priv->state = GSD_SMARTCARD_MANAGER_STATE_STARTING; + + nss_error = NULL; + if (!manager->priv->nss_is_loaded && !load_nss (&nss_error)) { + g_propagate_error (error, nss_error); + goto out; + } + manager->priv->nss_is_loaded = TRUE; + + if (manager->priv->modules == NULL) { + if (!load_driver (manager, manager->priv->module_path, &nss_error)) { + g_propagate_error (error, nss_error); + goto out; + } + } + + start_workers (manager); + + /* populate the hash with cards that are already inserted + */ + gsd_smartcard_manager_get_all_cards (manager); + + manager->priv->state = GSD_SMARTCARD_MANAGER_STATE_STARTED; + +out: + /* don't leave it in a half started state + */ + if (manager->priv->state != GSD_SMARTCARD_MANAGER_STATE_STARTED) { + g_debug ("smartcard manager could not be completely started"); + gsd_smartcard_manager_stop (manager); + } else { + g_debug ("smartcard manager started"); + } + + return manager->priv->state == GSD_SMARTCARD_MANAGER_STATE_STARTED; +} + +static gboolean +gsd_smartcard_manager_stop_now (GsdSmartcardManager *manager) +{ + if (manager->priv->state == GSD_SMARTCARD_MANAGER_STATE_STOPPED) { + return FALSE; + } + + gsd_smartcard_manager_stop_watching_for_events (manager); + + return FALSE; +} + +static void +gsd_smartcard_manager_queue_stop (GsdSmartcardManager *manager) +{ + + manager->priv->state = GSD_SMARTCARD_MANAGER_STATE_STOPPING; + + g_idle_add ((GSourceFunc) gsd_smartcard_manager_stop_now, manager); +} + +void +gsd_smartcard_manager_stop (GsdSmartcardManager *manager) +{ + if (manager->priv->state == GSD_SMARTCARD_MANAGER_STATE_STOPPED) { + return; + } + + if (manager->priv->is_unstoppable) { + gsd_smartcard_manager_queue_stop (manager); + return; + } + + gsd_smartcard_manager_stop_now (manager); +} + +static void +gsd_smartcard_manager_check_for_login_card (CK_SLOT_ID slot_id, + GsdSmartcard *card, + gboolean *is_inserted) +{ + g_assert (is_inserted != NULL); + + if (gsd_smartcard_is_login_card (card)) { + *is_inserted = TRUE; + } + +} + +gboolean +gsd_smartcard_manager_login_card_is_inserted (GsdSmartcardManager *manager) + +{ + gboolean is_inserted; + + is_inserted = FALSE; + g_hash_table_foreach (manager->priv->smartcards, + (GHFunc) + gsd_smartcard_manager_check_for_login_card, + &is_inserted); + return is_inserted; +} + +static GsdSmartcardManagerWorker * +gsd_smartcard_manager_worker_new (GsdSmartcardManager *manager, + int worker_fd, + int manager_fd, + SECMODModule *module) +{ + GsdSmartcardManagerWorker *worker; + + worker = g_slice_new0 (GsdSmartcardManagerWorker); + worker->manager = manager; + worker->fd = worker_fd; + worker->manager_fd = manager_fd; + worker->module = module; + + worker->smartcards = + g_hash_table_new_full ((GHashFunc) slot_id_hash, + (GEqualFunc) slot_id_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_object_unref); + + return worker; +} + +static void +gsd_smartcard_manager_worker_free (GsdSmartcardManagerWorker *worker) +{ + if (worker->smartcards != NULL) { + g_hash_table_destroy (worker->smartcards); + worker->smartcards = NULL; + } + + g_slice_free (GsdSmartcardManagerWorker, worker); +} + +static gboolean +read_bytes (int fd, + gpointer bytes, + gsize num_bytes) +{ + size_t bytes_left; + size_t total_bytes_read; + ssize_t bytes_read; + + bytes_left = (size_t) num_bytes; + total_bytes_read = 0; + + do { + bytes_read = read (fd, + (char *) bytes + total_bytes_read, + bytes_left); + g_assert (bytes_read <= (ssize_t) bytes_left); + + if (bytes_read <= 0) { + if ((bytes_read < 0) && (errno == EINTR || errno == EAGAIN)) { + continue; + } + + bytes_left = 0; + } else { + bytes_left -= bytes_read; + total_bytes_read += bytes_read; + } + } while (bytes_left > 0); + + if (total_bytes_read < (size_t) num_bytes) { + return FALSE; + } + + return TRUE; +} + +static gboolean +write_bytes (int fd, + gconstpointer bytes, + gsize num_bytes) +{ + size_t bytes_left; + size_t total_bytes_written; + ssize_t bytes_written; + + bytes_left = (size_t) num_bytes; + total_bytes_written = 0; + + do { + bytes_written = write (fd, + (char *) bytes + total_bytes_written, + bytes_left); + g_assert (bytes_written <= (ssize_t) bytes_left); + + if (bytes_written <= 0) { + if ((bytes_written < 0) && (errno == EINTR || errno == EAGAIN)) { + continue; + } + + bytes_left = 0; + } else { + bytes_left -= bytes_written; + total_bytes_written += bytes_written; + } + } while (bytes_left > 0); + + if (total_bytes_written < (size_t) num_bytes) { + return FALSE; + } + + return TRUE; +} + +static GsdSmartcard * +read_smartcard (int fd, + SECMODModule *module) +{ + GsdSmartcard *card; + char *card_name; + gsize card_name_size; + + card_name_size = 0; + if (!read_bytes (fd, &card_name_size, sizeof (card_name_size))) { + return NULL; + } + + card_name = g_slice_alloc0 (card_name_size); + if (!read_bytes (fd, card_name, card_name_size)) { + g_slice_free1 (card_name_size, card_name); + return NULL; + } + card = _gsd_smartcard_new_from_name (module, card_name); + g_slice_free1 (card_name_size, card_name); + + return card; +} + +static gboolean +write_smartcard (int fd, + GsdSmartcard *card) +{ + gsize card_name_size; + char *card_name; + + card_name = gsd_smartcard_get_name (card); + card_name_size = strlen (card_name) + 1; + + if (!write_bytes (fd, &card_name_size, sizeof (card_name_size))) { + g_free (card_name); + return FALSE; + } + + if (!write_bytes (fd, card_name, card_name_size)) { + g_free (card_name); + return FALSE; + } + g_free (card_name); + + return TRUE; +} + +static gboolean +gsd_smartcard_manager_worker_emit_smartcard_removed (GsdSmartcardManagerWorker *worker, + GsdSmartcard *card, + GError **error) +{ + g_debug ("card '%s' removed!", gsd_smartcard_get_name (card)); + + if (!write_bytes (worker->fd, "R", 1)) { + goto error_out; + } + + if (!write_smartcard (worker->fd, card)) { + goto error_out; + } + + return TRUE; + +error_out: + g_set_error (error, GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_REPORTING_EVENTS, + "%s", g_strerror (errno)); + return FALSE; +} + +static gboolean +gsd_smartcard_manager_worker_emit_smartcard_inserted (GsdSmartcardManagerWorker *worker, + GsdSmartcard *card, + GError **error) +{ + g_debug ("card '%s' inserted!", gsd_smartcard_get_name (card)); + if (!write_bytes (worker->fd, "I", 1)) { + goto error_out; + } + + if (!write_smartcard (worker->fd, card)) { + goto error_out; + } + + return TRUE; + +error_out: + g_set_error (error, GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_REPORTING_EVENTS, + "%s", g_strerror (errno)); + return FALSE; +} + +static gboolean +gsd_smartcard_manager_worker_watch_for_and_process_event (GsdSmartcardManagerWorker *worker, + GError **error) +{ + PK11SlotInfo *slot; + CK_SLOT_ID slot_id, *key = NULL; + int slot_series, card_slot_series; + GsdSmartcard *card; + GError *processing_error; + gboolean ret; + + g_debug ("waiting for card event"); + ret = FALSE; + + slot = SECMOD_WaitForAnyTokenEvent (worker->module, 0, PR_SecondsToInterval (1)); + + processing_error = NULL; + + if (slot == NULL) { + int error_code; + + error_code = PORT_GetError (); + if ((error_code == 0) || (error_code == SEC_ERROR_NO_EVENT)) { + g_debug ("spurrious event occurred"); + return TRUE; + } + + /* FIXME: is there a function to convert from a PORT error + * code to a translated string? + */ + g_set_error (error, GSD_SMARTCARD_MANAGER_ERROR, + GSD_SMARTCARD_MANAGER_ERROR_WITH_NSS, + _("encountered unexpected error while " + "waiting for smartcard events")); + goto out; + } + + /* the slot id and series together uniquely identify a card. + * You can never have two cards with the same slot id at the + * same time, however (I think), so we can key off of it. + */ + slot_id = PK11_GetSlotID (slot); + slot_series = PK11_GetSlotSeries (slot); + + /* First check to see if there is a card that we're currently + * tracking in the slot. + */ + key = g_new (CK_SLOT_ID, 1); + *key = slot_id; + card = g_hash_table_lookup (worker->smartcards, key); + + if (card != NULL) { + card_slot_series = gsd_smartcard_get_slot_series (card); + } else { + card_slot_series = -1; + } + + if (PK11_IsPresent (slot)) { + /* Now, check to see if their is a new card in the slot. + * If there was a different card in the slot now than + * there was before, then we need to emit a removed signal + * for the old card (we don't want unpaired insertion events). + */ + if ((card != NULL) && + card_slot_series != slot_series) { + if (!gsd_smartcard_manager_worker_emit_smartcard_removed (worker, card, &processing_error)) { + g_propagate_error (error, processing_error); + goto out; + } + } + + card = _gsd_smartcard_new (worker->module, + slot_id, slot_series); + + g_hash_table_replace (worker->smartcards, + key, card); + key = NULL; + + if (!gsd_smartcard_manager_worker_emit_smartcard_inserted (worker, card, &processing_error)) { + g_propagate_error (error, processing_error); + goto out; + } + } else { + /* if we aren't tracking the card, just discard the event. + * We don't want unpaired remove events. Note on startup + * NSS will generate an "insertion" event if a card is + * already inserted in the slot. + */ + if ((card != NULL)) { + /* FIXME: i'm not sure about this code. Maybe we + * shouldn't do this at all, or maybe we should do it + * n times (where n = slot_series - card_slot_series + 1) + * + * Right now, i'm just doing it once. + */ + if ((slot_series - card_slot_series) > 1) { + + if (!gsd_smartcard_manager_worker_emit_smartcard_removed (worker, card, &processing_error)) { + g_propagate_error (error, processing_error); + goto out; + } + g_hash_table_remove (worker->smartcards, key); + + card = _gsd_smartcard_new (worker->module, + slot_id, slot_series); + g_hash_table_replace (worker->smartcards, + key, card); + key = NULL; + if (!gsd_smartcard_manager_worker_emit_smartcard_inserted (worker, card, &processing_error)) { + g_propagate_error (error, processing_error); + goto out; + } + } + + if (!gsd_smartcard_manager_worker_emit_smartcard_removed (worker, card, &processing_error)) { + g_propagate_error (error, processing_error); + goto out; + } + + g_hash_table_remove (worker->smartcards, key); + card = NULL; + } else { + g_debug ("got spurious remove event"); + } + } + + ret = TRUE; + +out: + g_free (key); + PK11_FreeSlot (slot); + + return ret; +} + +static void +gsd_smartcard_manager_worker_run (GsdSmartcardManagerWorker *worker) +{ + GError *error; + gboolean should_continue; + + do + { + error = NULL; + should_continue = gsd_smartcard_manager_worker_watch_for_and_process_event (worker, &error); + } + while (should_continue); + + if (error != NULL) { + g_debug ("could not process card event - %s", error->message); + g_error_free (error); + } + + gsd_smartcard_manager_worker_free (worker); +} + +static GsdSmartcardManagerWorker * +gsd_smartcard_manager_create_worker (GsdSmartcardManager *manager, + SECMODModule *module) +{ + GsdSmartcardManagerWorker *worker; + int write_fd, read_fd; + + write_fd = -1; + read_fd = -1; + if (!open_pipe (&write_fd, &read_fd)) { + return NULL; + } + + worker = gsd_smartcard_manager_worker_new (manager, + write_fd, + read_fd, + module); + + worker->thread = g_thread_create ((GThreadFunc) + gsd_smartcard_manager_worker_run, + worker, FALSE, NULL); + + if (worker->thread == NULL) { + gsd_smartcard_manager_worker_free (worker); + return NULL; + } + + return worker; +} + +#ifdef GSD_SMARTCARD_MANAGER_ENABLE_TEST +#include + +static GMainLoop *event_loop; +static gboolean should_exit_on_next_remove = FALSE; + +static gboolean +on_timeout (GsdSmartcardManager *manager) +{ + GError *error; + g_print ("Re-enabling manager.\n"); + + if (!gsd_smartcard_manager_start (manager, &error)) { + g_warning ("could not start smartcard manager - %s", + error->message); + g_error_free (error); + return TRUE; + } + g_print ("Please re-insert smartcard\n"); + + should_exit_on_next_remove = TRUE; + + return FALSE; +} + +static void +on_device_inserted (GsdSmartcardManager *manager, + GsdSmartcard *card) +{ + g_print ("smartcard inserted!\n"); + g_print ("Please remove it.\n"); +} + +static void +on_device_removed (GsdSmartcardManager *manager, + GsdSmartcard *card) +{ + g_print ("smartcard removed!\n"); + + if (should_exit_on_next_remove) { + g_main_loop_quit (event_loop); + } else { + g_print ("disabling manager for 2 seconds\n"); + gsd_smartcard_manager_stop (manager); + g_timeout_add_seconds (2, (GSourceFunc) on_timeout, manager); + } +} + +int +main (int argc, + char *argv[]) +{ + GsdSmartcardManager *manager; + GError *error; + + g_log_set_always_fatal (G_LOG_LEVEL_ERROR + | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); + + g_type_init (); + + g_message ("creating instance of 'smartcard manager' object..."); + manager = gsd_smartcard_manager_new (NULL); + g_message ("'smartcard manager' object created successfully"); + + g_signal_connect (manager, "smartcard-inserted", + G_CALLBACK (on_device_inserted), NULL); + + g_signal_connect (manager, "smartcard-removed", + G_CALLBACK (on_device_removed), NULL); + + g_message ("starting listener..."); + + error = NULL; + if (!gsd_smartcard_manager_start (manager, &error)) { + g_warning ("could not start smartcard manager - %s", + error->message); + g_error_free (error); + return 1; + } + + event_loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (event_loop); + g_main_loop_unref (event_loop); + event_loop = NULL; + + g_message ("destroying previously created 'smartcard manager' object..."); + g_object_unref (manager); + manager = NULL; + g_message ("'smartcard manager' object destroyed successfully"); + + return 0; +} +#endif diff --git a/plugins/smartcard/gsd-smartcard-manager.h b/plugins/smartcard/gsd-smartcard-manager.h new file mode 100644 index 00000000..949f1949 --- /dev/null +++ b/plugins/smartcard/gsd-smartcard-manager.h @@ -0,0 +1,88 @@ +/* gsd-smartcard-manager.h - object for monitoring smartcard insertion and + * removal events + * + * Copyright (C) 2006, 2009 Red Hat, Inc. + * + * 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, 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. + * + * Written by: Ray Strode + */ +#ifndef GSD_SMARTCARD_MANAGER_H +#define GSD_SMARTCARD_MANAGER_H + +#define GSD_SMARTCARD_ENABLE_INTERNAL_API +#include "gsd-smartcard.h" + +#include +#include + +G_BEGIN_DECLS +#define GSD_TYPE_SMARTCARD_MANAGER (gsd_smartcard_manager_get_type ()) +#define GSD_SMARTCARD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_SMARTCARD_MANAGER, GsdSmartcardManager)) +#define GSD_SMARTCARD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_SMARTCARD_MANAGER, GsdSmartcardManagerClass)) +#define GSD_IS_SMARTCARD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_SMARTCARD_MANAGER)) +#define GSD_IS_SMARTCARD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_SMARTCARD_MANAGER)) +#define GSD_SMARTCARD_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSD_TYPE_SMARTCARD_MANAGER, GsdSmartcardManagerClass)) +#define GSD_SMARTCARD_MANAGER_ERROR (gsd_smartcard_manager_error_quark ()) +typedef struct _GsdSmartcardManager GsdSmartcardManager; +typedef struct _GsdSmartcardManagerClass GsdSmartcardManagerClass; +typedef struct _GsdSmartcardManagerPrivate GsdSmartcardManagerPrivate; +typedef enum _GsdSmartcardManagerError GsdSmartcardManagerError; + +struct _GsdSmartcardManager { + GObject parent; + + /*< private > */ + GsdSmartcardManagerPrivate *priv; +}; + +struct _GsdSmartcardManagerClass { + GObjectClass parent_class; + + /* Signals */ + void (*smartcard_inserted) (GsdSmartcardManager *manager, + GsdSmartcard *token); + void (*smartcard_removed) (GsdSmartcardManager *manager, + GsdSmartcard *token); + void (*error) (GsdSmartcardManager *manager, + GError *error); +}; + +enum _GsdSmartcardManagerError { + GSD_SMARTCARD_MANAGER_ERROR_GENERIC = 0, + GSD_SMARTCARD_MANAGER_ERROR_WITH_NSS, + GSD_SMARTCARD_MANAGER_ERROR_LOADING_DRIVER, + GSD_SMARTCARD_MANAGER_ERROR_WATCHING_FOR_EVENTS, + GSD_SMARTCARD_MANAGER_ERROR_REPORTING_EVENTS +}; + +GType gsd_smartcard_manager_get_type (void) G_GNUC_CONST; +GQuark gsd_smartcard_manager_error_quark (void) G_GNUC_CONST; + +GsdSmartcardManager *gsd_smartcard_manager_new_default (void); + +GsdSmartcardManager *gsd_smartcard_manager_new (const char *module); + +gboolean gsd_smartcard_manager_start (GsdSmartcardManager *manager, + GError **error); + +void gsd_smartcard_manager_stop (GsdSmartcardManager *manager); + +char *gsd_smartcard_manager_get_module_path (GsdSmartcardManager *manager); +gboolean gsd_smartcard_manager_login_card_is_inserted (GsdSmartcardManager *manager); + +G_END_DECLS +#endif /* GSD_SMARTCARD_MANAGER_H */ diff --git a/plugins/smartcard/gsd-smartcard-plugin.c b/plugins/smartcard/gsd-smartcard-plugin.c new file mode 100644 index 00000000..928ec289 --- /dev/null +++ b/plugins/smartcard/gsd-smartcard-plugin.c @@ -0,0 +1,344 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Red Hat, Inc. + * + * 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, 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 +#include + +#include +#include +#include + +#include "gnome-settings-plugin.h" +#include "gsd-smartcard-plugin.h" +#include "gsd-smartcard-manager.h" + +struct GsdSmartcardPluginPrivate { + GsdSmartcardManager *manager; + GDBusConnection *bus_connection; + + guint32 is_active : 1; +}; + +typedef enum +{ + GSD_SMARTCARD_REMOVE_ACTION_NONE, + GSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN, + GSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT, +} GsdSmartcardRemoveAction; + +#define SCREENSAVER_DBUS_NAME "org.gnome.ScreenSaver" +#define SCREENSAVER_DBUS_PATH "/" +#define SCREENSAVER_DBUS_INTERFACE "org.gnome.ScreenSaver" + +#define SM_DBUS_NAME "org.gnome.SessionManager" +#define SM_DBUS_PATH "/org/gnome/SessionManager" +#define SM_DBUS_INTERFACE "org.gnome.SessionManager" +#define SM_LOGOUT_MODE_FORCE 2 + +#define KEY_REMOVE_ACTION "removal-action" + +#define GSD_SMARTCARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_SMARTCARD_PLUGIN, GsdSmartcardPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdSmartcardPlugin, gsd_smartcard_plugin); + +static void +simulate_user_activity (GsdSmartcardPlugin *plugin) +{ + GDBusProxy *screensaver_proxy; + + g_debug ("GsdSmartcardPlugin telling screensaver about smart card insertion"); + screensaver_proxy = g_dbus_proxy_new_sync (plugin->priv->bus_connection, + 0, NULL, + SCREENSAVER_DBUS_NAME, + SCREENSAVER_DBUS_PATH, + SCREENSAVER_DBUS_INTERFACE, + NULL, NULL); + + g_dbus_proxy_call (screensaver_proxy, + "SimulateUserActivity", + NULL, G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + + g_object_unref (screensaver_proxy); +} + +static void +lock_screen (GsdSmartcardPlugin *plugin) +{ + GDBusProxy *screensaver_proxy; + + g_debug ("GsdSmartcardPlugin telling screensaver to lock screen"); + screensaver_proxy = g_dbus_proxy_new_sync (plugin->priv->bus_connection, + 0, NULL, + SCREENSAVER_DBUS_NAME, + SCREENSAVER_DBUS_PATH, + SCREENSAVER_DBUS_INTERFACE, + NULL, NULL); + + g_dbus_proxy_call (screensaver_proxy, + "Lock", + NULL, G_DBUS_CALL_FLAGS_NONE, + -1, NULL, NULL, NULL); + + g_object_unref (screensaver_proxy); +} + +static void +force_logout (GsdSmartcardPlugin *plugin) +{ + GDBusProxy *sm_proxy; + GError *error; + GVariant *res; + + g_debug ("GsdSmartcardPlugin telling session manager to force logout"); + sm_proxy = g_dbus_proxy_new_sync (plugin->priv->bus_connection, + 0, NULL, + SM_DBUS_NAME, + SM_DBUS_PATH, + SM_DBUS_INTERFACE, + NULL, NULL); + + error = NULL; + res = g_dbus_proxy_call_sync (sm_proxy, + "Logout", + g_variant_new ("(i)", SM_LOGOUT_MODE_FORCE), + G_DBUS_CALL_FLAGS_NONE, + -1, NULL, &error); + + if (! res) { + g_warning ("GsdSmartcardPlugin Unable to force logout: %s", error->message); + g_error_free (error); + } else + g_variant_unref (res); + + g_object_unref (sm_proxy); +} + +static void +gsd_smartcard_plugin_init (GsdSmartcardPlugin *plugin) +{ + plugin->priv = GSD_SMARTCARD_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdSmartcardPlugin initializing"); + + plugin->priv->manager = gsd_smartcard_manager_new (NULL); +} + +static void +gsd_smartcard_plugin_finalize (GObject *object) +{ + GsdSmartcardPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SMARTCARD_PLUGIN (object)); + + g_debug ("GsdSmartcardPlugin finalizing"); + + plugin = GSD_SMARTCARD_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_smartcard_plugin_parent_class)->finalize (object); +} + +static void +smartcard_inserted_cb (GsdSmartcardManager *card_monitor, + GsdSmartcard *card, + GsdSmartcardPlugin *plugin) +{ + char *name; + + name = gsd_smartcard_get_name (card); + g_debug ("GsdSmartcardPlugin smart card '%s' inserted", name); + g_free (name); + + simulate_user_activity (plugin); +} + +static gboolean +user_logged_in_with_smartcard (void) +{ + return g_getenv ("PKCS11_LOGIN_TOKEN_NAME") != NULL; +} + +static GsdSmartcardRemoveAction +get_configured_remove_action (GsdSmartcardPlugin *plugin) +{ + GSettings *settings; + char *remove_action_string; + GsdSmartcardRemoveAction remove_action; + + settings = g_settings_new ("org.gnome.settings-daemon.peripherals.smartcard"); + remove_action_string = g_settings_get_string (settings, KEY_REMOVE_ACTION); + + if (remove_action_string == NULL) { + g_warning ("GsdSmartcardPlugin unable to get smartcard remove action"); + remove_action = GSD_SMARTCARD_REMOVE_ACTION_NONE; + } else if (strcmp (remove_action_string, "none") == 0) { + remove_action = GSD_SMARTCARD_REMOVE_ACTION_NONE; + } else if (strcmp (remove_action_string, "lock_screen") == 0) { + remove_action = GSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN; + } else if (strcmp (remove_action_string, "force_logout") == 0) { + remove_action = GSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT; + } else { + g_warning ("GsdSmartcardPlugin unknown smartcard remove action"); + remove_action = GSD_SMARTCARD_REMOVE_ACTION_NONE; + } + + g_object_unref (settings); + + return remove_action; +} + +static void +process_smartcard_removal (GsdSmartcardPlugin *plugin) +{ + GsdSmartcardRemoveAction remove_action; + + g_debug ("GsdSmartcardPlugin processing smartcard removal"); + remove_action = get_configured_remove_action (plugin); + + switch (remove_action) + { + case GSD_SMARTCARD_REMOVE_ACTION_NONE: + return; + case GSD_SMARTCARD_REMOVE_ACTION_LOCK_SCREEN: + lock_screen (plugin); + break; + case GSD_SMARTCARD_REMOVE_ACTION_FORCE_LOGOUT: + force_logout (plugin); + break; + } +} + +static void +smartcard_removed_cb (GsdSmartcardManager *card_monitor, + GsdSmartcard *card, + GsdSmartcardPlugin *plugin) +{ + + char *name; + + name = gsd_smartcard_get_name (card); + g_debug ("GsdSmartcardPlugin smart card '%s' removed", name); + g_free (name); + + if (!gsd_smartcard_is_login_card (card)) { + g_debug ("GsdSmartcardPlugin removed smart card was not used to login"); + return; + } + + process_smartcard_removal (plugin); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + GError *error; + GsdSmartcardPlugin *smartcard_plugin = GSD_SMARTCARD_PLUGIN (plugin); + + if (smartcard_plugin->priv->is_active) { + g_debug ("GsdSmartcardPlugin Not activating smartcard plugin, because it's " + "already active"); + return; + } + + if (!user_logged_in_with_smartcard ()) { + g_debug ("GsdSmartcardPlugin Not activating smartcard plugin, because user didn't use " + " smartcard to log in"); + smartcard_plugin->priv->is_active = FALSE; + return; + } + + g_debug ("GsdSmartcardPlugin Activating smartcard plugin"); + + error = NULL; + smartcard_plugin->priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + + if (smartcard_plugin->priv->bus_connection == NULL) { + g_warning ("GsdSmartcardPlugin Unable to connect to session bus: %s", error->message); + return; + } + + if (!gsd_smartcard_manager_start (smartcard_plugin->priv->manager, &error)) { + g_warning ("GsdSmartcardPlugin Unable to start smartcard manager: %s", error->message); + g_error_free (error); + } + + g_signal_connect (smartcard_plugin->priv->manager, + "smartcard-removed", + G_CALLBACK (smartcard_removed_cb), smartcard_plugin); + + g_signal_connect (smartcard_plugin->priv->manager, + "smartcard-inserted", + G_CALLBACK (smartcard_inserted_cb), smartcard_plugin); + + if (!gsd_smartcard_manager_login_card_is_inserted (smartcard_plugin->priv->manager)) { + g_debug ("GsdSmartcardPlugin processing smartcard removal immediately user logged in with smartcard " + "and it's not inserted"); + process_smartcard_removal (smartcard_plugin); + } + + smartcard_plugin->priv->is_active = TRUE; +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + GsdSmartcardPlugin *smartcard_plugin = GSD_SMARTCARD_PLUGIN (plugin); + + if (!smartcard_plugin->priv->is_active) { + g_debug ("GsdSmartcardPlugin Not deactivating smartcard plugin, " + "because it's already inactive"); + return; + } + + g_debug ("GsdSmartcardPlugin Deactivating smartcard plugin"); + + gsd_smartcard_manager_stop (smartcard_plugin->priv->manager); + + g_signal_handlers_disconnect_by_func (smartcard_plugin->priv->manager, + smartcard_removed_cb, smartcard_plugin); + + g_signal_handlers_disconnect_by_func (smartcard_plugin->priv->manager, + smartcard_inserted_cb, smartcard_plugin); + smartcard_plugin->priv->bus_connection = NULL; + smartcard_plugin->priv->is_active = FALSE; +} + +static void +gsd_smartcard_plugin_class_init (GsdSmartcardPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_smartcard_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdSmartcardPluginPrivate)); +} diff --git a/plugins/smartcard/gsd-smartcard-plugin.h b/plugins/smartcard/gsd-smartcard-plugin.h new file mode 100644 index 00000000..f1458d1d --- /dev/null +++ b/plugins/smartcard/gsd-smartcard-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2010 Red Hat, Inc. + * + * 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, 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_SMARTCARD_PLUGIN_H__ +#define __GSD_SMARTCARD_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_SMARTCARD_PLUGIN (gsd_smartcard_plugin_get_type ()) +#define GSD_SMARTCARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SMARTCARD_PLUGIN, GsdSmartcardPlugin)) +#define GSD_SMARTCARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_SMARTCARD_PLUGIN, GsdSmartcardPluginClass)) +#define GSD_IS_SMARTCARD_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SMARTCARD_PLUGIN)) +#define GSD_IS_SMARTCARD_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SMARTCARD_PLUGIN)) +#define GSD_SMARTCARD_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SMARTCARD_PLUGIN, GsdSmartcardPluginClass)) + +typedef struct GsdSmartcardPluginPrivate GsdSmartcardPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdSmartcardPluginPrivate *priv; +} GsdSmartcardPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdSmartcardPluginClass; + +GType gsd_smartcard_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_SMARTCARD_PLUGIN_H__ */ diff --git a/plugins/smartcard/gsd-smartcard.c b/plugins/smartcard/gsd-smartcard.c new file mode 100644 index 00000000..a926df1e --- /dev/null +++ b/plugins/smartcard/gsd-smartcard.c @@ -0,0 +1,556 @@ +/* gsd-smartcard.c - smartcard object + * + * Copyright (C) 2006 Ray Strode + * + * 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, 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" + +#define GSD_SMARTCARD_ENABLE_INTERNAL_API +#include "gsd-smartcard.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +struct _GsdSmartcardPrivate { + SECMODModule *module; + GsdSmartcardState state; + + CK_SLOT_ID slot_id; + int slot_series; + + PK11SlotInfo *slot; + char *name; + + CERTCertificate *signing_certificate; + CERTCertificate *encryption_certificate; +}; + +static void gsd_smartcard_finalize (GObject *object); +static void gsd_smartcard_class_install_signals (GsdSmartcardClass *card_class); +static void gsd_smartcard_class_install_properties (GsdSmartcardClass *card_class); +static void gsd_smartcard_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gsd_smartcard_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gsd_smartcard_set_name (GsdSmartcard *card, const char *name); +static void gsd_smartcard_set_slot_id (GsdSmartcard *card, + int slot_id); +static void gsd_smartcard_set_slot_series (GsdSmartcard *card, + int slot_series); +static void gsd_smartcard_set_module (GsdSmartcard *card, + SECMODModule *module); + +static PK11SlotInfo *gsd_smartcard_find_slot_from_id (GsdSmartcard *card, + int slot_id); + +static PK11SlotInfo *gsd_smartcard_find_slot_from_card_name (GsdSmartcard *card, + const char *card_name); + +#ifndef GSD_SMARTCARD_DEFAULT_SLOT_ID +#define GSD_SMARTCARD_DEFAULT_SLOT_ID ((gulong) -1) +#endif + +#ifndef GSD_SMARTCARD_DEFAULT_SLOT_SERIES +#define GSD_SMARTCARD_DEFAULT_SLOT_SERIES -1 +#endif + +enum { + PROP_0 = 0, + PROP_NAME, + PROP_SLOT_ID, + PROP_SLOT_SERIES, + PROP_MODULE, + NUMBER_OF_PROPERTIES +}; + +enum { + INSERTED, + REMOVED, + NUMBER_OF_SIGNALS +}; + +static guint gsd_smartcard_signals[NUMBER_OF_SIGNALS]; + +G_DEFINE_TYPE (GsdSmartcard, gsd_smartcard, G_TYPE_OBJECT); + +static void +gsd_smartcard_class_init (GsdSmartcardClass *card_class) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (card_class); + + gobject_class->finalize = gsd_smartcard_finalize; + + gsd_smartcard_class_install_signals (card_class); + gsd_smartcard_class_install_properties (card_class); + + g_type_class_add_private (card_class, + sizeof (GsdSmartcardPrivate)); +} + +static void +gsd_smartcard_class_install_signals (GsdSmartcardClass *card_class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (card_class); + + gsd_smartcard_signals[INSERTED] = + g_signal_new ("inserted", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdSmartcardClass, + inserted), + NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gsd_smartcard_signals[REMOVED] = + g_signal_new ("removed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GsdSmartcardClass, + removed), + NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +gsd_smartcard_class_install_properties (GsdSmartcardClass *card_class) +{ + GObjectClass *object_class; + GParamSpec *param_spec; + + object_class = G_OBJECT_CLASS (card_class); + object_class->set_property = gsd_smartcard_set_property; + object_class->get_property = gsd_smartcard_get_property; + + param_spec = g_param_spec_ulong ("slot-id", "Slot ID", + "The slot the card is in", + 1, G_MAXULONG, + GSD_SMARTCARD_DEFAULT_SLOT_ID, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_SLOT_ID, param_spec); + + param_spec = g_param_spec_int ("slot-series", "Slot Series", + "per-slot card identifier", + -1, G_MAXINT, + GSD_SMARTCARD_DEFAULT_SLOT_SERIES, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_SLOT_SERIES, param_spec); + + param_spec = g_param_spec_string ("name", "name", + "name", NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_NAME, param_spec); + + param_spec = g_param_spec_pointer ("module", "Module", + "smartcard driver", + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_MODULE, param_spec); +} + +static void +gsd_smartcard_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GsdSmartcard *card = GSD_SMARTCARD (object); + + switch (prop_id) { + case PROP_NAME: + gsd_smartcard_set_name (card, g_value_get_string (value)); + break; + + case PROP_SLOT_ID: + gsd_smartcard_set_slot_id (card, + g_value_get_ulong (value)); + break; + + case PROP_SLOT_SERIES: + gsd_smartcard_set_slot_series (card, + g_value_get_int (value)); + break; + + case PROP_MODULE: + gsd_smartcard_set_module (card, + (SECMODModule *) + g_value_get_pointer (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +CK_SLOT_ID +gsd_smartcard_get_slot_id (GsdSmartcard *card) +{ + return card->priv->slot_id; +} + +GsdSmartcardState +gsd_smartcard_get_state (GsdSmartcard *card) +{ + return card->priv->state; +} + +char * +gsd_smartcard_get_name (GsdSmartcard *card) +{ + return g_strdup (card->priv->name); +} + +gboolean +gsd_smartcard_is_login_card (GsdSmartcard *card) +{ + const char *login_card_name; + login_card_name = g_getenv ("PKCS11_LOGIN_TOKEN_NAME"); + + if ((login_card_name == NULL) || (card->priv->name == NULL)) { + return FALSE; + } + + if (strcmp (card->priv->name, login_card_name) == 0) { + return TRUE; + } + + return FALSE; +} + +static void +gsd_smartcard_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GsdSmartcard *card = GSD_SMARTCARD (object); + + switch (prop_id) { + case PROP_NAME: + g_value_take_string (value, + gsd_smartcard_get_name (card)); + break; + + case PROP_SLOT_ID: + g_value_set_ulong (value, + (gulong) gsd_smartcard_get_slot_id (card)); + break; + + case PROP_SLOT_SERIES: + g_value_set_int (value, + gsd_smartcard_get_slot_series (card)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gsd_smartcard_set_name (GsdSmartcard *card, + const char *name) +{ + if (name == NULL) { + return; + } + + if ((card->priv->name == NULL) || + (strcmp (card->priv->name, name) != 0)) { + g_free (card->priv->name); + card->priv->name = g_strdup (name); + + if (card->priv->slot == NULL) { + card->priv->slot = gsd_smartcard_find_slot_from_card_name (card, + card->priv->name); + + if (card->priv->slot != NULL) { + int slot_id, slot_series; + + slot_id = PK11_GetSlotID (card->priv->slot); + if (slot_id != card->priv->slot_id) { + gsd_smartcard_set_slot_id (card, slot_id); + } + + slot_series = PK11_GetSlotSeries (card->priv->slot); + if (slot_series != card->priv->slot_series) { + gsd_smartcard_set_slot_series (card, slot_series); + } + + _gsd_smartcard_set_state (card, GSD_SMARTCARD_STATE_INSERTED); + } else { + _gsd_smartcard_set_state (card, GSD_SMARTCARD_STATE_REMOVED); + } + } + + g_object_notify (G_OBJECT (card), "name"); + } +} + +static void +gsd_smartcard_set_slot_id (GsdSmartcard *card, + int slot_id) +{ + if (card->priv->slot_id != slot_id) { + card->priv->slot_id = slot_id; + + if (card->priv->slot == NULL) { + card->priv->slot = gsd_smartcard_find_slot_from_id (card, + card->priv->slot_id); + + if (card->priv->slot != NULL) { + const char *card_name; + + card_name = PK11_GetTokenName (card->priv->slot); + if ((card->priv->name == NULL) || + ((card_name != NULL) && + (strcmp (card_name, card->priv->name) != 0))) { + gsd_smartcard_set_name (card, card_name); + } + + _gsd_smartcard_set_state (card, GSD_SMARTCARD_STATE_INSERTED); + } else { + _gsd_smartcard_set_state (card, GSD_SMARTCARD_STATE_REMOVED); + } + } + + g_object_notify (G_OBJECT (card), "slot-id"); + } +} + +static void +gsd_smartcard_set_slot_series (GsdSmartcard *card, + int slot_series) +{ + if (card->priv->slot_series != slot_series) { + card->priv->slot_series = slot_series; + g_object_notify (G_OBJECT (card), "slot-series"); + } +} + +static void +gsd_smartcard_set_module (GsdSmartcard *card, + SECMODModule *module) +{ + gboolean should_notify; + + if (card->priv->module != module) { + should_notify = TRUE; + } else { + should_notify = FALSE; + } + + if (card->priv->module != NULL) { + SECMOD_DestroyModule (card->priv->module); + card->priv->module = NULL; + } + + if (module != NULL) { + card->priv->module = SECMOD_ReferenceModule (module); + } + + if (should_notify) { + g_object_notify (G_OBJECT (card), "module"); + } +} + +int +gsd_smartcard_get_slot_series (GsdSmartcard *card) +{ + return card->priv->slot_series; +} + +static void +gsd_smartcard_init (GsdSmartcard *card) +{ + + g_debug ("initializing smartcard "); + + card->priv = G_TYPE_INSTANCE_GET_PRIVATE (card, + GSD_TYPE_SMARTCARD, + GsdSmartcardPrivate); +} + +static void gsd_smartcard_finalize (GObject *object) +{ + GsdSmartcard *card; + GObjectClass *gobject_class; + + card = GSD_SMARTCARD (object); + + g_free (card->priv->name); + + gsd_smartcard_set_module (card, NULL); + + gobject_class = G_OBJECT_CLASS (gsd_smartcard_parent_class); + + gobject_class->finalize (object); +} + +GQuark gsd_smartcard_error_quark (void) +{ + static GQuark error_quark = 0; + + if (error_quark == 0) { + error_quark = g_quark_from_static_string ("gsd-smartcard-error-quark"); + } + + return error_quark; +} + +GsdSmartcard * +_gsd_smartcard_new (SECMODModule *module, + CK_SLOT_ID slot_id, + int slot_series) +{ + GsdSmartcard *card; + + g_return_val_if_fail (module != NULL, NULL); + g_return_val_if_fail (slot_id >= 1, NULL); + g_return_val_if_fail (slot_series > 0, NULL); + g_return_val_if_fail (sizeof (gulong) == sizeof (slot_id), NULL); + + card = GSD_SMARTCARD (g_object_new (GSD_TYPE_SMARTCARD, + "module", module, + "slot-id", (gulong) slot_id, + "slot-series", slot_series, + NULL)); + return card; +} + +GsdSmartcard * +_gsd_smartcard_new_from_name (SECMODModule *module, + const char *name) +{ + GsdSmartcard *card; + + g_return_val_if_fail (module != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + + card = GSD_SMARTCARD (g_object_new (GSD_TYPE_SMARTCARD, + "module", module, + "name", name, + NULL)); + return card; +} + +void +_gsd_smartcard_set_state (GsdSmartcard *card, + GsdSmartcardState state) +{ + /* gsd_smartcard_fetch_certificates (card); */ + if (card->priv->state != state) { + card->priv->state = state; + + if (state == GSD_SMARTCARD_STATE_INSERTED) { + g_signal_emit (card, gsd_smartcard_signals[INSERTED], 0); + } else if (state == GSD_SMARTCARD_STATE_REMOVED) { + g_signal_emit (card, gsd_smartcard_signals[REMOVED], 0); + } else { + g_assert_not_reached (); + } + } +} + +/* So we could conceivably make the closure data a pointer to the card + * or something similiar and then emit signals when we want passwords, + * but it's probably easier to just get the password up front and use + * it. So we just take the passed in g_malloc'd (well probably, who knows) + * and strdup it using NSPR's memory allocation routines. + */ +static char * +gsd_smartcard_password_handler (PK11SlotInfo *slot, + PRBool is_retrying, + const char *password) +{ + if (is_retrying) { + return NULL; + } + + return password != NULL? PL_strdup (password): NULL; +} + +gboolean +gsd_smartcard_unlock (GsdSmartcard *card, + const char *password) +{ + SECStatus status; + + PK11_SetPasswordFunc ((PK11PasswordFunc) gsd_smartcard_password_handler); + + /* we pass PR_TRUE to load certificates + */ + status = PK11_Authenticate (card->priv->slot, PR_TRUE, (gpointer) password); + + if (status != SECSuccess) { + g_debug ("could not unlock card - %d", status); + return FALSE; + } + return TRUE; +} + +static PK11SlotInfo * +gsd_smartcard_find_slot_from_card_name (GsdSmartcard *card, + const char *card_name) +{ + int i; + + for (i = 0; i < card->priv->module->slotCount; i++) { + const char *slot_card_name; + + slot_card_name = PK11_GetTokenName (card->priv->module->slots[i]); + + if ((slot_card_name != NULL) && + (strcmp (slot_card_name, card_name) == 0)) { + return card->priv->module->slots[i]; + } + } + + return NULL; +} + +static PK11SlotInfo * +gsd_smartcard_find_slot_from_id (GsdSmartcard *card, + int slot_id) +{ + int i; + + for (i = 0; i < card->priv->module->slotCount; i++) { + if (PK11_GetSlotID (card->priv->module->slots[i]) == slot_id) { + return card->priv->module->slots[i]; + } + } + + return NULL; +} diff --git a/plugins/smartcard/gsd-smartcard.h b/plugins/smartcard/gsd-smartcard.h new file mode 100644 index 00000000..c99b5fa9 --- /dev/null +++ b/plugins/smartcard/gsd-smartcard.h @@ -0,0 +1,94 @@ +/* securitycard.h - api for reading and writing data to a security card + * + * Copyright (C) 2006 Ray Strode + * + * 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, 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_SMARTCARD_H +#define GSD_SMARTCARD_H + +#include +#include + +#include + +G_BEGIN_DECLS +#define GSD_TYPE_SMARTCARD (gsd_smartcard_get_type ()) +#define GSD_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_SMARTCARD, GsdSmartcard)) +#define GSD_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_SMARTCARD, GsdSmartcardClass)) +#define GSD_IS_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_SMARTCARD)) +#define GSD_IS_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_SMARTCARD)) +#define GSD_SMARTCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSD_TYPE_SMARTCARD, GsdSmartcardClass)) +#define GSD_SMARTCARD_ERROR (gsd_smartcard_error_quark ()) +typedef struct _GsdSmartcardClass GsdSmartcardClass; +typedef struct _GsdSmartcard GsdSmartcard; +typedef struct _GsdSmartcardPrivate GsdSmartcardPrivate; +typedef enum _GsdSmartcardError GsdSmartcardError; +typedef enum _GsdSmartcardState GsdSmartcardState; + +typedef struct _GsdSmartcardRequest GsdSmartcardRequest; + +struct _GsdSmartcard { + GObject parent; + + /*< private > */ + GsdSmartcardPrivate *priv; +}; + +struct _GsdSmartcardClass { + GObjectClass parent_class; + + void (* inserted) (GsdSmartcard *card); + void (* removed) (GsdSmartcard *card); +}; + +enum _GsdSmartcardError { + GSD_SMARTCARD_ERROR_GENERIC = 0, +}; + +enum _GsdSmartcardState { + GSD_SMARTCARD_STATE_INSERTED = 0, + GSD_SMARTCARD_STATE_REMOVED, +}; + +GType gsd_smartcard_get_type (void) G_GNUC_CONST; +GQuark gsd_smartcard_error_quark (void) G_GNUC_CONST; + +CK_SLOT_ID gsd_smartcard_get_slot_id (GsdSmartcard *card); +gint gsd_smartcard_get_slot_series (GsdSmartcard *card); +GsdSmartcardState gsd_smartcard_get_state (GsdSmartcard *card); + +char *gsd_smartcard_get_name (GsdSmartcard *card); +gboolean gsd_smartcard_is_login_card (GsdSmartcard *card); + +gboolean gsd_smartcard_unlock (GsdSmartcard *card, + const char *password); + +/* don't under any circumstances call these functions */ +#ifdef GSD_SMARTCARD_ENABLE_INTERNAL_API + +GsdSmartcard *_gsd_smartcard_new (SECMODModule *module, + CK_SLOT_ID slot_id, + gint slot_series); +GsdSmartcard *_gsd_smartcard_new_from_name (SECMODModule *module, + const char *name); + +void _gsd_smartcard_set_state (GsdSmartcard *card, + GsdSmartcardState state); +#endif + +G_END_DECLS +#endif /* GSD_SMARTCARD_H */ diff --git a/plugins/smartcard/smartcard.gnome-settings-plugin.in b/plugins/smartcard/smartcard.gnome-settings-plugin.in new file mode 100644 index 00000000..787c9101 --- /dev/null +++ b/plugins/smartcard/smartcard.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=smartcard +IAge=0 +_Name=Smartcard +_Description=Smartcard plugin +Authors=Ray Strode +Copyright=Copyright © 2010 Red Hat, Inc. +Website= diff --git a/plugins/smartcard/test-smartcard.c b/plugins/smartcard/test-smartcard.c new file mode 100644 index 00000000..b57d908c --- /dev/null +++ b/plugins/smartcard/test-smartcard.c @@ -0,0 +1,7 @@ +#define NEW gsd_smartcard_manager_new_default +#define START gsd_smartcard_manager_start +#define STOP gsd_smartcard_manager_stop +#define MANAGER GsdSmartcardManager +#include "gsd-smartcard-manager.h" + +#include "test-plugin.h" diff --git a/plugins/sound/Makefile.am b/plugins/sound/Makefile.am new file mode 100644 index 00000000..1e3c7d92 --- /dev/null +++ b/plugins/sound/Makefile.am @@ -0,0 +1,66 @@ +plugin_name = sound + +libexec_PROGRAMS = gsd-test-sound + +gsd_test_sound_SOURCES = \ + gsd-sound-manager.h \ + gsd-sound-manager.c \ + test-sound.c + +gsd_test_sound_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(SOUND_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_sound_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SOUND_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = \ + libsound.la + +libsound_la_SOURCES = \ + gsd-sound-plugin.h \ + gsd-sound-plugin.c \ + gsd-sound-manager.h \ + gsd-sound-manager.c + +libsound_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libsound_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(SOUND_CFLAGS) \ + $(AM_CFLAGS) + +libsound_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libsound_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(SOUND_LIBS) + +plugin_in_files = \ + sound.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/sound/Makefile.in b/plugins/sound/Makefile.in new file mode 100644 index 00000000..94fd8c93 --- /dev/null +++ b/plugins/sound/Makefile.in @@ -0,0 +1,899 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = gsd-test-sound$(EXEEXT) +subdir = plugins/sound +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libsound_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libsound_la_OBJECTS = libsound_la-gsd-sound-plugin.lo \ + libsound_la-gsd-sound-manager.lo +libsound_la_OBJECTS = $(am_libsound_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libsound_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libsound_la_CFLAGS) \ + $(CFLAGS) $(libsound_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_test_sound_OBJECTS = \ + gsd_test_sound-gsd-sound-manager.$(OBJEXT) \ + gsd_test_sound-test-sound.$(OBJEXT) +gsd_test_sound_OBJECTS = $(am_gsd_test_sound_OBJECTS) +gsd_test_sound_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +gsd_test_sound_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_sound_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libsound_la_SOURCES) $(gsd_test_sound_SOURCES) +DIST_SOURCES = $(libsound_la_SOURCES) $(gsd_test_sound_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = sound +gsd_test_sound_SOURCES = \ + gsd-sound-manager.h \ + gsd-sound-manager.c \ + test-sound.c + +gsd_test_sound_CFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(SOUND_CFLAGS) \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_sound_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SOUND_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) + +plugin_LTLIBRARIES = \ + libsound.la + +libsound_la_SOURCES = \ + gsd-sound-plugin.h \ + gsd-sound-plugin.c \ + gsd-sound-manager.h \ + gsd-sound-manager.c + +libsound_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libsound_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(SOUND_CFLAGS) \ + $(AM_CFLAGS) + +libsound_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libsound_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(SOUND_LIBS) + +plugin_in_files = \ + sound.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/sound/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/sound/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libsound.la: $(libsound_la_OBJECTS) $(libsound_la_DEPENDENCIES) $(EXTRA_libsound_la_DEPENDENCIES) + $(AM_V_CCLD)$(libsound_la_LINK) -rpath $(plugindir) $(libsound_la_OBJECTS) $(libsound_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-test-sound$(EXEEXT): $(gsd_test_sound_OBJECTS) $(gsd_test_sound_DEPENDENCIES) $(EXTRA_gsd_test_sound_DEPENDENCIES) + @rm -f gsd-test-sound$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_sound_LINK) $(gsd_test_sound_OBJECTS) $(gsd_test_sound_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_sound-gsd-sound-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_sound-test-sound.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsound_la-gsd-sound-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsound_la-gsd-sound-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libsound_la-gsd-sound-plugin.lo: gsd-sound-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsound_la_CPPFLAGS) $(CPPFLAGS) $(libsound_la_CFLAGS) $(CFLAGS) -MT libsound_la-gsd-sound-plugin.lo -MD -MP -MF $(DEPDIR)/libsound_la-gsd-sound-plugin.Tpo -c -o libsound_la-gsd-sound-plugin.lo `test -f 'gsd-sound-plugin.c' || echo '$(srcdir)/'`gsd-sound-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsound_la-gsd-sound-plugin.Tpo $(DEPDIR)/libsound_la-gsd-sound-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-sound-plugin.c' object='libsound_la-gsd-sound-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsound_la_CPPFLAGS) $(CPPFLAGS) $(libsound_la_CFLAGS) $(CFLAGS) -c -o libsound_la-gsd-sound-plugin.lo `test -f 'gsd-sound-plugin.c' || echo '$(srcdir)/'`gsd-sound-plugin.c + +libsound_la-gsd-sound-manager.lo: gsd-sound-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsound_la_CPPFLAGS) $(CPPFLAGS) $(libsound_la_CFLAGS) $(CFLAGS) -MT libsound_la-gsd-sound-manager.lo -MD -MP -MF $(DEPDIR)/libsound_la-gsd-sound-manager.Tpo -c -o libsound_la-gsd-sound-manager.lo `test -f 'gsd-sound-manager.c' || echo '$(srcdir)/'`gsd-sound-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsound_la-gsd-sound-manager.Tpo $(DEPDIR)/libsound_la-gsd-sound-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-sound-manager.c' object='libsound_la-gsd-sound-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsound_la_CPPFLAGS) $(CPPFLAGS) $(libsound_la_CFLAGS) $(CFLAGS) -c -o libsound_la-gsd-sound-manager.lo `test -f 'gsd-sound-manager.c' || echo '$(srcdir)/'`gsd-sound-manager.c + +gsd_test_sound-gsd-sound-manager.o: gsd-sound-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -MT gsd_test_sound-gsd-sound-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_sound-gsd-sound-manager.Tpo -c -o gsd_test_sound-gsd-sound-manager.o `test -f 'gsd-sound-manager.c' || echo '$(srcdir)/'`gsd-sound-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_sound-gsd-sound-manager.Tpo $(DEPDIR)/gsd_test_sound-gsd-sound-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-sound-manager.c' object='gsd_test_sound-gsd-sound-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -c -o gsd_test_sound-gsd-sound-manager.o `test -f 'gsd-sound-manager.c' || echo '$(srcdir)/'`gsd-sound-manager.c + +gsd_test_sound-gsd-sound-manager.obj: gsd-sound-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -MT gsd_test_sound-gsd-sound-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_sound-gsd-sound-manager.Tpo -c -o gsd_test_sound-gsd-sound-manager.obj `if test -f 'gsd-sound-manager.c'; then $(CYGPATH_W) 'gsd-sound-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-sound-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_sound-gsd-sound-manager.Tpo $(DEPDIR)/gsd_test_sound-gsd-sound-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-sound-manager.c' object='gsd_test_sound-gsd-sound-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -c -o gsd_test_sound-gsd-sound-manager.obj `if test -f 'gsd-sound-manager.c'; then $(CYGPATH_W) 'gsd-sound-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-sound-manager.c'; fi` + +gsd_test_sound-test-sound.o: test-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -MT gsd_test_sound-test-sound.o -MD -MP -MF $(DEPDIR)/gsd_test_sound-test-sound.Tpo -c -o gsd_test_sound-test-sound.o `test -f 'test-sound.c' || echo '$(srcdir)/'`test-sound.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_sound-test-sound.Tpo $(DEPDIR)/gsd_test_sound-test-sound.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-sound.c' object='gsd_test_sound-test-sound.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -c -o gsd_test_sound-test-sound.o `test -f 'test-sound.c' || echo '$(srcdir)/'`test-sound.c + +gsd_test_sound-test-sound.obj: test-sound.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -MT gsd_test_sound-test-sound.obj -MD -MP -MF $(DEPDIR)/gsd_test_sound-test-sound.Tpo -c -o gsd_test_sound-test-sound.obj `if test -f 'test-sound.c'; then $(CYGPATH_W) 'test-sound.c'; else $(CYGPATH_W) '$(srcdir)/test-sound.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_sound-test-sound.Tpo $(DEPDIR)/gsd_test_sound-test-sound.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-sound.c' object='gsd_test_sound-test-sound.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_test_sound_CFLAGS) $(CFLAGS) -c -o gsd_test_sound-test-sound.obj `if test -f 'test-sound.c'; then $(CYGPATH_W) 'test-sound.c'; else $(CYGPATH_W) '$(srcdir)/test-sound.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/sound/gsd-sound-manager.c b/plugins/sound/gsd-sound-manager.c new file mode 100644 index 00000000..e41d4db8 --- /dev/null +++ b/plugins/sound/gsd-sound-manager.c @@ -0,0 +1,392 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "gsd-sound-manager.h" +#include "gnome-settings-profile.h" + +#define GSD_SOUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_SOUND_MANAGER, GsdSoundManagerPrivate)) + +struct GsdSoundManagerPrivate +{ + GSettings *settings; + GList *monitors; + guint timeout; +}; + +static void gsd_sound_manager_class_init (GsdSoundManagerClass *klass); +static void gsd_sound_manager_init (GsdSoundManager *sound_manager); +static void gsd_sound_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdSoundManager, gsd_sound_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +sample_info_cb (pa_context *c, const pa_sample_info *i, int eol, void *userdata) +{ + pa_operation *o; + + if (!i) + return; + + g_debug ("Found sample %s", i->name); + + /* We only flush those samples which have an XDG sound name + * attached, because only those originate from themeing */ + if (!(pa_proplist_gets (i->proplist, PA_PROP_EVENT_ID))) + return; + + g_debug ("Dropping sample %s from cache", i->name); + + if (!(o = pa_context_remove_sample (c, i->name, NULL, NULL))) { + g_debug ("pa_context_remove_sample (): %s", pa_strerror (pa_context_errno (c))); + return; + } + + pa_operation_unref (o); + + /* We won't wait until the operation is actually executed to + * speed things up a bit.*/ +} + +static void +flush_cache (void) +{ + pa_mainloop *ml = NULL; + pa_context *c = NULL; + pa_proplist *pl = NULL; + pa_operation *o = NULL; + + g_debug ("Flushing sample cache"); + + if (!(ml = pa_mainloop_new ())) { + g_debug ("Failed to allocate pa_mainloop"); + goto fail; + } + + if (!(pl = pa_proplist_new ())) { + g_debug ("Failed to allocate pa_proplist"); + goto fail; + } + + pa_proplist_sets (pl, PA_PROP_APPLICATION_NAME, PACKAGE_NAME); + pa_proplist_sets (pl, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); + pa_proplist_sets (pl, PA_PROP_APPLICATION_ID, "org.gnome.SettingsDaemon"); + + if (!(c = pa_context_new_with_proplist (pa_mainloop_get_api (ml), PACKAGE_NAME, pl))) { + g_debug ("Failed to allocate pa_context"); + goto fail; + } + + pa_proplist_free (pl); + pl = NULL; + + if (pa_context_connect (c, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) { + g_debug ("pa_context_connect(): %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + /* Wait until the connection is established */ + while (pa_context_get_state (c) != PA_CONTEXT_READY) { + + if (!PA_CONTEXT_IS_GOOD (pa_context_get_state (c))) { + g_debug ("Connection failed: %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + if (pa_mainloop_iterate (ml, TRUE, NULL) < 0) { + g_debug ("pa_mainloop_iterate() failed"); + goto fail; + } + } + + /* Enumerate all cached samples */ + if (!(o = pa_context_get_sample_info_list (c, sample_info_cb, NULL))) { + g_debug ("pa_context_get_sample_info_list(): %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + /* Wait until our operation is finished and there's nothing + * more queued to send to the server */ + while (pa_operation_get_state (o) == PA_OPERATION_RUNNING || pa_context_is_pending (c)) { + + if (!PA_CONTEXT_IS_GOOD (pa_context_get_state (c))) { + g_debug ("Connection failed: %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + if (pa_mainloop_iterate (ml, TRUE, NULL) < 0) { + g_debug ("pa_mainloop_iterate() failed"); + goto fail; + } + } + + g_debug ("Sample cache flushed"); + +fail: + if (o) { + pa_operation_cancel (o); + pa_operation_unref (o); + } + + if (c) { + pa_context_disconnect (c); + pa_context_unref (c); + } + + if (pl) + pa_proplist_free (pl); + + if (ml) + pa_mainloop_free (ml); +} + +static gboolean +flush_cb (GsdSoundManager *manager) +{ + flush_cache (); + manager->priv->timeout = 0; + return FALSE; +} + +static void +trigger_flush (GsdSoundManager *manager) +{ + + if (manager->priv->timeout) + g_source_remove (manager->priv->timeout); + + /* We delay the flushing a bit so that we can coalesce + * multiple changes into a single cache flush */ + manager->priv->timeout = g_timeout_add (500, (GSourceFunc) flush_cb, manager); +} + +static void +settings_changed_cb (GSettings *settings, + const char *key, + GsdSoundManager *manager) +{ + trigger_flush (manager); +} + +static void +register_config_callback (GsdSoundManager *manager) +{ + manager->priv->settings = g_settings_new ("org.gnome.desktop.sound"); + g_signal_connect (G_OBJECT (manager->priv->settings), "changed", + G_CALLBACK (settings_changed_cb), manager); +} + +static void +file_monitor_changed_cb (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event, + GsdSoundManager *manager) +{ + g_debug ("Theme dir changed"); + trigger_flush (manager); +} + +static gboolean +register_directory_callback (GsdSoundManager *manager, + const char *path, + GError **error) +{ + GFile *f; + GFileMonitor *m; + gboolean succ = FALSE; + + g_debug ("Registering directory monitor for %s", path); + + f = g_file_new_for_path (path); + + m = g_file_monitor_directory (f, 0, NULL, error); + + if (m != NULL) { + g_signal_connect (m, "changed", G_CALLBACK (file_monitor_changed_cb), manager); + + manager->priv->monitors = g_list_prepend (manager->priv->monitors, m); + + succ = TRUE; + } + + g_object_unref (f); + + return succ; +} + +gboolean +gsd_sound_manager_start (GsdSoundManager *manager, + GError **error) +{ + char *p, **ps, **k; + const char *env, *dd; + + g_debug ("Starting sound manager"); + gnome_settings_profile_start (NULL); + + /* We listen for change of the selected theme ... */ + register_config_callback (manager); + + /* ... and we listen to changes of the theme base directories + * in $HOME ...*/ + + if ((env = g_getenv ("XDG_DATA_HOME")) && *env == '/') + p = g_build_filename (env, "sounds", NULL); + else if (((env = g_getenv ("HOME")) && *env == '/') || (env = g_get_home_dir ())) + p = g_build_filename (env, ".local", "share", "sounds", NULL); + else + p = NULL; + + if (p) { + register_directory_callback (manager, p, NULL); + g_free (p); + } + + /* ... and globally. */ + if (!(dd = g_getenv ("XDG_DATA_DIRS")) || *dd == 0) + dd = "/usr/local/share:/usr/share"; + + ps = g_strsplit (dd, ":", 0); + + for (k = ps; *k; ++k) + register_directory_callback (manager, *k, NULL); + + g_strfreev (ps); + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_sound_manager_stop (GsdSoundManager *manager) +{ + g_debug ("Stopping sound manager"); + + if (manager->priv->settings != NULL) { + g_object_unref (manager->priv->settings); + manager->priv->settings = NULL; + } + + if (manager->priv->timeout) { + g_source_remove (manager->priv->timeout); + manager->priv->timeout = 0; + } + + while (manager->priv->monitors) { + g_file_monitor_cancel (G_FILE_MONITOR (manager->priv->monitors->data)); + g_object_unref (manager->priv->monitors->data); + manager->priv->monitors = g_list_delete_link (manager->priv->monitors, manager->priv->monitors); + } +} + +static GObject * +gsd_sound_manager_constructor ( + GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdSoundManager *m; + + m = GSD_SOUND_MANAGER (G_OBJECT_CLASS (gsd_sound_manager_parent_class)->constructor ( + type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (m); +} + +static void +gsd_sound_manager_dispose (GObject *object) +{ + GsdSoundManager *manager; + + manager = GSD_SOUND_MANAGER (object); + + gsd_sound_manager_stop (manager); + + G_OBJECT_CLASS (gsd_sound_manager_parent_class)->dispose (object); +} + +static void +gsd_sound_manager_class_init (GsdSoundManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_sound_manager_constructor; + object_class->dispose = gsd_sound_manager_dispose; + object_class->finalize = gsd_sound_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdSoundManagerPrivate)); +} + +static void +gsd_sound_manager_init (GsdSoundManager *manager) +{ + manager->priv = GSD_SOUND_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_sound_manager_finalize (GObject *object) +{ + GsdSoundManager *sound_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SOUND_MANAGER (object)); + + sound_manager = GSD_SOUND_MANAGER (object); + + g_return_if_fail (sound_manager->priv); + + G_OBJECT_CLASS (gsd_sound_manager_parent_class)->finalize (object); +} + +GsdSoundManager * +gsd_sound_manager_new (void) +{ + if (manager_object) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_SOUND_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, (gpointer *) &manager_object); + } + + return GSD_SOUND_MANAGER (manager_object); +} diff --git a/plugins/sound/gsd-sound-manager.h b/plugins/sound/gsd-sound-manager.h new file mode 100644 index 00000000..bfcef5c2 --- /dev/null +++ b/plugins/sound/gsd-sound-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering + * + * 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_SOUND_MANAGER_H +#define __GSD_SOUND_MANAGER_H + +#include +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_SOUND_MANAGER (gsd_sound_manager_get_type ()) +#define GSD_SOUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SOUND_MANAGER, GsdSoundManager)) +#define GSD_SOUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_SOUND_MANAGER, GsdSoundManagerClass)) +#define GSD_IS_SOUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SOUND_MANAGER)) +#define GSD_IS_SOUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SOUND_MANAGER)) +#define GSD_SOUND_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SOUND_MANAGER, GsdSoundManagerClass)) + +typedef struct GsdSoundManagerPrivate GsdSoundManagerPrivate; + +typedef struct +{ + GObject parent; + GsdSoundManagerPrivate *priv; +} GsdSoundManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdSoundManagerClass; + +GType gsd_sound_manager_get_type (void) G_GNUC_CONST; + +GsdSoundManager *gsd_sound_manager_new (void); +gboolean gsd_sound_manager_start (GsdSoundManager *manager, GError **error); +void gsd_sound_manager_stop (GsdSoundManager *manager); + +G_END_DECLS + +#endif /* __GSD_SOUND_MANAGER_H */ diff --git a/plugins/sound/gsd-sound-plugin.c b/plugins/sound/gsd-sound-plugin.c new file mode 100644 index 00000000..941dc904 --- /dev/null +++ b/plugins/sound/gsd-sound-plugin.c @@ -0,0 +1,100 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-sound-plugin.h" +#include "gsd-sound-manager.h" + +struct GsdSoundPluginPrivate { + GsdSoundManager *manager; +}; + +#define GSD_SOUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_SOUND_PLUGIN, GsdSoundPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdSoundPlugin, gsd_sound_plugin) + +static void +gsd_sound_plugin_init (GsdSoundPlugin *plugin) +{ + plugin->priv = GSD_SOUND_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdSoundPlugin initializing"); + + plugin->priv->manager = gsd_sound_manager_new (); +} + +static void +gsd_sound_plugin_finalize (GObject *object) +{ + GsdSoundPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SOUND_PLUGIN (object)); + + g_debug ("GsdSoundPlugin finalizing"); + + plugin = GSD_SOUND_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) + g_object_unref (plugin->priv->manager); + + G_OBJECT_CLASS (gsd_sound_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + GError *error = NULL; + + g_debug ("Activating sound plugin"); + + if (!gsd_sound_manager_start (GSD_SOUND_PLUGIN (plugin)->priv->manager, &error)) { + g_warning ("Unable to start sound manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating sound plugin"); + gsd_sound_manager_stop (GSD_SOUND_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_sound_plugin_class_init (GsdSoundPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_sound_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdSoundPluginPrivate)); +} diff --git a/plugins/sound/gsd-sound-plugin.h b/plugins/sound/gsd-sound-plugin.h new file mode 100644 index 00000000..3a172616 --- /dev/null +++ b/plugins/sound/gsd-sound-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering + * + * 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, 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_SOUND_PLUGIN_H__ +#define __GSD_SOUND_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_SOUND_PLUGIN (gsd_sound_plugin_get_type ()) +#define GSD_SOUND_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SOUND_PLUGIN, GsdSoundPlugin)) +#define GSD_SOUND_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_SOUND_PLUGIN, GsdSoundPluginClass)) +#define GSD_IS_SOUND_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SOUND_PLUGIN)) +#define GSD_IS_SOUND_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SOUND_PLUGIN)) +#define GSD_SOUND_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SOUND_PLUGIN, GsdSoundPluginClass)) + +typedef struct GsdSoundPluginPrivate GsdSoundPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdSoundPluginPrivate *priv; +} GsdSoundPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdSoundPluginClass; + +GType gsd_sound_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_SOUND_PLUGIN_H__ */ diff --git a/plugins/sound/sound.gnome-settings-plugin.in b/plugins/sound/sound.gnome-settings-plugin.in new file mode 100644 index 00000000..79ec2d01 --- /dev/null +++ b/plugins/sound/sound.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=sound +IAge=0 +_Name=Sound +_Description=Sound Sample Cache plugin +Authors=Lennart Poettering +Copyright=Copyright © 2008 +Website= diff --git a/plugins/sound/test-sound.c b/plugins/sound/test-sound.c new file mode 100644 index 00000000..a618b547 --- /dev/null +++ b/plugins/sound/test-sound.c @@ -0,0 +1,7 @@ +#define NEW gsd_sound_manager_new +#define START gsd_sound_manager_start +#define STOP gsd_sound_manager_stop +#define MANAGER GsdSoundManager +#include "gsd-sound-manager.h" + +#include "test-plugin.h" diff --git a/plugins/updates/Makefile.am b/plugins/updates/Makefile.am new file mode 100644 index 00000000..81c7179c --- /dev/null +++ b/plugins/updates/Makefile.am @@ -0,0 +1,59 @@ +plugin_name = updates + +introspectiondir = $(datadir)/dbus-1/interfaces +dist_introspection_DATA = org.gnome.SettingsDaemonUpdates.xml + +plugin_LTLIBRARIES = \ + libupdates.la + +libupdates_la_SOURCES = \ + gsd-updates-common.h \ + gsd-updates-plugin.h \ + gsd-updates-plugin.c \ + gsd-updates-refresh.h \ + gsd-updates-refresh.c \ + gsd-updates-firmware.h \ + gsd-updates-firmware.c \ + gsd-updates-manager.h \ + gsd-updates-manager.c + +libupdates_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libupdates_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GUDEV_CFLAGS) \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + $(PACKAGEKIT_CFLAGS) \ + -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \ + -DDATADIR=\"$(datadir)\" \ + -DBINDIR=\"$(bindir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + -I$(top_srcdir)/data \ + $(AM_CFLAGS) + +libupdates_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libupdates_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(PACKAGEKIT_LIBS) + +plugin_in_files = \ + updates.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/updates/Makefile.in b/plugins/updates/Makefile.in new file mode 100644 index 00000000..e972c2d7 --- /dev/null +++ b/plugins/updates/Makefile.in @@ -0,0 +1,841 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = plugins/updates +DIST_COMMON = $(dist_introspection_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" \ + "$(DESTDIR)$(introspectiondir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libupdates_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libupdates_la_OBJECTS = libupdates_la-gsd-updates-plugin.lo \ + libupdates_la-gsd-updates-refresh.lo \ + libupdates_la-gsd-updates-firmware.lo \ + libupdates_la-gsd-updates-manager.lo +libupdates_la_OBJECTS = $(am_libupdates_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libupdates_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libupdates_la_CFLAGS) \ + $(CFLAGS) $(libupdates_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libupdates_la_SOURCES) +DIST_SOURCES = $(libupdates_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(dist_introspection_DATA) $(plugin_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = updates +introspectiondir = $(datadir)/dbus-1/interfaces +dist_introspection_DATA = org.gnome.SettingsDaemonUpdates.xml +plugin_LTLIBRARIES = \ + libupdates.la + +libupdates_la_SOURCES = \ + gsd-updates-common.h \ + gsd-updates-plugin.h \ + gsd-updates-plugin.c \ + gsd-updates-refresh.h \ + gsd-updates-refresh.c \ + gsd-updates-firmware.h \ + gsd-updates-firmware.c \ + gsd-updates-manager.h \ + gsd-updates-manager.c + +libupdates_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libupdates_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GUDEV_CFLAGS) \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + $(PACKAGEKIT_CFLAGS) \ + -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \ + -DDATADIR=\"$(datadir)\" \ + -DBINDIR=\"$(bindir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + -I$(top_srcdir)/data \ + $(AM_CFLAGS) + +libupdates_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libupdates_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(PACKAGEKIT_LIBS) + +plugin_in_files = \ + updates.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/updates/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/updates/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libupdates.la: $(libupdates_la_OBJECTS) $(libupdates_la_DEPENDENCIES) $(EXTRA_libupdates_la_DEPENDENCIES) + $(AM_V_CCLD)$(libupdates_la_LINK) -rpath $(plugindir) $(libupdates_la_OBJECTS) $(libupdates_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libupdates_la-gsd-updates-firmware.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libupdates_la-gsd-updates-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libupdates_la-gsd-updates-plugin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libupdates_la-gsd-updates-refresh.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libupdates_la-gsd-updates-plugin.lo: gsd-updates-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -MT libupdates_la-gsd-updates-plugin.lo -MD -MP -MF $(DEPDIR)/libupdates_la-gsd-updates-plugin.Tpo -c -o libupdates_la-gsd-updates-plugin.lo `test -f 'gsd-updates-plugin.c' || echo '$(srcdir)/'`gsd-updates-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libupdates_la-gsd-updates-plugin.Tpo $(DEPDIR)/libupdates_la-gsd-updates-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-updates-plugin.c' object='libupdates_la-gsd-updates-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -c -o libupdates_la-gsd-updates-plugin.lo `test -f 'gsd-updates-plugin.c' || echo '$(srcdir)/'`gsd-updates-plugin.c + +libupdates_la-gsd-updates-refresh.lo: gsd-updates-refresh.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -MT libupdates_la-gsd-updates-refresh.lo -MD -MP -MF $(DEPDIR)/libupdates_la-gsd-updates-refresh.Tpo -c -o libupdates_la-gsd-updates-refresh.lo `test -f 'gsd-updates-refresh.c' || echo '$(srcdir)/'`gsd-updates-refresh.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libupdates_la-gsd-updates-refresh.Tpo $(DEPDIR)/libupdates_la-gsd-updates-refresh.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-updates-refresh.c' object='libupdates_la-gsd-updates-refresh.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -c -o libupdates_la-gsd-updates-refresh.lo `test -f 'gsd-updates-refresh.c' || echo '$(srcdir)/'`gsd-updates-refresh.c + +libupdates_la-gsd-updates-firmware.lo: gsd-updates-firmware.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -MT libupdates_la-gsd-updates-firmware.lo -MD -MP -MF $(DEPDIR)/libupdates_la-gsd-updates-firmware.Tpo -c -o libupdates_la-gsd-updates-firmware.lo `test -f 'gsd-updates-firmware.c' || echo '$(srcdir)/'`gsd-updates-firmware.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libupdates_la-gsd-updates-firmware.Tpo $(DEPDIR)/libupdates_la-gsd-updates-firmware.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-updates-firmware.c' object='libupdates_la-gsd-updates-firmware.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -c -o libupdates_la-gsd-updates-firmware.lo `test -f 'gsd-updates-firmware.c' || echo '$(srcdir)/'`gsd-updates-firmware.c + +libupdates_la-gsd-updates-manager.lo: gsd-updates-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -MT libupdates_la-gsd-updates-manager.lo -MD -MP -MF $(DEPDIR)/libupdates_la-gsd-updates-manager.Tpo -c -o libupdates_la-gsd-updates-manager.lo `test -f 'gsd-updates-manager.c' || echo '$(srcdir)/'`gsd-updates-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libupdates_la-gsd-updates-manager.Tpo $(DEPDIR)/libupdates_la-gsd-updates-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-updates-manager.c' object='libupdates_la-gsd-updates-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libupdates_la_CPPFLAGS) $(CPPFLAGS) $(libupdates_la_CFLAGS) $(CFLAGS) -c -o libupdates_la-gsd-updates-manager.lo `test -f 'gsd-updates-manager.c' || echo '$(srcdir)/'`gsd-updates-manager.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-dist_introspectionDATA: $(dist_introspection_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_introspection_DATA)'; test -n "$(introspectiondir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(introspectiondir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(introspectiondir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(introspectiondir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(introspectiondir)" || exit $$?; \ + done + +uninstall-dist_introspectionDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_introspection_DATA)'; test -n "$(introspectiondir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(introspectiondir)'; $(am__uninstall_files_from_dir) +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(introspectiondir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_introspectionDATA install-pluginDATA \ + install-pluginLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_introspectionDATA uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES cscopelist ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dist_introspectionDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-dist_introspectionDATA uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/updates/gsd-updates-common.h b/plugins/updates/gsd-updates-common.h new file mode 100644 index 00000000..eafdf91e --- /dev/null +++ b/plugins/updates/gsd-updates-common.h @@ -0,0 +1,44 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GSD_UPDATES_COMMON_H +#define __GSD_UPDATES_COMMON_H + +G_BEGIN_DECLS + +#define GSD_SETTINGS_BANNED_FIRMWARE "banned-firmware" +#define GSD_SETTINGS_CONNECTION_USE_MOBILE "connection-use-mobile" +#define GSD_SETTINGS_ENABLE_CHECK_FIRMWARE "enable-check-firmware" +#define GSD_SETTINGS_FREQUENCY_GET_UPDATES "frequency-get-updates" +#define GSD_SETTINGS_FREQUENCY_GET_UPGRADES "frequency-get-upgrades" +#define GSD_SETTINGS_FREQUENCY_REFRESH_CACHE "frequency-refresh-cache" +#define GSD_SETTINGS_FREQUENCY_UPDATES_NOTIFICATION "frequency-updates-notification" +#define GSD_SETTINGS_IGNORED_DEVICES "ignored-devices" +#define GSD_SETTINGS_LAST_UPDATES_NOTIFICATION "last-updates-notification" +#define GSD_SETTINGS_MEDIA_REPO_FILENAMES "media-repo-filenames" +#define GSD_SETTINGS_NOTIFY_DISTRO_UPGRADES "notify-distro-upgrades" +#define GSD_SETTINGS_SCHEMA "org.gnome.settings-daemon.plugins.updates" +#define GSD_SETTINGS_UPDATE_BATTERY "update-battery" +#define GSD_SETTINGS_AUTO_DOWNLOAD_UPDATES "auto-download-updates" + +G_END_DECLS + +#endif /* __GSD_UPDATES_COMMON_H */ diff --git a/plugins/updates/gsd-updates-firmware.c b/plugins/updates/gsd-updates-firmware.c new file mode 100644 index 00000000..dc972a55 --- /dev/null +++ b/plugins/updates/gsd-updates-firmware.c @@ -0,0 +1,1030 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2012 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include +#include +#include +#include +#ifdef HAVE_GUDEV +#include +#endif + +#include "gsd-updates-common.h" +#include "gsd-updates-firmware.h" + +static void gsd_updates_firmware_finalize (GObject *object); + +#define GSD_UPDATES_FIRMWARE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_UPDATES_TYPE_FIRMWARE, GsdUpdatesFirmwarePrivate)) +#define GSD_UPDATES_FIRMWARE_MISSING_DIR "/run/udev/firmware-missing" +#define GSD_UPDATES_FIRMWARE_LOADING_DIR "/lib/firmware" +#define GSD_UPDATES_FIRMWARE_LOGIN_DELAY 10 /* seconds */ +#define GSD_UPDATES_FIRMWARE_PROCESS_DELAY 2 /* seconds */ +#define GSD_UPDATES_FIRMWARE_INSERT_DELAY 2 /* seconds */ +#define GSD_UPDATES_FIRMWARE_DEVICE_REBIND_PROGRAM "/usr/sbin/pk-device-rebind" + +struct GsdUpdatesFirmwarePrivate +{ + GSettings *settings; + GFileMonitor *monitor; + GPtrArray *array_requested; + PkTask *task; + GPtrArray *packages_found; + guint timeout_id; +}; + +typedef enum { + FIRMWARE_SUBSYSTEM_USB, + FIRMWARE_SUBSYSTEM_PCI, + FIRMWARE_SUBSYSTEM_UNKNOWN +} FirmwareSubsystem; + +typedef struct { + gchar *filename; + gchar *sysfs_path; + gchar *model; + gchar *id; + FirmwareSubsystem subsystem; +} GsdUpdatesFirmwareRequest; + +G_DEFINE_TYPE (GsdUpdatesFirmware, gsd_updates_firmware, G_TYPE_OBJECT) + +static void install_package_ids (GsdUpdatesFirmware *firmware); +static void ignore_devices (GsdUpdatesFirmware *firmware); + +static gboolean +subsystem_can_replug (FirmwareSubsystem subsystem) +{ + if (subsystem == FIRMWARE_SUBSYSTEM_USB) + return TRUE; + return FALSE; +} + +static GsdUpdatesFirmwareRequest * +request_new (const gchar *filename, const gchar *sysfs_path) +{ + GsdUpdatesFirmwareRequest *req; +#ifdef HAVE_GUDEV + GUdevDevice *device; + GUdevClient *client; + const gchar *subsystem; + const gchar *model; + const gchar *id_vendor; + const gchar *id_product; +#endif + + req = g_new0 (GsdUpdatesFirmwareRequest, 1); + req->filename = g_strdup (filename); + req->sysfs_path = g_strdup (sysfs_path); + req->subsystem = FIRMWARE_SUBSYSTEM_UNKNOWN; +#ifdef HAVE_GUDEV + + /* get all subsystems */ + client = g_udev_client_new (NULL); + device = g_udev_client_query_by_sysfs_path (client, sysfs_path); + if (device == NULL) + goto out; + + /* find subsystem, which will affect if we have to replug, or reboot */ + subsystem = g_udev_device_get_subsystem (device); + if (g_strcmp0 (subsystem, "usb") == 0) { + req->subsystem = FIRMWARE_SUBSYSTEM_USB; + } else if (g_strcmp0 (subsystem, "pci") == 0) { + req->subsystem = FIRMWARE_SUBSYSTEM_PCI; + } else { + g_warning ("subsystem unrecognised: %s", subsystem); + } + + /* get model, so we can show something sensible */ + model = g_udev_device_get_property (device, "ID_MODEL"); + if (model != NULL && model[0] != '\0') { + req->model = g_strdup (model); + /* replace invalid chars */ + g_strdelimit (req->model, "_", ' '); + } + + /* create ID so we can ignore the specific device */ + id_vendor = g_udev_device_get_property (device, "ID_VENDOR"); + id_product = g_udev_device_get_property (device, "ID_MODEL_ID"); + req->id = g_strdup_printf ("%s_%s", id_vendor, id_product); +out: + if (device != NULL) + g_object_unref (device); + g_object_unref (client); +#endif + return req; +} + +static void +request_free (GsdUpdatesFirmwareRequest *req) +{ + g_free (req->filename); + g_free (req->model); + g_free (req->sysfs_path); + g_free (req->id); + g_free (req); +} + +static gboolean +device_rebind (GsdUpdatesFirmware *firmware) +{ + gboolean ret; + gchar *argv[4]; + gchar *rebind_stderr = NULL; + gchar *rebind_stdout = NULL; + GError *error = NULL; + gint exit_status = 0; + guint i; + GPtrArray *array; + const GsdUpdatesFirmwareRequest *req; + GString *string; + + string = g_string_new (""); + + /* make a string array of all the devices to replug */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + g_string_append_printf (string, "%s ", req->sysfs_path); + } + + /* remove trailing space */ + if (string->len > 0) + g_string_set_size (string, string->len-1); + + /* use PolicyKit to do this as root */ + argv[0] = BINDIR "/pkexec"; + argv[1] = GSD_UPDATES_FIRMWARE_DEVICE_REBIND_PROGRAM; + argv[2] = string->str; + argv[3] = NULL; + ret = g_spawn_sync (NULL, + argv, + NULL, + 0, + NULL, NULL, + &rebind_stdout, + &rebind_stderr, + &exit_status, + &error); + if (!ret) { + g_warning ("failed to spawn '%s': %s", + argv[1], error->message); + g_error_free (error); + goto out; + } + + /* if we failed to rebind the device */ + if (exit_status != 0) { + g_warning ("failed to rebind: %s, %s", + rebind_stdout, rebind_stderr); + ret = FALSE; + goto out; + } +out: + g_free (rebind_stdout); + g_free (rebind_stderr); + g_string_free (string, TRUE); + return ret; +} +static void +libnotify_cb (NotifyNotification *notification, gchar *action, gpointer data) +{ + GsdUpdatesFirmware *firmware = GSD_UPDATES_FIRMWARE (data); + + if (g_strcmp0 (action, "install-firmware") == 0) { + install_package_ids (firmware); + } else if (g_strcmp0 (action, "ignore-devices") == 0) { + ignore_devices (firmware); + } else { + g_warning ("unknown action id: %s", action); + } + notify_notification_close (notification, NULL); +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +require_restart (GsdUpdatesFirmware *firmware) +{ + const gchar *message; + gboolean ret; + GError *error = NULL; + NotifyNotification *notification; + + /* TRANSLATORS: we need to restart so the new hardware can re-request the firmware */ + message = _("You will need to restart this computer before the hardware will work correctly."); + + /* TRANSLATORS: title of libnotify bubble */ + notification = notify_notification_new (_("Additional software was installed"), message, NULL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + + /* show the bubble */ + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } +} + +static void +require_replug (GsdUpdatesFirmware *firmware) +{ + const gchar *message; + gboolean ret; + GError *error = NULL; + NotifyNotification *notification; + + /* TRANSLATORS: we need to remove an replug so the new hardware can re-request the firmware */ + message = _("You will need to remove and then reinsert the hardware before it will work correctly."); + + /* TRANSLATORS: title of libnotify bubble */ + notification = notify_notification_new (_("Additional software was installed"), message, NULL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + + /* show the bubble */ + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } +} + +static void +require_nothing (GsdUpdatesFirmware *firmware) +{ + const gchar *message; + gboolean ret; + GError *error = NULL; + NotifyNotification *notification; + + /* TRANSLATORS: we need to remove an replug so the new hardware can re-request the firmware */ + message = _("Your hardware has been set up and is now ready to use."); + + /* TRANSLATORS: title of libnotify bubble */ + notification = notify_notification_new (_("Additional software was installed"), message, NULL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + + /* show the bubble */ + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } +} + +static void +install_packages_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesFirmware *firmware) +{ + PkClient *client = PK_CLIENT (object); + GError *error = NULL; + PkResults *results = NULL; + GPtrArray *array = NULL; + gboolean restart = FALSE; + const GsdUpdatesFirmwareRequest *req; + gboolean ret; + guint i; + PkError *error_code = NULL; + + /* get the results */ + results = pk_client_generic_finish (client, res, &error); + if (results == NULL) { + g_warning ("failed to install file: %s", error->message); + g_error_free (error); + goto out; + } + + /* check error code */ + error_code = pk_results_get_error_code (results); + if (error_code != NULL) { + g_warning ("failed to install file: %s, %s", + pk_error_enum_to_string (pk_error_get_code (error_code)), + pk_error_get_details (error_code)); + goto out; + } + + /* go through all the requests, and find the worst type */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + ret = subsystem_can_replug (req->subsystem); + if (!ret) { + restart = TRUE; + break; + } + } + + /* can we just rebind the device */ + ret = g_file_test (GSD_UPDATES_FIRMWARE_DEVICE_REBIND_PROGRAM, G_FILE_TEST_EXISTS); + if (ret) { + ret = device_rebind (firmware); + if (ret) { + require_nothing (firmware); + goto out; + } + } else { + /* give the user the correct message */ + if (restart) + require_restart (firmware); + else + require_replug (firmware); + } + + /* clear array */ + g_ptr_array_set_size (firmware->priv->array_requested, 0); +out: + if (error_code != NULL) + g_object_unref (error_code); + if (array != NULL) + g_ptr_array_unref (array); + if (results != NULL) + g_object_unref (results); +} + +static gchar ** +package_array_to_strv (GPtrArray *array) +{ + PkPackage *item; + gchar **results; + guint i; + + results = g_new0 (gchar *, array->len+1); + for (i=0; ilen; i++) { + item = g_ptr_array_index (array, i); + results[i] = g_strdup (pk_package_get_id (item)); + } + return results; +} + +static void +install_package_ids (GsdUpdatesFirmware *firmware) +{ + gchar **package_ids; + + /* install all of the firmware files */ + package_ids = package_array_to_strv (firmware->priv->packages_found); + pk_client_install_packages_async (PK_CLIENT(firmware->priv->task), + TRUE, package_ids, + NULL, + NULL, NULL, + (GAsyncReadyCallback) install_packages_cb, + firmware); + g_strfreev (package_ids); +} + +static void +ignore_devices (GsdUpdatesFirmware *firmware) +{ + gchar *existing = NULL; + GsdUpdatesFirmwareRequest *req; + GPtrArray *array; + GString *string; + guint i; + + /* get from settings */ + existing = g_settings_get_string (firmware->priv->settings, + GSD_SETTINGS_IGNORED_DEVICES); + + /* get existing string */ + string = g_string_new (existing); + if (string->len > 0) + g_string_append (string, ","); + + /* add all listed devices */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + g_string_append_printf (string, "%s,", req->id); + } + + /* remove final ',' */ + if (string->len > 2) + g_string_set_size (string, string->len - 1); + + /* set new string */ + g_settings_set_string (firmware->priv->settings, + GSD_SETTINGS_IGNORED_DEVICES, + string->str); + + g_free (existing); + g_string_free (string, TRUE); +} + +static PkPackage * +check_available (GsdUpdatesFirmware *firmware, const gchar *filename) +{ + guint length = 0; + GPtrArray *array = NULL; + GError *error = NULL; + PkPackage *item = NULL; + PkBitfield filter; + PkResults *results; + gchar **values = NULL; + PkError *error_code = NULL; + + /* search for newest not installed package */ + filter = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, + PK_FILTER_ENUM_NEWEST, -1); + values = g_strsplit (filename, "&", -1); + results = pk_client_search_files (PK_CLIENT(firmware->priv->task), + filter, + values, + NULL, + NULL, NULL, + &error); + if (results == NULL) { + g_warning ("failed to search file %s: %s", + filename, error->message); + g_error_free (error); + goto out; + } + + /* check error code */ + error_code = pk_results_get_error_code (results); + if (error_code != NULL) { + g_warning ("failed to search file: %s, %s", + pk_error_enum_to_string (pk_error_get_code (error_code)), + pk_error_get_details (error_code)); + goto out; + } + + /* make sure we have one package */ + array = pk_results_get_package_array (results); + if (array->len == 0) + g_debug ("no package providing %s found", filename); + else if (array->len != 1) + g_warning ("not one package providing %s found (%i)", filename, length); + else + item = g_object_ref (g_ptr_array_index (array, 0)); +out: + g_strfreev (values); + if (error_code != NULL) + g_object_unref (error_code); + if (array != NULL) + g_ptr_array_unref (array); + if (results != NULL) + g_object_unref (results); + return item; +} + +static void +remove_duplicate (GPtrArray *array) +{ + guint i, j; + const gchar *val; + const gchar *val_tmp; + + /* remove each duplicate entry */ + for (i=0; ilen; i++) { + val = g_ptr_array_index (array, i); + for (j=i+1; jlen; j++) { + val_tmp = g_ptr_array_index (array, j); + if (g_strcmp0 (val_tmp, val) == 0) + g_ptr_array_remove_index_fast (array, j); + } + } +} + +static gboolean +delay_timeout_cb (gpointer data) +{ + guint i; + gboolean ret; + GString *string; + GsdUpdatesFirmware *firmware = GSD_UPDATES_FIRMWARE (data); + NotifyNotification *notification; + GPtrArray *array; + GError *error = NULL; + PkPackage *item = NULL; + const GsdUpdatesFirmwareRequest *req; + gboolean has_data = FALSE; + + /* message string */ + string = g_string_new (""); + + /* try to find each firmware file in an available package */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + /* save to new array if we found one package for this file */ + item = check_available (firmware, req->filename); + if (item != NULL) { + g_ptr_array_add (firmware->priv->packages_found, item); + g_object_unref (item); + } + } + + /* nothing to do */ + if (firmware->priv->packages_found->len == 0) { + g_debug ("no packages providing any of the missing firmware"); + goto out; + } + + /* check we don't want the same package more than once */ + remove_duplicate (firmware->priv->packages_found); + + /* have we got any models to array */ + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + if (req->model != NULL) { + has_data = TRUE; + break; + } + } + + /* TRANSLATORS: we need another package to keep udev quiet */ + g_string_append (string, _("Additional firmware is required to make hardware in this computer function correctly.")); + + /* sdd what information we have */ + if (has_data) { + g_string_append (string, "\n"); + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + if (req->model != NULL) + g_string_append_printf (string, "\n• %s", req->model); + } + g_string_append (string, "\n"); + } + + /* TRANSLATORS: title of libnotify bubble */ + notification = notify_notification_new (_("Additional firmware required"), string->str, NULL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW); + notify_notification_add_action (notification, "install-firmware", + /* TRANSLATORS: button label */ + _("Install firmware"), libnotify_cb, firmware, NULL); + notify_notification_add_action (notification, "ignore-devices", + /* TRANSLATORS: we should ignore this device and not ask anymore */ + _("Ignore devices"), libnotify_cb, firmware, NULL); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } + +out: + g_string_free (string, TRUE); + /* never repeat */ + return FALSE; +} + +static void +remove_banned (GsdUpdatesFirmware *firmware, GPtrArray *array) +{ + gboolean ret; + gchar **banned = NULL; + gchar *banned_str; + GsdUpdatesFirmwareRequest *req; + guint i, j; + + /* get from settings */ + banned_str = g_settings_get_string (firmware->priv->settings, + GSD_SETTINGS_BANNED_FIRMWARE); + if (banned_str == NULL) { + g_warning ("could not read banned list"); + goto out; + } + + /* nothing in list, common case */ + if (banned_str[0] == '\0') { + g_debug ("nothing in banned list"); + goto out; + } + + /* split using "," */ + banned = g_strsplit (banned_str, ",", 0); + + /* remove any banned pattern matches */ + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + for (j=0; banned[j] != NULL; j++) { + ret = g_pattern_match_simple (banned[j], req->filename); + if (ret) { + g_debug ("match %s for %s, removing", + banned[j], req->filename); + request_free (req); + g_ptr_array_remove_index_fast (array, i); + break; + } + } + } +out: + g_free (banned_str); + g_strfreev (banned); +} + +static void +remove_ignored (GsdUpdatesFirmware *firmware, GPtrArray *array) +{ + gboolean ret; + gchar **ignored = NULL; + gchar *ignored_str; + GsdUpdatesFirmwareRequest *req; + guint i, j; + + /* get from settings */ + ignored_str = g_settings_get_string (firmware->priv->settings, + GSD_SETTINGS_IGNORED_DEVICES); + if (ignored_str == NULL) { + g_warning ("could not read ignored list"); + goto out; + } + + /* nothing in list, common case */ + if (ignored_str[0] == '\0') { + g_debug ("nothing in ignored list"); + goto out; + } + + /* split using "," */ + ignored = g_strsplit (ignored_str, ",", 0); + + /* remove any ignored pattern matches */ + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + if (req->id == NULL) + continue; + for (j=0; ignored[j] != NULL; j++) { + ret = g_pattern_match_simple (ignored[j], req->id); + if (ret) { + g_debug ("match %s for %s, removing", ignored[j], req->id); + request_free (req); + g_ptr_array_remove_index_fast (array, i); + break; + } + } + } +out: + g_free (ignored_str); + g_strfreev (ignored); +} + +static gchar * +udev_text_decode (const gchar *data) +{ + guint i; + guint j; + gchar *decode; + + decode = g_strdup (data); + for (i = 0, j = 0; data[i] != '\0'; j++) { + if (memcmp (&data[i], "\\x2f", 4) == 0) { + decode[j] = '/'; + i += 4; + } else if (memcmp (&data[i], "\\x5c", 4) == 0) { + decode[j] = '\\'; + i += 4; + } else { + decode[j] = data[i]; + i++; + } + } + decode[j] = '\0'; + return decode; +} + +static gchar * +get_device (GsdUpdatesFirmware *firmware, const gchar *filename) +{ + GFile *file; + GFileInfo *info; + const gchar *symlink_path; + gchar *syspath = NULL; + GError *error = NULL; + gchar *target = NULL; + gchar *tmp; + + /* get the file data */ + file = g_file_new_for_path (filename); + info = g_file_query_info (file, + G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET, + G_FILE_QUERY_INFO_NONE, + NULL, + &error); + if (info == NULL) { + g_warning ("Failed to get symlink: %s", + error->message); + g_error_free (error); + goto out; + } + + /* /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 */ + symlink_path = g_file_info_get_symlink_target (info); + if (symlink_path == NULL) { + g_warning ("failed to get symlink target"); + goto out; + } + + /* prepend sys to make '/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2' */ + syspath = g_strconcat ("/sys", symlink_path, NULL); + + /* start with the longest, and try to find a sub-path that exists */ + tmp = &syspath[strlen (syspath)]; + while (tmp != NULL) { + *tmp = '\0'; + g_debug ("testing %s", target); + if (g_file_test (syspath, G_FILE_TEST_EXISTS)) { + target = g_strdup (syspath); + goto out; + } + tmp = g_strrstr (syspath, "/"); + } +out: + if (info != NULL) + g_object_unref (info); + g_object_unref (file); + g_free (syspath); + return target; +} + +static void +add_filename (GsdUpdatesFirmware *firmware, const gchar *filename_no_path) +{ + gboolean ret; + gchar *filename_path = NULL; + gchar *missing_path = NULL; + gchar *sysfs_path = NULL; + GsdUpdatesFirmwareRequest *req; + GPtrArray *array; + guint i; + + /* this is the file we want to load */ + filename_path = g_build_filename (GSD_UPDATES_FIRMWARE_LOADING_DIR, + filename_no_path, NULL); + + /* file already exists */ + ret = g_file_test (filename_path, G_FILE_TEST_EXISTS); + if (ret) + goto out; + + /* this is the file that udev created for us */ + missing_path = g_build_filename (GSD_UPDATES_FIRMWARE_MISSING_DIR, + filename_no_path, NULL); + g_debug ("filename=%s -> %s", missing_path, filename_path); + + /* get symlink target */ + sysfs_path = get_device (firmware, missing_path); + if (sysfs_path == NULL) + goto out; + + /* find any previous requests with this path or firmware */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + if (g_strcmp0 (sysfs_path, req->sysfs_path) == 0) { + g_debug ("ignoring previous sysfs request for %s", + sysfs_path); + goto out; + } + if (g_strcmp0 (filename_path, req->filename) == 0) { + g_debug ("ignoring previous filename request for %s", + filename_path); + goto out; + } + } + + /* create new request object */ + req = request_new (filename_path, sysfs_path); + g_ptr_array_add (firmware->priv->array_requested, req); +out: + g_free (missing_path); + g_free (filename_path); + g_free (sysfs_path); +} + +static void +scan_directory (GsdUpdatesFirmware *firmware) +{ + gboolean ret; + GError *error = NULL; + GDir *dir; + const gchar *filename; + gchar *filename_decoded; + guint i; + GPtrArray *array; + const GsdUpdatesFirmwareRequest *req; + guint scan_id = 0; + + /* should we check and show the user */ + ret = g_settings_get_boolean (firmware->priv->settings, + GSD_SETTINGS_ENABLE_CHECK_FIRMWARE); + if (!ret) { + g_debug ("not showing thanks to GSettings"); + return; + } + + /* open the directory of requests */ + dir = g_dir_open (GSD_UPDATES_FIRMWARE_MISSING_DIR, 0, &error); + if (dir == NULL) { + if (error->code != G_FILE_ERROR_NOENT) { + g_warning ("failed to open directory: %s", + error->message); + } + g_error_free (error); + return; + } + + /* find all the firmware requests */ + filename = g_dir_read_name (dir); + while (filename != NULL) { + + filename_decoded = udev_text_decode (filename); + add_filename (firmware, filename_decoded); + g_free (filename_decoded); + + /* next file */ + filename = g_dir_read_name (dir); + } + g_dir_close (dir); + + /* debugging */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + g_debug ("requested: %s", req->filename); + } + + /* remove banned files */ + remove_banned (firmware, array); + + /* remove ignored devices */ + remove_ignored (firmware, array); + + /* debugging */ + array = firmware->priv->array_requested; + for (i=0; ilen; i++) { + req = g_ptr_array_index (array, i); + g_debug ("searching for: %s", req->filename); + } + + /* don't spam the user at startup, so wait a little delay */ + if (array->len > 0) { + scan_id = g_timeout_add_seconds (GSD_UPDATES_FIRMWARE_PROCESS_DELAY, + delay_timeout_cb, + firmware); + g_source_set_name_by_id (scan_id, "[GsdUpdatesFirmware] process"); + } +} + +static gboolean +scan_directory_cb (GsdUpdatesFirmware *firmware) +{ + scan_directory (firmware); + firmware->priv->timeout_id = 0; + return FALSE; +} + +static void +monitor_changed_cb (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + GsdUpdatesFirmware *firmware) +{ + if (firmware->priv->timeout_id > 0) { + g_debug ("clearing timeout as device changed"); + g_source_remove (firmware->priv->timeout_id); + } + + /* wait for the device to settle */ + firmware->priv->timeout_id = + g_timeout_add_seconds (GSD_UPDATES_FIRMWARE_INSERT_DELAY, + (GSourceFunc) scan_directory_cb, + firmware); + g_source_set_name_by_id (firmware->priv->timeout_id, + "[GsdUpdatesFirmware] changed"); +} + +static void +gsd_updates_firmware_class_init (GsdUpdatesFirmwareClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gsd_updates_firmware_finalize; + g_type_class_add_private (klass, sizeof (GsdUpdatesFirmwarePrivate)); +} + +static void +gsd_updates_firmware_init (GsdUpdatesFirmware *firmware) +{ + GFile *file; + GError *error = NULL; + + firmware->priv = GSD_UPDATES_FIRMWARE_GET_PRIVATE (firmware); + firmware->priv->timeout_id = 0; + firmware->priv->packages_found = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); + firmware->priv->array_requested = g_ptr_array_new_with_free_func ((GDestroyNotify) request_free); + firmware->priv->settings = g_settings_new (GSD_SETTINGS_SCHEMA); + firmware->priv->task = pk_task_new (); + g_object_set (firmware->priv->task, + "background", TRUE, + NULL); + + /* setup watch for new hardware */ + file = g_file_new_for_path (GSD_UPDATES_FIRMWARE_MISSING_DIR); + firmware->priv->monitor = g_file_monitor (file, + G_FILE_MONITOR_NONE, + NULL, + &error); + if (firmware->priv->monitor == NULL) { + g_warning ("failed to setup monitor: %s", error->message); + g_error_free (error); + goto out; + } + + /* limit to one per second */ + g_file_monitor_set_rate_limit (firmware->priv->monitor, 1000); + + /* get notified of changes */ + g_signal_connect (firmware->priv->monitor, "changed", + G_CALLBACK (monitor_changed_cb), firmware); +out: + g_object_unref (file); + firmware->priv->timeout_id = + g_timeout_add_seconds (GSD_UPDATES_FIRMWARE_LOGIN_DELAY, + (GSourceFunc) scan_directory_cb, + firmware); + g_source_set_name_by_id (firmware->priv->timeout_id, + "[GsdUpdatesFirmware] login coldplug"); +} + +static void +gsd_updates_firmware_finalize (GObject *object) +{ + GsdUpdatesFirmware *firmware; + + g_return_if_fail (GSD_UPDATES_IS_FIRMWARE (object)); + + firmware = GSD_UPDATES_FIRMWARE (object); + + g_return_if_fail (firmware->priv != NULL); + g_ptr_array_unref (firmware->priv->array_requested); + g_ptr_array_unref (firmware->priv->packages_found); + g_object_unref (PK_CLIENT(firmware->priv->task)); + g_object_unref (firmware->priv->settings); + if (firmware->priv->monitor != NULL) + g_object_unref (firmware->priv->monitor); + if (firmware->priv->timeout_id > 0) + g_source_remove (firmware->priv->timeout_id); + + G_OBJECT_CLASS (gsd_updates_firmware_parent_class)->finalize (object); +} + +GsdUpdatesFirmware * +gsd_updates_firmware_new (void) +{ + GsdUpdatesFirmware *firmware; + firmware = g_object_new (GSD_UPDATES_TYPE_FIRMWARE, NULL); + return GSD_UPDATES_FIRMWARE (firmware); +} diff --git a/plugins/updates/gsd-updates-firmware.h b/plugins/updates/gsd-updates-firmware.h new file mode 100644 index 00000000..07092f43 --- /dev/null +++ b/plugins/updates/gsd-updates-firmware.h @@ -0,0 +1,52 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GSD_UPDATES_FIRMWARE_H +#define __GSD_UPDATES_FIRMWARE_H + +#include + +G_BEGIN_DECLS + +#define GSD_UPDATES_TYPE_FIRMWARE (gsd_updates_firmware_get_type ()) +#define GSD_UPDATES_FIRMWARE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_UPDATES_TYPE_FIRMWARE, GsdUpdatesFirmware)) +#define GSD_UPDATES_FIRMWARE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_UPDATES_TYPE_FIRMWARE, GsdUpdatesFirmwareClass)) +#define GSD_UPDATES_IS_FIRMWARE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_UPDATES_TYPE_FIRMWARE)) + +typedef struct GsdUpdatesFirmwarePrivate GsdUpdatesFirmwarePrivate; + +typedef struct +{ + GObject parent; + GsdUpdatesFirmwarePrivate *priv; +} GsdUpdatesFirmware; + +typedef struct +{ + GObjectClass parent_class; +} GsdUpdatesFirmwareClass; + +GType gsd_updates_firmware_get_type (void); +GsdUpdatesFirmware *gsd_updates_firmware_new (void); + +G_END_DECLS + +#endif /* __GSD_UPDATES_FIRMWARE_H */ diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c new file mode 100644 index 00000000..9fc4cd3f --- /dev/null +++ b/plugins/updates/gsd-updates-manager.c @@ -0,0 +1,1556 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Richard Hughes + * + * 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 + +#include +#include +#include +#include +#include +#include + +#include "gsd-enums.h" +#include "gsd-updates-manager.h" +#include "gsd-updates-firmware.h" +#include "gsd-updates-refresh.h" +#include "gsd-updates-common.h" +#include "gnome-settings-profile.h" + +#define GSD_UPDATES_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerPrivate)) + +#define MAX_FAILED_GET_UPDATES 10 /* the maximum number of tries */ +#define GSD_UPDATES_ICON_NORMAL "software-update-available-symbolic" +#define GSD_UPDATES_ICON_URGENT "software-update-urgent-symbolic" + +struct GsdUpdatesManagerPrivate +{ + GCancellable *cancellable; + GsdUpdatesRefresh *refresh; + GsdUpdatesFirmware *firmware; + GSettings *settings_proxy; + GSettings *settings_ftp; + GSettings *settings_gsd; + GSettings *settings_http; + guint number_updates_critical_last_shown; + guint offline_update_id; + PkError *offline_update_error; + NotifyNotification *notification_updates; + PkControl *control; + PkTask *task; + guint inhibit_cookie; + GDBusProxy *proxy_session; + guint update_viewer_watcher_id; + GVolumeMonitor *volume_monitor; + guint failed_get_updates_count; + gboolean pending_updates; + GDBusConnection *connection; + guint owner_id; + GDBusNodeInfo *introspection; + GPtrArray *update_packages; +}; + +static void gsd_updates_manager_class_init (GsdUpdatesManagerClass *klass); +static void gsd_updates_manager_init (GsdUpdatesManager *updates_manager); +static void gsd_updates_manager_finalize (GObject *object); +static void emit_changed (GsdUpdatesManager *manager); + +G_DEFINE_TYPE (GsdUpdatesManager, gsd_updates_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +child_exit_cb (GPid pid, gint status, gpointer user_data) +{ + g_spawn_close_pid (pid); +} + +static void +clear_offline_updates_message (void) +{ + gboolean ret; + GError *error = NULL; + gchar *argv[3]; + GPid pid; + + argv[0] = BINDIR "/pkexec"; + argv[1] = LIBEXECDIR "/pk-clear-offline-update"; + argv[2] = NULL; + ret = g_spawn_async (NULL, + argv, + NULL, + G_SPAWN_DO_NOT_REAP_CHILD, + NULL, + NULL, + &pid, + &error); + if (!ret) { + g_warning ("Failure clearing offline update message: %s", + error->message); + g_error_free (error); + return; + } + g_child_watch_add (pid, child_exit_cb, NULL); +} + +static void +show_offline_updates_error (GsdUpdatesManager *manager) +{ + const gchar *title; + gboolean show_geeky = FALSE; + GString *msg; + GtkWidget *dialog; + + /* TRANSLATORS: this is when the offline update failed */ + title = _("Failed To Update"); + msg = g_string_new (""); + switch (pk_error_get_code (manager->priv->offline_update_error)) { + case PK_ERROR_ENUM_UNFINISHED_TRANSACTION: + /* TRANSLATORS: the transaction could not be completed + * as a previous transaction was unfinished */ + g_string_append (msg, _("A previous update was unfinished.")); + show_geeky = TRUE; + break; + case PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED: + case PK_ERROR_ENUM_NO_CACHE: + case PK_ERROR_ENUM_NO_NETWORK: + case PK_ERROR_ENUM_NO_MORE_MIRRORS_TO_TRY: + case PK_ERROR_ENUM_CANNOT_FETCH_SOURCES: + /* TRANSLATORS: the package manager needed to download + * something with no network available */ + g_string_append (msg, _("Network access was required but not available.")); + break; + case PK_ERROR_ENUM_BAD_GPG_SIGNATURE: + case PK_ERROR_ENUM_CANNOT_UPDATE_REPO_UNSIGNED: + case PK_ERROR_ENUM_GPG_FAILURE: + case PK_ERROR_ENUM_MISSING_GPG_SIGNATURE: + case PK_ERROR_ENUM_PACKAGE_CORRUPT: + /* TRANSLATORS: if the package is not signed correctly + * */ + g_string_append (msg, _("An update was not signed in the correct way.")); + show_geeky = TRUE; + break; + case PK_ERROR_ENUM_DEP_RESOLUTION_FAILED: + case PK_ERROR_ENUM_FILE_CONFLICTS: + case PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE: + case PK_ERROR_ENUM_PACKAGE_CONFLICTS: + /* TRANSLATORS: the transaction failed in a way the user + * probably cannot comprehend. Package management systems + * really are teh suck.*/ + g_string_append (msg, _("The update could not be completed.")); + show_geeky = TRUE; + break; + case PK_ERROR_ENUM_TRANSACTION_CANCELLED: + /* TRANSLATORS: the user aborted the update manually */ + g_string_append (msg, _("The update was cancelled.")); + break; + case PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE: + case PK_ERROR_ENUM_UPDATE_NOT_FOUND: + /* TRANSLATORS: the user must have updated manually after + * the updates were prepared */ + g_string_append (msg, _("An offline update was requested but no packages required updating.")); + break; + case PK_ERROR_ENUM_NO_SPACE_ON_DEVICE: + /* TRANSLATORS: we ran out of disk space */ + g_string_append (msg, _("No space was left on the drive.")); + break; + case PK_ERROR_ENUM_PACKAGE_FAILED_TO_BUILD: + case PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL: + case PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE: + /* TRANSLATORS: the update process failed in a general + * way, usually this message will come from source distros + * like gentoo */ + g_string_append (msg, _("An update failed to install correctly.")); + show_geeky = TRUE; + break; + default: + /* TRANSLATORS: We didn't handle the error type */ + g_string_append (msg, _("The offline update failed in an unexpected way.")); + show_geeky = TRUE; + break; + } + if (show_geeky) { + g_string_append_printf (msg, "\n%s\n\n%s", + /* TRANSLATORS: these are geeky messages from the + * package manager no mortal is supposed to understand, + * but google might know what they mean */ + _("Detailed errors from the package manager follow:"), + pk_error_get_details (manager->priv->offline_update_error)); + } + dialog = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", title); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + "%s", msg->str); + g_signal_connect_swapped (dialog, "response", + G_CALLBACK (gtk_widget_destroy), + dialog); + gtk_widget_show (dialog); + clear_offline_updates_message (); + g_string_free (msg, TRUE); +} + +static void +libnotify_action_cb (NotifyNotification *notification, + gchar *action, + gpointer user_data) +{ + gboolean ret; + GError *error = NULL; + GsdUpdatesManager *manager = GSD_UPDATES_MANAGER (user_data); + + notify_notification_close (notification, NULL); + if (g_strcmp0 (action, "distro-upgrade-info") == 0) { + ret = g_spawn_command_line_async (DATADIR "/PackageKit/pk-upgrade-distro.sh", + &error); + if (!ret) { + g_warning ("Failure launching pk-upgrade-distro.sh: %s", + error->message); + g_error_free (error); + } + goto out; + } + if (g_strcmp0 (action, "show-update-viewer") == 0) { + ret = g_spawn_command_line_async (BINDIR "/gpk-update-viewer", + &error); + if (!ret) { + g_warning ("Failure launching update viewer: %s", + error->message); + g_error_free (error); + } + goto out; + } + if (g_strcmp0 (action, "clear-offline-updates") == 0) { + clear_offline_updates_message (); + goto out; + } + if (g_strcmp0 (action, "error-offline-updates") == 0) { + show_offline_updates_error (manager); + goto out; + } + if (g_strcmp0 (action, "cancel") == 0) { + /* try to cancel */ + g_cancellable_cancel (manager->priv->cancellable); + goto out; + } + g_warning ("unknown action id: %s", action); +out: + return; +} + +static void +on_notification_closed (NotifyNotification *notification, gpointer data) +{ + g_object_unref (notification); +} + +static void +get_distro_upgrades_finished_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesManager *manager) +{ + const gchar *title; + gboolean ret; + gchar *name = NULL; + GError *error = NULL; + GPtrArray *array = NULL; + GString *string = NULL; + guint i; + NotifyNotification *notification; + PkClient *client = PK_CLIENT(object); + PkDistroUpgrade *item; + PkError *error_code = NULL; + PkResults *results; + PkUpdateStateEnum state; + + /* get the results */ + results = pk_client_generic_finish (PK_CLIENT(client), res, &error); + if (results == NULL) { + if (error->domain != PK_CLIENT_ERROR || + error->code != PK_CLIENT_ERROR_NOT_SUPPORTED) { + g_warning ("failed to get upgrades: %s", + error->message); + } + g_error_free (error); + goto out; + } + + /* check error code */ + error_code = pk_results_get_error_code (results); + if (error_code != NULL) { + g_warning ("failed to get upgrades: %s, %s", + pk_error_enum_to_string (pk_error_get_code (error_code)), + pk_error_get_details (error_code)); + goto out; + } + + /* process results */ + array = pk_results_get_distro_upgrade_array (results); + + /* any updates? */ + if (array->len == 0) { + g_debug ("no upgrades"); + goto out; + } + + /* do we do the notification? */ + ret = g_settings_get_boolean (manager->priv->settings_gsd, + GSD_SETTINGS_NOTIFY_DISTRO_UPGRADES); + if (!ret) { + g_debug ("ignoring due to GSettings"); + goto out; + } + + /* find the upgrade string */ + string = g_string_new (""); + for (i=0; i < array->len; i++) { + item = (PkDistroUpgrade *) g_ptr_array_index (array, i); + g_object_get (item, + "name", &name, + "state", &state, + NULL); + g_string_append_printf (string, "%s (%s)\n", + name, + pk_distro_upgrade_enum_to_string (state)); + g_free (name); + } + if (string->len != 0) + g_string_set_size (string, string->len-1); + + /* TRANSLATORS: a distro update is available, e.g. Fedora 8 to Fedora 9 */ + title = _("Distribution upgrades available"); + notification = notify_notification_new (title, + string->str, + GSD_UPDATES_ICON_NORMAL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); + notify_notification_add_action (notification, "distro-upgrade-info", + /* TRANSLATORS: provides more information about the upgrade */ + _("More information"), + libnotify_action_cb, + manager, NULL); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } +out: + if (error_code != NULL) + g_object_unref (error_code); + if (array != NULL) + g_ptr_array_unref (array); + if (string != NULL) + g_string_free (string, TRUE); + if (results != NULL) + g_object_unref (results); +} + +static void +due_get_upgrades_cb (GsdUpdatesRefresh *refresh, GsdUpdatesManager *manager) +{ + /* optimize the amount of downloaded data by setting the cache age */ + pk_client_set_cache_age (PK_CLIENT(manager->priv->task), + g_settings_get_int (manager->priv->settings_gsd, + GSD_SETTINGS_FREQUENCY_GET_UPGRADES)); + + /* get new distro upgrades list */ + pk_client_get_distro_upgrades_async (PK_CLIENT(manager->priv->task), + NULL, + NULL, NULL, + (GAsyncReadyCallback) get_distro_upgrades_finished_cb, + manager); +} + +static void +refresh_cache_finished_cb (GObject *object, GAsyncResult *res, GsdUpdatesManager *manager) +{ + PkClient *client = PK_CLIENT(object); + PkResults *results; + GError *error = NULL; + PkError *error_code = NULL; + + /* get the results */ + results = pk_client_generic_finish (PK_CLIENT(client), res, &error); + if (results == NULL) { + g_warning ("failed to refresh the cache: %s", + error->message); + g_error_free (error); + goto out; + } + + /* check error code */ + error_code = pk_results_get_error_code (results); + if (error_code != NULL) { + g_warning ("failed to refresh the cache: %s, %s", + pk_error_enum_to_string (pk_error_get_code (error_code)), + pk_error_get_details (error_code)); + goto out; + } +out: + if (error_code != NULL) + g_object_unref (error_code); + if (results != NULL) + g_object_unref (results); +} + +static void +due_refresh_cache_cb (GsdUpdatesRefresh *refresh, GsdUpdatesManager *manager) +{ + /* optimize the amount of downloaded data by setting the cache age */ + pk_client_set_cache_age (PK_CLIENT(manager->priv->task), + g_settings_get_int (manager->priv->settings_gsd, + GSD_SETTINGS_FREQUENCY_REFRESH_CACHE)); + + pk_client_refresh_cache_async (PK_CLIENT(manager->priv->task), + TRUE, + NULL, + NULL, NULL, + (GAsyncReadyCallback) refresh_cache_finished_cb, + manager); +} + +static void +notify_critical_updates (GsdUpdatesManager *manager, GPtrArray *array) +{ + const gchar *message; + const gchar *title; + gboolean ret; + GError *error = NULL; + NotifyNotification *notification; + + /* if the number of critical updates is the same as the last notification, + * then skip the notifcation as we don't want to bombard the user every hour */ + if (array->len == manager->priv->number_updates_critical_last_shown) { + g_debug ("ignoring as user ignored last warning"); + return; + } + + /* save for comparison later */ + manager->priv->number_updates_critical_last_shown = array->len; + + /* TRANSLATORS: title in the libnotify popup */ + title = ngettext ("Update", "Updates", array->len); + + /* TRANSLATORS: message when there are security updates */ + message = ngettext ("An important software update is available", + "Important software updates are available", array->len); + + /* close any existing notification */ + if (manager->priv->notification_updates != NULL) { + notify_notification_close (manager->priv->notification_updates, NULL); + manager->priv->notification_updates = NULL; + } + + /* do the bubble */ + g_debug ("title=%s, message=%s", title, message); + notification = notify_notification_new (title, + message, + GSD_UPDATES_ICON_URGENT); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, 15000); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL); + notify_notification_add_action (notification, "show-update-viewer", + /* TRANSLATORS: button: open the update viewer to install updates*/ + _("Install updates"), libnotify_action_cb, manager, NULL); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } + /* track so we can prevent doubled notifications */ + manager->priv->notification_updates = notification; +} + +static void +notify_normal_updates_maybe (GsdUpdatesManager *manager, GPtrArray *array) +{ + const gchar *message; + const gchar *title; + gboolean ret; + GError *error = NULL; + guint64 time_last_notify; + guint64 time_now; + guint freq_updates_notify; + NotifyNotification *notification; + + /* find out if enough time has passed since the last notification */ + time_now = g_get_real_time () / 1000000; + freq_updates_notify = g_settings_get_int (manager->priv->settings_gsd, + GSD_SETTINGS_FREQUENCY_UPDATES_NOTIFICATION); + g_settings_get (manager->priv->settings_gsd, + GSD_SETTINGS_LAST_UPDATES_NOTIFICATION, + "t", &time_last_notify); + if (time_last_notify > 0 && + (guint64) freq_updates_notify > time_now - time_last_notify) { + g_debug ("not showing non-critical notification as already shown %i hours ago", + (guint) (time_now - time_last_notify) / (60 * 60)); + return; + } + + /* TRANSLATORS: title in the libnotify popup */ + title = ngettext ("Update", "Updates", array->len); + + /* TRANSLATORS: message when there are non-security updates */ + message = ngettext ("A software update is available.", + "Software updates are available.", array->len); + + /* close any existing notification */ + if (manager->priv->notification_updates != NULL) { + notify_notification_close (manager->priv->notification_updates, NULL); + manager->priv->notification_updates = NULL; + } + + /* do the bubble */ + g_debug ("title=%s, message=%s", title, message); + notification = notify_notification_new (title, + message, + GSD_UPDATES_ICON_NORMAL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, 15000); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); + notify_notification_add_action (notification, "show-update-viewer", + /* TRANSLATORS: button: open the update viewer to install updates*/ + _("Install updates"), libnotify_action_cb, manager, NULL); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } + + /* reset notification time */ + g_settings_set (manager->priv->settings_gsd, + GSD_SETTINGS_LAST_UPDATES_NOTIFICATION, + "t", time_now); + + /* track so we can prevent doubled notifications */ + manager->priv->notification_updates = notification; +} + +static void +notify_failed_get_updates_maybe (GsdUpdatesManager *manager) +{ + const gchar *button; + const gchar *message; + const gchar *title; + gboolean ret; + GError *error = NULL; + NotifyNotification *notification; + + /* give the user a break */ + if (manager->priv->failed_get_updates_count++ < MAX_FAILED_GET_UPDATES) { + g_debug ("failed GetUpdates, but will retry %i more times before notification", + MAX_FAILED_GET_UPDATES - manager->priv->failed_get_updates_count); + goto out; + } + + /* TRANSLATORS: the updates mechanism */ + title = _("Updates"); + + /* TRANSLATORS: we failed to get the updates multiple times, + * and now we need to inform the user that something might be wrong */ + message = _("Unable to access software updates"); + + /* TRANSLATORS: try again, this time launching the update viewer */ + button = _("Try again"); + + notification = notify_notification_new (title, + message, + GSD_UPDATES_ICON_NORMAL); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, 120*1000); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); + notify_notification_add_action (notification, "show-update-viewer", + button, + libnotify_action_cb, + manager, NULL); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("failed to show notification: %s", + error->message); + g_error_free (error); + } +out: + /* reset, even if the message failed */ + manager->priv->failed_get_updates_count = 0; +} + +static void +check_updates_for_importance (GsdUpdatesManager *manager) +{ + guint i; + PkPackage *pkg; + GPtrArray *important_array; + + /* check each package */ + important_array = g_ptr_array_new (); + for (i = 0; i < manager->priv->update_packages->len; i++) { + pkg = g_ptr_array_index (manager->priv->update_packages, i); + if (pk_package_get_info (pkg) == PK_INFO_ENUM_SECURITY || + pk_package_get_info (pkg) == PK_INFO_ENUM_IMPORTANT) + g_ptr_array_add (important_array, pkg); + } + if (important_array->len > 0) { + notify_critical_updates (manager, + important_array); + } else { + notify_normal_updates_maybe (manager, + manager->priv->update_packages); + } + g_ptr_array_unref (important_array); +} + +static void +package_download_finished_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesManager *manager) +{ + PkClient *client = PK_CLIENT(object); + PkResults *results; + GError *error = NULL; + PkError *error_code = NULL; + + /* get the results */ + results = pk_client_generic_finish (PK_CLIENT(client), res, &error); + if (results == NULL) { + g_warning ("failed to download: %s", + error->message); + g_error_free (error); + notify_failed_get_updates_maybe (manager); + goto out; + } + + /* check error code */ + error_code = pk_results_get_error_code (results); + if (error_code != NULL) { + g_warning ("failed to download: %s, %s", + pk_error_enum_to_string (pk_error_get_code (error_code)), + pk_error_get_details (error_code)); + switch (pk_error_get_code (error_code)) { + case PK_ERROR_ENUM_CANCELLED_PRIORITY: + case PK_ERROR_ENUM_TRANSACTION_CANCELLED: + g_debug ("ignoring error"); + break; + default: + notify_failed_get_updates_maybe (manager); + break; + } + goto out; + } + + /* check to see if should notify */ + check_updates_for_importance (manager); + + /* we succeeded, so allow the shell to query us */ + manager->priv->pending_updates = TRUE; + emit_changed (manager); +out: + if (error_code != NULL) + g_object_unref (error_code); + if (results != NULL) + g_object_unref (results); +} + +static void +auto_download_updates (GsdUpdatesManager *manager) +{ + gchar **package_ids; + guint i; + PkPackage *pkg; + + /* download each package */ + package_ids = g_new0 (gchar *, manager->priv->update_packages->len + 1); + for (i = 0; i < manager->priv->update_packages->len; i++) { + pkg = g_ptr_array_index (manager->priv->update_packages, i); + package_ids[i] = g_strdup (pk_package_get_id (pkg)); + } + +#if PK_CHECK_VERSION(0,8,1) + /* we've set only-download in PkTask */ + pk_task_update_packages_async (manager->priv->task, + package_ids, + manager->priv->cancellable, + NULL, NULL, + (GAsyncReadyCallback) package_download_finished_cb, + manager); +#else + /* download them all */ + pk_client_download_packages_async (PK_CLIENT(manager->priv->task), + package_ids, + NULL, /* this means system cache */ + manager->priv->cancellable, + NULL, NULL, + (GAsyncReadyCallback) package_download_finished_cb, + manager); +#endif + g_strfreev (package_ids); +} + +static void +get_updates_finished_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesManager *manager) +{ + PkClient *client = PK_CLIENT(object); + PkResults *results; + GError *error = NULL; + gboolean ret; + PkError *error_code = NULL; + + /* get the results */ + results = pk_client_generic_finish (PK_CLIENT(client), res, &error); + if (results == NULL) { + g_warning ("failed to get updates: %s", + error->message); + g_error_free (error); + notify_failed_get_updates_maybe (manager); + goto out; + } + + /* check error code */ + error_code = pk_results_get_error_code (results); + if (error_code != NULL) { + g_warning ("failed to get updates: %s, %s", + pk_error_enum_to_string (pk_error_get_code (error_code)), + pk_error_get_details (error_code)); + switch (pk_error_get_code (error_code)) { + case PK_ERROR_ENUM_CANCELLED_PRIORITY: + case PK_ERROR_ENUM_TRANSACTION_CANCELLED: + g_debug ("ignoring error"); + break; + default: + notify_failed_get_updates_maybe (manager); + break; + } + goto out; + } + + /* we succeeded, so clear the count */ + manager->priv->failed_get_updates_count = 0; + + /* so we can download or check for important & security updates */ + if (manager->priv->update_packages != NULL) + g_ptr_array_unref (manager->priv->update_packages); + manager->priv->update_packages = pk_results_get_package_array (results); + + /* we have no updates */ + if (manager->priv->update_packages->len == 0) { + g_debug ("no updates"); + goto out; + } + + /* should we auto-download the updates? */ + ret = g_settings_get_boolean (manager->priv->settings_gsd, + GSD_SETTINGS_AUTO_DOWNLOAD_UPDATES); + if (ret) { + auto_download_updates (manager); + goto out; + } + + /* just check to see if should notify */ + check_updates_for_importance (manager); +out: + if (error_code != NULL) + g_object_unref (error_code); + if (results != NULL) + g_object_unref (results); +} + +static void +query_updates (GsdUpdatesManager *manager) +{ + /* optimize the amount of downloaded data by setting the cache age */ + pk_client_set_cache_age (PK_CLIENT(manager->priv->task), + g_settings_get_int (manager->priv->settings_gsd, + GSD_SETTINGS_FREQUENCY_GET_UPDATES)); + + /* get new update list */ + pk_client_get_updates_async (PK_CLIENT(manager->priv->task), + pk_bitfield_value (PK_FILTER_ENUM_NONE), + manager->priv->cancellable, + NULL, NULL, + (GAsyncReadyCallback) get_updates_finished_cb, + manager); +} + +static void +due_get_updates_cb (GsdUpdatesRefresh *refresh, GsdUpdatesManager *manager) +{ + query_updates (manager); +} + +static gchar * +get_proxy_http (GsdUpdatesManager *manager) +{ + gboolean ret; + gchar *host = NULL; + gchar *password = NULL; + gchar *proxy = NULL; + gchar *username = NULL; + GString *string = NULL; + guint port; + GDesktopProxyMode proxy_mode; + + proxy_mode = g_settings_get_enum (manager->priv->settings_proxy, "mode"); + if (proxy_mode != G_DESKTOP_PROXY_MODE_MANUAL) + goto out; + + host = g_settings_get_string (manager->priv->settings_http, + "host"); + if (host == NULL) + goto out; + port = g_settings_get_int (manager->priv->settings_http, + "port"); + + /* use an HTTP auth string? */ + ret = g_settings_get_boolean (manager->priv->settings_http, + "use-authentication"); + if (ret) { + username = g_settings_get_string (manager->priv->settings_http, + "authentication-user"); + password = g_settings_get_string (manager->priv->settings_http, + "authentication-password"); + } + + /* make PackageKit proxy string */ + string = g_string_new (host); + if (port > 0) + g_string_append_printf (string, ":%i", port); + if (username != NULL && password != NULL) + g_string_append_printf (string, "@%s:%s", username, password); + else if (username != NULL) + g_string_append_printf (string, "@%s", username); + else if (password != NULL) + g_string_append_printf (string, "@:%s", password); + proxy = g_string_free (string, FALSE); +out: + g_free (host); + g_free (username); + g_free (password); + return proxy; +} + +static gchar * +get_proxy_ftp (GsdUpdatesManager *manager) +{ + gchar *host = NULL; + gchar *proxy = NULL; + GString *string = NULL; + guint port; + GDesktopProxyMode proxy_mode; + + proxy_mode = g_settings_get_enum (manager->priv->settings_proxy, "mode"); + if (proxy_mode != G_DESKTOP_PROXY_MODE_MANUAL) + goto out; + + host = g_settings_get_string (manager->priv->settings_ftp, + "host"); + if (host == NULL) + goto out; + port = g_settings_get_int (manager->priv->settings_ftp, + "port"); + if (port == 0) + goto out; + + /* make PackageKit proxy string */ + string = g_string_new (host); + if (port > 0) + g_string_append_printf (string, ":%i", port); + proxy = g_string_free (string, FALSE); +out: + g_free (host); + return proxy; +} + + +static void +set_proxy_cb (GObject *object, GAsyncResult *res, gpointer user_data) +{ + gboolean ret; + GError *error = NULL; + PkControl *control = PK_CONTROL (object); + + /* get the result */ + ret = pk_control_set_proxy_finish (control, res, &error); + if (!ret) { + g_warning ("failed to set proxies: %s", error->message); + g_error_free (error); + } +} + +static void +reload_proxy_settings (GsdUpdatesManager *manager) +{ + gchar *proxy_http; + gchar *proxy_ftp; + + proxy_http = get_proxy_http (manager); + proxy_ftp = get_proxy_ftp (manager); + + /* send to daemon */ + pk_control_set_proxy_async (manager->priv->control, + proxy_http, + proxy_ftp, + NULL, + set_proxy_cb, + manager); + + g_free (proxy_http); + g_free (proxy_ftp); +} + +static void +settings_changed_cb (GSettings *settings, + const char *key, + GsdUpdatesManager *manager) +{ + reload_proxy_settings (manager); +} + +static void +settings_gsd_changed_cb (GSettings *settings, + const char *key, + GsdUpdatesManager *manager) +{ +} + +static void +session_inhibit (GsdUpdatesManager *manager) +{ + const gchar *reason; + GError *error = NULL; + GVariant *retval = NULL; + + /* state invalid somehow */ + if (manager->priv->inhibit_cookie != 0) { + g_warning ("already locked"); + goto out; + } + + /* TRANSLATORS: the reason why we've inhibited it */ + reason = _("A transaction that cannot be interrupted is running"); + retval = g_dbus_proxy_call_sync (manager->priv->proxy_session, + "Inhibit", + g_variant_new ("(susu)", + "gnome-settings-daemon", /* app-id */ + 0, /* xid */ + reason, /* reason */ + 4 /* flags */), + G_DBUS_CALL_FLAGS_NONE, + -1, + manager->priv->cancellable, + &error); + if (retval == NULL) { + g_warning ("failed to inhibit gnome-session: %s", + error->message); + g_error_free (error); + goto out; + } + + /* get cookie */ + g_variant_get (retval, "(u)", + &manager->priv->inhibit_cookie); +out: + if (retval != NULL) + g_variant_unref (retval); +} + +static void +session_uninhibit (GsdUpdatesManager *manager) +{ + GError *error = NULL; + GVariant *retval = NULL; + + /* state invalid somehow */ + if (manager->priv->inhibit_cookie == 0) { + g_warning ("not locked"); + goto out; + } + retval = g_dbus_proxy_call_sync (manager->priv->proxy_session, + "Uninhibit", + g_variant_new ("(u)", + manager->priv->inhibit_cookie), + G_DBUS_CALL_FLAGS_NONE, + -1, + manager->priv->cancellable, + &error); + if (retval == NULL) { + g_warning ("failed to uninhibit gnome-session: %s", + error->message); + g_error_free (error); + goto out; + } +out: + manager->priv->inhibit_cookie = 0; + if (retval != NULL) + g_variant_unref (retval); +} + +static void +notify_locked_cb (PkControl *control, + GParamSpec *pspec, + GsdUpdatesManager *manager) +{ + gboolean locked; + + g_object_get (control, "locked", &locked, NULL); + + /* TODO: locked is a bit harsh, we can probably still allow + * reboot when packages are downloading or the transaction is + * depsolving */ + if (locked) { + session_inhibit (manager); + } else { + session_uninhibit (manager); + } +} + +static void +update_viewer_appeared_cb (GDBusConnection *connection, + const gchar *name, + const gchar *name_owner, + gpointer user_data) +{ + GsdUpdatesManager *manager = GSD_UPDATES_MANAGER (user_data); + + /* close any existing notification */ + if (manager->priv->notification_updates != NULL) { + g_debug ("update viewer on the bus, clearing bubble"); + notify_notification_close (manager->priv->notification_updates, NULL); + manager->priv->notification_updates = NULL; + } +} + +static gboolean +file_exists_in_root (const gchar *root, const gchar *filename) +{ + gboolean ret = FALSE; + GFile *source; + gchar *source_path; + + source_path = g_build_filename (root, filename, NULL); + source = g_file_new_for_path (source_path); + + /* ignore virtual mountpoints */ + if (!g_file_is_native (source)) + goto out; + + /* an interesting file exists */ + ret = g_file_query_exists (source, NULL); + g_debug ("checking for %s: %s", source_path, ret ? "yes" : "no"); + if (!ret) + goto out; +out: + g_free (source_path); + g_object_unref (source); + return ret; +} + +static void +mount_added_cb (GVolumeMonitor *volume_monitor, + GMount *mount, + GsdUpdatesManager *manager) +{ + gboolean ret = FALSE; + gchar **filenames = NULL; + gchar *media_repo_filenames; + gchar *root_path; + GFile *root; + guint i; + + /* check if any installed media is an install disk */ + root = g_mount_get_root (mount); + root_path = g_file_get_path (root); + + /* use settings */ + media_repo_filenames = g_settings_get_string (manager->priv->settings_gsd, + GSD_SETTINGS_MEDIA_REPO_FILENAMES); + if (media_repo_filenames == NULL) { + g_warning ("failed to get media repo filenames"); + goto out; + } + + /* search each possible filename */ + filenames = g_strsplit (media_repo_filenames, ",", -1); + for (i=0; filenames[i] != NULL; i++) { + ret = file_exists_in_root (root_path, filenames[i]); + if (ret) + break; + } + + /* do an updates check with the new media */ + if (ret) + query_updates (manager); +out: + g_strfreev (filenames); + g_free (media_repo_filenames); + g_free (root_path); + g_object_unref (root); +} + +static GVariant * +handle_get_property (GDBusConnection *connection_, const gchar *sender, + const gchar *object_path, const gchar *interface_name, + const gchar *property_name, GError **error, + gpointer user_data) +{ + GVariant *retval = NULL; + GsdUpdatesManager *manager = GSD_UPDATES_MANAGER(user_data); + + if (g_strcmp0 (property_name, "PendingUpdates") == 0) { + retval = g_variant_new_boolean (manager->priv->pending_updates); + } + + return retval; +} + +static void +emit_changed (GsdUpdatesManager *manager) +{ + gboolean ret; + GError *error = NULL; + + /* check we are connected */ + if (manager->priv->connection == NULL) + return; + + /* just emit signal */ + ret = g_dbus_connection_emit_signal (manager->priv->connection, + NULL, + "/", + "org.gnome.SettingsDaemonUpdates", + "Changed", + NULL, + &error); + if (!ret) { + g_warning ("failed to emit signal: %s", error->message); + g_error_free (error); + } +} + +static const GDBusInterfaceVTable interface_vtable = +{ + NULL, /* MethodCall */ + handle_get_property, /* GetProperty */ + NULL, /* SetProperty */ +}; + +static void +on_bus_gotten (GObject *source_object, + GAsyncResult *res, + GsdUpdatesManager *manager) +{ + GDBusConnection *connection; + GError *error = NULL; + + connection = g_bus_get_finish (res, &error); + if (connection == NULL) { + g_warning ("Could not get session bus: %s", + error->message); + g_error_free (error); + return; + } + manager->priv->connection = connection; + + g_dbus_connection_register_object (connection, + "/", + manager->priv->introspection->interfaces[0], + &interface_vtable, + manager, + NULL, + NULL); +} + +#define PK_OFFLINE_UPDATE_RESULTS_GROUP "PackageKit Offline Update Results" +#define PK_OFFLINE_UPDATE_RESULTS_FILENAME "/var/lib/PackageKit/offline-update-competed" + +static gboolean +check_offline_update_cb (gpointer user_data) +{ + const gchar *message; + const gchar *title; + gboolean ret; + gboolean success; + gchar *error_code = NULL; + gchar *error_details = NULL; + gchar *packages = NULL; + GError *error = NULL; + GKeyFile *key_file = NULL; + GsdUpdatesManager *manager = (GsdUpdatesManager *) user_data; + guint i; + guint num_packages = 1; + NotifyNotification *notification; + PkErrorEnum error_enum = PK_ERROR_ENUM_UNKNOWN; + + /* was any offline update attempted */ + if (!g_file_test (PK_OFFLINE_UPDATE_RESULTS_FILENAME, G_FILE_TEST_EXISTS)) + goto out; + + /* open the file and see what happened */ + key_file = g_key_file_new (); + ret = g_key_file_load_from_file (key_file, + PK_OFFLINE_UPDATE_RESULTS_FILENAME, + G_KEY_FILE_NONE, + &error); + if (!ret) { + g_warning ("failed to open %s: %s", + PK_OFFLINE_UPDATE_RESULTS_FILENAME, + error->message); + g_error_free (error); + goto out; + } + success = g_key_file_get_boolean (key_file, + PK_OFFLINE_UPDATE_RESULTS_GROUP, + "Success", + NULL); + if (success) { + packages = g_key_file_get_string (key_file, + PK_OFFLINE_UPDATE_RESULTS_GROUP, + "Packages", + NULL); + if (packages == NULL) { + g_warning ("No 'Packages' in %s", + PK_OFFLINE_UPDATE_RESULTS_FILENAME); + goto out; + } + + /* count the packages for translators */ + for (i = 0; packages[i] != '\0'; i++) { + if (packages[i] == ',') + num_packages++; + } + + /* TRANSLATORS: title in the libnotify popup */ + title = ngettext ("Software Update Installed", + "Software Updates Installed", + num_packages); + + /* TRANSLATORS: message when we've done offline updates */ + message = ngettext ("An important OS update has been installed.", + "Important OS updates have been installed.", + num_packages); + + /* no need to keep the file around anymore */ + clear_offline_updates_message (); + } else { + /* get error details */ + manager->priv->offline_update_error = pk_error_new (); + + error_code = g_key_file_get_string (key_file, + PK_OFFLINE_UPDATE_RESULTS_GROUP, + "ErrorCode", + NULL); + if (error_code != NULL) + error_enum = pk_error_enum_from_string (error_code); + error_details = g_key_file_get_string (key_file, + PK_OFFLINE_UPDATE_RESULTS_GROUP, + "ErrorDetails", + NULL); + g_object_set (manager->priv->offline_update_error, + "code", error_enum, + "details", error_details, + NULL); + + /* TRANSLATORS: title in the libnotify popup */ + title = _("Software Updates Failed"); + + /* TRANSLATORS: message when we've not done offline updates */ + message = _("An important OS update failed to be installed."); + } + + /* do the bubble */ + g_debug ("title=%s, message=%s", title, message); + notification = notify_notification_new (title, + message, + GSD_UPDATES_ICON_URGENT); + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, -1); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); + if (success) { +#if 0 + notify_notification_add_action (notification, "review-offline-updates", + /* TRANSLATORS: button: review the offline update changes */ + _("Review"), libnotify_action_cb, manager, NULL); +#endif + } else { + notify_notification_add_action (notification, "error-offline-updates", + /* TRANSLATORS: button: review the offline update changes */ + _("Show details"), libnotify_action_cb, manager, NULL); + } + notify_notification_add_action (notification, "clear-offline-updates", + /* TRANSLATORS: button: clear notification */ + _("OK"), libnotify_action_cb, manager, NULL); + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); + if (!ret) { + g_warning ("error: %s", error->message); + g_error_free (error); + } +out: + g_free (packages); + g_free (error_code); + g_free (error_details); + if (key_file != NULL) + g_key_file_free (key_file); + manager->priv->offline_update_id = 0; + return FALSE; +} + +gboolean +gsd_updates_manager_start (GsdUpdatesManager *manager, + GError **error) +{ + gboolean ret = FALSE; + gchar *introspection_data = NULL; + GFile *file = NULL; + + g_debug ("Starting updates manager"); + + /* use PackageKit */ + manager->priv->cancellable = g_cancellable_new (); + manager->priv->control = pk_control_new (); + g_signal_connect (manager->priv->control, "notify::locked", + G_CALLBACK (notify_locked_cb), manager); + manager->priv->task = pk_task_new (); + g_object_set (manager->priv->task, + "background", TRUE, + "interactive", FALSE, +#if PK_CHECK_VERSION(0,8,1) + "only-download", TRUE, +#endif + NULL); + + /* watch UDev for missing firmware */ + manager->priv->firmware = gsd_updates_firmware_new (); + + /* get automatic callbacks about when we should check for + * updates, refresh-caches and upgrades */ + manager->priv->refresh = gsd_updates_refresh_new (); + g_signal_connect (manager->priv->refresh, "get-upgrades", + G_CALLBACK (due_get_upgrades_cb), manager); + g_signal_connect (manager->priv->refresh, "refresh-cache", + G_CALLBACK (due_refresh_cache_cb), manager); + g_signal_connect (manager->priv->refresh, "get-updates", + G_CALLBACK (due_get_updates_cb), manager); + + /* get proxy settings */ + manager->priv->settings_proxy = g_settings_new ("org.gnome.system.proxy"); + g_signal_connect (manager->priv->settings_proxy, "changed", + G_CALLBACK (settings_changed_cb), manager); + + /* get http settings */ + manager->priv->settings_http = g_settings_new ("org.gnome.system.proxy.http"); + g_signal_connect (manager->priv->settings_http, "changed", + G_CALLBACK (settings_changed_cb), manager); + + /* get ftp settings */ + manager->priv->settings_ftp = g_settings_new ("org.gnome.system.proxy.ftp"); + g_signal_connect (manager->priv->settings_ftp, "changed", + G_CALLBACK (settings_changed_cb), manager); + + /* get ftp settings */ + manager->priv->settings_gsd = g_settings_new ("org.gnome.settings-daemon.plugins.updates"); + g_signal_connect (manager->priv->settings_gsd, "changed", + G_CALLBACK (settings_gsd_changed_cb), manager); + + /* use gnome-session for the idle detection */ + manager->priv->proxy_session = + g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, /* GDBusInterfaceInfo */ + "org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager", + manager->priv->cancellable, + error); + if (manager->priv->proxy_session == NULL) + goto out; + + /* if the update viewer is started, then hide the notification */ + manager->priv->update_viewer_watcher_id = + g_bus_watch_name (G_BUS_TYPE_SESSION, + "org.freedesktop.PackageKit.UpdateViewer", + G_BUS_NAME_WATCHER_FLAGS_NONE, + update_viewer_appeared_cb, + NULL, + manager, + NULL); + + /* get a volume monitor so we can watch media */ + manager->priv->volume_monitor = g_volume_monitor_get (); + g_signal_connect (manager->priv->volume_monitor, "mount-added", + G_CALLBACK (mount_added_cb), manager); + + /* coldplug */ + reload_proxy_settings (manager); + + /* load introspection from file */ + file = g_file_new_for_path (DATADIR "/dbus-1/interfaces/org.gnome.SettingsDaemonUpdates.xml"); + ret = g_file_load_contents (file, NULL, &introspection_data, NULL, NULL, error); + if (!ret) + goto out; + + /* build introspection from XML */ + manager->priv->introspection = g_dbus_node_info_new_for_xml (introspection_data, error); + if (manager->priv->introspection == NULL) + goto out; + + /* export the object */ + g_bus_get (G_BUS_TYPE_SESSION, + NULL, + (GAsyncReadyCallback) on_bus_gotten, + manager); + + /* check for offline update */ + manager->priv->offline_update_id = + g_timeout_add_seconds (5, + check_offline_update_cb, + manager); + + /* success */ + ret = TRUE; + g_debug ("Started updates manager"); +out: + g_free (introspection_data); + return ret; +} + +void +gsd_updates_manager_stop (GsdUpdatesManager *manager) +{ + g_debug ("Stopping updates manager"); + + g_clear_object (&manager->priv->settings_proxy); + g_clear_object (&manager->priv->settings_http); + g_clear_object (&manager->priv->settings_ftp); + g_clear_object (&manager->priv->settings_gsd); + g_clear_object (&manager->priv->control); + g_clear_object (&manager->priv->task); + g_clear_object (&manager->priv->refresh); + g_clear_object (&manager->priv->firmware); + g_clear_object (&manager->priv->proxy_session); + g_clear_object (&manager->priv->volume_monitor); + g_clear_object (&manager->priv->cancellable); + g_clear_pointer (&manager->priv->introspection, g_dbus_node_info_unref); + if (manager->priv->update_viewer_watcher_id != 0) { + g_bus_unwatch_name (manager->priv->update_viewer_watcher_id); + manager->priv->update_viewer_watcher_id = 0; + } + if (manager->priv->owner_id > 0) { + g_bus_unown_name (manager->priv->owner_id); + manager->priv->owner_id = 0; + } + if (manager->priv->offline_update_id) { + g_source_remove (manager->priv->offline_update_id); + manager->priv->offline_update_id = 0; + } + if (manager->priv->update_packages != NULL) { + g_ptr_array_unref (manager->priv->update_packages); + manager->priv->update_packages = NULL; + } + g_clear_object (&manager->priv->offline_update_error); +} + +static GObject * +gsd_updates_manager_constructor ( + GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdUpdatesManager *m; + + m = GSD_UPDATES_MANAGER (G_OBJECT_CLASS (gsd_updates_manager_parent_class)->constructor ( + type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (m); +} + +static void +gsd_updates_manager_dispose (GObject *object) +{ + GsdUpdatesManager *manager; + + manager = GSD_UPDATES_MANAGER (object); + + gsd_updates_manager_stop (manager); + + G_OBJECT_CLASS (gsd_updates_manager_parent_class)->dispose (object); +} + +static void +gsd_updates_manager_class_init (GsdUpdatesManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_updates_manager_constructor; + object_class->dispose = gsd_updates_manager_dispose; + object_class->finalize = gsd_updates_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdUpdatesManagerPrivate)); +} + +static void +gsd_updates_manager_init (GsdUpdatesManager *manager) +{ + manager->priv = GSD_UPDATES_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_updates_manager_finalize (GObject *object) +{ + GsdUpdatesManager *updates_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_UPDATES_MANAGER (object)); + + updates_manager = GSD_UPDATES_MANAGER (object); + + g_return_if_fail (updates_manager->priv); + + G_OBJECT_CLASS (gsd_updates_manager_parent_class)->finalize (object); +} + +GsdUpdatesManager * +gsd_updates_manager_new (void) +{ + if (manager_object) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_UPDATES_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, (gpointer *) &manager_object); + } + + return GSD_UPDATES_MANAGER (manager_object); +} diff --git a/plugins/updates/gsd-updates-manager.h b/plugins/updates/gsd-updates-manager.h new file mode 100644 index 00000000..b0908722 --- /dev/null +++ b/plugins/updates/gsd-updates-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Richard Hughes + * + * 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_UPDATES_MANAGER_H +#define __GSD_UPDATES_MANAGER_H + +#include +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_UPDATES_MANAGER (gsd_updates_manager_get_type ()) +#define GSD_UPDATES_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManager)) +#define GSD_UPDATES_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerClass)) +#define GSD_IS_UPDATES_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UPDATES_MANAGER)) +#define GSD_IS_UPDATES_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_UPDATES_MANAGER)) +#define GSD_UPDATES_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerClass)) + +typedef struct GsdUpdatesManagerPrivate GsdUpdatesManagerPrivate; + +typedef struct +{ + GObject parent; + GsdUpdatesManagerPrivate *priv; +} GsdUpdatesManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdUpdatesManagerClass; + +GType gsd_updates_manager_get_type (void) G_GNUC_CONST; + +GsdUpdatesManager *gsd_updates_manager_new (void); +gboolean gsd_updates_manager_start (GsdUpdatesManager *manager, GError **error); +void gsd_updates_manager_stop (GsdUpdatesManager *manager); + +G_END_DECLS + +#endif /* __GSD_UPDATES_MANAGER_H */ diff --git a/plugins/updates/gsd-updates-plugin.c b/plugins/updates/gsd-updates-plugin.c new file mode 100644 index 00000000..368b1d6d --- /dev/null +++ b/plugins/updates/gsd-updates-plugin.c @@ -0,0 +1,100 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Richard Hughes + * + * 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, 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 +#include + +#include "gnome-settings-plugin.h" +#include "gsd-updates-plugin.h" +#include "gsd-updates-manager.h" + +struct GsdUpdatesPluginPrivate { + GsdUpdatesManager *manager; +}; + +#define GSD_UPDATES_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdUpdatesPlugin, gsd_updates_plugin) + +static void +gsd_updates_plugin_init (GsdUpdatesPlugin *plugin) +{ + plugin->priv = GSD_UPDATES_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdUpdatesPlugin initializing"); + + plugin->priv->manager = gsd_updates_manager_new (); +} + +static void +gsd_updates_plugin_finalize (GObject *object) +{ + GsdUpdatesPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_UPDATES_PLUGIN (object)); + + g_debug ("GsdUpdatesPlugin finalizing"); + + plugin = GSD_UPDATES_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) + g_object_unref (plugin->priv->manager); + + G_OBJECT_CLASS (gsd_updates_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + GError *error = NULL; + + g_debug ("Activating updates plugin"); + + if (!gsd_updates_manager_start (GSD_UPDATES_PLUGIN (plugin)->priv->manager, &error)) { + g_warning ("Unable to start updates manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating updates plugin"); + gsd_updates_manager_stop (GSD_UPDATES_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_updates_plugin_class_init (GsdUpdatesPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_updates_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdUpdatesPluginPrivate)); +} diff --git a/plugins/updates/gsd-updates-plugin.h b/plugins/updates/gsd-updates-plugin.h new file mode 100644 index 00000000..da1b8be6 --- /dev/null +++ b/plugins/updates/gsd-updates-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2011 Richard Hughes + * + * 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, 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_UPDATES_PLUGIN_H__ +#define __GSD_UPDATES_PLUGIN_H__ + +#include +#include +#include + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_UPDATES_PLUGIN (gsd_updates_plugin_get_type ()) +#define GSD_UPDATES_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPlugin)) +#define GSD_UPDATES_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPluginClass)) +#define GSD_IS_UPDATES_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UPDATES_PLUGIN)) +#define GSD_IS_UPDATES_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_UPDATES_PLUGIN)) +#define GSD_UPDATES_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_UPDATES_PLUGIN, GsdUpdatesPluginClass)) + +typedef struct GsdUpdatesPluginPrivate GsdUpdatesPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdUpdatesPluginPrivate *priv; +} GsdUpdatesPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdUpdatesPluginClass; + +GType gsd_updates_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_UPDATES_PLUGIN_H__ */ diff --git a/plugins/updates/gsd-updates-refresh.c b/plugins/updates/gsd-updates-refresh.c new file mode 100644 index 00000000..54e4b3f5 --- /dev/null +++ b/plugins/updates/gsd-updates-refresh.c @@ -0,0 +1,581 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "gsd-updates-common.h" +#include "gsd-updates-refresh.h" + +static void gsd_updates_refresh_finalize (GObject *object); + +#define GSD_UPDATES_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_UPDATES_REFRESH, GsdUpdatesRefreshPrivate)) + +#define PERIODIC_CHECK_TIME 60*60 /* poke PackageKit every hour */ +#define LOGIN_TIMEOUT 3 /* seconds */ +#define SESSION_STARTUP_TIMEOUT 10 /* seconds */ + +enum { + PRESENCE_STATUS_AVAILABLE = 0, + PRESENCE_STATUS_INVISIBLE, + PRESENCE_STATUS_BUSY, + PRESENCE_STATUS_IDLE, + PRESENCE_STATUS_UNKNOWN +}; + +/* + * at startup, after a small delay, force a GetUpdates call + * every hour (or any event) check: + - if we are online, idle and on AC power, it's been more than a day + since we refreshed then RefreshCache + - if we are online and it's been longer than the timeout since + getting the updates period then GetUpdates +*/ + +struct GsdUpdatesRefreshPrivate +{ + gboolean session_idle; + gboolean on_battery; + gboolean network_active; + guint timeout_id; + guint periodic_id; + UpClient *client; + GSettings *settings; + GDBusProxy *proxy_session; + PkControl *control; +}; + +enum { + REFRESH_CACHE, + GET_UPDATES, + GET_UPGRADES, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE (GsdUpdatesRefresh, gsd_updates_refresh, G_TYPE_OBJECT) + +static void +gsd_updates_refresh_class_init (GsdUpdatesRefreshClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->finalize = gsd_updates_refresh_finalize; + g_type_class_add_private (klass, sizeof (GsdUpdatesRefreshPrivate)); + signals [REFRESH_CACHE] = + g_signal_new ("refresh-cache", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals [GET_UPDATES] = + g_signal_new ("get-updates", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals [GET_UPGRADES] = + g_signal_new ("get-upgrades", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +get_time_refresh_cache_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesRefresh *refresh) +{ + PkControl *control = PK_CONTROL (object); + GError *error = NULL; + guint seconds; + guint thresh; + + /* get the result */ + seconds = pk_control_get_time_since_action_finish (control, res, &error); + if (seconds == 0) { + g_warning ("failed to get time: %s", error->message); + g_error_free (error); + return; + } + + /* have we passed the timout? */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_GET_UPDATES); + if (seconds < thresh) { + g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds); + return; + } + + /* send signal */ + g_debug ("emitting refresh-cache"); + g_signal_emit (refresh, signals [REFRESH_CACHE], 0); +} + +static void +maybe_refresh_cache (GsdUpdatesRefresh *refresh) +{ + guint thresh; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + + /* if we don't want to auto check for updates, don't do this either */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_GET_UPDATES); + if (thresh == 0) { + g_debug ("not when policy is set to never"); + return; + } + + /* only do the refresh cache when the user is idle */ + if (!refresh->priv->session_idle) { + g_debug ("not when session active"); + return; + } + + /* get this each time, as it may have changed behind out back */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_REFRESH_CACHE); + if (thresh == 0) { + g_debug ("not when policy is set to never"); + return; + } + + /* get the time since the last refresh */ + pk_control_get_time_since_action_async (refresh->priv->control, + PK_ROLE_ENUM_REFRESH_CACHE, + NULL, + (GAsyncReadyCallback) get_time_refresh_cache_cb, + refresh); +} + +static void +get_time_get_updates_cb (GObject *object, GAsyncResult *res, GsdUpdatesRefresh *refresh) +{ + PkControl *control = PK_CONTROL (object); + GError *error = NULL; + guint seconds; + guint thresh; + + /* get the result */ + seconds = pk_control_get_time_since_action_finish (control, res, &error); + if (seconds == 0) { + g_warning ("failed to get time: %s", error->message); + g_error_free (error); + return; + } + + /* have we passed the timout? */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_GET_UPDATES); + if (seconds < thresh) { + g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds); + return; + } + + /* send signal */ + g_debug ("emitting get-updates"); + g_signal_emit (refresh, signals [GET_UPDATES], 0); +} + +static void +maybe_get_updates (GsdUpdatesRefresh *refresh) +{ + guint thresh; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + + /* if we don't want to auto check for updates, don't do this either */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_GET_UPDATES); + if (thresh == 0) { + g_debug ("not when policy is set to never"); + return; + } + + /* get the time since the last refresh */ + pk_control_get_time_since_action_async (refresh->priv->control, + PK_ROLE_ENUM_GET_UPDATES, + NULL, + (GAsyncReadyCallback) get_time_get_updates_cb, + refresh); +} + +static void +get_time_get_upgrades_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesRefresh *refresh) +{ + PkControl *control = PK_CONTROL (object); + GError *error = NULL; + guint seconds; + guint thresh; + + /* get the result */ + seconds = pk_control_get_time_since_action_finish (control, res, &error); + if (seconds == 0) { + g_warning ("failed to get time: %s", error->message); + g_error_free (error); + return; + } + + /* have we passed the timout? */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_GET_UPDATES); + if (seconds < thresh) { + g_debug ("not before timeout, thresh=%u, now=%u", + thresh, seconds); + return; + } + + /* send signal */ + g_debug ("emitting get-upgrades"); + g_signal_emit (refresh, signals [GET_UPGRADES], 0); +} + +static void +maybe_get_upgrades (GsdUpdatesRefresh *refresh) +{ + guint thresh; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + + /* get this each time, as it may have changed behind out back */ + thresh = g_settings_get_int (refresh->priv->settings, + GSD_SETTINGS_FREQUENCY_GET_UPGRADES); + if (thresh == 0) { + g_debug ("not when policy is set to never"); + return; + } + + /* get the time since the last refresh */ + pk_control_get_time_since_action_async (refresh->priv->control, + PK_ROLE_ENUM_GET_DISTRO_UPGRADES, + NULL, + (GAsyncReadyCallback) get_time_get_upgrades_cb, + refresh); +} + +static gboolean +change_state_cb (GsdUpdatesRefresh *refresh) +{ + /* check all actions */ + maybe_refresh_cache (refresh); + maybe_get_updates (refresh); + maybe_get_upgrades (refresh); + return FALSE; +} + +static gboolean +change_state (GsdUpdatesRefresh *refresh) +{ + gboolean ret; + + g_return_val_if_fail (GSD_IS_UPDATES_REFRESH (refresh), FALSE); + + /* no point continuing if we have no network */ + if (!refresh->priv->network_active) { + g_debug ("not when no network"); + return FALSE; + } + + /* not on battery unless overridden */ + ret = g_settings_get_boolean (refresh->priv->settings, + GSD_SETTINGS_UPDATE_BATTERY); + if (!ret && refresh->priv->on_battery) { + g_debug ("not when on battery"); + return FALSE; + } + + /* wait a little time for things to settle down */ + if (refresh->priv->timeout_id != 0) + g_source_remove (refresh->priv->timeout_id); + g_debug ("defering action for %i seconds", + SESSION_STARTUP_TIMEOUT); + refresh->priv->timeout_id = + g_timeout_add_seconds (SESSION_STARTUP_TIMEOUT, + (GSourceFunc) change_state_cb, + refresh); + g_source_set_name_by_id (refresh->priv->timeout_id, + "[GsdUpdatesRefresh] change-state"); + + return TRUE; +} + +static void +settings_key_changed_cb (GSettings *client, + const gchar *key, + GsdUpdatesRefresh *refresh) +{ + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + if (g_strcmp0 (key, GSD_SETTINGS_FREQUENCY_GET_UPDATES) == 0 || + g_strcmp0 (key, GSD_SETTINGS_FREQUENCY_GET_UPGRADES) == 0 || + g_strcmp0 (key, GSD_SETTINGS_FREQUENCY_REFRESH_CACHE) == 0 || + g_strcmp0 (key, GSD_SETTINGS_UPDATE_BATTERY) == 0) + change_state (refresh); +} + +static gboolean +convert_network_state (GsdUpdatesRefresh *refresh, PkNetworkEnum state) +{ + /* offline */ + if (state == PK_NETWORK_ENUM_OFFLINE) + return FALSE; + + /* online */ + if (state == PK_NETWORK_ENUM_ONLINE || + state == PK_NETWORK_ENUM_WIFI || + state == PK_NETWORK_ENUM_WIRED) + return TRUE; + + /* check policy */ + if (state == PK_NETWORK_ENUM_MOBILE) + return g_settings_get_boolean (refresh->priv->settings, + GSD_SETTINGS_CONNECTION_USE_MOBILE); + + /* not recognised */ + g_warning ("state unknown: %i", state); + return TRUE; +} + +static void +notify_network_state_cb (PkControl *control, + GParamSpec *pspec, + GsdUpdatesRefresh *refresh) +{ + PkNetworkEnum state; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + + g_object_get (control, "network-state", &state, NULL); + refresh->priv->network_active = convert_network_state (refresh, state); + g_debug ("setting online %i", refresh->priv->network_active); + if (refresh->priv->network_active) + change_state (refresh); +} + +static gboolean +periodic_timeout_cb (gpointer user_data) +{ + GsdUpdatesRefresh *refresh = GSD_UPDATES_REFRESH (user_data); + + g_return_val_if_fail (GSD_IS_UPDATES_REFRESH (refresh), FALSE); + + /* debug so we can catch polling */ + g_debug ("polling check"); + + /* triggered once an hour */ + change_state (refresh); + + /* always return */ + return TRUE; +} + +static void +gsd_updates_refresh_client_changed_cb (UpClient *client, + GsdUpdatesRefresh *refresh) +{ + gboolean on_battery; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + + /* get the on-battery state */ + on_battery = up_client_get_on_battery (refresh->priv->client); + if (on_battery == refresh->priv->on_battery) { + g_debug ("same state as before, ignoring"); + return; + } + + /* save in local cache */ + g_debug ("setting on_battery %i", on_battery); + refresh->priv->on_battery = on_battery; + if (!on_battery) + change_state (refresh); +} + +static void +get_properties_cb (GObject *object, + GAsyncResult *res, + GsdUpdatesRefresh *refresh) +{ + PkNetworkEnum state; + GError *error = NULL; + PkControl *control = PK_CONTROL(object); + gboolean ret; + + /* get the result */ + ret = pk_control_get_properties_finish (control, res, &error); + if (!ret) { + /* TRANSLATORS: backend is broken, and won't tell us what it supports */ + g_warning ("could not get properties"); + g_error_free (error); + goto out; + } + + /* get values */ + g_object_get (control, + "network-state", &state, + NULL); + refresh->priv->network_active = convert_network_state (refresh, state); +out: + return; +} + +static void +session_presence_signal_cb (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + GsdUpdatesRefresh *refresh) +{ + guint status; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh)); + + if (g_strcmp0 (signal_name, "StatusChanged") != 0) + return; + + /* map status code into boolean */ + g_variant_get (parameters, "(u)", &status); + refresh->priv->session_idle = (status == PRESENCE_STATUS_IDLE); + g_debug ("setting is_idle %i", + refresh->priv->session_idle); + if (refresh->priv->session_idle) + change_state (refresh); + +} + +static void +gsd_updates_refresh_init (GsdUpdatesRefresh *refresh) +{ + GError *error = NULL; + GVariant *status; + guint status_code; + + refresh->priv = GSD_UPDATES_REFRESH_GET_PRIVATE (refresh); + refresh->priv->on_battery = FALSE; + refresh->priv->network_active = FALSE; + refresh->priv->timeout_id = 0; + refresh->priv->periodic_id = 0; + + /* we need to know the updates frequency */ + refresh->priv->settings = g_settings_new (GSD_SETTINGS_SCHEMA); + g_signal_connect (refresh->priv->settings, "changed", + G_CALLBACK (settings_key_changed_cb), refresh); + + /* we need to query the last cache refresh time */ + refresh->priv->control = pk_control_new (); + g_signal_connect (refresh->priv->control, "notify::network-state", + G_CALLBACK (notify_network_state_cb), + refresh); + + /* get network state */ + pk_control_get_properties_async (refresh->priv->control, + NULL, + (GAsyncReadyCallback) get_properties_cb, + refresh); + + /* use a UpClient */ + refresh->priv->client = up_client_new (); + g_signal_connect (refresh->priv->client, "changed", + G_CALLBACK (gsd_updates_refresh_client_changed_cb), refresh); + + /* get the battery state */ + refresh->priv->on_battery = up_client_get_on_battery (refresh->priv->client); + g_debug ("setting on battery %i", refresh->priv->on_battery); + + /* use gnome-session for the idle detection */ + refresh->priv->proxy_session = + g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NULL, /* GDBusInterfaceInfo */ + "org.gnome.SessionManager", + "/org/gnome/SessionManager/Presence", + "org.gnome.SessionManager.Presence", + NULL, /* GCancellable */ + &error); + if (refresh->priv->proxy_session == NULL) { + g_warning ("Error creating proxy: %s", + error->message); + g_error_free (error); + } else { + g_signal_connect (refresh->priv->proxy_session, + "g-signal", + G_CALLBACK (session_presence_signal_cb), + refresh); + status = g_dbus_proxy_get_cached_property (refresh->priv->proxy_session, + "status"); + if (status) { + g_variant_get (status, "u", &status_code); + refresh->priv->session_idle = (status_code == PRESENCE_STATUS_IDLE); + g_variant_unref (status); + } + else { + refresh->priv->session_idle = FALSE; + } + } + + /* we check this in case we miss one of the async signals */ + refresh->priv->periodic_id = + g_timeout_add_seconds (PERIODIC_CHECK_TIME, + periodic_timeout_cb, refresh); + g_source_set_name_by_id (refresh->priv->periodic_id, + "[GsdUpdatesRefresh] periodic check"); + + /* check system state */ + change_state (refresh); +} + +static void +gsd_updates_refresh_finalize (GObject *object) +{ + GsdUpdatesRefresh *refresh; + + g_return_if_fail (GSD_IS_UPDATES_REFRESH (object)); + + refresh = GSD_UPDATES_REFRESH (object); + g_return_if_fail (refresh->priv != NULL); + + if (refresh->priv->timeout_id != 0) + g_source_remove (refresh->priv->timeout_id); + if (refresh->priv->periodic_id != 0) + g_source_remove (refresh->priv->periodic_id); + + g_signal_handlers_disconnect_by_data (refresh->priv->client, refresh); + + g_object_unref (refresh->priv->control); + g_object_unref (refresh->priv->settings); + g_object_unref (refresh->priv->client); + if (refresh->priv->proxy_session != NULL) + g_object_unref (refresh->priv->proxy_session); + + G_OBJECT_CLASS (gsd_updates_refresh_parent_class)->finalize (object); +} + +GsdUpdatesRefresh * +gsd_updates_refresh_new (void) +{ + GsdUpdatesRefresh *refresh; + refresh = g_object_new (GSD_TYPE_UPDATES_REFRESH, NULL); + return GSD_UPDATES_REFRESH (refresh); +} + diff --git a/plugins/updates/gsd-updates-refresh.h b/plugins/updates/gsd-updates-refresh.h new file mode 100644 index 00000000..e8579987 --- /dev/null +++ b/plugins/updates/gsd-updates-refresh.h @@ -0,0 +1,52 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2007-2011 Richard Hughes + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __GSD_UPDATES_REFRESH_H +#define __GSD_UPDATES_REFRESH_H + +#include + +G_BEGIN_DECLS + +#define GSD_TYPE_UPDATES_REFRESH (gsd_updates_refresh_get_type ()) +#define GSD_UPDATES_REFRESH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_UPDATES_REFRESH, GsdUpdatesRefresh)) +#define GSD_UPDATES_REFRESH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_UPDATES_REFRESH, GsdUpdatesRefreshClass)) +#define GSD_IS_UPDATES_REFRESH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_UPDATES_REFRESH)) + +typedef struct GsdUpdatesRefreshPrivate GsdUpdatesRefreshPrivate; + +typedef struct +{ + GObject parent; + GsdUpdatesRefreshPrivate *priv; +} GsdUpdatesRefresh; + +typedef struct +{ + GObjectClass parent_class; +} GsdUpdatesRefreshClass; + +GType gsd_updates_refresh_get_type (void); +GsdUpdatesRefresh *gsd_updates_refresh_new (void); + +G_END_DECLS + +#endif /* __GSD_UPDATES_REFRESH_H */ diff --git a/plugins/updates/org.gnome.SettingsDaemonUpdates.xml b/plugins/updates/org.gnome.SettingsDaemonUpdates.xml new file mode 100644 index 00000000..b75585e4 --- /dev/null +++ b/plugins/updates/org.gnome.SettingsDaemonUpdates.xml @@ -0,0 +1,40 @@ + + + + + + + The interface used for quering trivial information about the + update plugin in gnome-settings-daemon. + + + + + + + + + + If there are updates that have been downloaded and are waiting + to be applied. + + + + + + + + + + + Some value on the interface has changed. + + + + + + + + diff --git a/plugins/updates/updates.gnome-settings-plugin.in b/plugins/updates/updates.gnome-settings-plugin.in new file mode 100644 index 00000000..c8389a22 --- /dev/null +++ b/plugins/updates/updates.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=updates +IAge=0 +_Name=Updates +_Description=Updates plugin +Authors=Richard Hughes +Copyright=Copyright © 2011 +Website= diff --git a/plugins/wacom/Makefile.am b/plugins/wacom/Makefile.am new file mode 100644 index 00000000..662388b7 --- /dev/null +++ b/plugins/wacom/Makefile.am @@ -0,0 +1,136 @@ +plugin_name = wacom + +plugin_LTLIBRARIES = libgsdwacom.la + +libgsdwacom_la_SOURCES = \ + gsd-wacom-plugin.h \ + gsd-wacom-plugin.c \ + gsd-wacom-manager.h \ + gsd-wacom-manager.c \ + gsd-wacom-device.c \ + gsd-wacom-device.h + +libgsdwacom_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -I$(top_srcdir)/data/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +libgsdwacom_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(WACOM_CFLAGS) \ + $(AM_CFLAGS) + +libgsdwacom_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libgsdwacom_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(WACOM_LIBS) + +org.gnome.settings-daemon.plugins.wacom.policy.in: org.gnome.settings-daemon.plugins.wacom.policy.in.in Makefile + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + +@INTLTOOL_POLICY_RULE@ +polkit_policydir = $(datadir)/polkit-1/actions +polkit_policy_in_files = org.gnome.settings-daemon.plugins.wacom.policy.in +polkit_policy_DATA = $(polkit_policy_in_files:.policy.in=.policy) + +# so it always gets included in the tarball +gsd_wacom_led_helper_SOURCES = gsd-wacom-led-helper.c + +EXTRA_DIST = $(gsd_wacom_led_helper_SOURCES) + +if HAVE_GUDEV +libexec_PROGRAMS = gsd-wacom-led-helper + +gsd_wacom_led_helper_LDFLAGS = \ + $(BACKLIGHT_HELPER_LIBS) \ + -lm + +gsd_wacom_led_helper_CFLAGS = \ + $(BACKLIGHT_HELPER_CFLAGS) +else +libexec_PROGRAMS = +endif + +EXTRA_DIST += org.gnome.settings-daemon.plugins.wacom.policy.in.in + +libexec_PROGRAMS += gsd-test-wacom gsd-list-wacom + +gsd_test_wacom_SOURCES = \ + test-wacom.c \ + gsd-wacom-manager.c \ + gsd-wacom-manager.h \ + gsd-wacom-device.c \ + gsd-wacom-device.h + +gsd_test_wacom_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DSCHEMA_NAME=\""gsdwacom"\" \ + $(AM_CPPFLAGS) + +gsd_test_wacom_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(WACOM_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_wacom_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(WACOM_LIBS) \ + -lm + +gsd_list_wacom_SOURCES = \ + list-wacom.c \ + gsd-wacom-device.c \ + gsd-wacom-device.h + +gsd_list_wacom_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gsd_list_wacom_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(WACOM_CFLAGS) \ + $(AM_CFLAGS) + +gsd_list_wacom_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(WACOM_LIBS) \ + -lm + +plugin_in_files = wacom.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST += $(plugin_in_files) README.config-storage +CLEANFILES = \ + $(plugin_DATA) \ + org.gnome.settings-daemon.plugins.wacom.policy \ + org.gnome.settings-daemon.plugins.wacom.policy.in + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/wacom/Makefile.in b/plugins/wacom/Makefile.in new file mode 100644 index 00000000..b1b96946 --- /dev/null +++ b/plugins/wacom/Makefile.in @@ -0,0 +1,1085 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_GUDEV_FALSE@libexec_PROGRAMS = gsd-test-wacom$(EXEEXT) \ +@HAVE_GUDEV_FALSE@ gsd-list-wacom$(EXEEXT) +@HAVE_GUDEV_TRUE@libexec_PROGRAMS = gsd-wacom-led-helper$(EXEEXT) \ +@HAVE_GUDEV_TRUE@ gsd-test-wacom$(EXEEXT) \ +@HAVE_GUDEV_TRUE@ gsd-list-wacom$(EXEEXT) +subdir = plugins/wacom +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(polkit_policydir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgsdwacom_la_DEPENDENCIES = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libgsdwacom_la_OBJECTS = libgsdwacom_la-gsd-wacom-plugin.lo \ + libgsdwacom_la-gsd-wacom-manager.lo \ + libgsdwacom_la-gsd-wacom-device.lo +libgsdwacom_la_OBJECTS = $(am_libgsdwacom_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libgsdwacom_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libgsdwacom_la_CFLAGS) $(CFLAGS) $(libgsdwacom_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +PROGRAMS = $(libexec_PROGRAMS) +am_gsd_list_wacom_OBJECTS = gsd_list_wacom-list-wacom.$(OBJEXT) \ + gsd_list_wacom-gsd-wacom-device.$(OBJEXT) +gsd_list_wacom_OBJECTS = $(am_gsd_list_wacom_OBJECTS) +gsd_list_wacom_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_list_wacom_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_list_wacom_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +am_gsd_test_wacom_OBJECTS = gsd_test_wacom-test-wacom.$(OBJEXT) \ + gsd_test_wacom-gsd-wacom-manager.$(OBJEXT) \ + gsd_test_wacom-gsd-wacom-device.$(OBJEXT) +gsd_test_wacom_OBJECTS = $(am_gsd_test_wacom_OBJECTS) +gsd_test_wacom_DEPENDENCIES = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +gsd_test_wacom_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_test_wacom_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +am_gsd_wacom_led_helper_OBJECTS = \ + gsd_wacom_led_helper-gsd-wacom-led-helper.$(OBJEXT) +gsd_wacom_led_helper_OBJECTS = $(am_gsd_wacom_led_helper_OBJECTS) +gsd_wacom_led_helper_LDADD = $(LDADD) +gsd_wacom_led_helper_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(gsd_wacom_led_helper_CFLAGS) $(CFLAGS) \ + $(gsd_wacom_led_helper_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgsdwacom_la_SOURCES) $(gsd_list_wacom_SOURCES) \ + $(gsd_test_wacom_SOURCES) $(gsd_wacom_led_helper_SOURCES) +DIST_SOURCES = $(libgsdwacom_la_SOURCES) $(gsd_list_wacom_SOURCES) \ + $(gsd_test_wacom_SOURCES) $(gsd_wacom_led_helper_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(plugin_DATA) $(polkit_policy_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AUTOMOUNT_CFLAGS = @AUTOMOUNT_CFLAGS@ +AUTOMOUNT_LIBS = @AUTOMOUNT_LIBS@ +AWK = @AWK@ +BACKGROUND_CFLAGS = @BACKGROUND_CFLAGS@ +BACKGROUND_LIBS = @BACKGROUND_LIBS@ +BACKLIGHT_HELPER_CFLAGS = @BACKLIGHT_HELPER_CFLAGS@ +BACKLIGHT_HELPER_LIBS = @BACKLIGHT_HELPER_LIBS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COLOR_CFLAGS = @COLOR_CFLAGS@ +COLOR_LIBS = @COLOR_LIBS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ +COMMON_LIBS = @COMMON_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_CONFIG = @CUPS_CONFIG@ +CUPS_LIBS = @CUPS_LIBS@ +CURSOR_CFLAGS = @CURSOR_CFLAGS@ +CURSOR_LIBS = @CURSOR_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_DESKTOP_CFLAGS = @GNOME_DESKTOP_CFLAGS@ +GNOME_DESKTOP_LIBS = @GNOME_DESKTOP_LIBS@ +GREP = @GREP@ +GSD_API_VERSION = @GSD_API_VERSION@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +KEYBOARD_CFLAGS = @KEYBOARD_CFLAGS@ +KEYBOARD_LIBS = @KEYBOARD_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MEDIA_KEYS_CFLAGS = @MEDIA_KEYS_CFLAGS@ +MEDIA_KEYS_LIBS = @MEDIA_KEYS_LIBS@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MOUSE_CFLAGS = @MOUSE_CFLAGS@ +MOUSE_LIBS = @MOUSE_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORIENTATION_CFLAGS = @ORIENTATION_CFLAGS@ +ORIENTATION_LIBS = @ORIENTATION_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGEKIT_CFLAGS = @PACKAGEKIT_CFLAGS@ +PACKAGEKIT_LIBS = @PACKAGEKIT_LIBS@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POWER_CFLAGS = @POWER_CFLAGS@ +POWER_LIBS = @POWER_LIBS@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOUND_CFLAGS = @SOUND_CFLAGS@ +SOUND_LIBS = @SOUND_LIBS@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WACOM_CFLAGS = @WACOM_CFLAGS@ +WACOM_LIBS = @WACOM_LIBS@ +WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XSETTINGS_CFLAGS = @XSETTINGS_CFLAGS@ +XSETTINGS_LIBS = @XSETTINGS_LIBS@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gsettingsschemadir = @gsettingsschemadir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +plugin_name = wacom +plugin_LTLIBRARIES = libgsdwacom.la +libgsdwacom_la_SOURCES = \ + gsd-wacom-plugin.h \ + gsd-wacom-plugin.c \ + gsd-wacom-manager.h \ + gsd-wacom-manager.c \ + gsd-wacom-device.c \ + gsd-wacom-device.h + +libgsdwacom_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common/ \ + -I$(top_srcdir)/data/ \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + $(AM_CPPFLAGS) + +libgsdwacom_la_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(WACOM_CFLAGS) \ + $(AM_CFLAGS) + +libgsdwacom_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libgsdwacom_la_LIBADD = \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_PLUGIN_LIBS) \ + $(WACOM_LIBS) + +polkit_policydir = $(datadir)/polkit-1/actions +polkit_policy_in_files = org.gnome.settings-daemon.plugins.wacom.policy.in +polkit_policy_DATA = $(polkit_policy_in_files:.policy.in=.policy) + +# so it always gets included in the tarball +gsd_wacom_led_helper_SOURCES = gsd-wacom-led-helper.c +EXTRA_DIST = $(gsd_wacom_led_helper_SOURCES) \ + org.gnome.settings-daemon.plugins.wacom.policy.in.in \ + $(plugin_in_files) README.config-storage +@HAVE_GUDEV_TRUE@gsd_wacom_led_helper_LDFLAGS = \ +@HAVE_GUDEV_TRUE@ $(BACKLIGHT_HELPER_LIBS) \ +@HAVE_GUDEV_TRUE@ -lm + +@HAVE_GUDEV_TRUE@gsd_wacom_led_helper_CFLAGS = \ +@HAVE_GUDEV_TRUE@ $(BACKLIGHT_HELPER_CFLAGS) + +gsd_test_wacom_SOURCES = \ + test-wacom.c \ + gsd-wacom-manager.c \ + gsd-wacom-manager.h \ + gsd-wacom-device.c \ + gsd-wacom-device.h + +gsd_test_wacom_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DSCHEMA_NAME=\""gsdwacom"\" \ + $(AM_CPPFLAGS) + +gsd_test_wacom_CFLAGS = \ + $(PLUGIN_CFLAGS) \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(WACOM_CFLAGS) \ + $(AM_CFLAGS) + +gsd_test_wacom_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(WACOM_LIBS) \ + -lm + +gsd_list_wacom_SOURCES = \ + list-wacom.c \ + gsd-wacom-device.c \ + gsd-wacom-device.h + +gsd_list_wacom_CPPFLAGS = \ + -I$(top_srcdir)/data/ \ + -I$(top_srcdir)/gnome-settings-daemon \ + -I$(top_srcdir)/plugins/common \ + -DBINDIR=\"$(bindir)\" \ + -DPIXMAPDIR=\""$(pkgdatadir)"\" \ + -DGTKBUILDERDIR=\""$(pkgdatadir)"\" \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +gsd_list_wacom_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(WACOM_CFLAGS) \ + $(AM_CFLAGS) + +gsd_list_wacom_LDADD = \ + $(top_builddir)/gnome-settings-daemon/libgsd.la \ + $(top_builddir)/plugins/common/libcommon.la \ + $(SETTINGS_DAEMON_LIBS) \ + $(SETTINGS_PLUGIN_LIBS) \ + $(WACOM_LIBS) \ + -lm + +plugin_in_files = wacom.gnome-settings-plugin.in +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) +CLEANFILES = \ + $(plugin_DATA) \ + org.gnome.settings-daemon.plugins.wacom.policy \ + org.gnome.settings-daemon.plugins.wacom.policy.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/wacom/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/wacom/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libgsdwacom.la: $(libgsdwacom_la_OBJECTS) $(libgsdwacom_la_DEPENDENCIES) $(EXTRA_libgsdwacom_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgsdwacom_la_LINK) -rpath $(plugindir) $(libgsdwacom_la_OBJECTS) $(libgsdwacom_la_LIBADD) $(LIBS) +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +gsd-list-wacom$(EXEEXT): $(gsd_list_wacom_OBJECTS) $(gsd_list_wacom_DEPENDENCIES) $(EXTRA_gsd_list_wacom_DEPENDENCIES) + @rm -f gsd-list-wacom$(EXEEXT) + $(AM_V_CCLD)$(gsd_list_wacom_LINK) $(gsd_list_wacom_OBJECTS) $(gsd_list_wacom_LDADD) $(LIBS) +gsd-test-wacom$(EXEEXT): $(gsd_test_wacom_OBJECTS) $(gsd_test_wacom_DEPENDENCIES) $(EXTRA_gsd_test_wacom_DEPENDENCIES) + @rm -f gsd-test-wacom$(EXEEXT) + $(AM_V_CCLD)$(gsd_test_wacom_LINK) $(gsd_test_wacom_OBJECTS) $(gsd_test_wacom_LDADD) $(LIBS) +gsd-wacom-led-helper$(EXEEXT): $(gsd_wacom_led_helper_OBJECTS) $(gsd_wacom_led_helper_DEPENDENCIES) $(EXTRA_gsd_wacom_led_helper_DEPENDENCIES) + @rm -f gsd-wacom-led-helper$(EXEEXT) + $(AM_V_CCLD)$(gsd_wacom_led_helper_LINK) $(gsd_wacom_led_helper_OBJECTS) $(gsd_wacom_led_helper_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_list_wacom-list-wacom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_test_wacom-test-wacom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsdwacom_la-gsd-wacom-device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsdwacom_la-gsd-wacom-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsdwacom_la-gsd-wacom-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libgsdwacom_la-gsd-wacom-plugin.lo: gsd-wacom-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsdwacom_la_CPPFLAGS) $(CPPFLAGS) $(libgsdwacom_la_CFLAGS) $(CFLAGS) -MT libgsdwacom_la-gsd-wacom-plugin.lo -MD -MP -MF $(DEPDIR)/libgsdwacom_la-gsd-wacom-plugin.Tpo -c -o libgsdwacom_la-gsd-wacom-plugin.lo `test -f 'gsd-wacom-plugin.c' || echo '$(srcdir)/'`gsd-wacom-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgsdwacom_la-gsd-wacom-plugin.Tpo $(DEPDIR)/libgsdwacom_la-gsd-wacom-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-plugin.c' object='libgsdwacom_la-gsd-wacom-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsdwacom_la_CPPFLAGS) $(CPPFLAGS) $(libgsdwacom_la_CFLAGS) $(CFLAGS) -c -o libgsdwacom_la-gsd-wacom-plugin.lo `test -f 'gsd-wacom-plugin.c' || echo '$(srcdir)/'`gsd-wacom-plugin.c + +libgsdwacom_la-gsd-wacom-manager.lo: gsd-wacom-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsdwacom_la_CPPFLAGS) $(CPPFLAGS) $(libgsdwacom_la_CFLAGS) $(CFLAGS) -MT libgsdwacom_la-gsd-wacom-manager.lo -MD -MP -MF $(DEPDIR)/libgsdwacom_la-gsd-wacom-manager.Tpo -c -o libgsdwacom_la-gsd-wacom-manager.lo `test -f 'gsd-wacom-manager.c' || echo '$(srcdir)/'`gsd-wacom-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgsdwacom_la-gsd-wacom-manager.Tpo $(DEPDIR)/libgsdwacom_la-gsd-wacom-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-manager.c' object='libgsdwacom_la-gsd-wacom-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsdwacom_la_CPPFLAGS) $(CPPFLAGS) $(libgsdwacom_la_CFLAGS) $(CFLAGS) -c -o libgsdwacom_la-gsd-wacom-manager.lo `test -f 'gsd-wacom-manager.c' || echo '$(srcdir)/'`gsd-wacom-manager.c + +libgsdwacom_la-gsd-wacom-device.lo: gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsdwacom_la_CPPFLAGS) $(CPPFLAGS) $(libgsdwacom_la_CFLAGS) $(CFLAGS) -MT libgsdwacom_la-gsd-wacom-device.lo -MD -MP -MF $(DEPDIR)/libgsdwacom_la-gsd-wacom-device.Tpo -c -o libgsdwacom_la-gsd-wacom-device.lo `test -f 'gsd-wacom-device.c' || echo '$(srcdir)/'`gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgsdwacom_la-gsd-wacom-device.Tpo $(DEPDIR)/libgsdwacom_la-gsd-wacom-device.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-device.c' object='libgsdwacom_la-gsd-wacom-device.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsdwacom_la_CPPFLAGS) $(CPPFLAGS) $(libgsdwacom_la_CFLAGS) $(CFLAGS) -c -o libgsdwacom_la-gsd-wacom-device.lo `test -f 'gsd-wacom-device.c' || echo '$(srcdir)/'`gsd-wacom-device.c + +gsd_list_wacom-list-wacom.o: list-wacom.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -MT gsd_list_wacom-list-wacom.o -MD -MP -MF $(DEPDIR)/gsd_list_wacom-list-wacom.Tpo -c -o gsd_list_wacom-list-wacom.o `test -f 'list-wacom.c' || echo '$(srcdir)/'`list-wacom.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_list_wacom-list-wacom.Tpo $(DEPDIR)/gsd_list_wacom-list-wacom.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='list-wacom.c' object='gsd_list_wacom-list-wacom.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -c -o gsd_list_wacom-list-wacom.o `test -f 'list-wacom.c' || echo '$(srcdir)/'`list-wacom.c + +gsd_list_wacom-list-wacom.obj: list-wacom.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -MT gsd_list_wacom-list-wacom.obj -MD -MP -MF $(DEPDIR)/gsd_list_wacom-list-wacom.Tpo -c -o gsd_list_wacom-list-wacom.obj `if test -f 'list-wacom.c'; then $(CYGPATH_W) 'list-wacom.c'; else $(CYGPATH_W) '$(srcdir)/list-wacom.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_list_wacom-list-wacom.Tpo $(DEPDIR)/gsd_list_wacom-list-wacom.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='list-wacom.c' object='gsd_list_wacom-list-wacom.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -c -o gsd_list_wacom-list-wacom.obj `if test -f 'list-wacom.c'; then $(CYGPATH_W) 'list-wacom.c'; else $(CYGPATH_W) '$(srcdir)/list-wacom.c'; fi` + +gsd_list_wacom-gsd-wacom-device.o: gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -MT gsd_list_wacom-gsd-wacom-device.o -MD -MP -MF $(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Tpo -c -o gsd_list_wacom-gsd-wacom-device.o `test -f 'gsd-wacom-device.c' || echo '$(srcdir)/'`gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Tpo $(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-device.c' object='gsd_list_wacom-gsd-wacom-device.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -c -o gsd_list_wacom-gsd-wacom-device.o `test -f 'gsd-wacom-device.c' || echo '$(srcdir)/'`gsd-wacom-device.c + +gsd_list_wacom-gsd-wacom-device.obj: gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -MT gsd_list_wacom-gsd-wacom-device.obj -MD -MP -MF $(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Tpo -c -o gsd_list_wacom-gsd-wacom-device.obj `if test -f 'gsd-wacom-device.c'; then $(CYGPATH_W) 'gsd-wacom-device.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-device.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Tpo $(DEPDIR)/gsd_list_wacom-gsd-wacom-device.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-device.c' object='gsd_list_wacom-gsd-wacom-device.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_list_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_list_wacom_CFLAGS) $(CFLAGS) -c -o gsd_list_wacom-gsd-wacom-device.obj `if test -f 'gsd-wacom-device.c'; then $(CYGPATH_W) 'gsd-wacom-device.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-device.c'; fi` + +gsd_test_wacom-test-wacom.o: test-wacom.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -MT gsd_test_wacom-test-wacom.o -MD -MP -MF $(DEPDIR)/gsd_test_wacom-test-wacom.Tpo -c -o gsd_test_wacom-test-wacom.o `test -f 'test-wacom.c' || echo '$(srcdir)/'`test-wacom.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_wacom-test-wacom.Tpo $(DEPDIR)/gsd_test_wacom-test-wacom.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-wacom.c' object='gsd_test_wacom-test-wacom.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -c -o gsd_test_wacom-test-wacom.o `test -f 'test-wacom.c' || echo '$(srcdir)/'`test-wacom.c + +gsd_test_wacom-test-wacom.obj: test-wacom.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -MT gsd_test_wacom-test-wacom.obj -MD -MP -MF $(DEPDIR)/gsd_test_wacom-test-wacom.Tpo -c -o gsd_test_wacom-test-wacom.obj `if test -f 'test-wacom.c'; then $(CYGPATH_W) 'test-wacom.c'; else $(CYGPATH_W) '$(srcdir)/test-wacom.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_wacom-test-wacom.Tpo $(DEPDIR)/gsd_test_wacom-test-wacom.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-wacom.c' object='gsd_test_wacom-test-wacom.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -c -o gsd_test_wacom-test-wacom.obj `if test -f 'test-wacom.c'; then $(CYGPATH_W) 'test-wacom.c'; else $(CYGPATH_W) '$(srcdir)/test-wacom.c'; fi` + +gsd_test_wacom-gsd-wacom-manager.o: gsd-wacom-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -MT gsd_test_wacom-gsd-wacom-manager.o -MD -MP -MF $(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Tpo -c -o gsd_test_wacom-gsd-wacom-manager.o `test -f 'gsd-wacom-manager.c' || echo '$(srcdir)/'`gsd-wacom-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Tpo $(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-manager.c' object='gsd_test_wacom-gsd-wacom-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -c -o gsd_test_wacom-gsd-wacom-manager.o `test -f 'gsd-wacom-manager.c' || echo '$(srcdir)/'`gsd-wacom-manager.c + +gsd_test_wacom-gsd-wacom-manager.obj: gsd-wacom-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -MT gsd_test_wacom-gsd-wacom-manager.obj -MD -MP -MF $(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Tpo -c -o gsd_test_wacom-gsd-wacom-manager.obj `if test -f 'gsd-wacom-manager.c'; then $(CYGPATH_W) 'gsd-wacom-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-manager.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Tpo $(DEPDIR)/gsd_test_wacom-gsd-wacom-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-manager.c' object='gsd_test_wacom-gsd-wacom-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -c -o gsd_test_wacom-gsd-wacom-manager.obj `if test -f 'gsd-wacom-manager.c'; then $(CYGPATH_W) 'gsd-wacom-manager.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-manager.c'; fi` + +gsd_test_wacom-gsd-wacom-device.o: gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -MT gsd_test_wacom-gsd-wacom-device.o -MD -MP -MF $(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Tpo -c -o gsd_test_wacom-gsd-wacom-device.o `test -f 'gsd-wacom-device.c' || echo '$(srcdir)/'`gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Tpo $(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-device.c' object='gsd_test_wacom-gsd-wacom-device.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -c -o gsd_test_wacom-gsd-wacom-device.o `test -f 'gsd-wacom-device.c' || echo '$(srcdir)/'`gsd-wacom-device.c + +gsd_test_wacom-gsd-wacom-device.obj: gsd-wacom-device.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -MT gsd_test_wacom-gsd-wacom-device.obj -MD -MP -MF $(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Tpo -c -o gsd_test_wacom-gsd-wacom-device.obj `if test -f 'gsd-wacom-device.c'; then $(CYGPATH_W) 'gsd-wacom-device.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-device.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Tpo $(DEPDIR)/gsd_test_wacom-gsd-wacom-device.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-device.c' object='gsd_test_wacom-gsd-wacom-device.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(gsd_test_wacom_CPPFLAGS) $(CPPFLAGS) $(gsd_test_wacom_CFLAGS) $(CFLAGS) -c -o gsd_test_wacom-gsd-wacom-device.obj `if test -f 'gsd-wacom-device.c'; then $(CYGPATH_W) 'gsd-wacom-device.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-device.c'; fi` + +gsd_wacom_led_helper-gsd-wacom-led-helper.o: gsd-wacom-led-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_wacom_led_helper_CFLAGS) $(CFLAGS) -MT gsd_wacom_led_helper-gsd-wacom-led-helper.o -MD -MP -MF $(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Tpo -c -o gsd_wacom_led_helper-gsd-wacom-led-helper.o `test -f 'gsd-wacom-led-helper.c' || echo '$(srcdir)/'`gsd-wacom-led-helper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Tpo $(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-led-helper.c' object='gsd_wacom_led_helper-gsd-wacom-led-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_wacom_led_helper_CFLAGS) $(CFLAGS) -c -o gsd_wacom_led_helper-gsd-wacom-led-helper.o `test -f 'gsd-wacom-led-helper.c' || echo '$(srcdir)/'`gsd-wacom-led-helper.c + +gsd_wacom_led_helper-gsd-wacom-led-helper.obj: gsd-wacom-led-helper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_wacom_led_helper_CFLAGS) $(CFLAGS) -MT gsd_wacom_led_helper-gsd-wacom-led-helper.obj -MD -MP -MF $(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Tpo -c -o gsd_wacom_led_helper-gsd-wacom-led-helper.obj `if test -f 'gsd-wacom-led-helper.c'; then $(CYGPATH_W) 'gsd-wacom-led-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-led-helper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Tpo $(DEPDIR)/gsd_wacom_led_helper-gsd-wacom-led-helper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsd-wacom-led-helper.c' object='gsd_wacom_led_helper-gsd-wacom-led-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_wacom_led_helper_CFLAGS) $(CFLAGS) -c -o gsd_wacom_led_helper-gsd-wacom-led-helper.obj `if test -f 'gsd-wacom-led-helper.c'; then $(CYGPATH_W) 'gsd-wacom-led-helper.c'; else $(CYGPATH_W) '$(srcdir)/gsd-wacom-led-helper.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(plugindir)'; $(am__uninstall_files_from_dir) +install-polkit_policyDATA: $(polkit_policy_DATA) + @$(NORMAL_INSTALL) + @list='$(polkit_policy_DATA)'; test -n "$(polkit_policydir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(polkit_policydir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(polkit_policydir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(polkit_policydir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(polkit_policydir)" || exit $$?; \ + done + +uninstall-polkit_policyDATA: + @$(NORMAL_UNINSTALL) + @list='$(polkit_policy_DATA)'; test -n "$(polkit_policydir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(polkit_policydir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(polkit_policydir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pluginDATA install-pluginLTLIBRARIES \ + install-polkit_policyDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES uninstall-polkit_policyDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libexecPROGRAMS install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES install-polkit_policyDATA install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-libexecPROGRAMS uninstall-pluginDATA \ + uninstall-pluginLTLIBRARIES uninstall-polkit_policyDATA + + +org.gnome.settings-daemon.plugins.wacom.policy.in: org.gnome.settings-daemon.plugins.wacom.policy.in.in Makefile + $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ + +@INTLTOOL_POLICY_RULE@ + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/plugins/wacom/README.config-storage b/plugins/wacom/README.config-storage new file mode 100644 index 00000000..645865e4 --- /dev/null +++ b/plugins/wacom/README.config-storage @@ -0,0 +1,48 @@ +Configuration storage for Wacom tablets and styli + +Tablets +------- + +Configuration is stored on a per-device model basis, meaning that it's +possible to use the same device, with same configuration on 2 machines +with a shared home directory, or replace a malfunctioning device with the +same model and have the same configuration. + +It does not allow having 2 separate tablets of the same model to have different +configurations, whether on a single machine, or using a shared home directory. + +The configuration scheme is: +schema: org.gnome.settings-daemon.peripherals.wacom +path: /org/gnome/settings-daemon/peripherals/wacom/-/ + +where is the D-Bus machine-id for the machine, and + is a unique identifier for the tablet. + +Stylus +------ + +Styli use a similar configuration scheme. The identifier for each stylus +is the tool ID, for professional ranges, and a generic identifier for +the consumer ranges that do not support tool ID. + +schema: org.gnome.settings-daemon.peripherals.wacom.stylus +or: org.gnome.settings-daemon.peripherals.wacom.eraser + +path: /org/gnome/settings-daemon/peripherals/wacom/// + +So each tool can be configured per tablet (so the compatible airbrush stylus +will have different configurations on a Cintiq and an Intuos tablet) + +Buttons +------- + +schema: org.gnome.settings-daemon.peripherals.wacom.tablet-button +path: /org/gnome/settings-daemon/peripherals/wacom//