dates r719 - in trunk: . src
- From: rbradford svn gnome org
- To: svn-commits-list gnome org
- Subject: dates r719 - in trunk: . src
- Date: Thu, 12 Mar 2009 19:32:41 +0000 (UTC)
Author: rbradford
Date: Thu Mar 12 19:32:40 2009
New Revision: 719
URL: http://svn.gnome.org/viewvc/dates?rev=719&view=rev
Log:
2009-03-12 Rob Bradford <rob linux intel com>
* src/dates_callbacks.c (_zoom_to_event_cb),
(dates_edit_event_on_startup):
* src/dates_callbacks.h:
* src/dates_main.c (main):
* src/dates_types.h:
Add a "--edit-event" option that will open Dates on a target event if
it finds it.
Modified:
trunk/ChangeLog
trunk/src/dates_callbacks.c
trunk/src/dates_callbacks.h
trunk/src/dates_main.c
trunk/src/dates_types.h
Modified: trunk/src/dates_callbacks.c
==============================================================================
--- trunk/src/dates_callbacks.c (original)
+++ trunk/src/dates_callbacks.c Thu Mar 12 19:32:40 2009
@@ -1847,3 +1847,55 @@
dates_platform_import_dialog ((DatesData *)user_data);
}
+
+static gboolean
+_zoom_to_event_cb (gpointer userdata)
+{
+ DatesData *data = (DatesData *)userdata;
+ static gint count = 0;
+
+ if (dates_view_set_selected_event (data->view,
+ data->url_uid,
+ NULL))
+ {
+ dates_fill_details_dialog (data->view, data);
+ dates_platform_details_dlg (data, TRUE);
+ g_free (data->url_uid);
+ count = 0;
+ return FALSE;
+ }
+
+ if (count > 5)
+ {
+ count = 0;
+ g_critical (G_STRLOC ": Unable to find event %s",
+ data->url_uid);
+ g_free (data->url_uid);
+ return FALSE;
+ }
+
+ count++;
+ return TRUE;
+}
+
+gboolean
+dates_edit_event_on_startup (DatesData *data,
+ const gchar *url_uri_in)
+{
+ gchar **split_str;
+
+ split_str = g_strsplit (url_uri_in, " ", 2);
+
+ if (g_strv_length (split_str) != 2)
+ {
+ g_critical (G_STRLOC ": Unable to parse url_uid string: %s",
+ url_uri_in);
+ return FALSE;
+ }
+
+ data->url_uid = g_strjoinv (NULL, split_str);
+ g_idle_add (_zoom_to_event_cb, data);
+ return TRUE;
+}
+
+
Modified: trunk/src/dates_callbacks.h
==============================================================================
--- trunk/src/dates_callbacks.h (original)
+++ trunk/src/dates_callbacks.h Thu Mar 12 19:32:40 2009
@@ -176,4 +176,8 @@
GError **error);
+gboolean
+dates_edit_event_on_startup (DatesData *data,
+ const gchar *url_uri_in);
+
#endif /* DATES_CALLBACKS_H */
Modified: trunk/src/dates_main.c
==============================================================================
--- trunk/src/dates_main.c (original)
+++ trunk/src/dates_main.c Thu Mar 12 19:32:40 2009
@@ -382,6 +382,7 @@
GConfBridge *bridge;
GError *error = NULL;
static gint plug = 0;
+ static gchar *url_uri = NULL;
#ifdef DEBUG
const gchar *debug;
#endif
@@ -389,6 +390,8 @@
static GOptionEntry entries[] = {
{ "plug", 'p', 0, G_OPTION_ARG_INT, &plug,
"Socket ID of an XEmbed socket to plug into", NULL },
+ { "edit-event", 'e', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &url_uri,
+ "Edit event from calendar", "<url of calendar> <uid>" },
{ NULL }
};
@@ -573,6 +576,12 @@
gtk_widget_show (data.main_window);
}
+ if (url_uri)
+ {
+ dates_edit_event_on_startup (&data, url_uri);
+ g_free (url_uri);
+ }
+
gtk_main ();
return 0;
Modified: trunk/src/dates_types.h
==============================================================================
--- trunk/src/dates_types.h (original)
+++ trunk/src/dates_types.h Thu Mar 12 19:32:40 2009
@@ -154,6 +154,8 @@
GtkWidget * time_date_editor;
GtkWidget * time_time_editor;
#endif
+
+ gchar *url_uid;
} DatesData;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]