static void log_window_calendar_chats_month_changed_cb (GtkWidget *calendar, EmpathyLogWindow *window) { TpAccount *account; gchar *chat_id; gboolean is_chatroom; gtk_calendar_clear_marks (GTK_CALENDAR (calendar)); if (!log_window_chats_get_selected (window, &account, &chat_id, &is_chatroom)) { DEBUG ("No chat selected to get dates for..."); return; } /* Get the log object for this contact */ tpl_log_manager_get_dates_async (window->log_manager, account, chat_id, is_chatroom, log_window_updating_calendar_month_cb, (gpointer) window); g_object_unref (account); g_free (chat_id); }
static void log_window_calendar_chats_month_changed_cb (GtkWidget *calendar, EmpathyLogWindow *window) { EmpathyAccount *account; gchar *chat_id; gboolean is_chatroom; guint year_selected; guint month_selected; GList *dates; GList *l; gtk_calendar_clear_marks (GTK_CALENDAR (calendar)); if (!log_window_chats_get_selected (window, &account, &chat_id, &is_chatroom)) { DEBUG ("No chat selected to get dates for..."); return; } g_object_get (calendar, "month", &month_selected, "year", &year_selected, NULL); /* We need this hear because it appears that the months start from 0 */ month_selected++; /* Get the log object for this contact */ dates = empathy_log_manager_get_dates (window->log_manager, account, chat_id, is_chatroom); g_object_unref (account); g_free (chat_id); for (l = dates; l; l = l->next) { const gchar *str; guint year; guint month; guint day; str = l->data; if (!str) { continue; } sscanf (str, "%4d%2d%2d", &year, &month, &day); if (year == year_selected && month == month_selected) { DEBUG ("Marking date:'%s'", str); gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day); } } g_list_foreach (dates, (GFunc) g_free, NULL); g_list_free (dates); DEBUG ("Currently showing month %d and year %d", month_selected, year_selected); }
static void log_window_get_messages_for_date (EmpathyLogWindow *window, const gchar *date) { TpAccount *account; gchar *chat_id; gboolean is_chatroom; gtk_calendar_clear_marks (GTK_CALENDAR (window->calendar_chats)); if (!log_window_chats_get_selected (window, &account, &chat_id, &is_chatroom)) { return; } /* Clear all current messages shown in the textview */ empathy_chat_view_clear (window->chatview_chats); /* Turn off scrolling temporarily */ empathy_chat_view_scroll (window->chatview_find, FALSE); /* Get messages */ tpl_log_manager_get_messages_for_date_async (window->log_manager, account, chat_id, is_chatroom, date, log_window_got_messages_for_date_cb, (gpointer) window); }
static void log_window_chats_changed_cb (GtkTreeSelection *selection, EmpathyLogWindow *window) { /* Use last date by default */ gtk_calendar_clear_marks (GTK_CALENDAR (window->calendar_chats)); log_window_chats_get_messages (window, NULL); }
static void log_window_updating_calendar_month_cb (GObject *manager, GAsyncResult *result, gpointer user_data) { EmpathyLogWindow *window = user_data; GList *dates; GList *l; guint year_selected; guint month_selected; GError *error = NULL; dates = tpl_log_manager_get_dates_async_finish (result, &error); if (error != NULL) { DEBUG ("Unable to retrieve messages' dates: %s. Aborting", error->message); empathy_chat_view_append_event (window->chatview_find, "Unable to retrieve messages' dates"); g_error_free (error); return; } gtk_calendar_clear_marks (GTK_CALENDAR (window->calendar_chats)); g_object_get (window->calendar_chats, "month", &month_selected, "year", &year_selected, NULL); /* We need this here because it appears that the months start from 0 */ month_selected++; for (l = dates; l; l = l->next) { const gchar *str; guint year; guint month; guint day; str = l->data; if (!str) { continue; } sscanf (str, "%4d%2d%2d", &year, &month, &day); if (year == year_selected && month == month_selected) { DEBUG ("Marking date:'%s'", str); gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day); } } g_list_foreach (dates, (GFunc) g_free, NULL); g_list_free (dates); DEBUG ("Currently showing month %d and year %d", month_selected, year_selected); }
int clip_GTK_CALENDARCLEARMARKS(ClipMachine * ClipMachineMemory) { C_widget *ccal = _fetch_cw_arg(ClipMachineMemory); CHECKCWID(ccal, GTK_IS_CALENDAR); gtk_calendar_clear_marks(GTK_CALENDAR(ccal->widget)); return 0; err: return 1; }
static void popcalendar_set_marks(GtkCalendar *cal, guint32 marks) { int day; gtk_calendar_freeze(cal); gtk_calendar_clear_marks(cal); for (day = 0; day < 31; day++) { if (marks & (1L << day)) { gtk_calendar_mark_day(cal, day); } } gtk_calendar_thaw(cal); }
/** * update the calendar of the scheduled transactions * * \param * * \return FALSE * */ gboolean gsb_calendar_update ( void ) { time_t temps; GSList *tmp_list; gint calendar_month; gint calendar_year; gtk_calendar_clear_marks ( GTK_CALENDAR ( scheduled_calendar )); /* select the current day */ time ( &temps ); if ( ( localtime ( &temps ) -> tm_mon == GTK_CALENDAR ( scheduled_calendar ) -> month ) && ( ( localtime ( &temps ) -> tm_year + 1900 ) == GTK_CALENDAR ( scheduled_calendar ) -> year ) ) gtk_calendar_select_day ( GTK_CALENDAR ( scheduled_calendar ), localtime ( &temps ) -> tm_mday ); else gtk_calendar_select_day ( GTK_CALENDAR ( scheduled_calendar ), FALSE ); calendar_month = GTK_CALENDAR ( scheduled_calendar ) -> month + 1; calendar_year = GTK_CALENDAR ( scheduled_calendar ) -> year + 25; /* check the scheduled transactions and bold them in the calendar */ tmp_list = gsb_data_scheduled_get_scheduled_list (); while ( tmp_list ) { GDate *tmp_date; gint scheduled_number; scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data); tmp_date = gsb_date_copy (gsb_data_scheduled_get_date (scheduled_number)); while (tmp_date && g_date_get_month (tmp_date) == calendar_month && g_date_get_year (tmp_date) < calendar_year) { GDate *new_date; gtk_calendar_mark_day ( GTK_CALENDAR ( scheduled_calendar ), g_date_get_day (tmp_date)); new_date = gsb_scheduler_get_next_date (scheduled_number, tmp_date); g_free (tmp_date); tmp_date = new_date; } tmp_list = tmp_list -> next; } return FALSE; }
static void log_window_updating_calendar_month_cb (GObject *manager, GAsyncResult *result, gpointer user_data) { EmpathyLogWindow *window = user_data; GList *dates; GList *l; guint year_selected; guint month_selected; GError *error = NULL; if (log_window == NULL) return; if (!tpl_log_manager_get_dates_finish (TPL_LOG_MANAGER (manager), result, &dates, &error)) { DEBUG ("Unable to retrieve messages' dates: %s. Aborting", error->message); empathy_chat_view_append_event (window->chatview_find, "Unable to retrieve messages' dates"); g_error_free (error); return; } gtk_calendar_clear_marks (GTK_CALENDAR (window->calendar_chats)); g_object_get (window->calendar_chats, "month", &month_selected, "year", &year_selected, NULL); /* We need this here because it appears that the months start from 0 */ month_selected++; for (l = dates; l; l = l->next) { GDate *date = l->data; if (g_date_get_year (date) == year_selected && g_date_get_month (date) == month_selected) { DEBUG ("Marking date: %04u-%02u-%02u", g_date_get_year (date), g_date_get_month (date), g_date_get_day (date)); gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), g_date_get_day (date)); } } g_list_foreach (dates, (GFunc) g_free, NULL); g_list_free (dates); DEBUG ("Currently showing month %d and year %d", month_selected, year_selected); }
static void gcrd_today_clicked (GtkWidget *button, GncCellRendererDate *cell) { time64 today; gint year, month, day; today = gnc_time (NULL); gcrd_time2dmy ( today, &day, &month, &year); gtk_calendar_clear_marks (GTK_CALENDAR (cell->calendar)); gtk_calendar_select_month (GTK_CALENDAR (cell->calendar), month - 1, year); gtk_calendar_select_day (GTK_CALENDAR (cell->calendar), day); gtk_calendar_mark_day (GTK_CALENDAR (cell->calendar), day); }
JNIEXPORT void JNICALL Java_org_gnome_gtk_GtkCalendar_gtk_1calendar_1clear_1marks ( JNIEnv* env, jclass cls, jlong _self ) { GtkCalendar* self; // convert parameter self self = (GtkCalendar*) _self; // call function gtk_calendar_clear_marks(self); // cleanup parameter self }
static void gcrd_show (GncCellRendererPopup *cell, const gchar *path, gint x1, gint y1, gint x2, gint y2) { GncCellRendererDate *date; gint year; gint month; gint day; gint index; const gchar *text; if (parent_class->show_popup) { parent_class->show_popup (cell, path, x1, y1, x2, y2); } date = GNC_CELL_RENDERER_DATE (cell); text = gnc_popup_entry_get_text (GNC_POPUP_ENTRY (GNC_CELL_RENDERER_POPUP (cell)->editable)); if (!(g_strcmp0(text, ""))) { date->time = gnc_time (NULL); gcrd_time2dmy ( date->time, &day, &month, &year); } else { date->time = gcrd_string_dmy2time (text); gcrd_time2dmy ( date->time, &day, &month, &year); } gtk_calendar_clear_marks (GTK_CALENDAR (date->calendar)); gtk_calendar_select_month (GTK_CALENDAR (date->calendar), month - 1, year); gtk_calendar_select_day (GTK_CALENDAR (date->calendar), day); gtk_calendar_mark_day (GTK_CALENDAR (date->calendar), day); }
static void update_calendar (TpawCalendarButton *self) { if (self->priv->calendar == NULL) return; gtk_calendar_clear_marks (GTK_CALENDAR (self->priv->calendar)); if (self->priv->date == NULL) return; gtk_calendar_select_day (GTK_CALENDAR (self->priv->calendar), g_date_get_day (self->priv->date)); gtk_calendar_select_month (GTK_CALENDAR (self->priv->calendar), g_date_get_month (self->priv->date) - 1, g_date_get_year (self->priv->date)); gtk_calendar_mark_day (GTK_CALENDAR (self->priv->calendar), g_date_get_day (self->priv->date)); }
static VALUE rg_clear_marks(VALUE self) { gtk_calendar_clear_marks(_SELF(self)); return self; }