]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-ui-utils.c
Updated Oriya Translation
[empathy.git] / libempathy-gtk / empathy-ui-utils.c
index cf423de41db0c75c8c12c959bb152c423c3064b5..40c6134cfd6b66b570132b04391ec910ee30b791 100644 (file)
@@ -37,7 +37,6 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <gio/gio.h>
-#include <canberra-gtk.h>
 
 #include <libmissioncontrol/mc-profile.h>
 
@@ -184,11 +183,11 @@ empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
 }
 
 const gchar *
-empathy_icon_name_from_account (McAccount *account)
+empathy_icon_name_from_account (EmpathyAccount *account)
 {
        McProfile *profile;
 
-       profile = mc_account_get_profile (account);
+       profile = empathy_account_get_profile (account);
 
        return mc_profile_get_icon_name (profile);
 }
@@ -1251,7 +1250,7 @@ empathy_window_get_is_visible (GtkWindow *window)
 
        g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
 
-       gdk_window = GTK_WIDGET (window)->window;
+       gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
        if (!gdk_window) {
                return FALSE;
        }
@@ -1273,7 +1272,7 @@ empathy_window_iconify (GtkWindow *window, GtkStatusIcon *status_icon)
        GdkWindow    *gdk_window;
 
        gtk_status_icon_get_geometry (status_icon, NULL, &icon_location, NULL);
-       gdk_window = GTK_WIDGET (window)->window;
+       gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
        dpy = gdk_x11_drawable_get_xdisplay (gdk_window);
 
        data[0] = icon_location.x;
@@ -1311,8 +1310,8 @@ empathy_window_present (GtkWindow *window,
        }
 
        timestamp = gtk_get_current_event_time ();
-       gtk_window_set_skip_taskbar_hint (window, FALSE);
        gtk_window_present_with_time (window, timestamp);
+       gtk_window_set_skip_taskbar_hint (window, FALSE);
        /* FIXME: This shouldn't be required as gtk_window_present's doc says
         *        it deiconify automatically. */
        gtk_window_deiconify (window);
@@ -1342,6 +1341,8 @@ empathy_get_toplevel_window (GtkWidget *widget)
 static gchar *
 fixup_url (const gchar *url)
 {
+       g_return_val_if_fail (url != NULL, NULL);
+
        if (g_str_has_prefix (url, "ghelp:") ||
            g_str_has_prefix (url, "mailto:") ||
            strstr (url, ":/")) {
@@ -1362,12 +1363,15 @@ empathy_url_show (GtkWidget *parent,
        gchar  *real_url;
        GError *error = NULL;
 
+       g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
+       g_return_if_fail (url != NULL);
+
        real_url = fixup_url (url);
        if (real_url) {
                url = real_url;
        }
 
-       gtk_show_uri (gtk_widget_get_screen (parent), url,
+       gtk_show_uri (parent ? gtk_widget_get_screen (parent) : NULL, url,
                      gtk_get_current_event_time (), &error);
 
        if (error) {
@@ -1484,6 +1488,8 @@ empathy_send_file_with_file_chooser (EmpathyContact *contact)
        gtk_dialog_set_default_response (GTK_DIALOG (widget),
                                         GTK_RESPONSE_OK);
 
+       gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), FALSE);
+
        g_signal_connect (widget, "response",
                          G_CALLBACK (file_manager_send_file_response_cb),
                          contact);
@@ -1541,139 +1547,3 @@ empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler)
 
        gtk_widget_show (widget);
 }
-
-typedef struct {
-       EmpathySound sound_id;
-       const char * event_ca_id;
-       const char * event_ca_description;
-       const char * gconf_key;
-} EmpathySoundEntry;
-
-/* NOTE: these entries MUST be in the same order than EmpathySound enum */
-static EmpathySoundEntry sound_entries[LAST_EMPATHY_SOUND] = {
-       { EMPATHY_SOUND_MESSAGE_INCOMING, "message-new-instant",
-         N_("Received an instant message"), EMPATHY_PREFS_SOUNDS_INCOMING_MESSAGE } ,
-       { EMPATHY_SOUND_MESSAGE_OUTGOING, "message-sent-instant",
-         N_("Sent an instant message"), EMPATHY_PREFS_SOUNDS_OUTGOING_MESSAGE } ,
-       { EMPATHY_SOUND_CONVERSATION_NEW, "message-new-instant",
-         N_("Incoming chat request"), EMPATHY_PREFS_SOUNDS_NEW_CONVERSATION },
-       { EMPATHY_SOUND_CONTACT_CONNECTED, "service-login",
-         N_("Contact connected"), EMPATHY_PREFS_SOUNDS_CONTACT_LOGIN },
-       { EMPATHY_SOUND_CONTACT_DISCONNECTED, "service-logout",
-         N_("Contact disconnected"), EMPATHY_PREFS_SOUNDS_CONTACT_LOGOUT },
-       { EMPATHY_SOUND_ACCOUNT_CONNECTED, "service-login",
-         N_("Connected to server"), EMPATHY_PREFS_SOUNDS_SERVICE_LOGIN },
-       { EMPATHY_SOUND_ACCOUNT_DISCONNECTED, "service-logout",
-         N_("Disconnected from server"), EMPATHY_PREFS_SOUNDS_SERVICE_LOGOUT },
-       { EMPATHY_SOUND_PHONE_INCOMING, "phone-incoming-call",
-         N_("Incoming voice call"), NULL },
-       { EMPATHY_SOUND_PHONE_OUTGOING, "phone-outgoing-calling",
-         N_("Outgoing voice call"), NULL },
-       { EMPATHY_SOUND_PHONE_HANGUP, "phone-hangup",
-         N_("Voice call ended"), NULL },
-};
-
-
-static gboolean
-empathy_sound_pref_is_enabled (const char *key)
-{
-       EmpathyConf *conf;
-       gboolean res;
-
-       conf = empathy_conf_get ();
-       res = FALSE;
-
-       empathy_conf_get_bool (conf, EMPATHY_PREFS_SOUNDS_ENABLED, &res);
-
-       if (!res) {
-               return FALSE;
-       }
-
-       if (!empathy_check_available_state ()) {
-               empathy_conf_get_bool (conf, EMPATHY_PREFS_SOUNDS_DISABLED_AWAY,
-                                      &res);
-               if (res) {
-                       return FALSE;
-               }
-       }
-
-       empathy_conf_get_bool (conf, key, &res);
-
-       return res;
-}
-
-void
-empathy_sound_stop (EmpathySound sound_id)
-{
-       EmpathySoundEntry *entry;
-
-       g_return_if_fail (sound_id < LAST_EMPATHY_SOUND);
-
-       entry = &(sound_entries[sound_id]);
-       g_return_if_fail (entry->sound_id == sound_id);
-
-       ca_context_cancel (ca_gtk_context_get (), entry->sound_id);
-}
-
-
-gboolean
-empathy_sound_play_full (GtkWidget *widget, EmpathySound sound_id,
-       ca_finish_callback_t callback, gpointer user_data)
-{
-       EmpathySoundEntry *entry;
-       gboolean should_play = TRUE;
-       ca_proplist *p = NULL;
-       ca_context *c;
-
-       g_return_val_if_fail (sound_id < LAST_EMPATHY_SOUND, FALSE);
-
-       entry = &(sound_entries[sound_id]);
-       g_return_val_if_fail (entry->sound_id == sound_id, FALSE);
-
-       if (entry->gconf_key != NULL) {
-               should_play = empathy_sound_pref_is_enabled (entry->gconf_key);
-       }
-
-       if (!should_play)
-               return FALSE;
-
-       c = ca_gtk_context_get ();
-       ca_context_cancel (c, entry->sound_id);
-
-       DEBUG ("Play sound \"%s\" (%s)",
-              entry->event_ca_id,
-              entry->event_ca_description);
-
-       if (ca_proplist_create (&p) < 0)
-               goto failed;
-
-       if (ca_proplist_sets (p, CA_PROP_EVENT_ID, entry->event_ca_id) < 0)
-               goto failed;
-
-       if (ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION,
-                       gettext (entry->event_ca_id)) < 0)
-               goto failed;
-
-       if (ca_gtk_proplist_set_for_widget (p, widget) < 0)
-               goto failed;
-
-       ca_context_play_full (ca_gtk_context_get (), entry->sound_id,
-               p, callback, user_data);
-
-       ca_proplist_destroy (p);
-
-       return TRUE;
-
-failed:
-       if (p != NULL)
-               ca_proplist_destroy (p);
-
-       return FALSE;
-}
-
-void
-empathy_sound_play (GtkWidget *widget, EmpathySound sound_id)
-{
-       empathy_sound_play_full (widget, sound_id, NULL, NULL);
-}
-