Commit fcfd04d5 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

Show/Hide Dialpad

parent 24c07ffc
......@@ -231,7 +231,6 @@ dbus_unhold (const call_t * c)
g_print ("DBus called unhold() on CallManager\n");
}
}
void
......
......@@ -51,15 +51,12 @@ get_numpad_button (const gchar* number, gboolean twolines, const gchar * letters
GtkWidget *
create_dialpad()
{
GtkWidget * ext;
GtkWidget * button;
GtkWidget * table;
ext = gtk_expander_new ("Dialpad");
gtk_expander_set_spacing ( GTK_EXPANDER(ext), 10 );
table = gtk_table_new ( 4, 3, TRUE /* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(table), 10);
gtk_table_set_col_spacings( GTK_TABLE(table), 10);
gtk_table_set_row_spacings( GTK_TABLE(table), 5);
gtk_table_set_col_spacings( GTK_TABLE(table), 5);
button = get_numpad_button("1", TRUE, "");
gtk_table_attach ( GTK_TABLE( table ), button, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -100,7 +97,6 @@ create_dialpad()
button = get_numpad_button("*", FALSE, "");
gtk_table_attach ( GTK_TABLE( table ), button, 2, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_container_add (GTK_CONTAINER (ext), table);
return ext;
return table;
}
......@@ -28,8 +28,11 @@
#include <gtk/gtk.h>
/** Local variables */
GtkAccelGroup * accelGroup;
GtkWidget * window;
GtkAccelGroup * accelGroup = NULL;
GtkWidget * window = NULL;
GtkWidget *subvbox = NULL;
GtkWidget * dialpad = NULL;
gboolean showDialpad = FALSE; // true if the dialpad have been showned
/**
* Terminate the main loop.
......@@ -101,7 +104,6 @@ create_main_window ()
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *subvbox;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
......@@ -138,7 +140,6 @@ create_main_window ()
button = create_screen();
gtk_box_pack_start (GTK_BOX (subvbox), button, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
//gtk_box_pack_start (GTK_BOX (subvbox), create_dialpad(), FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
gtk_box_pack_start (GTK_BOX (subvbox), create_call_tree(), TRUE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
/* Status bar */
......@@ -191,6 +192,23 @@ main_window_info_message(gchar * markup){
main_window_message(GTK_MESSAGE_INFO, markup);
}
void
main_window_dialpad(gboolean show){
if(show && !showDialpad)
{
dialpad = create_dialpad();
gtk_box_pack_end (GTK_BOX (subvbox), dialpad, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
gtk_box_reorder_child(GTK_BOX (subvbox), dialpad, 1);
gtk_widget_show_all (dialpad);
}
else if (!show && showDialpad)
{
gtk_container_remove(GTK_BOX (subvbox), dialpad);
}
showDialpad = show;
}
......
......@@ -28,5 +28,15 @@ GtkWidget * get_main_window();
void create_main_window ( );
void main_window_ask_quit() ;
/**
* Shows the dialpad on the mainwindow
* @param show TRUE if you want to show the dialpad, FALSE to hide it
*/
void main_window_dialpad(gboolean show);
void main_window_error_message(gchar * markup);
void main_window_warning_message(gchar * markup);
void main_window_warning_message(gchar * markup);
#endif
......@@ -166,6 +166,14 @@ create_debug_menu()
return root_menu;
}
/* ----------------------------------------------------------------- */
void
view_dial_pad (GtkCheckMenuItem *checkmenuitem,
void* foo)
{
main_window_dialpad(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkmenuitem)));
}
GtkWidget *
create_view_menu()
{
......@@ -175,19 +183,12 @@ create_view_menu()
menu = gtk_menu_new ();
menu_items = gtk_menu_item_new_with_label ("Show Dialpad");
menu_items = gtk_check_menu_item_new_with_mnemonic ("Show _Dialpad");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
G_CALLBACK (debug_hang_up),
g_signal_connect(G_OBJECT (menu_items), "toggled",
G_CALLBACK (view_dial_pad),
NULL);
gtk_widget_show (menu_items);
/*menu_items = gtk_menu_item_new_with_label ("Transfert current call");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
G_CALLBACK (debug_transfert),
NULL);
gtk_widget_show (menu_items);*/
root_menu = gtk_menu_item_new_with_mnemonic ("_View");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (root_menu), menu);
......
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