diff --git a/libslab/Makefile.am b/libslab/Makefile.am index 5f6c4b34d..d2ffe6a5c 100644 --- a/libslab/Makefile.am +++ b/libslab/Makefile.am @@ -1,16 +1,20 @@ INCLUDES = \ + -I$(top_srcdir) \ $(LIBSLAB_CFLAGS) \ $(WARN_CFLAGS) + HEADER_FILES= \ $(BUILT_SOURCES) \ app-resizer.h \ app-shell.h \ - app-shell-startup.h \ application-tile.h \ + bookmark-agent.h \ directory-tile.h \ document-tile.h \ + double-click-detector.h \ gnome-utils.h \ + libslab-utils.h \ nameplate-tile.h \ search-bar.h \ search-context-picker.h \ @@ -18,33 +22,23 @@ HEADER_FILES= \ shell-window.h \ slab-gnome-util.h \ slab-section.h \ + slab.h \ system-tile.h \ tile.h -if ENABLE_DYNAMIC_LIBSLAB lib_LTLIBRARIES = libslab.la -SOURCE_HEADER_FILES= -else -noinst_LTLIBRARIES = libslab.la -SOURCE_HEADER_FILES=$(HEADER_FILES) -endif libslab_la_SOURCES = \ - $(SOURCE_HEADER_FILES) \ $(MARSHAL_GENERATED) \ app-resizer.c \ app-shell.c \ - app-shell-startup.c \ application-tile.c \ - bookmark-agent.h \ bookmark-agent.c \ directory-tile.c \ document-tile.c \ double-click-detector.c \ - double-click-detector.h \ gnome-utils.c \ libslab-utils.c \ - libslab-utils.h \ nameplate-tile.c \ search-bar.c \ search-context-picker.c \ @@ -59,20 +53,13 @@ libslab_la_SOURCES = \ tile-action.c \ tile.c -if ENABLE_DYNAMIC_LIBSLAB -libslab_includedir = $(includedir)/slab +libslab_includedir = $(includedir)/libslab libslab_include_HEADERS = $(HEADER_FILES) -libslab_la_LDFLAGS = \ - -version-info $(LT_VERSION) -endif + +libslab_la_LDFLAGS = -version-info $(LT_VERSION) libslab_la_LIBADD = $(LIBSLAB_LIBS) -if ENABLE_DYNAMIC_LIBSLAB -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libslab.pc -endif - search-entry-watermark.h: search-entry-watermark.svg echo '#define SEARCH_ENTRY_WATERMARK_SVG "\' > $@; \ sed -e 's/"/\\"/g' -e 's/$$/\\/' -e 's/#000000/#%s/g' $< >> $@; \ @@ -103,5 +90,3 @@ CLEANFILES = \ EXTRA_DIST= \ search-entry-watermark.svg \ nld-marshal.list - --include $(top_srcdir)/git.mk diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c index 44f7b02ab..118406d37 100644 --- a/libslab/app-resizer.c +++ b/libslab/app-resizer.c @@ -24,8 +24,6 @@ #include "app-shell.h" #include "app-resizer.h" -static GtkLayoutClass *parent_class = NULL; - static void app_resizer_class_init (AppResizerClass *); static void app_resizer_init (AppResizer *); static void app_resizer_destroy (GtkObject *); @@ -34,39 +32,14 @@ static void app_resizer_size_allocate (GtkWidget * resizer, GtkAllocation * allo static gboolean app_resizer_paint_window (GtkWidget * widget, GdkEventExpose * event, AppShellData * app_data); -GType -app_resizer_get_type (void) -{ - static GType object_type = 0; +G_DEFINE_TYPE (AppResizer, app_resizer, GTK_TYPE_LAYOUT); - if (!object_type) - { - static const GTypeInfo object_info = { - sizeof (AppResizerClass), - NULL, - NULL, - (GClassInitFunc) app_resizer_class_init, - NULL, - NULL, - sizeof (AppResizer), - 0, - (GInstanceInitFunc) app_resizer_init - }; - - object_type = - g_type_register_static (GTK_TYPE_LAYOUT, "AppResizer", &object_info, 0); - } - - return object_type; -} static void app_resizer_class_init (AppResizerClass * klass) { GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (klass); - ((GtkObjectClass *) klass)->destroy = app_resizer_destroy; widget_class = GTK_WIDGET_CLASS (klass); @@ -225,8 +198,8 @@ app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation) if (first_time) { /* we are letting the first show be the "natural" size of the child widget so do nothing. */ - if (GTK_WIDGET_CLASS (parent_class)->size_allocate) - (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); + if (GTK_WIDGET_CLASS (app_resizer_parent_class)->size_allocate) + (*GTK_WIDGET_CLASS (app_resizer_parent_class)->size_allocate) (widget, allocation); first_time = FALSE; gtk_layout_set_size (GTK_LAYOUT (resizer), child->allocation.width, @@ -238,8 +211,8 @@ app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation) { GtkAllocation child_allocation; - if (GTK_WIDGET_CLASS (parent_class)->size_allocate) - (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); + if (GTK_WIDGET_CLASS (app_resizer_parent_class)->size_allocate) + (*GTK_WIDGET_CLASS (app_resizer_parent_class)->size_allocate) (widget, allocation); /* We want the message to center itself and only scroll if it's bigger than the available real size. */ child_allocation.x = 0; @@ -268,8 +241,8 @@ app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation) resizer->cur_num_cols = new_num_cols; } - if (GTK_WIDGET_CLASS (parent_class)->size_allocate) - (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); + if (GTK_WIDGET_CLASS (app_resizer_parent_class)->size_allocate) + (*GTK_WIDGET_CLASS (app_resizer_parent_class)->size_allocate) (widget, allocation); gtk_layout_set_size (GTK_LAYOUT (resizer), child->allocation.width, child->allocation.height); } diff --git a/libslab/app-resizer.h b/libslab/app-resizer.h index b84cfb931..690d7aedf 100644 --- a/libslab/app-resizer.h +++ b/libslab/app-resizer.h @@ -24,6 +24,8 @@ #include #include +#include + G_BEGIN_DECLS #define INITIAL_NUM_COLS 3 diff --git a/libslab/app-shell.c b/libslab/app-shell.c index c2a2ee2e1..2cf8e0269 100644 --- a/libslab/app-shell.c +++ b/libslab/app-shell.c @@ -18,14 +18,11 @@ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#undef GTK_DISABLE_DEPRECATED - #ifdef HAVE_CONFIG_H #include #endif #include -#include #include #include #include @@ -97,47 +94,48 @@ gboolean regenerate_categories (AppShellData * app_data); void hide_shell (AppShellData * app_data) { - gtk_window_get_position (GTK_WINDOW (app_data->main_gnome_app), - &app_data->main_gnome_app_window_x, &app_data->main_gnome_app_window_y); - /* printf("x:%d, y:%d\n", app_data->main_gnome_app_window_x, app_data->main_gnome_app_window_y); */ + gtk_window_get_position (GTK_WINDOW (app_data->main_app), + &app_data->main_app_window_x, &app_data->main_app_window_y); + /* printf("x:%d, y:%d\n", app_data->main_app_window_x, app_data->main_app_window_y); */ /* clear the search bar now so reshowing is fast and flicker free - BNC#283186 */ application_launcher_clear_search_bar (app_data); - gtk_widget_hide (app_data->main_gnome_app); + gtk_widget_hide (app_data->main_app); } void show_shell (AppShellData * app_data) { - gtk_widget_show_all (app_data->main_gnome_app); + gtk_widget_show_all (app_data->main_app); if (!app_data->static_actions) gtk_widget_hide_all (app_data->actions_section); /* don't show unless a launcher is selected */ - if (app_data->main_gnome_app_window_shown_once) - gtk_window_move (GTK_WINDOW (app_data->main_gnome_app), - app_data->main_gnome_app_window_x, app_data->main_gnome_app_window_y); + if (app_data->main_app_window_shown_once) + gtk_window_move (GTK_WINDOW (app_data->main_app), + app_data->main_app_window_x, app_data->main_app_window_y); /* if this is the first time shown, need to clear this handler */ else shell_window_clear_resize_handler (SHELL_WINDOW (app_data->shell)); - app_data->main_gnome_app_window_shown_once = TRUE; + app_data->main_app_window_shown_once = TRUE; } gboolean create_main_window (AppShellData * app_data, const gchar * app_name, const gchar * title, const gchar * window_icon, gint width, gint height, gboolean hidden) { - GtkWidget *main_app = gnome_app_new (app_name, title); - app_data->main_gnome_app = main_app; + GtkWidget *main_app = gtk_window_new (GTK_WINDOW_TOPLEVEL); + app_data->main_app = main_app; gtk_widget_set_name (main_app, app_name); + gtk_window_set_title (GTK_WINDOW (main_app), title); /* gtk_window_set_default_size(GTK_WINDOW(main_app), width, height); */ gtk_window_set_icon_name (GTK_WINDOW (main_app), window_icon); - gnome_app_set_contents (GNOME_APP (main_app), app_data->shell); + gtk_container_add (GTK_CONTAINER (main_app), app_data->shell); g_signal_connect (main_app, "delete-event", G_CALLBACK (main_delete_callback), app_data); g_signal_connect (main_app, "key-press-event", G_CALLBACK (main_keypress_callback), app_data); - gtk_window_set_position (GTK_WINDOW (app_data->main_gnome_app), GTK_WIN_POS_CENTER); + gtk_window_set_position (GTK_WINDOW (app_data->main_app), GTK_WIN_POS_CENTER); if (!hidden) show_shell (app_data); gtk_main (); diff --git a/libslab/app-shell.h b/libslab/app-shell.h index 2add23095..0be9a8bef 100644 --- a/libslab/app-shell.h +++ b/libslab/app-shell.h @@ -25,9 +25,10 @@ #include #define GMENU_I_KNOW_THIS_IS_UNSTABLE #include +#include -#include "slab-section.h" -#include "tile.h" +#include +#include G_BEGIN_DECLS @@ -54,10 +55,10 @@ typedef struct typedef struct _AppShellData { - GtkWidget *main_gnome_app; - gint main_gnome_app_window_x; - gint main_gnome_app_window_y; - gboolean main_gnome_app_window_shown_once; + GtkWidget *main_app; + gint main_app_window_x; + gint main_app_window_y; + gboolean main_app_window_shown_once; GtkWidget *shell; GtkWidget *groups_section; diff --git a/libslab/application-tile.c b/libslab/application-tile.c index 5b9449728..bc82f3e10 100644 --- a/libslab/application-tile.c +++ b/libslab/application-tile.c @@ -19,10 +19,11 @@ */ #include "application-tile.h" +#include "config.h" #include #include -#include +#include #include #include #include diff --git a/libslab/application-tile.h b/libslab/application-tile.h index 57a97d956..6df049f97 100644 --- a/libslab/application-tile.h +++ b/libslab/application-tile.h @@ -21,7 +21,7 @@ #ifndef __APPLICATION_TILE_H__ #define __APPLICATION_TILE_H__ -#include "nameplate-tile.h" +#include #include diff --git a/libslab/bookmark-agent.c b/libslab/bookmark-agent.c index 9bd4bd2d4..bdd418a76 100644 --- a/libslab/bookmark-agent.c +++ b/libslab/bookmark-agent.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/libslab/directory-tile.c b/libslab/directory-tile.c index cb4b7d94e..6d94aef4a 100644 --- a/libslab/directory-tile.c +++ b/libslab/directory-tile.c @@ -19,8 +19,9 @@ */ #include "directory-tile.h" +#include "config.h" -#include +#include #include #include #include diff --git a/libslab/directory-tile.h b/libslab/directory-tile.h index d6ef0d521..9c730fc57 100644 --- a/libslab/directory-tile.h +++ b/libslab/directory-tile.h @@ -23,7 +23,7 @@ #include -#include "nameplate-tile.h" +#include G_BEGIN_DECLS diff --git a/libslab/document-tile.c b/libslab/document-tile.c index d5b667342..3592ffebd 100644 --- a/libslab/document-tile.c +++ b/libslab/document-tile.c @@ -19,8 +19,9 @@ */ #include "document-tile.h" +#include "config.h" -#include +#include #include #include @@ -436,7 +437,7 @@ load_image (DocumentTile *tile) g_object_get (icon, "name", &icon_id, NULL); g_object_unref (icon); - } + } exit: diff --git a/libslab/double-click-detector.c b/libslab/double-click-detector.c index df773511b..64ed58e81 100644 --- a/libslab/double-click-detector.c +++ b/libslab/double-click-detector.c @@ -24,43 +24,11 @@ #include "libslab-utils.h" -static void double_click_detector_class_init (DoubleClickDetectorClass *); -static void double_click_detector_init (DoubleClickDetector *); -static void double_click_detector_dispose (GObject *); - -GType -double_click_detector_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = { - sizeof (DoubleClickDetectorClass), - NULL, - NULL, - (GClassInitFunc) double_click_detector_class_init, - NULL, - NULL, - sizeof (DoubleClickDetector), - 0, - (GInstanceInitFunc) double_click_detector_init - }; - - object_type = - g_type_register_static (G_TYPE_OBJECT, "DoubleClickDetector", &object_info, - 0); - } - - return object_type; -} +G_DEFINE_TYPE (DoubleClickDetector, double_click_detector, G_TYPE_OBJECT); static void double_click_detector_class_init (DoubleClickDetectorClass * detector_class) { - GObjectClass *g_obj_class = (GObjectClass *) detector_class; - - g_obj_class->dispose = double_click_detector_dispose; } static void @@ -83,11 +51,6 @@ double_click_detector_new () return g_object_new (DOUBLE_CLICK_DETECTOR_TYPE, NULL); } -static void -double_click_detector_dispose (GObject * obj) -{ -} - gboolean double_click_detector_is_double_click (DoubleClickDetector *this, guint32 event_time, gboolean auto_update) diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c index 3fd023720..3a2d50b1f 100644 --- a/libslab/libslab-utils.c +++ b/libslab/libslab-utils.c @@ -12,6 +12,7 @@ #include #include #include +#include #define DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG "TerminalEmulator" #define ALTERNATE_DOCPATH_KEY "DocPath" @@ -179,6 +180,29 @@ libslab_gnome_desktop_item_get_docpath (GnomeDesktopItem *item) return path; } +/* Ugh, here we don't have knowledge of the screen that is being used. So, do + * what we can to find it. + */ +GdkScreen * +libslab_get_current_screen (void) +{ + GdkEvent *event; + GdkScreen *screen = NULL; + + event = gtk_get_current_event (); + if (event) { + if (event->any.window) + screen = gdk_drawable_get_screen (GDK_DRAWABLE (event->any.window)); + + gdk_event_free (event); + } + + if (!screen) + screen = gdk_screen_get_default (); + + return screen; +} + gboolean libslab_gnome_desktop_item_open_help (GnomeDesktopItem *item) { @@ -198,9 +222,7 @@ libslab_gnome_desktop_item_open_help (GnomeDesktopItem *item) if (doc_path) { help_uri = g_strdup_printf ("ghelp:%s", doc_path); - gtk_show_uri (NULL, help_uri, gtk_get_current_event_time (), &error); - - if (error) { + if (!gtk_show_uri (libslab_get_current_screen (), help_uri, gtk_get_current_event_time (), &error)) { g_warning ("error opening %s [%s]\n", help_uri, error->message); g_error_free (error); diff --git a/libslab/libslab-utils.h b/libslab/libslab-utils.h index 8d414cb78..322a00ad1 100644 --- a/libslab/libslab-utils.h +++ b/libslab/libslab-utils.h @@ -29,6 +29,8 @@ gboolean libslab_desktop_item_is_lockscreen (const gchar *uri); gchar *libslab_string_replace_once (const gchar *string, const gchar *key, const gchar *value); void libslab_spawn_command (const gchar *cmd); +GdkScreen *libslab_get_current_screen (void); + void libslab_thumbnail_factory_preinit (void); GnomeDesktopThumbnailFactory *libslab_thumbnail_factory_get (void); diff --git a/libslab/nameplate-tile.c b/libslab/nameplate-tile.c index 3ea5f3eec..f3f45165a 100644 --- a/libslab/nameplate-tile.c +++ b/libslab/nameplate-tile.c @@ -122,7 +122,6 @@ static void nameplate_tile_get_property (GObject * g_object, guint prop_id, GValue * value, GParamSpec * param_spec) { - char *tooltip; NameplateTile *np_tile = NAMEPLATE_TILE (g_object); switch (prop_id) diff --git a/libslab/nameplate-tile.h b/libslab/nameplate-tile.h index c0b8c54b2..f6b338b8f 100644 --- a/libslab/nameplate-tile.h +++ b/libslab/nameplate-tile.h @@ -21,7 +21,7 @@ #ifndef __NAMEPLATE_TILE_H__ #define __NAMEPLATE_TILE_H__ -#include "tile.h" +#include #include diff --git a/libslab/search-bar.c b/libslab/search-bar.c index a15ff2165..8e3f465b2 100644 --- a/libslab/search-bar.c +++ b/libslab/search-bar.c @@ -19,12 +19,13 @@ */ #include "search-bar.h" +#include "config.h" + #include "search-entry.h" #include "search-context-picker.h" #include "nld-marshal.h" -#include -#include +#include typedef struct { diff --git a/libslab/shell-window.c b/libslab/shell-window.c index d7fd6d1d3..52022293d 100644 --- a/libslab/shell-window.c +++ b/libslab/shell-window.c @@ -24,8 +24,6 @@ #include "app-resizer.h" -static GtkWindowClass *parent_class = NULL; - static void shell_window_class_init (ShellWindowClass *); static void shell_window_init (ShellWindow *); static void shell_window_destroy (GtkObject *); @@ -36,38 +34,11 @@ gboolean shell_window_paint_window (GtkWidget * widget, GdkEventExpose * event, #define SHELL_WINDOW_BORDER_WIDTH 6 -GType -shell_window_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = { - sizeof (ShellWindowClass), - NULL, - NULL, - (GClassInitFunc) shell_window_class_init, - NULL, - NULL, - sizeof (ShellWindow), - 0, - (GInstanceInitFunc) shell_window_init - }; - - object_type = g_type_register_static ( - GTK_TYPE_FRAME, "ShellWindow", &object_info, 0); - } - - return object_type; -} +G_DEFINE_TYPE (ShellWindow, shell_window, GTK_TYPE_FRAME); static void shell_window_class_init (ShellWindowClass * klass) { - parent_class = g_type_class_peek_parent (klass); - - ((GtkObjectClass *) klass)->destroy = shell_window_destroy; } static void @@ -98,11 +69,6 @@ shell_window_new (AppShellData * app_data) return GTK_WIDGET (window); } -static void -shell_window_destroy (GtkObject * obj) -{ -} - void shell_window_clear_resize_handler (ShellWindow * win) { diff --git a/libslab/shell-window.h b/libslab/shell-window.h index 88c1b1aee..54124c0e7 100644 --- a/libslab/shell-window.h +++ b/libslab/shell-window.h @@ -24,7 +24,8 @@ #include #include #include -#include "app-shell.h" + +#include G_BEGIN_DECLS diff --git a/libslab/slab-gnome-util.c b/libslab/slab-gnome-util.c index cf588784b..a22d51408 100644 --- a/libslab/slab-gnome-util.c +++ b/libslab/slab-gnome-util.c @@ -19,6 +19,7 @@ */ #include "slab-gnome-util.h" +#include "libslab-utils.h" #include #include @@ -275,10 +276,7 @@ open_desktop_item_help (GnomeDesktopItem * desktop_item) help_uri = g_strdup_printf ("ghelp:%s", doc_path); error = NULL; - - gtk_show_uri (NULL, help_uri, gtk_get_current_event_time (), &error); - - if (error) + if (!gtk_show_uri (libslab_get_current_screen (), help_uri, gtk_get_current_event_time (), &error)) { g_warning ("error opening %s [%s]\n", help_uri, error->message); diff --git a/libslab/slab-section.c b/libslab/slab-section.c index bb5d25ac5..6fbf70063 100644 --- a/libslab/slab-section.c +++ b/libslab/slab-section.c @@ -20,8 +20,6 @@ #include "slab-section.h" -#include - G_DEFINE_TYPE (SlabSection, slab_section, GTK_TYPE_VBOX) static void slab_section_finalize (GObject *); diff --git a/libslab/slab.h b/libslab/slab.h new file mode 100644 index 000000000..b550fc761 --- /dev/null +++ b/libslab/slab.h @@ -0,0 +1,45 @@ +/* + * This file is part of libslab. + * + * Copyright (c) 2006 Novell, Inc. + * + * Libslab 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. + * + * Libslab 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 libslab; if not, write to the Free Software Foundation, Inc., 51 + * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef __SLAB_H__ +#define __SLAB_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* __SLAB_H__ */ + diff --git a/libslab/system-tile.c b/libslab/system-tile.c index 6ab5b22a0..f5915a033 100644 --- a/libslab/system-tile.c +++ b/libslab/system-tile.c @@ -19,10 +19,10 @@ */ #include "system-tile.h" +#include "config.h" #include -#include -#include +#include #include #include "bookmark-agent.h" diff --git a/libslab/system-tile.h b/libslab/system-tile.h index 270a7a128..40ee87e6d 100644 --- a/libslab/system-tile.h +++ b/libslab/system-tile.h @@ -21,7 +21,7 @@ #ifndef __SYSTEM_TILE_H__ #define __SYSTEM_TILE_H__ -#include "nameplate-tile.h" +#include #include