Commit 59511dfe authored by Alexander Larsson's avatar Alexander Larsson

Merge gio-branch

svn path=/trunk/; revision=1996
parent be3f4ab4
2007-11-29 Alexander Larsson <alexl@redhat.com>
* eel/eel-app-launch-context.c:
* eel/eel-vfs-extensions.c:
Update code to handle glib version of gio
2007-11-22 Alexander Larsson <alexl@redhat.com>
* eel/eel-string.c (handlers):
Make handlers static
2007-11-22 Alexander Larsson <alexl@redhat.com>
* eel/eel-string.[ch]:
Added eel_strdup_vprintf_with_custom and
eel_strdup_printf_with_custom
2007-11-06 Alexander Larsson <alexl@redhat.com>
* eel/eel-mount-operation.c:
Fix build for new gio
2007-11-06 Alexander Larsson <alexl@redhat.com>
* configure.in:
Look for libstartupnotify
* eel/Makefile.am:
* eel/eel-app-launch-context.[ch]:
Add EelAppLaunchContext
2007-11-02 Paolo Borelli <pborelli@katamail.com>
* eel/eel-string.c:
* eel/eel-string.h:
Remove two functions that were just used in eel-string-list.
2007-11-02 Paolo Borelli <pborelli@katamail.com>
* eel/eel-preferences-glade.c:
* eel/eel-gconf-extensions.c:
* eel/eel-preferences.c:
* eel/eel-preferences.h:
Introduce eel_preference_[get|set]_string_array and remove
all uses of eel-string-list.
* eel/eel-enumerations.c:
* eel/eel-enumerations.h:
Simplify implementation and API and avoid use of eel-string-list.
* eel/eel-string-list.c:
* eel/eel-string-list.h:
* eel/Makefile.am:
Remove eel-string-list.c
2007-11-02 Alexander Larsson <alexl@redhat.com>
* eel/eel-string.c (eel_str_middle_truncate):
Fix off by one bug
2007-11-01 Alexander Larsson <alexl@redhat.com>
* eel/eel-string.c:
Make eel_str_middle_truncate handle utf8 strings
correctly.
2007-10-24 Alexander Larsson <alexl@redhat.com>
* eel/eel-mount-operation.[ch]:
Add active_changed signal
2007-10-24 Alexander Larsson <alexl@redhat.com>
* eel/Makefile.am:
* eel/eel-mount-operation.[ch]:
Add GMountOperation version with gtk+ dialogs
2007-10-24 Alexander Larsson <alexl@redhat.com>
* eel/eel-gdk-pixbuf-extensions.[ch]:
* eel/eel-background.c:
Convert gnome_vfs use to gio
* configure.in:
* eel/check-program.c:
* test/test-eel-background.c:
* test/test.[ch]:
Remove dependencies on gnome-vfs, libgnomedesktop, etc
2007-10-24 Alexander Larsson <alexl@redhat.com>
* eel/eel-art-extensions.[ch]:
* eel/eel-enumeration.c:
* eel/eel-gdk-extensions.[ch]:
* eel/eel-glib-extensions.c:
* eel/eel-gtk-extensions.[ch]:
* eel/eel-pango-extensions.[ch]:
* eel/eel-self-checks.c:
* eel/eel-string-list.[ch]:
* eel/eel-string.[ch]:
Remove even more unused functions
2007-10-24 Alexander Larsson <alexl@redhat.com>
* eel/eel-editable-label.c:
* eel/eelmarshal.list:
Remove unused marshallers
2007-10-24 Alexander Larsson <alexl@redhat.com>
* eel/eel-art-extensions.[ch]:
* eel/eel-debug-drawing.c:
* eel/eel-gdk-extensions.[ch]:
* eel/eel-gdk-pixbuf-extensions.[ch]:
* eel/eel-glib-extensions.[ch]:
* eel/eel-lib-self-check-functions.h:
* test/Makefile.am:
* test/test-eel-gtk-style.c: Removed.
* test/test-eel-pixbuf-tile.c: Removed.
* test/test.c:
Remove unused functions
2007-10-23 Alexander Larsson <alexl@redhat.com>
* configure.in:
* eel/eel-art-extensions.[ch]:
* eel/eel-art-gtk-extensions.[ch]:
* eel/eel-background.c:
* eel/eel-debug-drawing.[ch]:
* eel/eel-gdk-pixbuf-extensions.[ch]:
* eel/eel-gnome-extensions.c:
* eel/eel-graphic-effects.c:
* eel/eel-gtk-container.[ch]:
* eel/eel-image-table.c:
* eel/eel-labeled-image.[ch]:
* eel/eel-self-checks.[ch]:
* eel/eel-wrap-table.c:
* test/test-eel-gtk-style.c:
* test/test-eel-pixbuf-tile.c:
* test/test.c:
Lift in the small amount of code and typedefs we
need from libart. Remove libart dependency.
2007-10-23 Alexander Larsson <alexl@redhat.com>
* eel/Makefile.am:
* eel/eel-dateedit-extensions.[ch]: Removed.
* eel/eel-gnome-extensions.[ch]:
* eel/eel.h:
Remove unneeded eel functions
2007-10-23 Alexander Larsson <alexl@redhat.com>
* eel/eel-lib-self-check-functions.h:
* eel/eel-vfs-extensions.[ch]:
Remove a bunch of unnecessary gnome-vfs functions
2007-10-11 Alexander Larsson <alexl@redhat.com>
* eel/eel-gdk-pixbuf-extensions.[ch]:
Added eel_gdk_pixbuf_load_from_stream
2007-10-01 Alexander Larsson <alexl@redhat.com>
* eel/Makefile.am:
* eel/eel-mime-application-chooser.[ch]:
* eel/eel-open-with-dialog.[ch]:
Move these to nautilus
2007-10-01 Alexander Larsson <alexl@redhat.com>
* eel/eel-mime-application-chooser.c:
* eel/eel-open-with-dialog.c:
Port more stuff to gio mimetype code
* eel/Makefile.am:
* eel/eel-mime-extensions.[ch]:
Remove unused code
2007-10-01 Alexander Larsson <alexl@redhat.com>
* configure.in:
Pull in gio when linking
* eel/eel-open-with-dialog.[ch]:
Update to use GAppInfo and gio APIs.
2007-09-26 Alexander Larsson <alexl@redhat.com>
* eel/eel-string.h:
Fix up macro definition.
It can't have a space before the param list
2007-09-26 Alexander Larsson <alexl@redhat.com>
* eel/eel-string.[ch];
Add eel_ref_str, a set of refcounted and optionally uniquified
string functions.
2007-09-26 Alexander Larsson <alexl@redhat.com>
* eel/eel-vfs-extensions.[ch]:
Remove more unused code
2007-09-26 Alexander Larsson <alexl@redhat.com>
* eel/eel-vfs-extensions.c:
Remove code not used by nautilus anymore
2007-11-28 Soren Sandmann <sandmann@redhat.com>
* configure.in: Require libgnomedesktop 2.21.3
......@@ -12,6 +221,17 @@
(eel_debug_show_pixbuf): unconstify parameter 1 to
unbreak the build on gcc 4.2
2007-09-18 Alexander Larsson <alexl@redhat.com>
* configure.in:
Add gio as extraversion
* eel/eel-gdk-pixbuf-extensions.c:
* eel/eel-vfs-extensions.[ch]:
Use goffset instead of GnomeVFSFileSize
=== gio-branch starts here ===
2007-09-18 Alexander Larsson <alexl@redhat.com>
* configure.in:
......
......@@ -2,27 +2,23 @@ AC_INIT(eel)
dnl ===========================================================================
ART_REQUIRED=2.3.8
GCONF_REQUIRED=1.1.11
GDK_PIXBUF_REQUIRED=2
GLIB_REQUIRED=2.6.0
GNOME_REQUIRED=2.0
GNOME_UI_REQUIRED=2.7.92
GNOME_VFS_REQUIRED=2.9.1
GTK_REQUIRED=2.9.4
XML_REQUIRED=2.4.7
GAIL_REQUIRED=0.16
LIBGLADE_REQUIRED=2.0.0
LIBGNOME_DESKTOP_REQUIRED=2.21.3
LIBGNOME_MENU_REQUIRED=2.13.5
STARTUP_NOTIFICATION_REQUIRED=0.8
AC_SUBST(ART_REQUIRED)
AC_SUBST(GCONF_REQUIRED)
AC_SUBST(GDK_PIXBUF_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
AC_SUBST(GNOME_REQUIRED)
AC_SUBST(GNOME_UI_REQUIRED)
AC_SUBST(GNOME_VFS_REQUIRED)
AC_SUBST(GTK_REQUIRED)
AC_SUBST(XML_REQUIRED)
AC_SUBST(GAIL_REQUIRED)
......@@ -35,9 +31,9 @@ EEL_MINOR_VERSION=20
EEL_MICRO_VERSION=1
# If you need a modifier for the version number.
# Normally empty, but can be used to make "fixup" releases.
LIBGNOMEVFS_EXTRAVERSION=
LIBEEL_EXTRAVERSION=gio
EEL_VERSION=$EEL_MAJOR_VERSION.$EEL_MINOR_VERSION.$EEL_MICRO_VERSION$LIBGNOMEVFS_EXTRAVERSION
EEL_VERSION=$EEL_MAJOR_VERSION.$EEL_MINOR_VERSION.$EEL_MICRO_VERSION$LIBEEL_EXTRAVERSION
EEL_VERSION_INFO=`expr $EEL_MAJOR_VERSION + $EEL_MINOR_VERSION`:$EEL_MICRO_VERSION:$EEL_MINOR_VERSION
AC_SUBST(EEL_MAJOR_VERSION)
......@@ -65,27 +61,43 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_C_CONST
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if $PKG_CONFIG --atleast-version $STARTUP_NOTIFICATION_REQUIRED libstartup-notification-1.0; then
echo "Building with libstartup-notification"
AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1,
[define to enable startup notification support])
with_startup_notification=yes
STARTUP_NOTIFICATION_PACKAGE=libstartup-notification-1.0
EXTRA_CORE_MODULES="$EXTRA_CORE_MODULES libstartup-notification-1.0"
else
echo "***** WARNING: Building without libstartup-notification"
with_startup_notification=no
STARTUP_NOTIFICATION_PACKAGE=
fi
AC_SUBST(STARTUP_NOTIFICATION_PACKAGE)
PKG_CHECK_MODULES(EEL, [
gail >= $GAIL_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED
gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED
glib-2.0 >= $GLIB_REQUIRED
gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED
gnome-vfs-module-2.0 >= $GNOME_VFS_REQUIRED
gio-2.0
gthread-2.0 >= $GLIB_REQUIRED
gtk+-2.0 >= $GTK_REQUIRED
libart-2.0 >= $ART_REQUIRED
libglade-2.0 >= $LIBGLADE_REQUIRED
libgnome-2.0 >= $GNOME_REQUIRED
libgnomeui-2.0 >= $GNOME_UI_REQUIRED
libxml-2.0 >= $XML_REQUIRED
libgnome-menu >= $LIBGNOME_MENU_REQUIRED
gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED
libxml-2.0 >= $XML_REQUIRED
$STARTUP_NOTIFICATION_PACKAGE
])
AC_SUBST(EEL_LIBS)
AC_SUBST(EEL_CFLAGS)
dnl ===========================================================================
dnl strftime checks
......
......@@ -41,7 +41,6 @@ libeel_2_la_SOURCES = \
eel-canvas.c \
eel-canvas-util.c \
eel-canvas-rect-ellipse.c \
eel-dateedit-extensions.c \
eel-debug-drawing.c \
eel-debug.c \
eel-editable-label.c \
......@@ -58,16 +57,14 @@ libeel_2_la_SOURCES = \
eel-i18n.c \
eel-image-table.c \
eel-labeled-image.c \
eel-mount-operation.c \
eel-app-launch-context.c \
eel-lib-self-check-functions.c \
eel-mime-application-chooser.c \
eel-mime-extensions.c \
eel-open-with-dialog.c \
eel-pango-extensions.c \
eel-preferences-glade.c \
eel-preferences.c \
eel-self-checks.c \
eel-stock-dialogs.c \
eel-string-list.c \
eel-string.c \
eel-types.c \
eel-vfs-extensions.c \
......@@ -88,7 +85,6 @@ eel_headers = \
eel-canvas.h \
eel-canvas-util.h \
eel-canvas-rect-ellipse.h \
eel-dateedit-extensions.h \
eel-debug-drawing.h \
eel-debug.h \
eel-editable-label.h \
......@@ -106,15 +102,13 @@ eel_headers = \
eel-i18n.h \
eel-image-table.h \
eel-labeled-image.h \
eel-mime-application-chooser.h \
eel-mime-extensions.h \
eel-open-with-dialog.h \
eel-mount-operation.h \
eel-app-launch-context.h \
eel-pango-extensions.h \
eel-preferences-glade.h \
eel-preferences.h \
eel-self-checks.h \
eel-stock-dialogs.h \
eel-string-list.h \
eel-string.h \
eel-types.h \
eel-vfs-extensions.h \
......
......@@ -31,7 +31,6 @@
#include <gdk/gdkrgb.h>
#include <gtk/gtkmain.h>
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomevfs/gnome-vfs-init.h>
#include <libxml/parser.h>
#include <stdlib.h>
......@@ -56,7 +55,6 @@ main (int argc, char *argv[])
eel_run_lib_self_checks ();
eel_exit_if_self_checks_failed ();
gnome_vfs_shutdown ();
eel_debug_shut_down ();
#endif /* !EEL_OMIT_SELF_CHECK */
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* eel-mount-operation.c - Gtk+ implementation for GAppLaunchContext
Copyright (C) 2007 Red Hat, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Alexander Larsson <alexl@redhat.com>
*/
#include <config.h>
#include "eel-i18n.h"
#include "eel-app-launch-context.h"
#include <gio/gfileicon.h>
#include <gio/gthemedicon.h>
#include <glib/gurifuncs.h>
#include <string.h>
#ifdef HAVE_STARTUP_NOTIFICATION
#define SN_API_NOT_YET_FROZEN
#include <libsn/sn.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtkmain.h>
#endif
G_DEFINE_TYPE (EelAppLaunchContext, eel_app_launch_context, G_TYPE_APP_LAUNCH_CONTEXT);
struct EelAppLaunchContextPrivate {
GdkDisplay *display;
GdkScreen *screen;
guint32 timestamp;
GIcon *icon;
char *icon_name;
};
static void
eel_app_launch_context_finalize (GObject *object)
{
EelAppLaunchContext *context;
EelAppLaunchContextPrivate *priv;
context = EEL_APP_LAUNCH_CONTEXT (object);
priv = context->priv;
if (priv->display) {
g_object_unref (priv->display);
}
if (priv->screen) {
g_object_unref (priv->screen);
}
if (priv->icon) {
g_object_unref (priv->screen);
}
g_free (priv->icon_name);
(*G_OBJECT_CLASS (eel_app_launch_context_parent_class)->finalize) (object);
}
static char *
get_display (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
{
GdkDisplay *display;
EelAppLaunchContextPrivate *priv;
priv = EEL_APP_LAUNCH_CONTEXT (context)->priv;
if (priv->screen) {
return gdk_screen_make_display_name (priv->screen);
}
if (priv->display) {
display = priv->display;
} else {
display = gdk_display_get_default ();
}
return g_strdup (gdk_display_get_name (display));
}
#ifdef HAVE_STARTUP_NOTIFICATION
static void
sn_error_trap_push (SnDisplay *display,
Display *xdisplay)
{
gdk_error_trap_push ();
}
static void
sn_error_trap_pop (SnDisplay *display,
Display *xdisplay)
{
gdk_error_trap_pop ();
}
static char *
get_display_name (GFile *file)
{
GFileInfo *info;
char *name, *tmp;
/* This does sync i/o, which isn't ideal.
* It should probably use the NautilusFile machinery
*/
name = NULL;
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STD_DISPLAY_NAME,
0, NULL, NULL);
if (info) {
name = g_strdup (g_file_info_get_display_name (info));
g_object_unref (info);
}
if (name == NULL) {
name = g_file_get_basename (file);
if (!g_utf8_validate (name, -1, NULL)) {
tmp = name;
name = g_uri_escape_string (name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
g_free (tmp);
}
}
return name;
}
static GIcon *
get_icon (GFile *file)
{
GFileInfo *info;
GIcon *icon;
icon = NULL;
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STD_ICON,
0, NULL, NULL);
if (info) {
icon = g_file_info_get_icon (info);
if (icon) {
g_object_ref (icon);
}
g_object_unref (info);
}
return icon;
}
static char *
gicon_to_string (GIcon *icon)
{
GFile *file;
const char * const *names;
if (G_IS_FILE_ICON (icon)) {
file = g_file_icon_get_file (G_FILE_ICON (icon));
if (file) {
return g_file_get_path (file);
}
} else if (G_IS_THEMED_ICON (icon)) {
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
if (names) {
return g_strdup (names[0]);
}
}
return NULL;
}
/* FIXME: This is the wrong way to do this; there should be some event
* (e.g. button press) available with a good time. A function like
* this should not be needed.
*/
static Time
slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
{
Window xwindow;
XEvent event;
{
XSetWindowAttributes attrs;
Atom atom_name;
Atom atom_type;
char* name;
attrs.override_redirect = True;
attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
xwindow =
XCreateWindow (xdisplay,
RootWindow (xdisplay, 0),
-100, -100, 1, 1,
0,
CopyFromParent,
CopyFromParent,
(Visual *)CopyFromParent,
CWOverrideRedirect | CWEventMask,
&attrs);
atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE);
g_assert (atom_name != None);
atom_type = XInternAtom (xdisplay, "STRING", TRUE);
g_assert (atom_type != None);
name = "Fake Window";
XChangeProperty (xdisplay,
xwindow, atom_name,
atom_type,
8, PropModeReplace, name, strlen (name));
}
XWindowEvent (xdisplay,
xwindow,
PropertyChangeMask,
&event);
XDestroyWindow(xdisplay, xwindow);
return event.xproperty.time;
}
/* This should be fairly long, as it's confusing to users if a startup
* ends when it shouldn't (it appears that the startup failed, and
* they have to relaunch the app). Also the timeout only matters when
* there are bugs and apps don't end their own startup sequence.
*
* This timeout is a "last resort" timeout that ignores whether the
* startup sequence has shown activity or not. Metacity and the
* tasklist have smarter, and correspondingly able-to-be-shorter
* timeouts. The reason our timeout is dumb is that we don't monitor
* the sequence (don't use an SnMonitorContext)
*/
#define STARTUP_TIMEOUT_LENGTH (30 /* seconds */ * 1000)
typedef struct
{
GSList *contexts;
guint timeout_id;
} StartupTimeoutData;
static void
free_startup_timeout (void *data)
{
StartupTimeoutData *std;
std = data;
g_slist_foreach (std->contexts,
(GFunc) sn_launcher_context_unref,
NULL);
g_slist_free (std->contexts);
if (std->timeout_id != 0) {
g_source_remove (std->timeout_id);
std->timeout_id = 0;
}
g_free (std);
}
static gboolean
startup_timeout (void *data)
{
StartupTimeoutData *std;
GSList *tmp;
GTimeVal now;
int min_timeout;
std = data;
min_timeout = STARTUP_TIMEOUT_LENGTH;
g_get_current_time (&now);
tmp = std->contexts;
while (tmp != NULL) {
SnLauncherContext *sn_context;
GSList *next;
long tv_sec, tv_usec;
double elapsed;
sn_context = tmp->data;
next = tmp->next;
sn_launcher_context_get_last_active_time (sn_context,
&tv_sec, &tv_usec);
elapsed =
((((double)now.tv_sec - tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - tv_usec))) / 1000.0;
if (elapsed >= STARTUP_TIMEOUT_LENGTH) {
std->contexts = g_slist_remove (std->contexts,
sn_context);
sn_launcher_context_complete (sn_context);
sn_launcher_context_unref (sn_context);
} else {
min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
}
tmp = next;
}
if (std->contexts == NULL) {
std->timeout_id = 0;
} else {
std->timeout_id = g_timeout_add (min_timeout,
startup_timeout,
std);
}
/* always remove this one, but we may have reinstalled another one. */
return FALSE;
}
static void
add_startup_timeout (GdkScreen *screen,
SnLauncherContext *sn_context)
{
StartupTimeoutData *data;
data = g_object_get_data (G_OBJECT (screen), "appinfo-startup-data");
if (data == NULL) {
data = g_new (StartupTimeoutData, 1);
data->contexts = NULL;
data->timeout_id = 0;
g_object_set_data_full (G_OBJECT (screen), "nautilus-startup-data",
data, free_startup_timeout);
}
sn_launcher_context_ref (sn_context);
data->contexts = g_slist_prepend (data->contexts, sn_context);
if (data->timeout_id == 0) {
data->timeout_id = g_timeout_add (STARTUP_TIMEOUT_LENGTH,
startup_timeout,
data);
}
}
#endif
static char *
get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
GList *files)