diff options
-rw-r--r-- | libmdock/mdock-item.c | 63 | ||||
-rw-r--r-- | libmdock/mdock-item.h | 12 | ||||
-rw-r--r-- | libmdock/mdock-widget.c | 3 | ||||
-rw-r--r-- | libmdock/thumbnailer.c | 4 |
4 files changed, 17 insertions, 65 deletions
diff --git a/libmdock/mdock-item.c b/libmdock/mdock-item.c index 9a0572b..2c9a836 100644 --- a/libmdock/mdock-item.c +++ b/libmdock/mdock-item.c @@ -25,12 +25,14 @@ struct _MDockItemPrivate { - MDockItemType type; + gboolean pinned; GDesktopAppInfo *appinfo; guint icon_size; GdkPixbuf *icon; GList *windows; + WnckWindow *last_active; + GtkMenu *menu; GtkImageMenuItem *menu_close_all; GtkImageMenuItem *menu_pin; @@ -41,7 +43,6 @@ G_DEFINE_TYPE (MDockItem, mdock_item, GTK_TYPE_WIDGET) enum { PROP_0, - PROP_TYPE, PROP_DESKTOP_APP_INFO, PROP_ICON_SIZE, N_PROPERTIES @@ -239,15 +240,8 @@ static gboolean mdock_item_expose(GtkWidget *widget, GdkEventExpose *event) cairo_t *cr = gdk_cairo_create(widget->window); if (self->priv->icon) { - if (self->priv->windows) { - GdkPixmap *pix = thumbnailer_get_thumbnail(self->priv->windows->data); - if (pix) { - gdk_cairo_set_source_pixmap(cr, pix, 0, 0); - cairo_paint(cr); - } - } - //gdk_cairo_set_source_pixbuf(cr, self->priv->icon, 0, 0); - //cairo_paint(cr); + gdk_cairo_set_source_pixbuf(cr, self->priv->icon, 0, 0); + cairo_paint(cr); } cairo_destroy(cr); @@ -262,10 +256,6 @@ static void mdock_item_set_property(GObject *object, { MDockItem *self = MDOCK_ITEM(object); switch (property_id) { - case PROP_TYPE: - self->priv->type = g_value_get_enum(value); - mdock_item_update_icon(self); - break; case PROP_DESKTOP_APP_INFO: self->priv->appinfo = g_value_dup_object(value); mdock_item_update_icon(self); @@ -289,9 +279,6 @@ static void mdock_item_get_property(GObject *object, { MDockItem *self = MDOCK_ITEM(object); switch (property_id) { - case PROP_TYPE: - g_value_set_enum(value, self->priv->type); - break; case PROP_DESKTOP_APP_INFO: g_value_set_object(value, self->priv->appinfo); break; @@ -326,7 +313,7 @@ static void mdock_item_finalize(GObject *object) static void mdock_item_init(MDockItem *self) { self->priv = MDOCK_ITEM_GET_PRIVATE (self); - self->priv->type = MDOCK_ITEM_TYPE_APPLICATION; + self->priv->pinned = FALSE; self->priv->icon_size = 48; gtk_widget_add_events(GTK_WIDGET(self), GDK_BUTTON_PRESS_MASK); @@ -364,13 +351,6 @@ mdock_item_class_init(MDockItemClass *klass) widget_class->button_press_event = mdock_item_button_press; widget_class->expose_event = mdock_item_expose; - obj_properties[PROP_TYPE] = g_param_spec_enum("type", - "Type of this dock item", - "Set the type of this dock item", - M_TYPE_DOCK_ITEM_TYPE, - MDOCK_ITEM_TYPE_APPLICATION, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - obj_properties[PROP_DESKTOP_APP_INFO] = g_param_spec_object("desktop-app-info", "The GDesktopAppInfo this application or launcher refers to", "Set the GDesktopAppInfo this application or launcher refers to", @@ -389,19 +369,9 @@ mdock_item_class_init(MDockItemClass *klass) g_type_class_add_private (obj_class, sizeof (MDockItemPrivate)); } -MDockItem *mdock_item_new(MDockItemType type) +MDockItem *mdock_item_new() { - return g_object_new(MDOCK_TYPE_ITEM, "type", type, NULL); -} - -MDockItemType mdock_item_get_item_type(MDockItem *self) -{ - return self->priv->type; -} - -void mdock_item_set_item_type(MDockItem *self, MDockItemType type) -{ - g_object_set(self, "type", type, NULL); + return g_object_new(MDOCK_TYPE_ITEM, NULL); } GDesktopAppInfo *mdock_item_get_desktop_app_info(MDockItem *self) @@ -430,24 +400,17 @@ void mdock_item_add_window(MDockItem *self, WnckWindow *window) void mdock_item_remove_window(MDockItem *self, WnckWindow *window) { self->priv->windows = g_list_remove(self->priv->windows, window); + if (self->priv->last_active == window) { + self->priv->last_active = NULL; + } mdock_item_update_menu(self); } void mdock_item_set_last_active_window(MDockItem *self, WnckWindow *window) { -#if 0 /* Reorder the list of windows; put most recently used windows first. */ - GList *l = g_list_find(self->priv->windows, window); - g_return_if_fail(l != NULL); - - if (self->priv->windows == l) { - return; - } - - self->priv->windows = g_list_remove_link(self->priv->windows, l); - self->priv->windows = g_list_concat(l, self->priv->windows); -#endif + g_return_if_fail(g_list_find(self->priv->windows, window)); + self->priv->last_active = window; thumbnailer_update_thumbnail(window); - gtk_widget_queue_draw(GTK_WIDGET(self)); } gint mdock_item_get_num_windows(MDockItem *self) diff --git a/libmdock/mdock-item.h b/libmdock/mdock-item.h index 619f2c8..9876ce8 100644 --- a/libmdock/mdock-item.h +++ b/libmdock/mdock-item.h @@ -39,13 +39,6 @@ typedef struct _MDockItem MDockItem; typedef struct _MDockItemClass MDockItemClass; typedef struct _MDockItemPrivate MDockItemPrivate; -typedef enum { - MDOCK_ITEM_TYPE_APPLICATION, - MDOCK_ITEM_TYPE_LAUNCHER, - MDOCK_ITEM_TYPE_SEPARATOR, - MDOCK_ITEM_TYPE_MINIMIZED_WINDOW -} MDockItemType; - struct _MDockItem { GtkWidget parent; @@ -57,10 +50,7 @@ struct _MDockItemClass { }; GType mdock_item_get_type(void) G_GNUC_CONST; -MDockItem *mdock_item_new(MDockItemType type); - -MDockItemType mdock_item_get_item_type(MDockItem *self); -void mdock_item_set_item_type(MDockItem *self, MDockItemType type); +MDockItem *mdock_item_new(); GDesktopAppInfo *mdock_item_get_desktop_app_info(MDockItem *self); void mdock_item_set_desktop_app_info(MDockItem *self, GDesktopAppInfo *app_info); diff --git a/libmdock/mdock-widget.c b/libmdock/mdock-widget.c index 81e492d..27f8f50 100644 --- a/libmdock/mdock-widget.c +++ b/libmdock/mdock-widget.c @@ -113,7 +113,7 @@ static void handle_window_opened(MDockWidget *self, WnckWindow *window, WnckScre } } - MDockItem *item = mdock_item_new(MDOCK_ITEM_TYPE_APPLICATION); + MDockItem *item = mdock_item_new(); iter = g_sequence_append(self->priv->items, item); if (desktopid) { GDesktopAppInfo *app_info = g_desktop_app_info_new(desktopid); @@ -124,7 +124,6 @@ static void handle_window_opened(MDockWidget *self, WnckWindow *window, WnckScre g_settings_bind(self->priv->settings, "icon-size", item, "icon-size", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY); - g_settings_set_uint(self->priv->settings, "icon-size", 128); mdock_item_add_window(item, window); diff --git a/libmdock/thumbnailer.c b/libmdock/thumbnailer.c index 774d04c..c2adc0f 100644 --- a/libmdock/thumbnailer.c +++ b/libmdock/thumbnailer.c @@ -20,8 +20,8 @@ #include <gdk/gdkx.h> #include "thumbnailer.h" -#define THUMBNAIL_MAX_WIDTH 128 -#define THUMBNAIL_MAX_HEIGHT 128 +#define THUMBNAIL_MAX_WIDTH 256 +#define THUMBNAIL_MAX_HEIGHT 256 typedef struct _ThumbnailData { |