aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-23 11:14:48 -0600
committerTed Gould <ted@gould.cx>2011-02-23 11:14:48 -0600
commit461b168779bda841bfe40ae206e9f4654f8c6040 (patch)
tree223d1ce481df66c43feffeceb46dd6a22f180d45 /src
parent5b3b2fe2705a2b9e56d8d468b842c48eef9515c0 (diff)
parentb6f75c173098cd4a7ea605496a2692d436a16a96 (diff)
downloadayatana-ido-461b168779bda841bfe40ae206e9f4654f8c6040.tar.gz
ayatana-ido-461b168779bda841bfe40ae206e9f4654f8c6040.tar.bz2
ayatana-ido-461b168779bda841bfe40ae206e9f4654f8c6040.zip
Adding API to the calendar menu item
Diffstat (limited to 'src')
-rw-r--r--src/idocalendarmenuitem.c53
-rw-r--r--src/idocalendarmenuitem.h14
2 files changed, 59 insertions, 8 deletions
diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c
index fca4bb6..3e326e0 100644
--- a/src/idocalendarmenuitem.c
+++ b/src/idocalendarmenuitem.c
@@ -42,6 +42,8 @@ static void calendar_realized_cb (GtkWidget *widg
static void calendar_move_focus_cb (GtkWidget *widget,
GtkDirectionType direction,
IdoCalendarMenuItem *item);
+static void calendar_month_changed_cb (GtkWidget *widget,
+ gpointer user_data);
struct _IdoCalendarMenuItemPrivate
{
@@ -76,6 +78,11 @@ ido_calendar_menu_item_class_init (IdoCalendarMenuItemClass *klass)
menu_item_class->hide_on_activate = TRUE;
g_type_class_add_private (gobject_class, sizeof (IdoCalendarMenuItemPrivate));
+
+ g_signal_new("month-changed", G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
@@ -234,6 +241,11 @@ calendar_realized_cb (GtkWidget *widget,
"key-press-event",
G_CALLBACK (ido_calendar_menu_item_key_press),
item);
+
+ g_signal_connect (item->priv->calendar,
+ "month-changed",
+ G_CALLBACK (calendar_month_changed_cb),
+ item);
ido_calendar_menu_item_send_focus_change (widget, TRUE);
}
@@ -250,6 +262,14 @@ calendar_move_focus_cb (GtkWidget *widget,
GTK_DIR_TAB_FORWARD);
}
+static void
+calendar_month_changed_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ IdoCalendarMenuItem *item = (IdoCalendarMenuItem *)user_data;
+ g_signal_emit_by_name (item, "month-changed", NULL);
+}
+
/* Public API */
GtkWidget *
ido_calendar_menu_item_new (void)
@@ -257,10 +277,35 @@ ido_calendar_menu_item_new (void)
return g_object_new (IDO_TYPE_CALENDAR_MENU_ITEM, NULL);
}
-GtkWidget *
-ido_calendar_menu_item_get_calendar (IdoCalendarMenuItem *item)
+gboolean
+ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day)
+{
+ return gtk_calendar_mark_day(GTK_CALENDAR (menuitem->priv->calendar), day);
+}
+
+gboolean
+ido_calendar_menu_item_unmark_day (IdoCalendarMenuItem *menuitem, guint day)
{
- g_return_val_if_fail (IDO_IS_CALENDAR_MENU_ITEM (item), NULL);
+ return gtk_calendar_unmark_day(GTK_CALENDAR (menuitem->priv->calendar), day);
+}
+
+void
+ido_calendar_menu_item_clear_marks (IdoCalendarMenuItem *menuitem)
+{
+ gtk_calendar_clear_marks(GTK_CALENDAR (menuitem->priv->calendar));
+}
+
+void
+ido_calendar_menu_item_set_display_options (IdoCalendarMenuItem *menuitem, GtkCalendarDisplayOptions flags)
+{
+ gtk_calendar_set_display_options (GTK_CALENDAR (menuitem->priv->calendar), flags);
+}
+
+void
+ido_calendar_menu_item_get_date (IdoCalendarMenuItem *menuitem,
+ guint *year,
+ guint *month,
+ guint *day) {
- return item->priv->calendar;
+ gtk_calendar_get_date (GTK_CALENDAR (menuitem->priv->calendar), year, month, day);
}
diff --git a/src/idocalendarmenuitem.h b/src/idocalendarmenuitem.h
index 3f9bf96..6e9ff9a 100644
--- a/src/idocalendarmenuitem.h
+++ b/src/idocalendarmenuitem.h
@@ -53,11 +53,17 @@ struct _IdoCalendarMenuItemClass
GtkMenuItemClass parent_class;
};
-GType ido_calendar_menu_item_get_type (void) G_GNUC_CONST;
-
-GtkWidget *ido_calendar_menu_item_new (void);
-GtkWidget *ido_calendar_menu_item_get_calendar (IdoCalendarMenuItem *menuitem);
+GType ido_calendar_menu_item_get_type (void) G_GNUC_CONST;
+GtkWidget *ido_calendar_menu_item_new (void);
+gboolean ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day);
+gboolean ido_calendar_menu_item_unmark_day (IdoCalendarMenuItem *menuitem, guint day);
+void ido_calendar_menu_item_clear_marks (IdoCalendarMenuItem *menuitem);
+void ido_calendar_menu_item_set_display_options (IdoCalendarMenuItem *menuitem, GtkCalendarDisplayOptions flags);
+void ido_calendar_menu_item_get_date (IdoCalendarMenuItem *menuitem,
+ guint *year,
+ guint *month,
+ guint *day)
G_END_DECLS
#endif /* __IDO_CALENDAR_MENU_ITEM_H__ */