Commit b45d410b authored by Emmanuel Milou's avatar Emmanuel Milou

add delete event, migrate to GTK 2.16 for sexy icons

parent 37b02e80
......@@ -22,7 +22,11 @@
#include <assistant.h>
#include "reqaccount.h"
// From version 2.16, gtk provides the functionalities libsexy used to provide
#if GTK_CHECK_VERSION(2,16,0)
#else
#include <libsexy/sexy-icon-entry.h>
#endif
#if GTK_CHECK_VERSION(2,10,0)
......@@ -254,9 +258,14 @@ GtkWidget* build_sip_account_configuration( void ) {
label = gtk_label_new_with_mnemonic (_("_User name"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
#if GTK_CHECK_VERSION(2,16,0)
wiz->sip_username = gtk_entry_new();
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (wiz->sip_username), GTK_ENTRY_ICON_PRIMARY, gdk_pixbuf_new_from_file(ICONS_DIR "/stock_person.svg", NULL));
#else
wiz->sip_username = sexy_icon_entry_new();
image = gtk_image_new_from_file( ICONS_DIR "/stock_person.svg" );
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->sip_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_username);
gtk_table_attach ( GTK_TABLE( table ), wiz->sip_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -264,9 +273,14 @@ GtkWidget* build_sip_account_configuration( void ) {
label = gtk_label_new_with_mnemonic (_("_Password"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
#if GTK_CHECK_VERSION(2,16,0)
wiz->sip_password = gtk_entry_new();
gtk_entry_set_icon_from_stock (GTK_ENTRY (wiz->sip_password), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
#else
wiz->sip_password = sexy_icon_entry_new();
image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->sip_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_password);
gtk_entry_set_visibility(GTK_ENTRY(wiz->sip_password), FALSE);
gtk_table_attach ( GTK_TABLE( table ), wiz->sip_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -329,9 +343,14 @@ GtkWidget* build_iax_account_configuration( void ) {
label = gtk_label_new_with_mnemonic (_("_User name"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
#if GTK_CHECK_VERSION(2,16,0)
wiz->iax_username = gtk_entry_new();
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (wiz->iax_username), GTK_ENTRY_ICON_PRIMARY, gdk_pixbuf_new_from_file(ICONS_DIR "/stock_person.svg", NULL));
#else
wiz->iax_username = sexy_icon_entry_new();
image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
image = gtk_image_new_from_file( ICONS_DIR "/stock_person.svg" );
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->iax_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_username);
gtk_table_attach ( GTK_TABLE( table ), wiz->iax_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -339,8 +358,14 @@ GtkWidget* build_iax_account_configuration( void ) {
label = gtk_label_new_with_mnemonic (_("_Password"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
#if GTK_CHECK_VERSION(2,16,0)
wiz->iax_password = gtk_entry_new();
gtk_entry_set_icon_from_stock (GTK_ENTRY (wiz->iax_password), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
#else
wiz->iax_password = sexy_icon_entry_new();
image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->iax_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_password);
gtk_entry_set_visibility(GTK_ENTRY(wiz->iax_password), FALSE);
gtk_table_attach ( GTK_TABLE( table ), wiz->iax_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......
......@@ -22,7 +22,12 @@
#include <mainwindow.h>
#include <accountlist.h>
// From version 2.16, gtk provides the functionalities libsexy used to provide
#if GTK_CHECK_VERSION(2,16,0)
#else
#include <libsexy/sexy-icon-entry.h>
#endif
#include <string.h>
#include <dbus/dbus.h>
#include <config.h>
......@@ -187,10 +192,14 @@ show_account_window (account_t * a)
label = gtk_label_new_with_mnemonic (_("_User name"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
#if GTK_CHECK_VERSION(2,16,0)
entryUsername = gtk_entry_new();
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (entryUsername), GTK_ENTRY_ICON_PRIMARY, gdk_pixbuf_new_from_file(ICONS_DIR "/stock_person.svg", NULL));
#else
entryUsername = sexy_icon_entry_new();
//image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
image = gtk_image_new_from_file( ICONS_DIR "/stock_person.svg" );
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(entryUsername), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
#endif
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryUsername);
gtk_entry_set_text(GTK_ENTRY(entryUsername), curUsername);
gtk_table_attach ( GTK_TABLE( table ), entryUsername, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -198,9 +207,14 @@ show_account_window (account_t * a)
label = gtk_label_new_with_mnemonic (_("_Password"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
#if GTK_CHECK_VERSION(2,16,0)
entryPassword = gtk_entry_new();
gtk_entry_set_icon_from_stock (GTK_ENTRY (entryPassword), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
#else
entryPassword = sexy_icon_entry_new();
image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR );
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(entryPassword), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
#endif
gtk_entry_set_visibility(GTK_ENTRY(entryPassword), FALSE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPassword);
gtk_entry_set_text(GTK_ENTRY(entryPassword), curPassword);
......
......@@ -58,10 +58,16 @@ GtkWidget* searchbar_new(gchar* searchbar_type) {
GtkWidget* image;
GtkWidget* ret = gtk_hbox_new(FALSE, 0);
#if GTK_CHECK_VERSION(2,16,0)
searchbox = gtk_entry_new();
gtk_entry_set_icon_from_stock (GTK_ENTRY (searchbox), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
gtk_entry_set_icon_from_stock (GTK_ENTRY (searchbox), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
#else
searchbox = sexy_icon_entry_new();
image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR);
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(searchbox), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(searchbox) );
#endif
gtk_entry_set_text(GTK_ENTRY(searchbox), _("Search"));
g_signal_connect(GTK_ENTRY(searchbox), "changed", G_CALLBACK(searchbar_entry_changed), NULL);
g_signal_connect(GTK_ENTRY(searchbox), "grab-focus", G_CALLBACK(searchbar_clear_entry_if_default), NULL);
......
......@@ -30,7 +30,13 @@
#include <calllist.h>
#include <gtk/gtk.h>
// From version 2.16, gtk provides the functionalities libsexy used to provide
#if GTK_CHECK_VERSION(2,16,0)
#else
#include <libsexy/sexy-icon-entry.h>
#endif
#include <addressbook.h>
#include <history.h>
......
......@@ -105,7 +105,7 @@ create_main_window ()
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_window_set_title (GTK_WINDOW (window), PACKAGE);
gtk_window_set_default_size (GTK_WINDOW (window), 258, 320);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 320);
gtk_window_set_default_icon_from_file (ICONS_DIR "/sflphone.png",
NULL);
gtk_window_set_position( GTK_WINDOW( window ) , GTK_WIN_POS_MOUSE);
......
......@@ -1034,12 +1034,11 @@ static void ok_cb (GtkWidget *widget, gpointer userdata) {
call_t *modified_call, *original;
// Change the number of the selected call before calling
new_number = gtk_entry_get_text (GTK_WIDGET (editable_num));
new_number = (gchar*) gtk_entry_get_text (GTK_ENTRY (editable_num));
original = (call_t*)userdata;
// Edit the from field with the updated phone number value
from = g_strconcat("\"", call_get_name (original), "\" <", new_number, ">",NULL);
g_print ("name:%s \n", from);
// Create the new call
create_new_call (g_strdup (new_number), from, CALL_STATE_DIALING, g_strdup (original->accountID), &modified_call);
......@@ -1054,6 +1053,11 @@ static void ok_cb (GtkWidget *widget, gpointer userdata) {
gtk_widget_destroy (GTK_WIDGET (edit_dialog));
}
static void on_delete (GtkWidget * widget)
{
gtk_widget_destroy (widget);
}
void show_edit_number (call_t *call) {
GtkWidget *ok, *hbox, *image;
......@@ -1066,6 +1070,8 @@ void show_edit_number (call_t *call) {
gtk_window_set_title(GTK_WINDOW(edit_dialog), _("Edit phone"));
gtk_window_set_resizable (GTK_WINDOW (edit_dialog), FALSE);
g_signal_connect (G_OBJECT (edit_dialog), "delete-event", G_CALLBACK (on_delete), NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start(GTK_BOX (edit_dialog->vbox), hbox, TRUE, TRUE, 0);
......
......@@ -21,6 +21,7 @@
#define __MENUS_H__
#include <gtk/gtk.h>
#include <call.h>
/** @file menus.h
* @brief The menus of the main window.
*/
......@@ -53,4 +54,6 @@ void show_popup_menu_history (GtkWidget *my_widget, GdkEventButton *event);
void show_popup_menu_contacts (GtkWidget *my_widget, GdkEventButton *event);
void add_registered_accounts_to_menu (GtkWidget *menu);
void show_edit_number (call_t *call);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment