[gnome-todo/wip/gbsneto/plugins: 12/18] grid-item: rename from GtdTaskListItem
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/plugins: 12/18] grid-item: rename from GtdTaskListItem
- Date: Mon, 18 Jan 2016 19:05:43 +0000 (UTC)
commit 5a67b45ae7168115634054674a7647ab15ed9868
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Jan 16 15:35:58 2016 -0200
grid-item: rename from GtdTaskListItem
data/Makefile.am | 2 +-
data/theme/Adwaita.css | 8 +-
data/todo.gresource.xml | 2 +-
...ask-list-item.ui => list-selector-grid-item.ui} | 4 +-
src/Makefile.am | 4 +-
src/gtd-window.c | 1 -
.../gtd-list-selector-grid-item.c} | 211 +++++++++-----------
.../gtd-list-selector-grid-item.h} | 20 +-
src/views/gtd-list-selector-grid.c | 39 ++--
src/views/gtd-list-selector-panel.c | 14 +-
10 files changed, 144 insertions(+), 161 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index c7632b9..67b1fda 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -32,6 +32,7 @@ EXTRA_DIST= \
gtk/menus.ui \
ui/edit-pane.ui \
ui/initial-setup.ui \
+ ui/list-selector-grid-item.ui \
ui/list-selector-panel.ui \
ui/list-view.ui \
ui/notification.ui \
@@ -41,7 +42,6 @@ EXTRA_DIST= \
ui/provider-popover.ui \
ui/provider-row.ui \
ui/provider-selector.ui \
- ui/task-list-item.ui \
ui/task-row.ui \
ui/window.ui \
theme/Adwaita.css \
diff --git a/data/theme/Adwaita.css b/data/theme/Adwaita.css
index 9c78ff2..d646c5e 100644
--- a/data/theme/Adwaita.css
+++ b/data/theme/Adwaita.css
@@ -6,7 +6,7 @@ task-row {
border-bottom: 1px solid alpha(@borders, 0.4);
}
-task-list-item.thumbnail {
+grid-item.thumbnail {
margin-left: 10px;
margin-right: 10px;
margin-top: 8px;
@@ -14,11 +14,11 @@ task-list-item.thumbnail {
font-size: 9px;
}
-task-list-item {
+grid-item {
background-color: transparent;
}
-task-list-item,
+grid-item,
task-list-view task-row {
color: #000003;
}
@@ -27,7 +27,7 @@ task-list-view task-row:hover {
background-color: alpha(#ededed, 0.4);
}
-task-list-item.dark,
+grid-item.dark,
task-list-view.dark task-row {
color: #eeeeec;
}
diff --git a/data/todo.gresource.xml b/data/todo.gresource.xml
index e8ad861..621312e 100644
--- a/data/todo.gresource.xml
+++ b/data/todo.gresource.xml
@@ -4,6 +4,7 @@
<file alias="gtk/menus.ui">gtk/menus.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/edit-pane.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/initial-setup.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">ui/list-selector-grid-item.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/list-selector-panel.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/list-view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/notification.ui</file>
@@ -13,7 +14,6 @@
<file compressed="true" preprocess="xml-stripblanks">ui/provider-popover.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/provider-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/provider-selector.ui</file>
- <file compressed="true" preprocess="xml-stripblanks">ui/task-list-item.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/task-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
<file compressed="true">theme/Adwaita.css</file>
diff --git a/data/ui/task-list-item.ui b/data/ui/list-selector-grid-item.ui
similarity index 95%
rename from data/ui/task-list-item.ui
rename to data/ui/list-selector-grid-item.ui
index d471701..a1b327b 100644
--- a/data/ui/task-list-item.ui
+++ b/data/ui/list-selector-grid-item.ui
@@ -2,7 +2,7 @@
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.16"/>
- <template class="GtdTaskListItem" parent="GtkFlowBoxChild">
+ <template class="GtdListSelectorGridItem" parent="GtkFlowBoxChild">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
@@ -15,7 +15,7 @@
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <signal name="button-press-event" handler="gtd_task_list_item__button_press_event_cb"
object="GtdTaskListItem" swapped="no" />
+ <signal name="button-press-event" handler="gtd_list_selector_grid_item__button_press_event_cb"
object="GtdListSelectorGridItem" swapped="no" />
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index ad87dc2..eeeaa58 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,6 +45,8 @@ gnome_todo_SOURCES = \
views/gtd-list-selector.h \
views/gtd-list-selector-grid.c \
views/gtd-list-selector-grid.h \
+ views/gtd-list-selector-grid-item.c \
+ views/gtd-list-selector-grid-item.h \
views/gtd-list-selector-panel.c \
views/gtd-list-selector-panel.h \
gtd-application.c \
@@ -65,8 +67,6 @@ gnome_todo_SOURCES = \
gtd-task.h \
gtd-task-list.c \
gtd-task-list.h \
- gtd-task-list-item.c \
- gtd-task-list-item.h \
gtd-task-list-view.c \
gtd-task-list-view.h \
gtd-task-row.c \
diff --git a/src/gtd-window.c b/src/gtd-window.c
index 1b9f73e..4679da9 100644
--- a/src/gtd-window.c
+++ b/src/gtd-window.c
@@ -31,7 +31,6 @@
#include "gtd-provider-dialog.h"
#include "gtd-task.h"
#include "gtd-task-list.h"
-#include "gtd-task-list-item.h"
#include "gtd-window.h"
#include <glib/gi18n.h>
diff --git a/src/gtd-task-list-item.c b/src/views/gtd-list-selector-grid-item.c
similarity index 68%
rename from src/gtd-task-list-item.c
rename to src/views/gtd-list-selector-grid-item.c
index e457b18..84b283a 100644
--- a/src/gtd-task-list-item.c
+++ b/src/views/gtd-list-selector-grid-item.c
@@ -19,12 +19,14 @@
#include "gtd-enum-types.h"
#include "gtd-task.h"
#include "gtd-task-list.h"
-#include "gtd-task-list-item.h"
+#include "gtd-list-selector-grid-item.h"
#include <glib/gi18n.h>
-typedef struct
+struct _GtdListSelectorGridItem
{
+ GtkFlowBoxChild parent;
+
GtkImage *icon_image;
GtkLabel *subtitle_label;
GtkLabel *title_label;
@@ -37,17 +39,9 @@ typedef struct
/* flags */
gint selected : 1;
-} GtdTaskListItemPrivate;
-
-struct _GtdTaskListItem
-{
- GtkFlowBoxChild parent;
-
- /*<private>*/
- GtdTaskListItemPrivate *priv;
};
-G_DEFINE_TYPE_WITH_PRIVATE (GtdTaskListItem, gtd_task_list_item, GTK_TYPE_FLOW_BOX_CHILD)
+G_DEFINE_TYPE (GtdListSelectorGridItem, gtd_list_selector_grid_item, GTK_TYPE_FLOW_BOX_CHILD)
#define LUMINANCE(c) (0.299 * c->red + 0.587 * c->green + 0.114 * c->blue)
@@ -63,7 +57,7 @@ enum {
};
static cairo_surface_t*
-gtd_task_list_item__render_thumbnail (GtdTaskListItem *item)
+gtd_list_selector_grid_item__render_thumbnail (GtdListSelectorGridItem *item)
{
PangoFontDescription *font_desc;
GtkStyleContext *context;
@@ -80,7 +74,7 @@ gtd_task_list_item__render_thumbnail (GtdTaskListItem *item)
GList *tasks;
/* TODO: review size here, maybe not hardcoded */
- list = item->priv->list;
+ list = item->list;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
THUMBNAIL_SIZE,
THUMBNAIL_SIZE);
@@ -250,11 +244,11 @@ gtd_task_list_item__render_thumbnail (GtdTaskListItem *item)
g_object_unref (layout);
/* Draws the selection checkbox */
- if (item->priv->mode == GTD_WINDOW_MODE_SELECTION)
+ if (item->mode == GTD_WINDOW_MODE_SELECTION)
{
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
- if (item->priv->selected)
+ if (item->selected)
gtk_style_context_set_state (context, GTK_STATE_FLAG_CHECKED);
gtk_render_check (context,
@@ -274,60 +268,56 @@ out:
}
static void
-gtd_task_list_item__update_thumbnail (GtdTaskListItem *item)
+gtd_list_selector_grid_item__update_thumbnail (GtdListSelectorGridItem *item)
{
- GtdTaskListItemPrivate *priv;
cairo_surface_t *surface;
- priv = item->priv;
- surface = gtd_task_list_item__render_thumbnail (item);
+ surface = gtd_list_selector_grid_item__render_thumbnail (item);
- gtk_image_set_from_surface (GTK_IMAGE (priv->icon_image), surface);
+ gtk_image_set_from_surface (GTK_IMAGE (item->icon_image), surface);
cairo_surface_destroy (surface);
}
static void
-gtd_task_list_item__task_changed (GtdTaskList *list,
- GtdTask *task,
- gpointer user_data)
+gtd_list_selector_grid_item__task_changed (GtdTaskList *list,
+ GtdTask *task,
+ gpointer user_data)
{
- g_return_if_fail (GTD_IS_TASK_LIST_ITEM (user_data));
-
if (!gtd_task_get_complete (task))
- gtd_task_list_item__update_thumbnail (GTD_TASK_LIST_ITEM (user_data));
+ gtd_list_selector_grid_item__update_thumbnail (GTD_LIST_SELECTOR_GRID_ITEM (user_data));
}
static void
-gtd_task_list_item__notify_ready (GtdTaskListItem *item,
+gtd_list_selector_grid_item__notify_ready (GtdListSelectorGridItem *item,
GParamSpec *pspec,
gpointer user_data)
{
- gtd_task_list_item__update_thumbnail (item);
+ gtd_list_selector_grid_item__update_thumbnail (item);
}
GtkWidget*
-gtd_task_list_item_new (GtdTaskList *list)
+gtd_list_selector_grid_item_new (GtdTaskList *list)
{
- return g_object_new (GTD_TYPE_TASK_LIST_ITEM,
+ return g_object_new (GTD_TYPE_LIST_SELECTOR_GRID_ITEM,
"task-list", list,
NULL);
}
static gboolean
-gtd_task_list_item__button_press_event_cb (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
+gtd_list_selector_grid_item__button_press_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
- GtdTaskListItemPrivate *priv;
+ GtdListSelectorGridItem *item;
GdkEventButton *button_ev;
+ item = GTD_LIST_SELECTOR_GRID_ITEM (user_data);
button_ev = (GdkEventButton*) event;
- priv = GTD_TASK_LIST_ITEM (user_data)->priv;
if (button_ev->button == 3)
{
- if (priv->mode == GTD_WINDOW_MODE_NORMAL)
+ if (item->mode == GTD_WINDOW_MODE_NORMAL)
{
g_object_set (user_data,
"mode", GTD_WINDOW_MODE_SELECTION,
@@ -336,7 +326,7 @@ gtd_task_list_item__button_press_event_cb (GtkWidget *widget,
}
else
{
- gtd_task_list_item_set_selected (GTD_TASK_LIST_ITEM (user_data), !priv->selected);
+ gtd_list_selector_grid_item_set_selected (GTD_LIST_SELECTOR_GRID_ITEM (user_data),
!item->selected);
}
return GDK_EVENT_STOP;
@@ -346,41 +336,41 @@ gtd_task_list_item__button_press_event_cb (GtkWidget *widget,
}
static void
-gtd_task_list_item_state_flags_changed (GtkWidget *item,
+gtd_list_selector_grid_item_state_flags_changed (GtkWidget *item,
GtkStateFlags flags)
{
- if (GTK_WIDGET_CLASS (gtd_task_list_item_parent_class)->state_flags_changed)
- GTK_WIDGET_CLASS (gtd_task_list_item_parent_class)->state_flags_changed (item, flags);
+ if (GTK_WIDGET_CLASS (gtd_list_selector_grid_item_parent_class)->state_flags_changed)
+ GTK_WIDGET_CLASS (gtd_list_selector_grid_item_parent_class)->state_flags_changed (item, flags);
- gtd_task_list_item__update_thumbnail (GTD_TASK_LIST_ITEM (item));
+ gtd_list_selector_grid_item__update_thumbnail (GTD_LIST_SELECTOR_GRID_ITEM (item));
}
static void
-gtd_task_list_item_finalize (GObject *object)
+gtd_list_selector_grid_item_finalize (GObject *object)
{
- G_OBJECT_CLASS (gtd_task_list_item_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gtd_list_selector_grid_item_parent_class)->finalize (object);
}
static void
-gtd_task_list_item_get_property (GObject *object,
+gtd_list_selector_grid_item_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- GtdTaskListItem *self = GTD_TASK_LIST_ITEM (object);
+ GtdListSelectorGridItem *self = GTD_LIST_SELECTOR_GRID_ITEM (object);
switch (prop_id)
{
case PROP_MODE:
- g_value_set_enum (value, self->priv->mode);
+ g_value_set_enum (value, self->mode);
break;
case PROP_SELECTED:
- g_value_set_boolean (value, self->priv->selected);
+ g_value_set_boolean (value, self->selected);
break;
case PROP_TASK_LIST:
- g_value_set_object (value, self->priv->list);
+ g_value_set_object (value, self->list);
break;
default:
@@ -389,71 +379,70 @@ gtd_task_list_item_get_property (GObject *object,
}
static void
-gtd_task_list_item_set_property (GObject *object,
+gtd_list_selector_grid_item_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- GtdTaskListItem *self = GTD_TASK_LIST_ITEM (object);
- GtdTaskListItemPrivate *priv = self->priv;
+ GtdListSelectorGridItem *self = GTD_LIST_SELECTOR_GRID_ITEM (object);
switch (prop_id)
{
case PROP_MODE:
- priv->mode = g_value_get_enum (value);
- gtd_task_list_item__update_thumbnail (self);
+ self->mode = g_value_get_enum (value);
+ gtd_list_selector_grid_item__update_thumbnail (self);
g_object_notify (object, "mode");
break;
case PROP_SELECTED:
- gtd_task_list_item_set_selected (self, g_value_get_boolean (value));
+ gtd_list_selector_grid_item_set_selected (self, g_value_get_boolean (value));
break;
case PROP_TASK_LIST:
- priv->list = g_value_get_object (value);
- g_object_bind_property (priv->list,
+ self->list = g_value_get_object (value);
+ g_object_bind_property (self->list,
"name",
- priv->title_label,
+ self->title_label,
"label",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- g_object_bind_property (gtd_task_list_get_provider (priv->list),
+ g_object_bind_property (gtd_task_list_get_provider (self->list),
"description",
- priv->subtitle_label,
+ self->subtitle_label,
"label",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- g_object_bind_property (priv->list,
+ g_object_bind_property (self->list,
"ready",
- priv->spinner,
+ self->spinner,
"visible",
G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE);
- g_object_bind_property (priv->list,
+ g_object_bind_property (self->list,
"ready",
- priv->spinner,
+ self->spinner,
"active",
G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE);
- g_signal_connect_swapped (priv->list,
+ g_signal_connect_swapped (self->list,
"notify::ready",
- G_CALLBACK (gtd_task_list_item__notify_ready),
+ G_CALLBACK (gtd_list_selector_grid_item__notify_ready),
self);
- g_signal_connect_swapped (priv->list,
+ g_signal_connect_swapped (self->list,
"notify::color",
- G_CALLBACK (gtd_task_list_item__update_thumbnail),
+ G_CALLBACK (gtd_list_selector_grid_item__update_thumbnail),
self);
- g_signal_connect (priv->list,
+ g_signal_connect (self->list,
"task-added",
- G_CALLBACK (gtd_task_list_item__task_changed),
+ G_CALLBACK (gtd_list_selector_grid_item__task_changed),
self);
- g_signal_connect (priv->list,
+ g_signal_connect (self->list,
"task-removed",
- G_CALLBACK (gtd_task_list_item__task_changed),
+ G_CALLBACK (gtd_list_selector_grid_item__task_changed),
self);
- g_signal_connect (priv->list,
+ g_signal_connect (self->list,
"task-updated",
- G_CALLBACK (gtd_task_list_item__task_changed),
+ G_CALLBACK (gtd_list_selector_grid_item__task_changed),
self);
break;
@@ -463,19 +452,19 @@ gtd_task_list_item_set_property (GObject *object,
}
static void
-gtd_task_list_item_class_init (GtdTaskListItemClass *klass)
+gtd_list_selector_grid_item_class_init (GtdListSelectorGridItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = gtd_task_list_item_finalize;
- object_class->get_property = gtd_task_list_item_get_property;
- object_class->set_property = gtd_task_list_item_set_property;
+ object_class->finalize = gtd_list_selector_grid_item_finalize;
+ object_class->get_property = gtd_list_selector_grid_item_get_property;
+ object_class->set_property = gtd_list_selector_grid_item_set_property;
- widget_class->state_flags_changed = gtd_task_list_item_state_flags_changed;
+ widget_class->state_flags_changed = gtd_list_selector_grid_item_state_flags_changed;
/**
- * GtdTaskListItem::mode:
+ * GtdListSelectorGridItem::mode:
*
* The parent source of the list.
*/
@@ -490,7 +479,7 @@ gtd_task_list_item_class_init (GtdTaskListItemClass *klass)
G_PARAM_READWRITE));
/**
- * GtdTaskListItem::selected:
+ * GtdListSelectorGridItem::selected:
*
* Whether this item is selected when in %GTD_WINDOW_MODE_SELECTION.
*/
@@ -504,7 +493,7 @@ gtd_task_list_item_class_init (GtdTaskListItemClass *klass)
G_PARAM_READWRITE));
/**
- * GtdTaskListItem::task-list:
+ * GtdListSelectorGridItem::task-list:
*
* The parent source of the list.
*/
@@ -518,82 +507,74 @@ gtd_task_list_item_class_init (GtdTaskListItemClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/* template class */
- gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/todo/ui/task-list-item.ui");
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/todo/ui/list-selector-grid-item.ui");
- gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListItem, icon_image);
- gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListItem, spinner);
- gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListItem, subtitle_label);
- gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListItem, title_label);
+ gtk_widget_class_bind_template_child (widget_class, GtdListSelectorGridItem, icon_image);
+ gtk_widget_class_bind_template_child (widget_class, GtdListSelectorGridItem, spinner);
+ gtk_widget_class_bind_template_child (widget_class, GtdListSelectorGridItem, subtitle_label);
+ gtk_widget_class_bind_template_child (widget_class, GtdListSelectorGridItem, title_label);
- gtk_widget_class_bind_template_callback (widget_class, gtd_task_list_item__button_press_event_cb);
+ gtk_widget_class_bind_template_callback (widget_class, gtd_list_selector_grid_item__button_press_event_cb);
- gtk_widget_class_set_css_name (widget_class, "task-list-item");
+ gtk_widget_class_set_css_name (widget_class, "grid-item");
}
static void
-gtd_task_list_item_init (GtdTaskListItem *self)
+gtd_list_selector_grid_item_init (GtdListSelectorGridItem *self)
{
- self->priv = gtd_task_list_item_get_instance_private (self);
-
gtk_widget_init_template (GTK_WIDGET (self));
}
/**
- * gtd_task_list_item_get_list:
- * @item: a #GtdTaskListItem
+ * gtd_list_selector_grid_item_get_list:
+ * @item: a #GtdListSelectorGridItem
*
* Retrieves the internal #GtdTaskList from @item.
*
* Returns: (transfer none): the internal #GtdTaskList from @item
*/
GtdTaskList*
-gtd_task_list_item_get_list (GtdTaskListItem *item)
+gtd_list_selector_grid_item_get_list (GtdListSelectorGridItem *item)
{
- g_return_val_if_fail (GTD_IS_TASK_LIST_ITEM (item), NULL);
+ g_return_val_if_fail (GTD_IS_LIST_SELECTOR_GRID_ITEM (item), NULL);
- return item->priv->list;
+ return item->list;
}
/**
- * gtd_task_list_item_get_selected:
- * @item: a #GtdTaskListItem
+ * gtd_list_selector_grid_item_get_selected:
+ * @item: a #GtdListSelectorGridItem
*
* Retrieves whether @item is selected or not.
*
* Returns: %TRUE if @item is selected, %FALSE otherwise
*/
gboolean
-gtd_task_list_item_get_selected (GtdTaskListItem *item)
+gtd_list_selector_grid_item_get_selected (GtdListSelectorGridItem *item)
{
- g_return_val_if_fail (GTD_IS_TASK_LIST_ITEM (item), FALSE);
+ g_return_val_if_fail (GTD_IS_LIST_SELECTOR_GRID_ITEM (item), FALSE);
- return item->priv->selected;
+ return item->selected;
}
/**
- * gtd_task_list_item_set_selected:
- * @item: a #GtdTaskListItem
+ * gtd_list_selector_grid_item_set_selected:
+ * @item: a #GtdListSelectorGridItem
* @selected: %TRUE if @item is selected, %FALSE otherwise
*
* Sets whether @item is selected or not.
- *
- * Returns:
*/
void
-gtd_task_list_item_set_selected (GtdTaskListItem *item,
- gboolean selected)
+gtd_list_selector_grid_item_set_selected (GtdListSelectorGridItem *item,
+ gboolean selected)
{
- GtdTaskListItemPrivate *priv;
-
- g_return_if_fail (GTD_IS_TASK_LIST_ITEM (item));
-
- priv = item->priv;
+ g_return_if_fail (GTD_IS_LIST_SELECTOR_GRID_ITEM (item));
- if (priv->selected != selected)
+ if (item->selected != selected)
{
- priv->selected = selected;
+ item->selected = selected;
- gtd_task_list_item__update_thumbnail (item);
+ gtd_list_selector_grid_item__update_thumbnail (item);
g_object_notify (G_OBJECT (item), "selected");
}
diff --git a/src/gtd-task-list-item.h b/src/views/gtd-list-selector-grid-item.h
similarity index 50%
rename from src/gtd-task-list-item.h
rename to src/views/gtd-list-selector-grid-item.h
index 5d92936..2dc68c0 100644
--- a/src/gtd-task-list-item.h
+++ b/src/views/gtd-list-selector-grid-item.h
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GTD_TASK_LIST_ITEM_H
-#define GTD_TASK_LIST_ITEM_H
+#ifndef GTD_LIST_SELECTOR_GRID_ITEM_H
+#define GTD_LIST_SELECTOR_GRID_ITEM_H
#include "gtd-types.h"
@@ -25,19 +25,19 @@
G_BEGIN_DECLS
-#define GTD_TYPE_TASK_LIST_ITEM (gtd_task_list_item_get_type())
+#define GTD_TYPE_LIST_SELECTOR_GRID_ITEM (gtd_list_selector_grid_item_get_type())
-G_DECLARE_FINAL_TYPE (GtdTaskListItem, gtd_task_list_item, GTD, TASK_LIST_ITEM, GtkFlowBoxChild)
+G_DECLARE_FINAL_TYPE (GtdListSelectorGridItem, gtd_list_selector_grid_item, GTD, LIST_SELECTOR_GRID_ITEM,
GtkFlowBoxChild)
-GtkWidget* gtd_task_list_item_new (GtdTaskList *list);
+GtkWidget* gtd_list_selector_grid_item_new (GtdTaskList *list);
-GtdTaskList* gtd_task_list_item_get_list (GtdTaskListItem *item);
+GtdTaskList* gtd_list_selector_grid_item_get_list (GtdListSelectorGridItem *item);
-gboolean gtd_task_list_item_get_selected (GtdTaskListItem *item);
+gboolean gtd_list_selector_grid_item_get_selected (GtdListSelectorGridItem *item);
-void gtd_task_list_item_set_selected (GtdTaskListItem *item,
- gboolean selected);
+void gtd_list_selector_grid_item_set_selected (GtdListSelectorGridItem *item,
+ gboolean selected);
G_END_DECLS
-#endif /* GTD_TASK_LIST_ITEM_H */
+#endif /* GTD_LIST_SELECTOR_GRID_ITEM_H */
diff --git a/src/views/gtd-list-selector-grid.c b/src/views/gtd-list-selector-grid.c
index 740e37a..1eb1edf 100644
--- a/src/views/gtd-list-selector-grid.c
+++ b/src/views/gtd-list-selector-grid.c
@@ -19,9 +19,9 @@
#include "interfaces/gtd-provider.h"
#include "gtd-list-selector.h"
#include "gtd-list-selector-grid.h"
+#include "gtd-list-selector-grid-item.h"
#include "gtd-manager.h"
#include "gtd-task-list.h"
-#include "gtd-task-list-item.h"
struct _GtdListSelectorGrid
{
@@ -53,7 +53,7 @@ gtd_list_selector_grid_list_added (GtdManager *manager,
{
GtkWidget *item;
- item = gtd_task_list_item_new (list);
+ item = gtd_list_selector_grid_item_new (list);
g_object_bind_property (selector,
"mode",
@@ -80,7 +80,7 @@ gtd_list_selector_grid_list_removed (GtdManager *manager,
for (l = children; l != NULL; l = l->next)
{
- if (gtd_task_list_item_get_list (l->data) == list)
+ if (gtd_list_selector_grid_item_get_list (l->data) == list)
gtk_widget_destroy (l->data);
}
@@ -89,9 +89,9 @@ gtd_list_selector_grid_list_removed (GtdManager *manager,
static gint
-gtd_list_selector_grid_sort_func (GtdTaskListItem *a,
- GtdTaskListItem *b,
- GtdListSelectorGrid *selector)
+gtd_list_selector_grid_sort_func (GtdListSelectorGridItem *a,
+ GtdListSelectorGridItem *b,
+ GtdListSelectorGrid *selector)
{
GtdProvider *p1;
GtdProvider *p2;
@@ -99,10 +99,10 @@ gtd_list_selector_grid_sort_func (GtdTaskListItem *a,
GtdTaskList *l2;
gint retval = 0;
- l1 = gtd_task_list_item_get_list (a);
+ l1 = gtd_list_selector_grid_item_get_list (a);
p1 = gtd_task_list_get_provider (l1);
- l2 = gtd_task_list_item_get_list (b);
+ l2 = gtd_list_selector_grid_item_get_list (b);
p2 = gtd_task_list_get_provider (l2);
retval = g_strcmp0 (gtd_provider_get_description (p1), gtd_provider_get_description (p2));
@@ -114,8 +114,8 @@ gtd_list_selector_grid_sort_func (GtdTaskListItem *a,
}
static gboolean
-gtd_list_selector_grid_filter_func (GtdTaskListItem *item,
- GtdListSelectorGrid *selector)
+gtd_list_selector_grid_filter_func (GtdListSelectorGridItem *item,
+ GtdListSelectorGrid *selector)
{
GtdTaskList *list;
gboolean return_value;
@@ -130,7 +130,7 @@ gtd_list_selector_grid_filter_func (GtdTaskListItem *item,
if (!selector->search_query)
return TRUE;
- list = gtd_task_list_item_get_list (item);
+ list = gtd_list_selector_grid_item_get_list (item);
haystack = NULL;
search_folded = g_utf8_casefold (selector->search_query, -1);
list_name_folded = g_utf8_casefold (gtd_task_list_get_name (list), -1);
@@ -183,7 +183,7 @@ gtd_list_selector_grid_set_mode (GtdListSelector *selector,
if (mode != GTD_WINDOW_MODE_SELECTION)
{
gtk_container_foreach (GTK_CONTAINER (self),
- (GtkCallback) gtd_task_list_item_set_selected,
+ (GtkCallback) gtd_list_selector_grid_item_set_selected,
FALSE);
}
@@ -234,7 +234,7 @@ gtd_list_selector_grid_get_selected_lists (GtdListSelector *selector)
for (l = children; l != NULL; l = l->next)
{
- if (gtd_task_list_item_get_selected (l->data))
+ if (gtd_list_selector_grid_item_get_selected (l->data))
selected = g_list_append (selected, l->data);
}
@@ -313,21 +313,24 @@ static void
gtd_list_selector_grid_child_activated (GtkFlowBox *flowbox,
GtkFlowBoxChild *child)
{
+ GtdListSelectorGridItem *item;
GtdListSelectorGrid *self;
- GtdTaskListItem *item;
self = GTD_LIST_SELECTOR_GRID (flowbox);
- if (!GTD_IS_TASK_LIST_ITEM (child))
+ if (!GTD_IS_LIST_SELECTOR_GRID_ITEM (child))
return;
- item = GTD_TASK_LIST_ITEM (child);
+ item = GTD_LIST_SELECTOR_GRID_ITEM (child);
/* We only mark the item as selected when we're in selection mode */
if (self->mode == GTD_WINDOW_MODE_SELECTION)
- gtd_task_list_item_set_selected (item, !gtd_task_list_item_get_selected (item));
+ {
+ gtd_list_selector_grid_item_set_selected (item,
+ !gtd_list_selector_grid_item_get_selected (item));
+ }
- g_signal_emit_by_name (flowbox, "list-selected", gtd_task_list_item_get_list (item));
+ g_signal_emit_by_name (flowbox, "list-selected", gtd_list_selector_grid_item_get_list (item));
}
static void
diff --git a/src/views/gtd-list-selector-panel.c b/src/views/gtd-list-selector-panel.c
index c5f7486..bd27417 100644
--- a/src/views/gtd-list-selector-panel.c
+++ b/src/views/gtd-list-selector-panel.c
@@ -21,10 +21,10 @@
#include "gtd-enum-types.h"
#include "gtd-list-selector.h"
#include "gtd-list-selector-grid.h"
+#include "gtd-list-selector-grid-item.h"
#include "gtd-list-selector-panel.h"
#include "gtd-manager.h"
#include "gtd-task-list.h"
-#include "gtd-task-list-item.h"
#include "gtd-task-list-view.h"
#include "gtd-window.h"
@@ -148,7 +148,7 @@ update_action_bar_buttons (GtdListSelectorPanel *panel)
{
GtdTaskList *list;
- list = gtd_task_list_item_get_list (l->data);
+ list = gtd_list_selector_grid_item_get_list (l->data);
if (!gtd_task_list_is_removable (list))
{
@@ -259,12 +259,12 @@ gtd_list_selector_panel_rename_task_list (GtdListSelectorPanel *panel)
if (selection && selection->data)
{
- GtdTaskListItem *item;
+ GtdListSelectorGridItem *item;
GtdTaskList *list;
GtdWindow *window;
item = selection->data;
- list = gtd_task_list_item_get_list (item);
+ list = gtd_list_selector_grid_item_get_list (item);
window = GTD_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (panel)));
gtd_task_list_set_name (list, gtk_entry_get_text (GTK_ENTRY (panel->rename_entry)));
@@ -285,11 +285,11 @@ gtd_list_selector_panel_rename_button_clicked (GtdListSelectorPanel *panel)
if (selection && selection->data)
{
- GtdTaskListItem *item;
+ GtdListSelectorGridItem *item;
GtdTaskList *list;
item = selection->data;
- list = gtd_task_list_item_get_list (item);
+ list = gtd_list_selector_grid_item_get_list (item);
gtk_popover_set_relative_to (GTK_POPOVER (panel->rename_popover), GTK_WIDGET (item));
gtk_entry_set_text (GTK_ENTRY (panel->rename_entry), gtd_task_list_get_name (list));
@@ -349,7 +349,7 @@ gtd_list_selector_panel_delete_button_clicked (GtdListSelectorPanel *panel)
{
GtdTaskList *list;
- list = gtd_task_list_item_get_list (l->data);
+ list = gtd_list_selector_grid_item_get_list (l->data);
if (gtd_task_list_is_removable (list))
gtd_manager_remove_task_list (gtd_manager_get_default (), list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]