[Xfce4-commits] r26682 - xfcalendar/trunk/src
Juha Kautto
juha at xfce.org
Mon Mar 17 21:44:57 CET 2008
Author: juha
Date: 2008-03-17 20:44:57 +0000 (Mon, 17 Mar 2008)
New Revision: 26682
Modified:
xfcalendar/trunk/src/about-xfcalendar.c
xfcalendar/trunk/src/appointment.c
xfcalendar/trunk/src/appointment.h
xfcalendar/trunk/src/event-list.c
xfcalendar/trunk/src/main.c
xfcalendar/trunk/src/mainbox.c
xfcalendar/trunk/src/parameters.c
xfcalendar/trunk/src/parameters.h
xfcalendar/trunk/src/reminder.c
xfcalendar/trunk/src/tray_icon.c
xfcalendar/trunk/src/tray_icon.h
Log:
minor changes in tray icon handling
minor changes in h files making them less dependent on each other
Modified: xfcalendar/trunk/src/about-xfcalendar.c
===================================================================
--- xfcalendar/trunk/src/about-xfcalendar.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/about-xfcalendar.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -42,7 +42,7 @@
, _("Manage your time with Xfce4")
, XFCE_COPYRIGHT_TEXT("2003-2008", " Juha Kautto")
, XFCE_LICENSE_GPL);
- orage_logo = orage_create_icon(xfcal, FALSE, 48, 48);
+ orage_logo = orage_create_icon(FALSE, 48, 48);
xfce_about_info_set_homepage(about, "http://www.xfce.org");
/* Credits */
Modified: xfcalendar/trunk/src/appointment.c
===================================================================
--- xfcalendar/trunk/src/appointment.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/appointment.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -704,7 +704,7 @@
gtk_object_destroy(GTK_OBJECT(apptw->Tooltips));
g_free(apptw->xf_uid);
g_free(apptw->par);
- xfical_appt_free(apptw->appt);
+ xfical_appt_free((xfical_appt *)apptw->xf_appt);
g_free(apptw);
}
@@ -1074,7 +1074,7 @@
static gboolean save_xfical_from_appt_win(appt_win *apptw)
{
gboolean ok = FALSE;
- xfical_appt *appt = apptw->appt;
+ xfical_appt *appt = (xfical_appt *)apptw->xf_appt;
if (fill_appt_from_apptw(appt, apptw)) {
/* Here we try to save the event... */
@@ -1241,7 +1241,7 @@
appt_win *apptw = (appt_win *)user_data;
xfical_appt *appt;
- appt = apptw->appt;
+ appt = (xfical_appt *)apptw->xf_appt;
if (xfical_timezone_button_clicked(button, GTK_WINDOW(apptw->Window)
, &appt->start_tz_loc))
mark_appointment_changed(apptw);
@@ -1253,7 +1253,7 @@
appt_win *apptw = (appt_win *)user_data;
xfical_appt *appt;
- appt = apptw->appt;
+ appt = (xfical_appt *)apptw->xf_appt;
if (xfical_timezone_button_clicked(button, GTK_WINDOW(apptw->Window)
, &appt->end_tz_loc))
mark_appointment_changed(apptw);
@@ -1265,7 +1265,7 @@
appt_win *apptw = (appt_win *)user_data;
xfical_appt *appt;
- appt = apptw->appt;
+ appt = (xfical_appt *)apptw->xf_appt;
if (xfical_timezone_button_clicked(button, GTK_WINDOW(apptw->Window)
, &appt->completed_tz_loc))
mark_appointment_changed(apptw);
@@ -1888,10 +1888,10 @@
orage_message(10, "%s appointment: %s", action, par);
if ((appt = fill_appt_window_get_appt(apptw, action, par)) == NULL) {
- apptw->appt = NULL;
+ apptw->xf_appt = NULL;
return;
}
- apptw->appt = appt;
+ apptw->xf_appt = appt;
/* first flags */
apptw->xf_uid = g_strdup(appt->uid);
@@ -2190,7 +2190,7 @@
, gpointer user_data)
{
appt_win *apptw = (appt_win *)user_data;
- xfical_appt *appt = apptw->appt;
+ xfical_appt *appt = (xfical_appt *)apptw->xf_appt;
fill_appt_from_apptw_alarm(appt, apptw);
store_default_alarm(appt);
@@ -2200,7 +2200,7 @@
, gpointer user_data)
{
appt_win *apptw = (appt_win *)user_data;
- xfical_appt *appt = apptw->appt;
+ xfical_appt *appt = (xfical_appt *)apptw->xf_appt;
read_default_alarm(appt);
fill_appt_window_alarm(appt, apptw);
@@ -2923,7 +2923,7 @@
apptw = g_new(appt_win, 1);
apptw->xf_uid = NULL;
apptw->par = NULL;
- apptw->appt = NULL;
+ apptw->xf_appt = NULL;
apptw->el = NULL;
apptw->dw = NULL;
apptw->appointment_changed = FALSE;
@@ -2955,7 +2955,7 @@
, G_CALLBACK(on_appWindow_delete_event_cb), apptw);
fill_appt_window(apptw, action, par);
- if (apptw->appt) { /* all fine */
+ if (apptw->xf_appt) { /* all fine */
gtk_widget_show_all(apptw->Window);
recur_hide_show(apptw);
type_hide_show(apptw);
Modified: xfcalendar/trunk/src/appointment.h
===================================================================
--- xfcalendar/trunk/src/appointment.h 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/appointment.h 2008-03-17 20:44:57 UTC (rev 26682)
@@ -24,8 +24,6 @@
#ifndef __APPOINTMENT_H__
#define __APPOINTMENT_H__
-#include "ical-code.h"
-
typedef struct _appt_win
{
GtkAccelGroup *accel_group;
@@ -181,7 +179,7 @@
GtkWidget *Recur_byday_spin_hbox;
GtkWidget *Recur_byday_spin[7]; /* 0=Mo, 1=Tu ... 6=Su */
- xfical_appt *appt;
+ void *xf_appt; /* this is xfical_appt * */
gchar *xf_uid;
gchar *par;
void *el; /* used to refresh calling event list */
Modified: xfcalendar/trunk/src/event-list.c
===================================================================
--- xfcalendar/trunk/src/event-list.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/event-list.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -695,7 +695,8 @@
{
char *title;
- title = orage_cal_to_i18_date(GTK_CALENDAR(g_par.xfcal->mCalendar));
+ title = orage_cal_to_i18_date(
+ GTK_CALENDAR(((CalWin *)g_par.xfcal)->mCalendar));
set_el_data(el, title);
}
@@ -814,7 +815,7 @@
tm_date = orage_i18_date_to_tm_date(
gtk_window_get_title(GTK_WINDOW(el->Window)));
orage_move_day(&tm_date, day);
- orage_select_date(GTK_CALENDAR(g_par.xfcal->mCalendar)
+ orage_select_date(GTK_CALENDAR(((CalWin *)g_par.xfcal)->mCalendar)
, tm_date.tm_year + 1900, tm_date.tm_mon, tm_date.tm_mday);
set_el_data_from_cal(el);
}
@@ -831,7 +832,7 @@
static void go_to_today(el_win *el)
{
- orage_select_today(GTK_CALENDAR(g_par.xfcal->mCalendar));
+ orage_select_today(GTK_CALENDAR(((CalWin *)g_par.xfcal)->mCalendar));
set_el_data_from_cal(el);
}
@@ -1346,7 +1347,7 @@
gtk_drag_source_set(el->TreeView, GDK_BUTTON1_MASK
, drag_targets, DRAG_TARGET_COUNT, GDK_ACTION_COPY);
- pixbuf = orage_create_icon(g_par.xfcal, TRUE, 16, 16);
+ pixbuf = orage_create_icon(TRUE, 16, 16);
gtk_drag_source_set_icon_pixbuf(el->TreeView, pixbuf);
g_object_unref(pixbuf);
g_signal_connect(el->TreeView, "drag_data_get"
Modified: xfcalendar/trunk/src/main.c
===================================================================
--- xfcalendar/trunk/src/main.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/main.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -103,29 +103,32 @@
{
GdkScreen *screen = NULL;
GdkWindow *window;
+ CalWin *cal = (CalWin *)g_par.xfcal;
/*
screen = xfce_gdk_display_locate_monitor_with_pointer(NULL, NULL);
*/
- gtk_window_set_screen(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_set_screen(GTK_WINDOW(cal->mWindow)
, screen ? screen : gdk_screen_get_default());
if (g_par.pos_x || g_par.pos_y)
- gtk_window_move(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_move(GTK_WINDOW(cal->mWindow)
, g_par.pos_x, g_par.pos_y);
if (g_par.select_always_today)
- orage_select_today(GTK_CALENDAR(g_par.xfcal->mCalendar));
+ orage_select_today(GTK_CALENDAR(cal->mCalendar));
if (g_par.set_stick)
- gtk_window_stick(GTK_WINDOW(g_par.xfcal->mWindow));
- gtk_window_set_keep_above(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_stick(GTK_WINDOW(cal->mWindow));
+ gtk_window_set_keep_above(GTK_WINDOW(cal->mWindow)
, g_par.set_ontop);
- window = GTK_WIDGET(g_par.xfcal->mWindow)->window;
+ window = GTK_WIDGET(cal->mWindow)->window;
gdk_x11_window_set_user_time(window, gdk_x11_get_server_time(window));
- gtk_window_present(GTK_WINDOW(g_par.xfcal->mWindow));
+ gtk_window_present(GTK_WINDOW(cal->mWindow));
}
static gboolean client_message_received(GtkWidget *widget
, GdkEventClient *event, gpointer user_data)
{
+ CalWin *cal = (CalWin *)g_par.xfcal;
+
if (event->message_type ==
gdk_atom_intern("_XFCE_CALENDAR_RAISE", FALSE)) {
raise_window();
@@ -133,9 +136,9 @@
}
else if (event->message_type ==
gdk_atom_intern("_XFCE_CALENDAR_TOGGLE_HERE", FALSE)) {
- if (GTK_WIDGET_VISIBLE(g_par.xfcal->mWindow)) {
+ if (GTK_WIDGET_VISIBLE(cal->mWindow)) {
write_parameters();
- gtk_widget_hide(g_par.xfcal->mWindow);
+ gtk_widget_hide(cal->mWindow);
return TRUE;
}
else {
@@ -433,8 +436,8 @@
g_par.xfcal = g_new(CalWin, 1);
/* Create the main window */
- g_par.xfcal->mWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- g_signal_connect((gpointer) g_par.xfcal->mWindow, "delete_event"
+ ((CalWin *)g_par.xfcal)->mWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ g_signal_connect((gpointer) ((CalWin *)g_par.xfcal)->mWindow, "delete_event"
, G_CALLBACK(mWindow_delete_event_cb), (gpointer)g_par.xfcal);
/*
@@ -461,19 +464,20 @@
build_mainWin();
set_parameters();
if (g_par.start_visible) {
- gtk_widget_show(g_par.xfcal->mWindow);
+ gtk_widget_show(((CalWin *)g_par.xfcal)->mWindow);
}
else if (g_par.start_minimized) {
- gtk_window_iconify(GTK_WINDOW(g_par.xfcal->mWindow));
- gtk_widget_show(g_par.xfcal->mWindow);
+ gtk_window_iconify(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow));
+ gtk_widget_show(((CalWin *)g_par.xfcal)->mWindow);
}
else { /* hidden */
- gtk_widget_realize(g_par.xfcal->mWindow);
- gtk_widget_hide(g_par.xfcal->mWindow);
+ gtk_widget_realize(((CalWin *)g_par.xfcal)->mWindow);
+ gtk_widget_hide(((CalWin *)g_par.xfcal)->mWindow);
}
reset_orage_day_change(FALSE); /* first day change after we start */
alarm_read();
- mCalendar_month_changed_cb((GtkCalendar *)g_par.xfcal->mCalendar, NULL);
+ mCalendar_month_changed_cb(
+ (GtkCalendar *)((CalWin *)g_par.xfcal)->mCalendar, NULL);
/* start monitoring foreign file updates if we have foreign files */
if (g_par.foreign_count)
Modified: xfcalendar/trunk/src/mainbox.c
===================================================================
--- xfcalendar/trunk/src/mainbox.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/mainbox.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -65,7 +65,7 @@
#endif
if (!xfical_file_open(TRUE))
return(FALSE);
- xfical_mark_calendar(GTK_CALENDAR(g_par.xfcal->mCalendar));
+ xfical_mark_calendar(GTK_CALENDAR(((CalWin *)g_par.xfcal)->mCalendar));
xfical_file_close(TRUE);
return(TRUE);
}
@@ -249,7 +249,7 @@
#undef P_N
#define P_N "build_menu: "
GtkWidget *menu_separator;
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
#ifdef ORAGE_DEBUG
orage_message(-100, P_N);
@@ -306,7 +306,7 @@
cal->mHelp_about = orage_image_menu_item_new_from_stock("gtk-about"
, cal->mHelp_menu, cal->mAccel_group);
- gtk_widget_show_all(g_par.xfcal->mMenubar);
+ gtk_widget_show_all(((CalWin *)g_par.xfcal)->mMenubar);
/* Signals */
g_signal_connect((gpointer) cal->mFile_newApp, "activate"
@@ -352,7 +352,7 @@
#undef P_N
#define P_N "add_info_row: "
GtkWidget *ev, *label;
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
gchar *tip, *tmp;
struct tm *t;
char *l_time, *s_time, *e_time, *c_time, *na;
@@ -458,7 +458,7 @@
#define P_N "info_process: "
xfical_appt *appt = (xfical_appt *)a;;
GtkBox *box = GTK_BOX(pbox);
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
gboolean todo;
#ifdef ORAGE_DEBUG
@@ -476,7 +476,7 @@
{
#undef P_N
#define P_N "create_mainbox_todo_info: "
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
#ifdef ORAGE_DEBUG
orage_message(-100, P_N);
@@ -504,7 +504,7 @@
{
#undef P_N
#define P_N "create_mainbox_event_info: "
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
gchar *tmp;
#ifdef ORAGE_DEBUG
@@ -537,7 +537,7 @@
{
#undef P_N
#define P_N "build_mainbox_todo_info: "
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
char *s_time;
char a_day[9]; /* yyyymmdd */
struct tm *t;
@@ -584,7 +584,7 @@
{
#undef P_N
#define P_N "build_mainbox_event_info: "
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
char *s_time;
char a_day[9]; /* yyyymmdd */
struct tm tt= {0,0,0,0,0,0,0,0,0};
@@ -667,7 +667,7 @@
#undef P_N
#define P_N "build_mainWin: "
GdkPixbuf *orage_logo;
- CalWin *cal = g_par.xfcal;
+ CalWin *cal = (CalWin *)g_par.xfcal;
GdkColormap *pic1_cmap;
#ifdef ORAGE_DEBUG
@@ -682,7 +682,7 @@
/* using static icon here since this dynamic icon is not updated
* when date changes. Could be added, but not worth it.
* Dynamic icon is used in systray and about windows */
- orage_logo = orage_create_icon(cal, TRUE, 48, 48);
+ orage_logo = orage_create_icon(TRUE, 48, 48);
cal->mAccel_group = gtk_accel_group_new();
cal->Tooltips = gtk_tooltips_new();
Modified: xfcalendar/trunk/src/parameters.c
===================================================================
--- xfcalendar/trunk/src/parameters.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/parameters.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -43,6 +43,7 @@
#include "tray_icon.h"
#include "ical-code.h"
#include "parameters.h"
+#include "mainbox.h"
static gboolean is_running = FALSE;
@@ -185,7 +186,7 @@
static void set_border()
{
- gtk_window_set_decorated(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_set_decorated(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow)
, g_par.show_borders);
}
@@ -201,9 +202,9 @@
static void set_menu()
{
if (g_par.show_menu)
- gtk_widget_show(g_par.xfcal->mMenubar);
+ gtk_widget_show(((CalWin *)g_par.xfcal)->mMenubar);
else
- gtk_widget_hide(g_par.xfcal->mMenubar);
+ gtk_widget_hide(((CalWin *)g_par.xfcal)->mMenubar);
}
static void menu_changed(GtkWidget *dialog, gpointer user_data)
@@ -218,9 +219,9 @@
static void set_todos()
{
if (g_par.show_todos)
- gtk_widget_show_all(g_par.xfcal->mTodo_vbox);
+ gtk_widget_show_all(((CalWin *)g_par.xfcal)->mTodo_vbox);
else
- gtk_widget_hide_all(g_par.xfcal->mTodo_vbox);
+ gtk_widget_hide_all(((CalWin *)g_par.xfcal)->mTodo_vbox);
}
static void todos_changed(GtkWidget *dialog, gpointer user_data)
@@ -235,9 +236,9 @@
static void set_events()
{
if (g_par.show_events)
- gtk_widget_show_all(g_par.xfcal->mEvent_vbox);
+ gtk_widget_show_all(((CalWin *)g_par.xfcal)->mEvent_vbox);
else
- gtk_widget_hide_all(g_par.xfcal->mEvent_vbox);
+ gtk_widget_hide_all(((CalWin *)g_par.xfcal)->mEvent_vbox);
}
static void events_changed(GtkWidget *dialog, gpointer user_data)
@@ -252,9 +253,9 @@
static void set_stick()
{
if (g_par.set_stick)
- gtk_window_stick(GTK_WINDOW(g_par.xfcal->mWindow));
+ gtk_window_stick(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow));
else
- gtk_window_unstick(GTK_WINDOW(g_par.xfcal->mWindow));
+ gtk_window_unstick(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow));
}
static void stick_changed(GtkWidget *dialog, gpointer user_data)
@@ -268,7 +269,7 @@
static void set_ontop()
{
- gtk_window_set_keep_above(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_set_keep_above(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow)
, g_par.set_ontop);
}
@@ -283,8 +284,8 @@
static void set_taskbar()
{
- gtk_window_set_skip_taskbar_hint(GTK_WINDOW(g_par.xfcal->mWindow)
- , !g_par.show_taskbar);
+ gtk_window_set_skip_taskbar_hint(
+ GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow), !g_par.show_taskbar);
}
static void taskbar_changed(GtkWidget *dialog, gpointer user_data)
@@ -298,7 +299,7 @@
static void set_pager()
{
- gtk_window_set_skip_pager_hint(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_set_skip_pager_hint(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow)
, !g_par.show_pager);
}
@@ -313,14 +314,15 @@
static void set_systray()
{
- if (!(g_par.trayIcon && NETK_IS_TRAY_ICON(g_par.trayIcon->tray))) {
- g_par.trayIcon = create_TrayIcon(g_par.xfcal);
+ if (!(g_par.trayIcon
+ && NETK_IS_TRAY_ICON(((XfceTrayIcon *)g_par.trayIcon)->tray))) {
+ g_par.trayIcon = create_TrayIcon();
}
if (g_par.show_systray)
- xfce_tray_icon_connect(g_par.trayIcon);
+ xfce_tray_icon_connect((XfceTrayIcon *)g_par.trayIcon);
else
- xfce_tray_icon_disconnect(g_par.trayIcon);
+ xfce_tray_icon_disconnect((XfceTrayIcon *)g_par.trayIcon);
}
static void systray_changed(GtkWidget *dialog, gpointer user_data)
@@ -425,13 +427,7 @@
static void set_icon_size()
{
- if (g_par.trayIcon && NETK_IS_TRAY_ICON(g_par.trayIcon->tray)) {
- /* refresh date in tray icon */
- xfce_tray_icon_disconnect(g_par.trayIcon);
- destroy_TrayIcon(g_par.trayIcon);
- g_par.trayIcon = create_TrayIcon(g_par.xfcal);
- xfce_tray_icon_connect(g_par.trayIcon);
- }
+ refresh_TrayIcon();
}
static void icon_size_x_spin_changed(GtkSpinButton *sb, gpointer user_data)
@@ -895,7 +891,7 @@
#endif
orage_rc_put_str(orc, "Orage file", g_par.orage_file);
orage_rc_put_str(orc, "Sound application", g_par.sound_application);
- gtk_window_get_position(GTK_WINDOW(g_par.xfcal->mWindow)
+ gtk_window_get_position(GTK_WINDOW(((CalWin *)g_par.xfcal)->mWindow)
, &g_par.pos_x, &g_par.pos_y);
orage_rc_put_int(orc, "Main window X", g_par.pos_x);
orage_rc_put_int(orc, "Main window Y", g_par.pos_y);
Modified: xfcalendar/trunk/src/parameters.h
===================================================================
--- xfcalendar/trunk/src/parameters.h 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/parameters.h 2008-03-17 20:44:57 UTC (rev 26682)
@@ -23,9 +23,6 @@
#ifndef __ORAGE_PARAMETERS_H__
#define __ORAGE_PARAMETERS_H__
-#include "xfce_trayicon.h"
-#include "mainbox.h"
-
#define BORDER 5
typedef struct _foreign_file
{
@@ -78,11 +75,11 @@
guint tooltip_timer; /* keeps tooltips upto date */
/* main window */
- CalWin *xfcal;
+ void *xfcal; /* this is main calendar CalWin * */
gint pos_x, pos_y;
/* tray icon */
- XfceTrayIcon *trayIcon;
+ void *trayIcon; /* this is XfceTrayIcon * */
gint icon_size_x, icon_size_y;
/* event-list window */
Modified: xfcalendar/trunk/src/reminder.c
===================================================================
--- xfcalendar/trunk/src/reminder.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/reminder.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -426,8 +426,10 @@
strncat(heading, alarm->title, 50);
n = notify_notification_new(heading, alarm->description, NULL, NULL);
alarm->active_alarm->active_notify = n;
- if (g_par.trayIcon && NETK_IS_TRAY_ICON(g_par.trayIcon->tray))
- notify_notification_attach_to_widget(n, g_par.trayIcon->image);
+ if (g_par.trayIcon
+ && NETK_IS_TRAY_ICON(((XfceTrayIcon *)g_par.trayIcon)->tray))
+ notify_notification_attach_to_widget(n
+ , ((XfceTrayIcon *)g_par.trayIcon)->image);
if (alarm->notify_timeout == -1)
notify_notification_set_timeout(n, NOTIFY_EXPIRES_NEVER);
@@ -648,7 +650,6 @@
{
#undef P_N
#define P_N "orage_day_change: "
- CalWin *xfcal;
struct tm *t;
static guint previous_year=0, previous_month=0, previous_day=0;
guint selected_year=0, selected_month=0, selected_day=0;
@@ -666,29 +667,20 @@
current_month = t->tm_mon;
current_day = t->tm_mday;
/* Get the selected date from calendar */
- xfcal = g_par.xfcal;
- gtk_calendar_get_date(GTK_CALENDAR (xfcal->mCalendar),
+ gtk_calendar_get_date(GTK_CALENDAR(((CalWin *)g_par.xfcal)->mCalendar),
&selected_year, &selected_month, &selected_day);
if (selected_year == previous_year
&& selected_month == previous_month
&& selected_day == previous_day) {
/* previous day was indeed selected,
keep it current automatically */
- orage_select_date(GTK_CALENDAR(xfcal->mCalendar)
+ orage_select_date(GTK_CALENDAR(((CalWin *)g_par.xfcal)->mCalendar)
, current_year, current_month, current_day);
}
previous_year = current_year;
previous_month = current_month;
previous_day = current_day;
- if (g_par.show_systray) {
- /* refresh date in tray icon */
- if (g_par.trayIcon && NETK_IS_TRAY_ICON(g_par.trayIcon->tray)) {
- xfce_tray_icon_disconnect(g_par.trayIcon);
- destroy_TrayIcon(g_par.trayIcon);
- }
- g_par.trayIcon = create_TrayIcon(xfcal);
- xfce_tray_icon_connect(g_par.trayIcon);
- }
+ refresh_TrayIcon();
xfical_alarm_build_list(TRUE); /* new alarm list when date changed */
reset_orage_day_change(TRUE); /* setup for next time */
}
@@ -821,7 +813,8 @@
#ifdef ORAGE_DEBUG
orage_message(-100, P_N);
#endif
- if (!(g_par.trayIcon && NETK_IS_TRAY_ICON(g_par.trayIcon->tray))) {
+ if (!(g_par.trayIcon
+ && NETK_IS_TRAY_ICON(((XfceTrayIcon *)g_par.trayIcon)->tray))) {
/* no trayicon => no need to update the tooltip */
return(FALSE);
}
@@ -863,7 +856,8 @@
}
if (alarm_cnt == 0)
g_string_append_printf(tooltip, _("\nNo active alarms found"));
- xfce_tray_icon_set_tooltip(g_par.trayIcon, tooltip->str, NULL);
+ xfce_tray_icon_set_tooltip((XfceTrayIcon *)g_par.trayIcon, tooltip->str
+ , NULL);
g_string_free(tooltip, TRUE);
return(TRUE);
}
Modified: xfcalendar/trunk/src/tray_icon.c
===================================================================
--- xfcalendar/trunk/src/tray_icon.c 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/tray_icon.c 2008-03-17 20:44:57 UTC (rev 26682)
@@ -45,6 +45,7 @@
#include "xfce_trayicon.h"
#include "parameters.h"
+#define ORAGE_TRAYICON ((XfceTrayIcon *)g_par.trayIcon)
void orage_toggle_visible();
@@ -79,208 +80,208 @@
void on_about_activate(GtkMenuItem *menuitem, gpointer user_data)
{
- create_wAbout((GtkWidget *)menuitem, user_data);
+ create_wAbout((GtkWidget *)menuitem, user_data);
}
void toggle_visible_cb ()
{
- orage_toggle_visible ();
+ orage_toggle_visible ();
}
-GdkPixbuf *orage_create_icon(CalWin *xfcal, gboolean static_icon
- , gint x, gint y)
+GdkPixbuf *orage_create_icon(gboolean static_icon, gint x, gint y)
{
- GtkIconTheme *icon_theme = NULL;
- GdkPixbuf *pixbuf;
- GdkPixmap *pic1;
- GdkGC *pic1_gc1, *pic1_gc2;
- GdkColormap *pic1_cmap;
- GdkColor color;
- GdkVisual *pic1_vis;
- PangoLayout *pl_day, *pl_head, *pl_month;
- gint width = 0, height = 0, depth = 16;
- gint red = 239, green = 235, blue = 230;
- PangoRectangle real_rect, log_rect;
- struct tm *t;
- gchar ts[200], month[50];
- gint x_offset = 0, y_offset = 0, y_used = 0, i, limit;
- gint x_day = 0, y_day = 0;
- gint x_head = 0, y_head = 0, y_used_head = 0;
- gint x_month = 0, y_month = 0, y_used_month = 0;
- gboolean draw_head = FALSE, draw_month = FALSE;
- gboolean draw_dynamic = FALSE, work_in_progress = TRUE;
- gchar *day_sizes[] = {"xx-large", "x-large", "large", "medium"
- , "small", "x-small", "xx-small", "END"};
+ CalWin *xfcal = (CalWin *)g_par.xfcal;
+ GtkIconTheme *icon_theme = NULL;
+ GdkPixbuf *pixbuf;
+ GdkPixmap *pic1;
+ GdkGC *pic1_gc1, *pic1_gc2;
+ GdkColormap *pic1_cmap;
+ GdkColor color;
+ GdkVisual *pic1_vis;
+ PangoLayout *pl_day, *pl_head, *pl_month;
+ gint width = 0, height = 0, depth = 16;
+ gint red = 239, green = 235, blue = 230;
+ PangoRectangle real_rect, log_rect;
+ struct tm *t;
+ gchar ts[200], month[50];
+ gint x_offset = 0, y_offset = 0, y_used = 0, i, limit;
+ gint x_day = 0, y_day = 0;
+ gint x_head = 0, y_head = 0, y_used_head = 0;
+ gint x_month = 0, y_month = 0, y_used_month = 0;
+ gboolean draw_head = FALSE, draw_month = FALSE;
+ gboolean draw_dynamic = FALSE, work_in_progress = TRUE;
+ gchar *day_sizes[] = {"xx-large", "x-large", "large", "medium"
+ , "small", "x-small", "xx-small", "END"};
- icon_theme = gtk_icon_theme_get_default();
- if (static_icon) {
- pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", x
- , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- return(pixbuf);
- }
- if (x <= 12 || y <= 12) {
- orage_message(110, "Too small icon size, using static icon\n");
- pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", 16
- , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- return(pixbuf);
- }
- if (g_par.icon_size_x == 0
- || g_par.icon_size_y == 0) { /* signal to use static icon */
- orage_message(110, "Icon size set to zero, using static icon\n");
- pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", x
- , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- return(pixbuf);
- }
+ icon_theme = gtk_icon_theme_get_default();
+ if (static_icon) {
+ pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", x
+ , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+ return(pixbuf);
+ }
+ if (x <= 12 || y <= 12) {
+ orage_message(110, "Too small icon size, using static icon\n");
+ pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", 16
+ , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+ return(pixbuf);
+ }
+ if (g_par.icon_size_x == 0
+ || g_par.icon_size_y == 0) { /* signal to use static icon */
+ orage_message(110, "Icon size set to zero, using static icon\n");
+ pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", x
+ , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+ return(pixbuf);
+ }
- t = orage_localtime();
- width = x;
- height = y;
- pic1_cmap = gdk_colormap_get_system();
- pic1_vis = gdk_colormap_get_visual(pic1_cmap);
- depth = pic1_vis->depth;
- pic1 = gdk_pixmap_new(NULL, width, height, depth);
- gdk_drawable_set_colormap(pic1, pic1_cmap);
- /* pic1_cmap = gtk_widget_get_colormap(xfcal->mWindow); */
- pic1_gc1 = gdk_gc_new(pic1);
- pic1_gc2 = gdk_gc_new(pic1);
- color.red = red * (65535/255);
- color.green = green * (65535/255);
- color.blue = blue * (65535/255);
- color.pixel = (gulong)(red*65536 + green*256 + blue);
- /*
- gdk_color_alloc(pic1_cmap, &color);
- */
- gdk_colormap_alloc_color(pic1_cmap, &color, FALSE, TRUE);
- gdk_gc_set_foreground(pic1_gc1, &color);
- gdk_draw_rectangle(pic1, pic1_gc1, TRUE, 0, 0, width, height);
- gdk_draw_rectangle(pic1, pic1_gc2, FALSE, 0, 0, width-1, height-1);
- gdk_draw_rectangle(pic1, pic1_gc2, FALSE, 0, 0, width-3, height-3);
+ t = orage_localtime();
+ width = x;
+ height = y;
+ pic1_cmap = gdk_colormap_get_system();
+ pic1_vis = gdk_colormap_get_visual(pic1_cmap);
+ depth = pic1_vis->depth;
+ pic1 = gdk_pixmap_new(NULL, width, height, depth);
+ gdk_drawable_set_colormap(pic1, pic1_cmap);
+ /* pic1_cmap = gtk_widget_get_colormap(xfcal->mWindow); */
+ pic1_gc1 = gdk_gc_new(pic1);
+ pic1_gc2 = gdk_gc_new(pic1);
+ color.red = red * (65535/255);
+ color.green = green * (65535/255);
+ color.blue = blue * (65535/255);
+ color.pixel = (gulong)(red*65536 + green*256 + blue);
+ /*
+ gdk_color_alloc(pic1_cmap, &color);
+ */
+ gdk_colormap_alloc_color(pic1_cmap, &color, FALSE, TRUE);
+ gdk_gc_set_foreground(pic1_gc1, &color);
+ gdk_draw_rectangle(pic1, pic1_gc1, TRUE, 0, 0, width, height);
+ gdk_draw_rectangle(pic1, pic1_gc2, FALSE, 0, 0, width-1, height-1);
+ gdk_draw_rectangle(pic1, pic1_gc2, FALSE, 0, 0, width-3, height-3);
- /* gdk_draw_line(pic1, pic1_gc1, 10, 20, 30, 38); */
+ /* gdk_draw_line(pic1, pic1_gc1, 10, 20, 30, 38); */
- /* create any valid pango layout to get things started */
- /* this does not quite work, but almost
- pl_day = pango_layout_new(gdk_pango_context_get_for_screen(gdk_screen_get_default()));
- */
- pl_day = gtk_widget_create_pango_layout(xfcal->mWindow, "x");
- pl_head = pango_layout_copy(pl_day);
- pl_month = pango_layout_copy(pl_day);
+ /* create any valid pango layout to get things started */
+ /* this does not quite work, but almost
+ pl_day = pango_layout_new(gdk_pango_context_get_for_screen(gdk_screen_get_default()));
+ */
+ pl_day = gtk_widget_create_pango_layout(xfcal->mWindow, "x");
+ pl_head = pango_layout_copy(pl_day);
+ pl_month = pango_layout_copy(pl_day);
- /* heading: orage */
- g_snprintf(ts, 199
- , "<span foreground=\"blue\" size=\"x-small\">Orage</span>");
- pango_layout_set_markup(pl_head, ts, -1);
- pango_layout_set_alignment(pl_head, PANGO_ALIGN_CENTER);
- pango_layout_get_extents(pl_head, &real_rect, &log_rect);
- x_offset = (width - PANGO_PIXELS(log_rect.width) - 2)/2;
- y_offset = -2;
- /* g_print("orage offset x=%d y=%d height=%d text height=%d real text height=%d\n" , x_offset, y_offset, height, PANGO_PIXELS(log_rect.height), PANGO_PIXELS(real_rect.height)); */
- if (x_offset > 0 && (height-PANGO_PIXELS(log_rect.height)-y_offset) > 0) {
- draw_head = TRUE; /* fits */
- x_head = x_offset;
- y_head = y_offset;
- y_used_head = PANGO_PIXELS(real_rect.height);
- }
- else
- orage_message(110, "trayicon: heading does not fit in dynamic icon");
+ /* heading: orage */
+ g_snprintf(ts, 199
+ , "<span foreground=\"blue\" size=\"x-small\">Orage</span>");
+ pango_layout_set_markup(pl_head, ts, -1);
+ pango_layout_set_alignment(pl_head, PANGO_ALIGN_CENTER);
+ pango_layout_get_extents(pl_head, &real_rect, &log_rect);
+ x_offset = (width - PANGO_PIXELS(log_rect.width) - 2)/2;
+ y_offset = -2;
+ /* g_print("orage offset x=%d y=%d height=%d text height=%d real text height=%d\n" , x_offset, y_offset, height, PANGO_PIXELS(log_rect.height), PANGO_PIXELS(real_rect.height)); */
+ if (x_offset > 0 && (height-PANGO_PIXELS(log_rect.height)-y_offset) > 0) {
+ draw_head = TRUE; /* fits */
+ x_head = x_offset;
+ y_head = y_offset;
+ y_used_head = PANGO_PIXELS(real_rect.height);
+ }
+ else
+ orage_message(110, "trayicon: heading does not fit in dynamic icon");
- /* month */
- if (strftime(month, 19, "%^b", t) == 0) {
- g_warning("orage_create_icon: strftime %%^b failed");
- if (strftime(month, 19, "%b", t) == 0) {
- g_warning("orage_create_icon: strftime %%b failed");
- g_sprintf(month, "orage");
- }
- }
- g_snprintf(ts, 199
- , "<span foreground=\"blue\" size=\"x-small\">%s</span>", month);
- pango_layout_set_markup(pl_month, ts, -1);
- pango_layout_set_alignment(pl_month, PANGO_ALIGN_CENTER);
- pango_layout_get_extents(pl_month, &real_rect, &log_rect);
- x_offset = (width - PANGO_PIXELS(real_rect.width) - 2)/2;
- y_offset = (height - PANGO_PIXELS(log_rect.height) - 2);
- if (x_offset > 0 && (height - y_offset - PANGO_PIXELS(log_rect.height))) {
- draw_month = TRUE; /* fits */
- x_month = x_offset;
- y_month = y_offset;
- y_used_month = PANGO_PIXELS(real_rect.height);
- }
- else
- orage_message(110, "trayicon: month does not fit in dynamic icon");
+ /* month */
+ if (strftime(month, 19, "%^b", t) == 0) {
+ g_warning("orage_create_icon: strftime %%^b failed");
+ if (strftime(month, 19, "%b", t) == 0) {
+ g_warning("orage_create_icon: strftime %%b failed");
+ g_sprintf(month, "orage");
+ }
+ }
+ g_snprintf(ts, 199
+ , "<span foreground=\"blue\" size=\"x-small\">%s</span>", month);
+ pango_layout_set_markup(pl_month, ts, -1);
+ pango_layout_set_alignment(pl_month, PANGO_ALIGN_CENTER);
+ pango_layout_get_extents(pl_month, &real_rect, &log_rect);
+ x_offset = (width - PANGO_PIXELS(real_rect.width) - 2)/2;
+ y_offset = (height - PANGO_PIXELS(log_rect.height) - 2);
+ if (x_offset > 0 && (height - y_offset - PANGO_PIXELS(log_rect.height))) {
+ draw_month = TRUE; /* fits */
+ x_month = x_offset;
+ y_month = y_offset;
+ y_used_month = PANGO_PIXELS(real_rect.height);
+ }
+ else
+ orage_message(110, "trayicon: month does not fit in dynamic icon");
- do { /* main loop where we try our best to fit header+day+month into icon */
- y_used = 0;
- if (draw_month || draw_head) {
- limit = 3; /* = medium */
- if (draw_head)
- y_used += y_used_head;
- if (draw_month)
- y_used += y_used_month;
- }
- else
- limit = 10; /* no limit */
+ do { /* main loop where we try our best to fit header+day+month into icon */
+ y_used = 0;
+ if (draw_month || draw_head) {
+ limit = 3; /* = medium */
+ if (draw_head)
+ y_used += y_used_head;
+ if (draw_month)
+ y_used += y_used_month;
+ }
+ else
+ limit = 10; /* no limit */
- /* day */
- for (i = 0, x_offset = 0, y_offset = 0;
- (strcmp(day_sizes[i], "END") != 0)
- && (i <= limit)
- && ((x_offset <= 0) || ((y_offset) <= 0));
- i++) {
- g_snprintf(ts, 199
- , "<span foreground=\"red\" weight=\"bold\" size=\"%s\">%02d</span>"
- , day_sizes[i], t->tm_mday);
- pango_layout_set_markup(pl_day, ts, -1);
- pango_layout_set_alignment(pl_day, PANGO_ALIGN_CENTER);
- pango_layout_get_extents(pl_day, &real_rect, &log_rect);
- x_offset = (width - PANGO_PIXELS(log_rect.width))/2;
- y_offset = (height - y_used - PANGO_PIXELS(log_rect.height))/2;
- } /* for */
- if (x_offset >= 0 && (y_offset) >= 0) { /* it fits */
- draw_dynamic = TRUE;
- work_in_progress = FALSE; /* done! */
- x_day = x_offset;
- y_day = (height - PANGO_PIXELS(log_rect.height) - 2)/2;
- if (!draw_head && draw_month)
- y_day -= y_used_head/2;
- if (draw_head && !draw_month)
- y_day += y_used_head/2;
- }
- else {
- if (draw_head)
- draw_head = FALSE; /* does not fit */
- else if (draw_month)
- draw_month = FALSE; /* does not fit */
- else
- work_in_progress = FALSE; /* done! */
- }
- } while (work_in_progress);
+ /* day */
+ for (i = 0, x_offset = 0, y_offset = 0;
+ (strcmp(day_sizes[i], "END") != 0)
+ && (i <= limit)
+ && ((x_offset <= 0) || ((y_offset) <= 0));
+ i++) {
+ g_snprintf(ts, 199
+ , "<span foreground=\"red\" weight=\"bold\" size=\"%s\">%02d</span>"
+ , day_sizes[i], t->tm_mday);
+ pango_layout_set_markup(pl_day, ts, -1);
+ pango_layout_set_alignment(pl_day, PANGO_ALIGN_CENTER);
+ pango_layout_get_extents(pl_day, &real_rect, &log_rect);
+ x_offset = (width - PANGO_PIXELS(log_rect.width))/2;
+ y_offset = (height - y_used - PANGO_PIXELS(log_rect.height))/2;
+ } /* for */
+ if (x_offset >= 0 && (y_offset) >= 0) { /* it fits */
+ draw_dynamic = TRUE;
+ work_in_progress = FALSE; /* done! */
+ x_day = x_offset;
+ y_day = (height - PANGO_PIXELS(log_rect.height) - 2)/2;
+ if (!draw_head && draw_month)
+ y_day -= y_used_head/2;
+ if (draw_head && !draw_month)
+ y_day += y_used_head/2;
+ }
+ else {
+ if (draw_head)
+ draw_head = FALSE; /* does not fit */
+ else if (draw_month)
+ draw_month = FALSE; /* does not fit */
+ else
+ work_in_progress = FALSE; /* done! */
+ }
+ } while (work_in_progress);
- if (draw_dynamic) {
- if (draw_head)
- gdk_draw_layout(pic1, pic1_gc1, x_head, y_head, pl_head);
- if (draw_month)
- gdk_draw_layout(pic1, pic1_gc1, x_month, y_month, pl_month);
- gdk_draw_layout(pic1, pic1_gc1, x_day, y_day, pl_day);
+ if (draw_dynamic) {
+ if (draw_head)
+ gdk_draw_layout(pic1, pic1_gc1, x_head, y_head, pl_head);
+ if (draw_month)
+ gdk_draw_layout(pic1, pic1_gc1, x_month, y_month, pl_month);
+ gdk_draw_layout(pic1, pic1_gc1, x_day, y_day, pl_day);
- pixbuf = gdk_pixbuf_get_from_drawable(NULL, pic1, pic1_cmap
- , 0, 0, 0, 0, width, height);
- }
- else {
- pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", x
- , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- }
+ pixbuf = gdk_pixbuf_get_from_drawable(NULL, pic1, pic1_cmap
+ , 0, 0, 0, 0, width, height);
+ }
+ else {
+ pixbuf = gtk_icon_theme_load_icon(icon_theme, "xfcalendar", x
+ , GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+ }
- if (pixbuf == NULL)
- g_warning("orage_create_icon: load failed\n");
+ if (pixbuf == NULL)
+ g_warning("orage_create_icon: load failed\n");
- g_object_unref(pic1_gc1);
- g_object_unref(pic1_gc2);
- g_object_unref(pl_day);
- g_object_unref(pl_head);
- g_object_unref(pl_month);
- g_object_unref(pic1);
+ g_object_unref(pic1_gc1);
+ g_object_unref(pic1_gc2);
+ g_object_unref(pl_day);
+ g_object_unref(pl_head);
+ g_object_unref(pl_month);
+ g_object_unref(pic1);
- return(pixbuf);
+ return(pixbuf);
}
void destroy_TrayIcon(XfceTrayIcon *trayIcon)
@@ -298,76 +299,88 @@
*/
}
-XfceTrayIcon* create_TrayIcon(CalWin *xfcal)
+XfceTrayIcon* create_TrayIcon()
{
- XfceTrayIcon *trayIcon = NULL;
- GtkWidget *menuItem;
- GtkWidget *trayMenu;
- GdkPixbuf *pixbuf;
+ CalWin *xfcal = (CalWin *)g_par.xfcal;
+ XfceTrayIcon *trayIcon = NULL;
+ GtkWidget *menuItem;
+ GtkWidget *trayMenu;
+ GdkPixbuf *pixbuf;
- /*
- * Create the tray icon popup menu
- */
- trayMenu = gtk_menu_new();
- menuItem = gtk_image_menu_item_new_with_mnemonic(_("Today"));
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem)
- , gtk_image_new_from_stock(GTK_STOCK_HOME, GTK_ICON_SIZE_MENU));
- g_signal_connect(menuItem, "activate", G_CALLBACK(on_Today_activate)
- , xfcal);
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show_all(menuItem);
- menuItem = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
+ /*
+ * Create the tray icon popup menu
+ */
+ trayMenu = gtk_menu_new();
+ menuItem = gtk_image_menu_item_new_with_mnemonic(_("Today"));
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem)
+ , gtk_image_new_from_stock(GTK_STOCK_HOME, GTK_ICON_SIZE_MENU));
+ g_signal_connect(menuItem, "activate", G_CALLBACK(on_Today_activate)
+ , xfcal);
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show_all(menuItem);
+ menuItem = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
- menuItem = gtk_image_menu_item_new_with_label(_("New appointment"));
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem)
- , gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_MENU));
- g_signal_connect(menuItem, "activate"
- , G_CALLBACK(on_new_appointment_activate), NULL);
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
- menuItem = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
+ menuItem = gtk_image_menu_item_new_with_label(_("New appointment"));
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem)
+ , gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_MENU));
+ g_signal_connect(menuItem, "activate"
+ , G_CALLBACK(on_new_appointment_activate), NULL);
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
+ menuItem = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
- menuItem = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL);
- g_signal_connect(menuItem, "activate", G_CALLBACK(on_preferences_activate)
- , NULL);
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
- menuItem = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
+ menuItem = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL);
+ g_signal_connect(menuItem, "activate", G_CALLBACK(on_preferences_activate)
+ , NULL);
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
+ menuItem = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
- menuItem = gtk_image_menu_item_new_with_label(_("About Orage"));
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem)
- , gtk_image_new_from_stock(GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU));
- g_signal_connect(menuItem, "activate", G_CALLBACK(on_about_activate)
- , xfcal);
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
- menuItem = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
+ menuItem = gtk_image_menu_item_new_with_label(_("About Orage"));
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuItem)
+ , gtk_image_new_from_stock(GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU));
+ g_signal_connect(menuItem, "activate", G_CALLBACK(on_about_activate)
+ , xfcal);
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
+ menuItem = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
- menuItem = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
- g_signal_connect(menuItem, "activate", G_CALLBACK(gtk_main_quit), NULL);
- gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
- gtk_widget_show(menuItem);
+ menuItem = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
+ g_signal_connect(menuItem, "activate", G_CALLBACK(gtk_main_quit), NULL);
+ gtk_menu_shell_append(GTK_MENU_SHELL(trayMenu), menuItem);
+ gtk_widget_show(menuItem);
- /*
- * Create the tray icon
- */
+ /*
+ * Create the tray icon
+ */
- pixbuf = orage_create_icon(xfcal, FALSE
- , g_par.icon_size_x, g_par.icon_size_y);
- trayIcon = xfce_tray_icon_new_with_menu_from_pixbuf(trayMenu, pixbuf);
- g_object_ref(trayIcon);
- gtk_object_sink(GTK_OBJECT(trayIcon));
- g_object_unref(pixbuf);
+ pixbuf = orage_create_icon(FALSE, g_par.icon_size_x, g_par.icon_size_y);
+ trayIcon = xfce_tray_icon_new_with_menu_from_pixbuf(trayMenu, pixbuf);
+ g_object_ref(trayIcon);
+ gtk_object_sink(GTK_OBJECT(trayIcon));
+ g_object_unref(pixbuf);
- g_signal_connect_swapped(G_OBJECT(trayIcon), "clicked",
- G_CALLBACK(toggle_visible_cb), xfcal);
- return trayIcon;
+ g_signal_connect_swapped(G_OBJECT(trayIcon), "clicked",
+ G_CALLBACK(toggle_visible_cb), xfcal);
+ return(trayIcon);
}
+
+void refresh_TrayIcon()
+{
+ if (g_par.show_systray) { /* refresh tray icon */
+ if (ORAGE_TRAYICON && NETK_IS_TRAY_ICON(ORAGE_TRAYICON->tray)) {
+ xfce_tray_icon_disconnect(ORAGE_TRAYICON);
+ destroy_TrayIcon(ORAGE_TRAYICON);
+ }
+ g_par.trayIcon = create_TrayIcon();
+ xfce_tray_icon_connect(ORAGE_TRAYICON);
+ }
+}
Modified: xfcalendar/trunk/src/tray_icon.h
===================================================================
--- xfcalendar/trunk/src/tray_icon.h 2008-03-17 18:12:48 UTC (rev 26681)
+++ xfcalendar/trunk/src/tray_icon.h 2008-03-17 20:44:57 UTC (rev 26682)
@@ -25,13 +25,11 @@
#define __TRAY_ICON_H__
#include "xfce_trayicon.h"
-#include "mainbox.h"
-GdkPixbuf *orage_create_icon(CalWin *xfcal, gboolean static_icon
- , gint x, gint y);
+GdkPixbuf *orage_create_icon(gboolean static_icon, gint x, gint y);
-XfceTrayIcon *create_TrayIcon(CalWin *xfcal);
+XfceTrayIcon *create_TrayIcon(void);
-void destroy_TrayIcon(XfceTrayIcon *trayIcon);
+void refresh_TrayIcon(void);
#endif /* !__TRAY_ICON_H__ */
More information about the Xfce4-commits
mailing list