summaryrefslogtreecommitdiff
path: root/libmdock
diff options
context:
space:
mode:
Diffstat (limited to 'libmdock')
-rw-r--r--libmdock/Makefile.am2
-rw-r--r--libmdock/mdock-item-menu.c2
-rw-r--r--libmdock/mdock-item-window-list.c56
-rw-r--r--libmdock/mdock-item-window-list.h55
-rw-r--r--libmdock/mdock-item-window-selector.c118
-rw-r--r--libmdock/mdock-item-window-selector.h54
-rw-r--r--libmdock/mdock-item.c4
-rw-r--r--libmdock/mdock-widget.c8
8 files changed, 182 insertions, 117 deletions
diff --git a/libmdock/Makefile.am b/libmdock/Makefile.am
index 421f656..023ed49 100644
--- a/libmdock/Makefile.am
+++ b/libmdock/Makefile.am
@@ -1,5 +1,5 @@
lib_LTLIBRARIES = libmdock.la
-libmdock_la_SOURCES = mdock-widget.h mdock-widget.c mdock-enums.h mdock-enums.c mdock-item.h mdock-item.c mdock-item-menu.c mdock-item-menu.h mdock-item-window-list.c mdock-item-window-list.h matcher.h matcher.c app-id.h app-id.c thumbnailer.h thumbnailer.c
+libmdock_la_SOURCES = mdock-widget.h mdock-widget.c mdock-enums.h mdock-enums.c mdock-item.h mdock-item.c mdock-item-menu.c mdock-item-menu.h mdock-item-window-selector.c mdock-item-window-selector.h matcher.h matcher.c app-id.h app-id.c thumbnailer.h thumbnailer.c
libmdock_la_CPPFLAGS = $(GTK_CFLAGS) $(GIO_CFLAGS) $(WNCK_CFLAGS) $(GTOP_CFLAGS) -D_GNU_SOURCE -DG_LOG_DOMAIN=\"libmdock\"
libmdock_la_LIBADD = $(GTK_LIBS) $(GIO_LIBS) $(WNCK_LIBS) $(GTOP_LIBS)
diff --git a/libmdock/mdock-item-menu.c b/libmdock/mdock-item-menu.c
index e5e60fc..3138c86 100644
--- a/libmdock/mdock-item-menu.c
+++ b/libmdock/mdock-item-menu.c
@@ -120,6 +120,8 @@ mdock_item_menu_constructed(GObject *object)
{
MDockItemMenu *self = MDOCK_ITEM_MENU(object);
+ G_OBJECT_CLASS(mdock_item_menu_parent_class)->constructed(object);
+
g_signal_connect_object(self->priv->menu_close_all, "activate",
G_CALLBACK(mdock_item_close_all_windows), self->item,
G_CONNECT_SWAPPED);
diff --git a/libmdock/mdock-item-window-list.c b/libmdock/mdock-item-window-list.c
deleted file mode 100644
index ebaedd3..0000000
--- a/libmdock/mdock-item-window-list.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2015 Javier S. Pedro <dev.git@javispedro.com>
- *
- * This file is part of MDock.
- *
- * MDock 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.
- *
- * MDock is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MDock. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "mdock-item-window-list.h"
-
-#define MDOCK_ITEM_WINDOW_LIST_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), MDOCK_TYPE_ITEM_WINDOW_LIST, MDockItemWindowListPrivate))
-
-struct _MDockItemWindowListPrivate
-{
-};
-
-G_DEFINE_TYPE (MDockItemWindowList, mdock_item_window_list, GTK_TYPE_WINDOW)
-
-static void
-mdock_item_window_list_finalize (GObject *object)
-{
- G_OBJECT_CLASS (mdock_item_window_list_parent_class)->finalize (object);
-}
-
-static void
-mdock_item_window_list_class_init (MDockItemWindowListClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = mdock_item_window_list_finalize;
-
- g_type_class_add_private (object_class, sizeof (MDockItemWindowListPrivate));
-}
-
-static void
-mdock_item_window_list_init (MDockItemWindowList *self)
-{
- self->priv = MDOCK_ITEM_WINDOW_LIST_GET_PRIVATE (self);
-}
-
-MDockItemWindowList *
-mdock_item_window_list_new ()
-{
- return g_object_new (MDOCK_TYPE_ITEM_WINDOW_LIST, NULL);
-}
diff --git a/libmdock/mdock-item-window-list.h b/libmdock/mdock-item-window-list.h
deleted file mode 100644
index b353c46..0000000
--- a/libmdock/mdock-item-window-list.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2015 Javier S. Pedro <dev.git@javispedro.com>
- *
- * This file is part of MDock.
- *
- * MDock 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.
- *
- * MDock is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MDock. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __MDOCK_ITEM_WINDOW_LIST_H__
-#define __MDOCK_ITEM_WINDOW_LIST_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define MDOCK_TYPE_ITEM_WINDOW_LIST (mdock_item_window_list_get_type ())
-#define MDOCK_ITEM_WINDOW_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MDOCK_TYPE_ITEM_WINDOW_LIST, MdockItemWindowList))
-#define MDOCK_ITEM_WINDOW_LIST_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MDOCK_TYPE_ITEM_WINDOW_LIST, MdockItemWindowList const))
-#define MDOCK_ITEM_WINDOW_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MDOCK_TYPE_ITEM_WINDOW_LIST, MdockItemWindowListClass))
-#define MDOCK_IS_ITEM_WINDOW_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MDOCK_TYPE_ITEM_WINDOW_LIST))
-#define MDOCK_IS_ITEM_WINDOW_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MDOCK_TYPE_ITEM_WINDOW_LIST))
-#define MDOCK_ITEM_WINDOW_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MDOCK_TYPE_ITEM_WINDOW_LIST, MdockItemWindowListClass))
-
-typedef struct _MDockItemWindowList MDockItemWindowList;
-typedef struct _MDockItemWindowListClass MDockItemWindowListClass;
-typedef struct _MDockItemWindowListPrivate MDockItemWindowListPrivate;
-
-struct _MDockItemWindowList {
- GtkWindow parent;
-
- MDockItemWindowListPrivate *priv;
-};
-
-struct _MDockItemWindowListClass {
- GtkWindowClass parent_class;
-};
-
-GType mdock_item_window_list_get_type (void) G_GNUC_CONST;
-MDockItemWindowList *mdock_item_window_list_new (void);
-
-
-G_END_DECLS
-
-#endif /* __MDOCK_ITEM_WINDOW_LIST_H__ */
diff --git a/libmdock/mdock-item-window-selector.c b/libmdock/mdock-item-window-selector.c
new file mode 100644
index 0000000..c7df718
--- /dev/null
+++ b/libmdock/mdock-item-window-selector.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2015 Javier S. Pedro <dev.git@javispedro.com>
+ *
+ * This file is part of MDock.
+ *
+ * MDock 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.
+ *
+ * MDock is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with MDock. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mdock-item-window-selector.h"
+
+#define MDOCK_ITEM_WINDOW_SELECTOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), MDOCK_TYPE_ITEM_WINDOW_SELECTOR, MDockItemWindowSelectorPrivate))
+
+struct _MDockItemWindowSelectorPrivate
+{
+ GList *temp;
+};
+
+G_DEFINE_TYPE (MDockItemWindowSelector, mdock_item_window_selector, GTK_TYPE_WINDOW)
+
+enum {
+ PROP_0,
+ PROP_ITEM,
+ N_PROPERTIES
+};
+
+static GParamSpec *obj_properties[N_PROPERTIES] = { NULL };
+
+static void mdock_item_window_selector_set_property(GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ MDockItemWindowSelector *self = MDOCK_ITEM_WINDOW_SELECTOR(object);
+ switch (property_id) {
+ case PROP_ITEM:
+ g_clear_object(&self->item);
+ self->item = g_value_dup_object(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void mdock_item_window_selector_get_property(GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ MDockItemWindowSelector *self = MDOCK_ITEM_WINDOW_SELECTOR(object);
+ switch (property_id) {
+ case PROP_ITEM:
+ g_value_set_object(value, self->item);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void mdock_item_window_selector_constructed(GObject *object)
+{
+ G_OBJECT_CLASS(mdock_item_window_selector_parent_class)->constructed(object);
+}
+
+static void mdock_item_window_selector_dispose(GObject *object)
+{
+ G_OBJECT_CLASS(mdock_item_window_selector_parent_class)->dispose(object);
+}
+
+static void mdock_item_window_selector_finalize(GObject *object)
+{
+ G_OBJECT_CLASS(mdock_item_window_selector_parent_class)->finalize(object);
+}
+
+static void
+mdock_item_window_selector_class_init(MDockItemWindowSelectorClass *klass)
+{
+ GObjectClass *obj_class = G_OBJECT_CLASS (klass);
+ obj_class->set_property = mdock_item_window_selector_set_property;
+ obj_class->get_property = mdock_item_window_selector_get_property;
+ obj_class->constructed = mdock_item_window_selector_constructed;
+ obj_class->dispose = mdock_item_window_selector_dispose;
+ obj_class->finalize = mdock_item_window_selector_finalize;
+
+ g_type_class_add_private(obj_class, sizeof(MDockItemWindowSelectorPrivate));
+
+ obj_properties[PROP_ITEM] = g_param_spec_object("item",
+ "The MDockItem the options in this menu apply to",
+ "Set the MDockItem the options in this menu apply to",
+ MDOCK_TYPE_ITEM,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(obj_class, N_PROPERTIES, obj_properties);
+}
+
+static void
+mdock_item_window_selector_init (MDockItemWindowSelector *self)
+{
+ self->priv = MDOCK_ITEM_WINDOW_SELECTOR_GET_PRIVATE (self);
+}
+
+MDockItemWindowSelector *
+mdock_item_window_selector_new(MDockItem *item)
+{
+ return g_object_new(MDOCK_TYPE_ITEM_WINDOW_SELECTOR, "item", item, NULL);
+}
diff --git a/libmdock/mdock-item-window-selector.h b/libmdock/mdock-item-window-selector.h
new file mode 100644
index 0000000..da78b2b
--- /dev/null
+++ b/libmdock/mdock-item-window-selector.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2015 Javier S. Pedro <dev.git@javispedro.com>
+ *
+ * This file is part of MDock.
+ *
+ * MDock 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.
+ *
+ * MDock is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with MDock. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MDOCK_ITEM_WINDOW_SELECTOR_H__
+#define __MDOCK_ITEM_WINDOW_SELECTOR_H__
+
+#include "mdock-item.h"
+
+G_BEGIN_DECLS
+
+#define MDOCK_TYPE_ITEM_WINDOW_SELECTOR (mdock_item_window_selector_get_type ())
+#define MDOCK_ITEM_WINDOW_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MDOCK_TYPE_ITEM_WINDOW_SELECTOR, MDockItemWindowSelector))
+#define MDOCK_ITEM_WINDOW_SELECTOR_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MDOCK_TYPE_ITEM_WINDOW_SELECTOR, MDockItemWindowSelector const))
+#define MDOCK_ITEM_WINDOW_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MDOCK_TYPE_ITEM_WINDOW_SELECTOR, MDockItemWindowSelectorClass))
+#define MDOCK_IS_ITEM_WINDOW_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MDOCK_TYPE_ITEM_WINDOW_SELECTOR))
+#define MDOCK_IS_ITEM_WINDOW_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MDOCK_TYPE_ITEM_WINDOW_SELECTOR))
+#define MDOCK_ITEM_WINDOW_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MDOCK_TYPE_ITEM_WINDOW_SELECTOR, MDockItemWindowSelectorClass))
+
+typedef struct _MDockItemWindowSelector MDockItemWindowSelector;
+typedef struct _MDockItemWindowSelectorClass MDockItemWindowSelectorClass;
+typedef struct _MDockItemWindowSelectorPrivate MDockItemWindowSelectorPrivate;
+
+struct _MDockItemWindowSelector {
+ GtkWindow parent;
+ MDockItem *item;
+ MDockItemWindowSelectorPrivate *priv;
+};
+
+struct _MDockItemWindowSelectorClass {
+ GtkWindowClass parent_class;
+};
+
+GType mdock_item_window_selector_get_type(void) G_GNUC_CONST;
+MDockItemWindowSelector *mdock_item_window_selector_new(MDockItem *item);
+
+G_END_DECLS
+
+#endif /* __MDOCK_ITEM_WINDOW_SELECTOR_H__ */
diff --git a/libmdock/mdock-item.c b/libmdock/mdock-item.c
index 7de1264..1d899c0 100644
--- a/libmdock/mdock-item.c
+++ b/libmdock/mdock-item.c
@@ -19,7 +19,6 @@
#include "mdock-enums.h"
#include "mdock-item.h"
-#include "mdock-item-menu.h"
#include "thumbnailer.h"
#define MDOCK_ITEM_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), MDOCK_TYPE_ITEM, MDockItemPrivate))
@@ -33,8 +32,6 @@ struct _MDockItemPrivate
GList *windows;
WnckWindow *last_active;
-
- MDockItemMenu *menu;
};
G_DEFINE_TYPE (MDockItem, mdock_item, GTK_TYPE_WIDGET)
@@ -203,7 +200,6 @@ static void mdock_item_dispose(GObject *object)
MDockItem *self = MDOCK_ITEM(object);
g_clear_object(&self->priv->appinfo);
g_clear_object(&self->priv->icon);
- g_clear_object(&self->priv->menu);
G_OBJECT_CLASS(mdock_item_parent_class)->dispose(object);
}
diff --git a/libmdock/mdock-widget.c b/libmdock/mdock-widget.c
index a97e886..af3b165 100644
--- a/libmdock/mdock-widget.c
+++ b/libmdock/mdock-widget.c
@@ -23,7 +23,7 @@
#include <libwnck/libwnck.h>
#include "mdock-widget.h"
-#include "mdock-item-window-list.h"
+#include "mdock-item-window-selector.h"
#include "mdock-item-menu.h"
#include "mdock-item.h"
#include "matcher.h"
@@ -55,6 +55,7 @@ static GParamSpec *obj_properties[N_PROPERTIES] = { NULL };
G_DEFINE_QUARK(mdock-widget-item-iter, mdock_widget_item_iter)
G_DEFINE_QUARK(mdock-widget-item-menu, mdock_widget_item_menu)
+G_DEFINE_QUARK(mdock-widget-item-window-selector, mdock_widget_item_window_selector)
enum {
DRAG_TYPE_ITEM,
@@ -338,6 +339,9 @@ static void connect_item(MDockWidget *self, MDockItem *item, GSequenceIter *posi
g_object_set_qdata_full(G_OBJECT(item), mdock_widget_item_menu_quark(),
mdock_item_menu_new(item), (GDestroyNotify)gtk_widget_destroy);
+
+ g_object_set_qdata_full(G_OBJECT(item), mdock_widget_item_window_selector_quark(),
+ mdock_item_window_selector_new(item), (GDestroyNotify)gtk_widget_destroy);
}
@@ -489,6 +493,8 @@ static void mdock_widget_constructed(GObject *obj)
{
MDockWidget *self = MDOCK_WIDGET(obj);
+ G_OBJECT_CLASS(mdock_widget_parent_class)->constructed(obj);
+
g_debug("Constructing with path: %s", self->priv->settings_path);
self->priv->settings = g_settings_new_with_path("com.javispedro.mdock.widget",
self->priv->settings_path);