[Xfce4-commits] <orage:master> 4.9.1.0 Enhancement 9810 tooltips should not display "Location: (null)"
Juha
noreply at xfce.org
Mon Feb 4 12:58:02 CET 2013
Updating branch refs/heads/master
to ed8e48c6e21cdaf8b0f78529563b73c1cd58f22d (commit)
from 63f351bc49a58dd3c18aa1399279a3db9690b889 (commit)
commit ed8e48c6e21cdaf8b0f78529563b73c1cd58f22d
Author: Juha <juha at xfce.org>
Date: Mon Feb 4 13:55:15 2013 +0200
4.9.1.0 Enhancement 9810 tooltips should not display "Location: (null)"
Removed location and note totally if they are null instead of showing
(null). Thanks to Lee Thomas for the patch!
Also removed gtk check 2.16 and changed gtk requirement to be 2.16.
configure.in.in | 2 +-
src/ical-code.h | 2 +-
src/mainbox.c | 77 ++++++++++++++++++++++--------------------------------
src/reminder.c | 21 ---------------
4 files changed, 33 insertions(+), 69 deletions(-)
diff --git a/configure.in.in b/configure.in.in
index 5ea2e00..7258324 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
dnl
dnl Version information
-m4_define([orage_version], [4.9.0.0-git])
+m4_define([orage_version], [4.9.1.0-git])
m4_define([gtk_minimum_version], [2.14.0])
m4_define([xfce_minimum_version], [4.8.0])
diff --git a/src/ical-code.h b/src/ical-code.h
index c412f9d..f479c85 100644
--- a/src/ical-code.h
+++ b/src/ical-code.h
@@ -89,7 +89,7 @@ typedef struct _xfical_appt
gchar *note;
/* alarm */
- gint alarmtime; /* 0 means no alarms */
+ gint alarmtime;
gboolean alarm_before; /* TRUE = before FALSE = after */
/* TRUE = related to start FALSE= related to end */
gboolean alarm_related_start;
diff --git a/src/mainbox.c b/src/mainbox.c
index be17c9d..2e47375 100644
--- a/src/mainbox.c
+++ b/src/mainbox.c
@@ -380,10 +380,8 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
GtkWidget *ev, *label;
CalWin *cal = (CalWin *)g_par.xfcal;
gchar *tip, *tmp, *tmp_title, *tmp_note;
-#if GTK_CHECK_VERSION(2,16,0)
- gchar *tip_title = NULL, *tip_location = NULL, *tip_note = NULL;
+ gchar *tip_title, *tip_location, *tip_note;
gchar *format_bold = "<span weight=\"bold\"> %s </span>";
-#endif
struct tm *t;
char *l_time, *s_time, *s_timeonly, *e_time, *c_time, *na, *today;
gint len;
@@ -393,7 +391,9 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
#endif
/***** add data into the vbox *****/
ev = gtk_event_box_new();
- tmp_title = orage_process_text_commands(appt->title);
+ tmp_title = appt->title
+ ? orage_process_text_commands(appt->title)
+ : g_strdup(_("No title defined"));
s_time = g_strdup(orage_icaltime_to_i18_time(appt->starttimecur));
if (todo) {
e_time = g_strdup(appt->use_due_time
@@ -447,66 +447,51 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
}
/***** set tooltip hint *****/
- tmp_note = orage_process_text_commands(appt->note);
+ tip_title = g_markup_printf_escaped(format_bold, tmp_title);
+ if (appt->location) {
+ tmp = g_markup_printf_escaped(format_bold, appt->location);
+ tip_location = g_strdup_printf(_(" Location: %s\n"), tmp);
+ g_free(tmp);
+ }
+ else {
+ tip_location = g_strdup("");
+ }
+ if (appt->note) {
+ tmp_note = orage_process_text_commands(appt->note);
+ tmp = g_markup_printf_escaped(format_bold, tmp_note);
+ tip_note = g_strdup_printf(_("\n Note:\n%s"), tmp);
+ g_free(tmp);
+ g_free(tmp_note);
+ }
+ else {
+ tip_note = g_strdup("");
+ }
+
if (todo) {
na = _("Never");
e_time = g_strdup(appt->use_due_time
? orage_icaltime_to_i18_time(appt->endtimecur) : na);
c_time = g_strdup(appt->completed
? orage_icaltime_to_i18_time(appt->completedtime) : na);
-#if GTK_CHECK_VERSION(2,16,0)
- if (tmp_title) {
- tip_title = g_markup_printf_escaped(format_bold, tmp_title);
- }
- if (appt->location) {
- tip_location = g_markup_printf_escaped(format_bold, appt->location);
- }
- if (tmp_note) {
- tip_note = g_markup_escape_text(tmp_note, strlen(tmp_note));
- }
- tip = g_strdup_printf(_("Title: %s\n Location: %s\n Start:\t%s\n Due:\t%s\n Done:\t%s\n Note:\n%s")
+ tip = g_strdup_printf(_("Title: %s\n%s Start:\t%s\n Due:\t%s\n Done:\t%s%s")
, tip_title, tip_location, s_time, e_time, c_time, tip_note);
-#else
- tip = g_strdup_printf(_("Title: %s\n Location: %s\n Start:\t%s\n Due:\t%s\n Done:\t%s\n Note:\n%s")
- , tmp_title, appt->location, s_time, e_time, c_time, tmp_note);
-#endif
g_free(c_time);
}
else { /* it is event */
e_time = g_strdup(orage_icaltime_to_i18_time(appt->endtimecur));
-#if GTK_CHECK_VERSION(2,16,0)
- if (tmp_title) {
- tip_title = g_markup_printf_escaped(format_bold, tmp_title);
- }
- if (appt->location) {
- tip_location = g_markup_printf_escaped(format_bold, appt->location);
- }
- if (tmp_note) {
- tip_note = g_markup_escape_text(tmp_note, strlen(tmp_note));
- }
- tip = g_strdup_printf(_("Title: %s\n Location: %s\n Start:\t%s\n End:\t%s\n Note:\n%s")
+ tip = g_strdup_printf(_("Title: %s\n%s Start:\t%s\n End:\t%s%s")
, tip_title, tip_location, s_time, e_time, tip_note);
-#else
- tip = g_strdup_printf(_("Title: %s\n Location: %s\n Start:\t%s\n End:\t%s\n Note:\n%s")
- , tmp_title, appt->location, s_time, e_time, tmp_note);
-#endif
}
-#if GTK_CHECK_VERSION(2,16,0)
+
gtk_widget_set_tooltip_markup(ev, tip);
- if (tip_title)
- g_free(tip_title);
- if (tip_location)
- g_free(tip_location);
- if (tip_note)
- g_free(tip_note);
-#else
- gtk_tooltips_set_tip(cal->Tooltips, ev, tip, NULL);
-#endif
+
+ g_free(tip_title);
+ g_free(tip_location);
+ g_free(tip_note);
g_free(tmp_title);
- g_free(tmp_note);
g_free(s_time);
g_free(e_time);
g_free(tip);
diff --git a/src/reminder.c b/src/reminder.c
index 23c980d..0dbc916 100644
--- a/src/reminder.c
+++ b/src/reminder.c
@@ -709,9 +709,6 @@ static void create_orage_reminder(alarm_struct *l_alarm)
GtkWidget *hdtReminder;
orage_ddmmhh_hbox_struct *ddmmhh_hbox;
GtkWidget *e_hbox;
-#if !GTK_CHECK_VERSION(2,16,0)
- GtkWidget *e_label;
-#endif
gchar *tmp;
#ifdef ORAGE_DEBUG
@@ -803,14 +800,8 @@ static void create_orage_reminder(alarm_struct *l_alarm)
}
btRecreateReminder = gtk_button_new_from_stock("gtk-execute");
-#if GTK_CHECK_VERSION(2,16,0)
gtk_widget_set_tooltip_text(btRecreateReminder
, _("Remind me again after the specified time"));
-#else
- /* Note that this goes to the main area. Temporary for the version */
- e_label = gtk_label_new(_("Press <Execute> to remind me again after the specified time:"));
- gtk_box_pack_end(GTK_BOX(vbReminder), e_label, FALSE, FALSE, 5);
-#endif
gtk_dialog_add_action_widget(GTK_DIALOG(wReminder)
, btRecreateReminder, GTK_RESPONSE_OK);
g_signal_connect((gpointer) btRecreateReminder, "clicked"
@@ -1097,10 +1088,8 @@ static gboolean orage_tooltip_update(gpointer user_data)
}
t = orage_localtime();
tooltip = g_string_new(_("Next active alarms:"));
-#if GTK_CHECK_VERSION(2,16,0)
g_string_prepend(tooltip, "<span foreground=\"blue\" weight=\"bold\" underline=\"single\">");
g_string_append(tooltip, " </span>");
-#endif
/* Check if there are any alarms to show */
for (alarm_l = g_list_first(g_par.alarm_list);
alarm_l != NULL && more_alarms;
@@ -1137,7 +1126,6 @@ static gboolean orage_tooltip_update(gpointer user_data)
/*
orage_message(10, P_N "tooltip: alarm=%s hh=%d hh=%d min=%d", cur_alarm->alarm_time, dd, hh, min);
*/
-#if GTK_CHECK_VERSION(2,16,0)
g_string_append(tooltip, "<span weight=\"bold\">");
tooltip_highlight_helper = g_string_new(" </span>");
if (cur_alarm->temporary) { /* let's add a small mark */
@@ -1152,11 +1140,6 @@ static gboolean orage_tooltip_update(gpointer user_data)
_("\n%02d d %02d h %02d min to: %s"),
dd, hh, min, tooltip_highlight_helper->str);
g_string_free(tooltip_highlight_helper, TRUE);
-#else
- g_string_append_printf(tooltip,
- _("\n%02d d %02d h %02d min to: %s"),
- dd, hh, min, cur_alarm->title);
-#endif
alarm_cnt++;
}
else /* sorted so scan can be stopped */
@@ -1166,11 +1149,7 @@ static gboolean orage_tooltip_update(gpointer user_data)
g_string_append_printf(tooltip, _("\nNo active alarms found"));
/* deprecated since version 2.16 */
/* after 2.16 use gtk_status_icon_set_tooltip_markup to get nicer text */
-#if GTK_CHECK_VERSION(2,16,0)
gtk_status_icon_set_tooltip_markup((GtkStatusIcon *)g_par.trayIcon, tooltip->str);
-#else
- gtk_status_icon_set_tooltip((GtkStatusIcon *)g_par.trayIcon, tooltip->str);
-#endif
g_string_free(tooltip, TRUE);
return(TRUE);
}
More information about the Xfce4-commits
mailing list