*/
#include "config.h"
-
-#include <string.h>
-#include <stdlib.h>
+#include "empathy-log-window.h"
#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-#include <webkit/webkit.h>
-
-#include <telepathy-glib/telepathy-glib.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-images.h>
+#include <tp-account-widgets/tpaw-camera-monitor.h>
+#include <tp-account-widgets/tpaw-utils.h>
+#include <telepathy-glib/telepathy-glib-dbus.h>
-#include <telepathy-yell/telepathy-yell.h>
-
-#include <telepathy-logger/telepathy-logger.h>
-#ifdef HAVE_CALL_LOGS
-# include <telepathy-logger/call-event.h>
-#endif
-
-#include <extensions/extensions.h>
-
-#include <libempathy/action-chain-internal.h>
-#include <libempathy/empathy-camera-monitor.h>
-#include <libempathy/empathy-chatroom-manager.h>
-#include <libempathy/empathy-chatroom.h>
-#include <libempathy/empathy-gsettings.h>
-#include <libempathy/empathy-message.h>
-#include <libempathy/empathy-request-util.h>
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-time.h>
-
-#include "empathy-log-window.h"
+#include "action-chain-internal.h"
#include "empathy-account-chooser.h"
#include "empathy-call-utils.h"
-#include "empathy-chat-view.h"
-#include "empathy-contact-dialogs.h"
+#include "empathy-geometry.h"
+#include "empathy-gsettings.h"
#include "empathy-images.h"
+#include "empathy-individual-information-dialog.h"
+#include "empathy-request-util.h"
#include "empathy-theme-manager.h"
#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
#include "empathy-webkit-utils.h"
+#include "extensions.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
#define EMPATHY_NS "http://live.gnome.org/Empathy"
EmpathyContact *selected_contact;
EmpathyContact *events_contact;
- EmpathyCameraMonitor *camera_monitor;
+ TpawCameraMonitor *camera_monitor;
GBinding *button_video_binding;
/* Used to cancel logger calls when no longer needed */
g_slice_free (Ctx, ctx);
}
-static void
-account_chooser_ready_cb (EmpathyAccountChooser *chooser,
- EmpathyLogWindow *self)
-{
- /* We'll display the account once the model has been populate with the chats
- * of this account. */
- empathy_account_chooser_set_account (EMPATHY_ACCOUNT_CHOOSER (
- self->priv->account_chooser), self->priv->selected_account);
-}
-
static void
select_account_once_ready (EmpathyLogWindow *self,
TpAccount *account,
self->priv->selected_is_chatroom = is_chatroom;
- if (empathy_account_chooser_is_ready (account_chooser))
- account_chooser_ready_cb (account_chooser, self);
- else
- /* Chat will be selected once the account chooser is ready */
- g_signal_connect (account_chooser, "ready",
- G_CALLBACK (account_chooser_ready_cb), self);
+ empathy_account_chooser_set_account (account_chooser,
+ self->priv->selected_account);
}
static void
toolbutton_profile_clicked (GtkToolButton *toolbutton,
EmpathyLogWindow *self)
{
+ FolksIndividual *individual;
+
g_return_if_fail (self != NULL);
g_return_if_fail (EMPATHY_IS_CONTACT (self->priv->selected_contact));
- empathy_contact_information_dialog_show (self->priv->selected_contact,
- GTK_WINDOW (self));
+ individual = empathy_ensure_individual_from_tp_contact (
+ empathy_contact_get_tp_contact (self->priv->selected_contact));
+
+ empathy_display_individual_info (individual);
+
+ g_object_unref (individual);
}
static void
empathy_call_new_with_streams (
empathy_contact_get_id (self->priv->selected_contact),
empathy_contact_get_account (self->priv->selected_contact),
- TRUE, video, gtk_get_current_event_time ());
+ video, gtk_get_current_event_time ());
}
static void
{
char *str = gtk_tree_path_to_string (path);
char *script, *text, *date, *stock_icon;
+ GString *escaped_text;
char *icon = NULL;
+ gint i;
gtk_tree_model_get (model, iter,
COL_EVENTS_TEXT, &text,
if (icon_info != NULL)
icon = g_strdup (gtk_icon_info_get_filename (icon_info));
- gtk_icon_info_free (icon_info);
+ g_object_unref (icon_info);
+ }
+
+ escaped_text = g_string_new (NULL);
+
+ /* Only need to deal with «'» and «\».
+ *
+ * Note that these never appear in non-ascii utf8 characters, so just
+ * pretend like we have an ascii string...
+ */
+ for (i = 0; text && text[i]; i++)
+ {
+ gchar c = text[i];
+
+ if (c == '\'' || c == '\\')
+ g_string_append_c (escaped_text, '\\');
+
+ g_string_append_c (escaped_text, c);
}
script = g_strdup_printf ("javascript:%s([%s], '%s', '%s', '%s');",
method,
g_strdelimit (str, ":", ','),
- text,
+ escaped_text->str,
icon != NULL ? icon : "",
date);
webkit_web_view_execute_script (WEBKIT_WEB_VIEW (self->priv->webview),
script);
+ g_string_free (escaped_text, TRUE);
g_free (str);
g_free (text);
g_free (date);
GFile *gfile;
GtkWidget *vbox, *accounts, *search, *label, *closeitem;
GtkWidget *scrolledwindow_events;
+ gchar *uri;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
EMPATHY_TYPE_LOG_WINDOW, EmpathyLogWindowPriv);
self->priv->chain = _tpl_action_chain_new_async (NULL, NULL, NULL);
- self->priv->camera_monitor = empathy_camera_monitor_dup_singleton ();
+ self->priv->camera_monitor = tpaw_camera_monitor_dup_singleton ();
self->priv->log_manager = tpl_log_manager_dup_singleton ();
gtk_window_set_default_size (GTK_WINDOW (self), 800, 600);
filename = empathy_file_lookup ("empathy-log-window.ui", "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
+ gui = tpaw_builder_get_file (filename,
"vbox1", &self->priv->vbox,
"toolbutton_profile", &self->priv->button_profile,
"toolbutton_chat", &self->priv->button_chat,
NULL);
g_free (filename);
- empathy_builder_connect (gui, self,
+ tpaw_builder_connect (gui, self,
"toolbutton_profile", "clicked", toolbutton_profile_clicked,
"toolbutton_chat", "clicked", toolbutton_chat_clicked,
"toolbutton_call", "clicked", toolbutton_av_clicked,
G_CALLBACK (gtk_widget_destroy), self);
/* Account chooser for chats */
- vbox = gtk_vbox_new (FALSE, 3);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
self->priv->account_chooser = empathy_account_chooser_new ();
account_chooser = EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser);
gtk_container_add (GTK_CONTAINER (accounts), vbox);
/* Search entry */
- vbox = gtk_vbox_new (FALSE, 3);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
self->priv->search_entry = gtk_entry_new ();
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (self->priv->search_entry),
gfile = g_file_new_for_path (filename);
g_free (filename);
- webkit_web_view_load_uri (WEBKIT_WEB_VIEW (self->priv->webview),
- g_file_get_uri (gfile));
+ uri = g_file_get_uri (gfile);
+ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (self->priv->webview), uri);
g_object_unref (gfile);
+ g_free (uri);
/* handle all navigation externally */
g_signal_connect (self->priv->webview, "navigation-policy-decision-requested",
log_window_update_buttons_sensitivity (self);
gtk_widget_show (GTK_WIDGET (self));
+
+ empathy_geometry_bind (GTK_WINDOW (self), "log-window");
}
GtkWidget *
if (!tp_strdiff (type, TP_IFACE_CHANNEL_TYPE_TEXT) &&
!(event_mask & TPL_EVENT_MASK_TEXT))
goto out;
- if ((!tp_strdiff (type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA) ||
- !tp_strdiff (type, TPY_IFACE_CHANNEL_TYPE_CALL)) &&
+ if ((!tp_strdiff (type, TP_IFACE_CHANNEL_TYPE_CALL)) &&
!(event_mask & TPL_EVENT_MASK_CALL))
goto out;
tp_g_signal_connect_object (channel, "invalidated",
G_CALLBACK (on_channel_ended), self, 0);
}
- else if (!tp_strdiff (type, TPY_IFACE_CHANNEL_TYPE_CALL) ||
- !tp_strdiff (type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA))
+ else if (!tp_strdiff (type, TP_IFACE_CHANNEL_TYPE_CALL))
{
g_hash_table_insert (self->priv->channels,
g_object_ref (channel), g_object_ref (account));
tp_base_client_take_observer_filter (self->priv->observer,
tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
- TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
- NULL));
- tp_base_client_take_observer_filter (self->priv->observer,
- tp_asv_new (
- TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
- TPY_IFACE_CHANNEL_TYPE_CALL,
+ TP_IFACE_CHANNEL_TYPE_CALL,
NULL));
tp_base_client_register (self->priv->observer, NULL);
if (!tp_str_empty (tpl_text_event_get_supersedes_token (text)))
icon = EMPATHY_IMAGE_EDIT_MESSAGE;
}
-#ifdef HAVE_CALL_LOGS
else if (TPL_IS_CALL_EVENT (event))
{
TplCallEvent *call = TPL_CALL_EVENT (event);
- TplCallEndReason reason = tpl_call_event_get_end_reason (call);
+ TpCallStateChangeReason reason = tpl_call_event_get_end_reason (call);
TplEntity *sender = tpl_event_get_sender (event);
TplEntity *receiver = tpl_event_get_receiver (event);
- if (reason == TPL_CALL_END_REASON_NO_ANSWER)
+ if (reason == TP_CALL_STATE_CHANGE_REASON_NO_ANSWER)
icon = EMPATHY_IMAGE_CALL_MISSED;
else if (tpl_entity_get_entity_type (sender) == TPL_ENTITY_SELF)
icon = EMPATHY_IMAGE_CALL_OUTGOING;
else if (tpl_entity_get_entity_type (receiver) == TPL_ENTITY_SELF)
icon = EMPATHY_IMAGE_CALL_INCOMING;
}
-#endif
return icon;
}
GtkTreeIter iter, parent;
gchar *pretty_date, *alias, *body;
GDateTime *date;
- EmpathyStringParser *parsers;
+ TpawStringParser *parsers;
GString *msg;
date = g_date_time_new_from_unix_local (
EMPATHY_PREFS_CHAT_SHOW_SMILEYS));
msg = g_string_new ("");
- empathy_string_parser_substr (empathy_message_get_body (message), -1,
+ tpaw_string_parser_substr (empathy_message_get_body (message), -1,
parsers, msg);
if (tpl_text_event_get_message_type (TPL_TEXT_EVENT (event))
g_date_time_unref (date);
}
-#ifdef HAVE_CALL_LOGS
static void
log_window_append_call (TplEvent *event,
EmpathyMessage *message)
GTimeSpan span;
/* If searching, only add the call if the search string appears anywhere */
- if (!EMP_STR_EMPTY (log_window->priv->last_find))
+ if (!TPAW_STR_EMPTY (log_window->priv->last_find))
{
if (strstr (tpl_entity_get_identifier (tpl_event_get_sender (event)),
log_window->priv->last_find) == NULL &&
COL_EVENTS_EVENT, event,
-1);
- if (tpl_call_event_get_end_reason (call) != TPL_CALL_END_REASON_NO_ANSWER)
+ if (tpl_call_event_get_end_reason (call) != TP_CALL_STATE_CHANGE_REASON_NO_ANSWER)
{
gchar *body;
gchar *tmp;
g_free (pretty_date);
g_date_time_unref (started_date);
}
-#endif
static void
log_window_append_message (TplEvent *event,
{
if (TPL_IS_TEXT_EVENT (event))
log_window_append_chat_message (event, message);
-#ifdef HAVE_CALL_LOGS
else if (TPL_IS_CALL_EVENT (event))
log_window_append_call (event, message);
-#endif
else
DEBUG ("Message type not handled");
}
if (!g_date_compare (date, d))
{
has_element = TRUE;
+ g_date_free (d);
return TRUE;
}
+ g_date_free (d);
return FALSE;
}
return text;
}
+static void
+add_date_if_needed (EmpathyLogWindow *self,
+ GDate *date)
+{
+ GtkTreeModel *model;
+ GtkListStore *store;
+ gchar *text;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (
+ log_window->priv->treeview_when));
+ store = GTK_LIST_STORE (model);
+
+ /* Add the date if it's not already there */
+ has_element = FALSE;
+ gtk_tree_model_foreach (model, model_has_date, date);
+ if (has_element)
+ return;
+
+ text = format_date_for_display (date);
+
+ gtk_list_store_insert_with_values (store, NULL, -1,
+ COL_WHEN_DATE, date,
+ COL_WHEN_TEXT, text,
+ COL_WHEN_ICON, CALENDAR_ICON,
+ -1);
+
+ g_free (text);
+}
+
static void
populate_dates_from_search_hits (GList *accounts,
GList *targets)
if (!found)
continue;
- /* Add the date if it's not already there */
- has_element = FALSE;
- gtk_tree_model_foreach (model, model_has_date, hit->date);
- if (!has_element)
- {
- gchar *text = format_date_for_display (hit->date);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_WHEN_DATE, hit->date,
- COL_WHEN_TEXT, text,
- COL_WHEN_ICON, CALENDAR_ICON,
- -1);
- }
+ add_date_if_needed (log_window, hit->date);
}
if (gtk_tree_model_get_iter_first (model, &iter))
{
+ GDate *date;
+
+ date = g_date_new_dmy (1, 1, -1),
+
gtk_list_store_prepend (store, &iter);
gtk_list_store_set (store, &iter,
- COL_WHEN_DATE, g_date_new_dmy (1, 1, -1),
+ COL_WHEN_DATE, date,
COL_WHEN_TEXT, "separator",
-1);
+ g_date_free (date);
+
+ date = g_date_new_dmy (2, 1, -1),
gtk_list_store_prepend (store, &iter);
gtk_list_store_set (store, &iter,
- COL_WHEN_DATE, g_date_new_dmy (2, 1, -1),
+ COL_WHEN_DATE, date,
COL_WHEN_TEXT, _("Anytime"),
-1);
+ g_date_free (date);
+
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, 2))
gtk_tree_selection_select_iter (selection, &iter);
}
}
+static void
+add_event_to_store (EmpathyLogWindow *self,
+ TpAccount *account,
+ TplEntity *entity)
+{
+ GtkListStore *store;
+ TplEntityType type = tpl_entity_get_entity_type (entity);
+ EmpathyContact *contact;
+ const gchar *name;
+ gchar *sort_key;
+ gboolean room = type == TPL_ENTITY_ROOM;
+
+ store = GTK_LIST_STORE (gtk_tree_view_get_model (
+ GTK_TREE_VIEW (log_window->priv->treeview_who)));
+
+ contact = empathy_contact_from_tpl_contact (account, entity);
+
+ name = empathy_contact_get_alias (contact);
+ sort_key = g_utf8_collate_key (name, -1);
+
+ gtk_list_store_insert_with_values (store, NULL, -1,
+ COL_WHO_TYPE, COL_TYPE_NORMAL,
+ COL_WHO_ICON, room ? EMPATHY_IMAGE_GROUP_MESSAGE
+ : TPAW_IMAGE_AVATAR_DEFAULT,
+ COL_WHO_NAME, name,
+ COL_WHO_NAME_SORT_KEY, sort_key,
+ COL_WHO_ID, tpl_entity_get_identifier (entity),
+ COL_WHO_ACCOUNT, account,
+ COL_WHO_TARGET, entity,
+ -1);
+
+ g_free (sort_key);
+ g_object_unref (contact);
+}
+
static void
populate_entities_from_search_hits (void)
{
gtk_tree_model_foreach (model, model_has_entity, hit);
if (!has_element)
{
- TplEntityType type = tpl_entity_get_entity_type (hit->target);
- EmpathyContact *contact;
- const gchar *name;
- gchar *sort_key;
- gboolean room = type == TPL_ENTITY_ROOM;
-
- contact = empathy_contact_from_tpl_contact (hit->account,
- hit->target);
-
- name = empathy_contact_get_alias (contact);
- sort_key = g_utf8_collate_key (name, -1);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_WHO_TYPE, COL_TYPE_NORMAL,
- COL_WHO_ICON, room ? EMPATHY_IMAGE_GROUP_MESSAGE
- : EMPATHY_IMAGE_AVATAR_DEFAULT,
- COL_WHO_NAME, name,
- COL_WHO_NAME_SORT_KEY, sort_key,
- COL_WHO_ID, tpl_entity_get_identifier (hit->target),
- COL_WHO_ACCOUNT, hit->account,
- COL_WHO_TARGET, hit->target,
- -1);
-
- g_free (sort_key);
- g_object_unref (contact);
+ add_event_to_store (log_window, hit->account, hit->target);
}
}
gtk_list_store_clear (store);
- if (EMP_STR_EMPTY (search_criteria))
+ if (TPAW_STR_EMPTY (search_criteria))
{
tp_clear_pointer (&self->priv->hits, tpl_log_manager_search_free);
webkit_web_view_set_highlight_text_matches (
"", -1);
}
+static void
+do_update_buttons_sensitivity (EmpathyLogWindow *self)
+{
+ EmpathyCapabilities capabilities;
+ gboolean profile, chat, call, video;
+
+ tp_clear_object (&self->priv->button_video_binding);
+
+ if (self->priv->selected_contact != NULL)
+ {
+ capabilities = empathy_contact_get_capabilities (
+ self->priv->selected_contact);
+
+ profile = chat = TRUE;
+ call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
+ video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
+ }
+ else
+ {
+ profile = chat = call = video = FALSE;
+ }
+
+ gtk_widget_set_sensitive (self->priv->button_profile, profile);
+ gtk_widget_set_sensitive (self->priv->button_chat, chat);
+ gtk_widget_set_sensitive (self->priv->button_call, call);
+
+ if (video)
+ {
+ self->priv->button_video_binding = g_object_bind_property (
+ self->priv->camera_monitor, "available",
+ self->priv->button_video, "sensitive",
+ G_BINDING_SYNC_CREATE);
+ }
+ else
+ {
+ /* Don't override the binding */
+ gtk_widget_set_sensitive (self->priv->button_video, video);
+ }
+}
+
+static void
+contact_capabilities_changed_cb (EmpathyContact *contact,
+ GParamSpec *spec,
+ EmpathyLogWindow *self)
+{
+ do_update_buttons_sensitivity (self);
+}
+
static void
log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
{
GtkTreeView *view;
GtkTreeModel *model;
GtkTreeSelection *selection;
- EmpathyCapabilities capabilities;
TpAccount *account;
TplEntity *target;
GtkTreeIter iter;
GList *paths;
GtkTreePath *path;
- gboolean profile, chat, call, video;
- profile = chat = call = video = FALSE;
+ if (self->priv->selected_contact != NULL)
+ {
+ g_signal_handlers_disconnect_by_func (self->priv->selected_contact,
+ contact_capabilities_changed_cb, self);
- tp_clear_object (&self->priv->button_video_binding);
- tp_clear_object (&self->priv->selected_contact);
+ tp_clear_object (&self->priv->selected_contact);
+ }
view = GTK_TREE_VIEW (self->priv->treeview_who);
model = gtk_tree_view_get_model (view);
selection = gtk_tree_view_get_selection (view);
- profile = chat = call = video = FALSE;
-
if (!gtk_tree_model_get_iter_first (model, &iter))
goto events;
g_object_unref (account);
g_object_unref (target);
- capabilities = empathy_contact_get_capabilities (self->priv->selected_contact);
-
- profile = chat = TRUE;
- call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
- video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
-
goto out;
events:
if (self->priv->events_contact != NULL)
self->priv->selected_contact = g_object_ref (self->priv->events_contact);
- else
- goto out;
-
- capabilities = empathy_contact_get_capabilities (self->priv->selected_contact);
-
- profile = chat = TRUE;
- call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
- video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
-
- if (video)
- self->priv->button_video_binding = g_object_bind_property (
- self->priv->camera_monitor, "available",
- self->priv->button_video, "sensitive",
- G_BINDING_SYNC_CREATE);
out:
- gtk_widget_set_sensitive (self->priv->button_profile, profile);
- gtk_widget_set_sensitive (self->priv->button_chat, chat);
- gtk_widget_set_sensitive (self->priv->button_call, call);
+ if (self->priv->selected_contact != NULL)
+ {
+ tp_g_signal_connect_object (self->priv->selected_contact,
+ "notify::capabilities", G_CALLBACK (contact_capabilities_changed_cb),
+ self, 0);
+ }
- /* Don't override the binding */
- if (!video)
- gtk_widget_set_sensitive (self->priv->button_video, video);
+ do_update_buttons_sensitivity (self);
}
static void
for (l = entities; l; l = l->next)
{
- TplEntity *entity = TPL_ENTITY (l->data);
- TplEntityType type = tpl_entity_get_entity_type (entity);
- EmpathyContact *contact;
- const gchar *name;
- gchar *sort_key;
- gboolean room = type == TPL_ENTITY_ROOM;
-
- contact = empathy_contact_from_tpl_contact (ctx->account, entity);
-
- name = empathy_contact_get_alias (contact);
- sort_key = g_utf8_collate_key (name, -1);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_WHO_TYPE, COL_TYPE_NORMAL,
- COL_WHO_ICON, room ? EMPATHY_IMAGE_GROUP_MESSAGE
- : EMPATHY_IMAGE_AVATAR_DEFAULT,
- COL_WHO_NAME, name,
- COL_WHO_NAME_SORT_KEY, sort_key,
- COL_WHO_ID, tpl_entity_get_identifier (entity),
- COL_WHO_ACCOUNT, ctx->account,
- COL_WHO_TARGET, entity,
- -1);
-
- g_free (sort_key);
- g_object_unref (contact);
+ add_event_to_store (ctx->self, ctx->account, l->data);
if (ctx->self->priv->selected_account != NULL &&
!tp_strdiff (tp_proxy_get_object_path (ctx->account),
GList *accounts, *l;
manager = empathy_account_chooser_get_account_manager (account_chooser);
- accounts = tp_account_manager_get_valid_accounts (manager);
+ accounts = tp_account_manager_dup_valid_accounts (manager);
for (l = accounts; l != NULL; l = l->next)
{
get_entities_for_account, ctx);
}
- g_list_free (accounts);
+ g_list_free_full (accounts, g_object_unref);
}
_tpl_action_chain_append (self->priv->chain, select_first_entity, self);
_tpl_action_chain_start (self->priv->chain);
gpointer user_data)
{
GDate *date1, *date2;
+ gint result;
gtk_tree_model_get (model, a,
COL_WHEN_DATE, &date1,
COL_WHEN_DATE, &date2,
-1);
- return g_date_compare (date1, date2);
+ result = g_date_compare (date1, date2);
+
+ g_date_free (date1);
+ g_date_free (date2);
+ return result;
}
static gboolean
GtkTreeIter iter;
GtkTreeStore *store;
GtkCellRenderer *cell;
+ GtkTreeIter parent;
guint i;
+
struct event events [] = {
{ TPL_EVENT_MASK_ANY, 0, NULL, _("Anything") },
{ WHAT_TYPE_SEPARATOR, 0, NULL, "separator" },
{ TPL_EVENT_MASK_TEXT, 0, "format-justify-fill", _("Text chats") },
-#ifdef HAVE_CALL_LOGS
{ TPL_EVENT_MASK_CALL, EVENT_CALL_ALL, EMPATHY_IMAGE_CALL, _("Calls") },
-#endif
};
-#ifdef HAVE_CALL_LOGS
+
struct event call_events [] = {
{ TPL_EVENT_MASK_CALL, EVENT_CALL_INCOMING, EMPATHY_IMAGE_CALL_INCOMING, _("Incoming calls") },
{ TPL_EVENT_MASK_CALL, EVENT_CALL_OUTGOING, EMPATHY_IMAGE_CALL_OUTGOING, _("Outgoing calls") },
{ TPL_EVENT_MASK_CALL, EVENT_CALL_MISSED, EMPATHY_IMAGE_CALL_MISSED, _("Missed calls") }
};
- GtkTreeIter parent;
-#endif
view = GTK_TREE_VIEW (self->priv->treeview_what);
selection = gtk_tree_view_get_selection (view);
-1);
}
-#ifdef HAVE_CALL_LOGS
gtk_tree_model_iter_nth_child (model, &parent, NULL, 3);
for (i = 0; i < G_N_ELEMENTS (call_events); i++)
{
COL_WHAT_ICON, call_events[i].icon,
-1);
}
-#endif
gtk_tree_view_expand_all (view);
TplEvent *event = l->data;
gboolean append = TRUE;
-#ifdef HAVE_CALL_LOGS
if (TPL_IS_CALL_EVENT (l->data)
&& ctx->event_mask & TPL_EVENT_MASK_CALL
&& ctx->event_mask != TPL_EVENT_MASK_ANY)
}
else
{
- TplCallEndReason reason = tpl_call_event_get_end_reason (call);
+ TpCallStateChangeReason reason =
+ tpl_call_event_get_end_reason (call);
TplEntity *sender = tpl_event_get_sender (event);
TplEntity *receiver = tpl_event_get_receiver (event);
- if (reason == TPL_CALL_END_REASON_NO_ANSWER)
+ if (reason == TP_CALL_STATE_CHANGE_REASON_NO_ANSWER)
{
if (ctx->subtype & EVENT_CALL_MISSED)
append = TRUE;
}
}
}
-#endif
if (append)
{
event_mask, subtype, self->priv->count);
_tpl_action_chain_append (self->priv->chain, get_events_for_date, ctx);
}
+
+ g_date_free (d);
}
}
}
for (l = dates; l != NULL; l = l->next)
{
- GDate *date = l->data;
-
- /* Add the date if it's not already there */
- has_element = FALSE;
- gtk_tree_model_foreach (model, model_has_date, date);
- if (!has_element)
- {
- gchar *text = format_date_for_display (date);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_WHEN_DATE, date,
- COL_WHEN_TEXT, text,
- COL_WHEN_ICON, CALENDAR_ICON,
- -1);
-
- g_free (text);
- }
+ add_date_if_needed (log_window, l->data);
}
if (gtk_tree_model_get_iter_first (model, &iter))
if (g_strcmp0 (separator, "separator") != 0)
{
+ GDate *date;
+
+ date = g_date_new_dmy (1, 1, -1);
+
gtk_list_store_prepend (store, &iter);
gtk_list_store_set (store, &iter,
- COL_WHEN_DATE, g_date_new_dmy (1, 1, -1),
+ COL_WHEN_DATE, date,
COL_WHEN_TEXT, "separator",
-1);
+ g_date_free (date);
+
+ date = g_date_new_dmy (2, 1, -1);
+
gtk_list_store_prepend (store, &iter);
gtk_list_store_set (store, &iter,
- COL_WHEN_DATE, g_date_new_dmy (2, 1, -1),
+ COL_WHEN_DATE, date,
COL_WHEN_TEXT, _("Anytime"),
-1);
+
+ g_date_free (date);
}
+
+ g_free (separator);
}
g_list_free_full (dates, g_free);
gtk_tree_store_clear (self->priv->store_events);
log_window_who_populate (self);
- /* Re-filter the account chooser so the accounts without logs get greyed out */
- empathy_account_chooser_set_filter (
- EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser),
- empathy_account_chooser_filter_has_logs, NULL);
-}
-
-static void
-log_window_clear_logs_chooser_select_account (EmpathyAccountChooser *chooser,
- EmpathyLogWindow *self)
-{
- EmpathyAccountChooser *account_chooser;
-
- account_chooser = EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser);
-
- empathy_account_chooser_set_account (chooser,
- empathy_account_chooser_get_account (account_chooser));
+ /* Re-filter the account chooser so the accounts without logs get
+ * greyed out */
+ empathy_account_chooser_refilter (
+ EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser));
}
static void
account_chooser = (EmpathyAccountChooser *) empathy_account_chooser_new ();
empathy_account_chooser_set_has_all_option (account_chooser, TRUE);
- empathy_account_chooser_set_filter (account_chooser,
- empathy_account_chooser_filter_has_logs, NULL);
+
+ empathy_account_chooser_refilter (account_chooser);
/* Select the same account as in the history window */
- if (empathy_account_chooser_is_ready (account_chooser))
- log_window_clear_logs_chooser_select_account (account_chooser, self);
- else
- g_signal_connect (account_chooser, "ready",
- G_CALLBACK (log_window_clear_logs_chooser_select_account), self);
+ empathy_account_chooser_set_account (account_chooser,
+ empathy_account_chooser_get_account (
+ EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser)));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (self),
GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING,
content_area = gtk_message_dialog_get_message_area (
GTK_MESSAGE_DIALOG (dialog));
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
label = gtk_label_new (_("Delete from:"));
gtk_box_pack_start (GTK_BOX (hbox), label,
FALSE, FALSE, 0);