Skip to content
Snippets Groups Projects
Commit 9f9c25e6 authored by deuce's avatar deuce
Browse files

Whee! She's done! Added missing support for viewing another days log

(Pops up a calendar for selecting now)
Removed useless glade project file from CVS.
parent cfbc2596
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,80 @@
#include "gtkmonitor.h"
#include "util_funcs.h"
#include "datewrap.h"
int got_date=0;
void destroy_calendar_window(GtkWidget *t, gpointer data)
{
if(!got_date)
gtk_main_quit();
}
void changed_day(GtkWidget *t, gpointer data)
{
got_date=1;
gtk_main_quit();
}
int get_date(GtkWidget *t, isoDate_t *date)
{
GladeXML *cxml;
GtkWidget *w;
GtkWidget *win;
GtkWidget *thiswin;
gint x,x_off;
gint y,y_off;
guint year;
guint month;
guint day;
isoDate_t odate=*date;
got_date=0;
cxml = glade_xml_new(glade_path, "CalendarWindow", NULL);
if(cxml==NULL) {
fprintf(stderr,"Could not locate Calendar Window XML\n");
return(-1);
}
/* connect the signals in the interface */
glade_xml_signal_autoconnect(cxml);
win=glade_xml_get_widget(cxml, "CalendarWindow");
if(win==NULL) {
fprintf(stderr,"Could not locate Calendar window\n");
return(-1);
}
thiswin = gtk_widget_get_toplevel(t);
if(thiswin==NULL) {
fprintf(stderr,"Could not locate main window\n");
return(-1);
}
if(!(gtk_widget_translate_coordinates(GTK_WIDGET(t)
,GTK_WIDGET(thiswin), 0, 0, &x_off, &y_off))) {
fprintf(stderr,"Could not get position of button in window");
}
gtk_window_get_position(GTK_WINDOW(thiswin), &x, &y);
gtk_window_move(GTK_WINDOW(win), x+x_off, y+y_off);
w=glade_xml_get_widget(cxml, "Calendar");
if(w==NULL) {
fprintf(stderr,"Could not locate Calendar widget\n");
return(-1);
}
gtk_calendar_select_month(GTK_CALENDAR(w), isoDate_month(*date)-1, isoDate_year(*date));
gtk_calendar_select_day(GTK_CALENDAR(w), isoDate_day(*date));
gtk_window_present(GTK_WINDOW(win));
/* Wait for window to close... */
gtk_main();
w=glade_xml_get_widget(cxml, "Calendar");
if(w==NULL)
return(-1);
gtk_calendar_get_date(GTK_CALENDAR(w), &year, &month, &day);
gtk_widget_destroy(GTK_WIDGET(gtk_widget_get_toplevel(GTK_WIDGET(w))));
*date=isoDate_create(year, month+1, day);
return(odate!=*date);
}
void update_stats_callback(GtkWidget *wiggy, gpointer data)
{
......@@ -192,7 +266,14 @@ void on_yesterdays_log1_activate(GtkWidget *wiggy, gpointer data)
}
void on_another_days_log1_activate(GtkWidget *wiggy, gpointer data) {
/* ToDo */
isoDate_t date;
char fn[20];
GtkWidget *w;
date=time_to_isoDate(time(NULL));
get_date(wiggy, &date);
sprintf(fn,"logs/%02d%02d%02d.log",isoDate_month(date),isoDate_day(date),isoDate_year(date)%100);
exec_cmdstr(gtkm_conf.view_text_file, cfg.logs_dir, fn);
}
void on_spam_log1_activate(GtkWidget *wiggy, gpointer data)
......
......@@ -3390,4 +3390,31 @@ Set9</property>
</child>
</widget>
<widget class="GtkWindow" id="CalendarWindow">
<property name="title" translatable="yes">Calendar</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">True</property>
<property name="icon_name"></property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="destroy" handler="destroy_calendar_window" last_modification_time="Sun, 07 May 2006 04:15:11 GMT"/>
<child>
<widget class="GtkCalendar" id="Calendar">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="display_options">GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES</property>
<signal name="day_selected_double_click" handler="changed_day" last_modification_time="Sun, 07 May 2006 02:26:35 GMT"/>
</widget>
</child>
</widget>
</glade-interface>
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
<glade-project>
<name>GTK Monitor</name>
<program_name>gtkmonitor</program_name>
<source_directory></source_directory>
<gnome_support>FALSE</gnome_support>
<gettext_support>FALSE</gettext_support>
<output_build_files>FALSE</output_build_files>
</glade-project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment