]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-new-message-dialog.c
switch new message dialog to use an header bar
[empathy.git] / libempathy-gtk / empathy-new-message-dialog.c
index 25bc069b233a1139bbe2d497978d583538ce1b41..aa55ae01d74821bfa250afeac2d4ffe473af62e2 100644 (file)
  * Authors: Xavier Claessens <xclaesse@gmail.com>
  */
 
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
+#include "config.h"
+#include "empathy-new-message-dialog.h"
 
-#include <gtk/gtk.h>
 #include <glib/gi18n-lib.h>
 
-#include <telepathy-glib/interfaces.h>
-
-#include <libempathy/empathy-tp-contact-factory.h>
-#include <libempathy/empathy-contact-manager.h>
-#include <libempathy/empathy-request-util.h>
-#include <libempathy/empathy-utils.h>
+#include "empathy-request-util.h"
+#include "empathy-contact-chooser.h"
+#include "empathy-ui-utils.h"
+#include "empathy-images.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
-#include <libempathy/empathy-debug.h>
-
-#include <libempathy-gtk/empathy-contact-chooser.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-images.h>
-
-#include "empathy-new-message-dialog.h"
-#include "empathy-account-chooser.h"
+#include "empathy-debug.h"
 
 static EmpathyNewMessageDialog *dialog_singleton = NULL;
 
@@ -151,8 +139,8 @@ empathy_new_message_dialog_response (GtkDialog *dialog,
     int response_id)
 {
   EmpathyNewMessageDialog *self = (EmpathyNewMessageDialog *) dialog;
-  FolksIndividual *individual;
-  EmpathyContact *contact;
+  FolksIndividual *individual = NULL;
+  EmpathyContact *contact = NULL;
 
   if (response_id < EMP_NEW_MESSAGE_TEXT)
     goto out;
@@ -266,7 +254,9 @@ selection_changed_cb (GtkWidget *chooser,
     }
 
   gtk_widget_set_sensitive (self->priv->button_chat, can_chat);
+#if 0
   gtk_widget_set_sensitive (self->priv->button_sms, can_sms);
+#endif
 }
 
 static void
@@ -279,7 +269,6 @@ selection_activate_cb (GtkWidget *chooser,
 static void
 empathy_new_message_dialog_init (EmpathyNewMessageDialog *self)
 {
-  GtkWidget *label;
   GtkWidget *image;
   GtkWidget *content;
 
@@ -288,17 +277,13 @@ empathy_new_message_dialog_init (EmpathyNewMessageDialog *self)
 
   content = gtk_dialog_get_content_area (GTK_DIALOG (self));
 
-  label = gtk_label_new (_("Enter a contact identifier or phone number:"));
-  gtk_box_pack_start (GTK_BOX (content), label, FALSE, FALSE, 0);
-  gtk_widget_show (label);
-
   /* contact chooser */
   self->priv->chooser = empathy_contact_chooser_new ();
 
   empathy_contact_chooser_set_filter_func (
       EMPATHY_CONTACT_CHOOSER (self->priv->chooser), filter_individual, self);
 
-  gtk_box_pack_start (GTK_BOX (content), self->priv->chooser, TRUE, TRUE, 6);
+  gtk_box_pack_start (GTK_BOX (content), self->priv->chooser, TRUE, TRUE, 0);
   gtk_widget_show (self->priv->chooser);
 
   g_signal_connect (self->priv->chooser, "selection-changed",
@@ -307,37 +292,44 @@ empathy_new_message_dialog_init (EmpathyNewMessageDialog *self)
       G_CALLBACK (selection_activate_cb), self);
 
   /* close button */
-  gtk_dialog_add_buttons (GTK_DIALOG (self), GTK_STOCK_CLOSE, NULL);
+  gtk_dialog_add_button (GTK_DIALOG (self),
+      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
 
+#if 0
   /* add SMS button */
   self->priv->button_sms = gtk_button_new_with_mnemonic (_("_SMS"));
   image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_SMS,
       GTK_ICON_SIZE_BUTTON);
   gtk_button_set_image (GTK_BUTTON (self->priv->button_sms), image);
+#endif
 
   /* add chat button */
-  self->priv->button_chat = gtk_button_new_with_mnemonic (_("_Chat"));
+  self->priv->button_chat = gtk_button_new_with_mnemonic (_("_Done"));
   image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_NEW_MESSAGE,
       GTK_ICON_SIZE_BUTTON);
   gtk_button_set_image (GTK_BUTTON (self->priv->button_chat), image);
 
-  gtk_dialog_add_action_widget (GTK_DIALOG (self), self->priv->button_chat,
-      EMP_NEW_MESSAGE_TEXT);
-  gtk_widget_show (self->priv->button_chat);
-
+#if 0
   gtk_dialog_add_action_widget (GTK_DIALOG (self), self->priv->button_sms,
       EMP_NEW_MESSAGE_SMS);
   gtk_widget_show (self->priv->button_sms);
+#endif
+
+  gtk_dialog_add_action_widget (GTK_DIALOG (self), self->priv->button_chat,
+      EMP_NEW_MESSAGE_TEXT);
+  gtk_widget_show (self->priv->button_chat);
 
   /* Tweak the dialog */
   gtk_window_set_title (GTK_WINDOW (self), _("New Conversation"));
   gtk_window_set_role (GTK_WINDOW (self), "new_message");
 
   /* Set a default height so a few contacts are displayed */
-  gtk_window_set_default_size (GTK_WINDOW (self), -1, 400);
+  gtk_window_set_default_size (GTK_WINDOW (self), -1, 600);
 
   gtk_widget_set_sensitive (self->priv->button_chat, FALSE);
+#if 0
   gtk_widget_set_sensitive (self->priv->button_sms, FALSE);
+#endif
 }
 
 static void
@@ -367,7 +359,9 @@ empathy_new_message_dialog_show (GtkWindow *parent)
 {
   GtkWidget *dialog;
 
-  dialog = g_object_new (EMPATHY_TYPE_NEW_MESSAGE_DIALOG, NULL);
+  dialog = g_object_new (EMPATHY_TYPE_NEW_MESSAGE_DIALOG,
+                  "use-header-bar", 1,
+                  NULL);
 
   if (parent)
     {