Skip to content
Snippets Groups Projects
Commit 494debca authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#4867] Add gtkinfobar in configuration panel

parent b1422f6b
No related branches found
No related tags found
No related merge requests found
......@@ -786,20 +786,25 @@ GtkWidget* alsa_box()
GtkWidget *ret;
GtkWidget *table;
GtkWidget *item;
GtkWidget *info_bar;
GtkCellRenderer *renderer;
ret = gtk_hbox_new (FALSE, 10);
gtk_widget_show (ret);
table = gtk_table_new (5, 3, FALSE);
table = gtk_table_new (6, 3, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 40);
gtk_box_pack_start (GTK_BOX (ret) , table , TRUE , TRUE , 1);
gtk_widget_show (table);
gchar *message = "<small><i>default</i> plugin always uses internal sound card. Select <i>dmix/dsnoop</i> to use an alternate soundcard.</small>";
gnome_info_bar (message, GTK_MESSAGE_INFO, &info_bar);
gtk_table_attach (GTK_TABLE (table), info_bar, 1, 3, 1, 2, GTK_FILL, GTK_SHRINK, 10, 10);
DEBUG ("Audio: Configuration plugin");
item = gtk_label_new (_ ("ALSA plugin"));
gtk_misc_set_alignment (GTK_MISC (item), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (item);
// Set choices of audio managers
pluginlist = gtk_list_store_new (1, G_TYPE_STRING);
......@@ -813,7 +818,7 @@ GtkWidget* alsa_box()
renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (plugin), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (plugin), renderer, "text", 0, NULL);
gtk_table_attach (GTK_TABLE (table), plugin, 2, 3, 1, 2, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), plugin, 2, 3, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (plugin);
// Device : Output device
......@@ -821,7 +826,7 @@ GtkWidget* alsa_box()
DEBUG ("Audio: Configuration output");
item = gtk_label_new (_ ("Output"));
gtk_misc_set_alignment (GTK_MISC (item), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (item);
// Set choices of output devices
outputlist = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
......@@ -835,7 +840,7 @@ GtkWidget* alsa_box()
renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (output), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (output), renderer, "text", 0, NULL);
gtk_table_attach (GTK_TABLE (table), output, 2, 3, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), output, 2, 3, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (output);
// Device : Input device
......@@ -843,7 +848,7 @@ GtkWidget* alsa_box()
DEBUG ("Audio: Configuration input");
item = gtk_label_new (_ ("Input"));
gtk_misc_set_alignment (GTK_MISC (item), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (item);
// Set choices of output devices
......@@ -854,10 +859,17 @@ GtkWidget* alsa_box()
gtk_label_set_mnemonic_widget (GTK_LABEL (item), input);
g_signal_connect (G_OBJECT (input), "changed", G_CALLBACK (select_audio_input_device), input);
// Set rendering
renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (input), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (input), renderer, "text", 0, NULL);
gtk_table_attach (GTK_TABLE (table), input, 2, 3, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (input);
DEBUG ("Audio: Configuration rintgtone");
item = gtk_label_new (_ ("Ringtone"));
gtk_misc_set_alignment (GTK_MISC (item), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), item, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (item);
// set choices of ringtone devices
ringtonelist = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
......@@ -871,17 +883,9 @@ GtkWidget* alsa_box()
renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ringtone), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ringtone), renderer, "text", 0, NULL);
gtk_table_attach (GTK_TABLE (table), ringtone, 2, 3, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), ringtone, 2, 3, 5, 6, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (ringtone);
// Set rendering
renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (input), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (input), renderer, "text", 0, NULL);
gtk_table_attach (GTK_TABLE (table), input, 2, 3, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (input);
gtk_widget_show_all (ret);
// Update the combo box
......
......@@ -138,7 +138,7 @@ static void phone_number_enabled_cb (GtkWidget *widget)
GtkWidget* create_hooks_settings ()
{
GtkWidget *ret, *frame, *table, *label, *widg;
GtkWidget *ret, *frame, *table, *label, *widg, *info_bar;
// Load the user value
hooks_load_parameters (&_urlhook_config);
......@@ -150,12 +150,9 @@ GtkWidget* create_hooks_settings ()
gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
label = gtk_label_new (_ ("Custom commands on incoming calls with URL"));
gtk_table_attach (GTK_TABLE (table), label, 0, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new (_ ("%s will be replaced with the passed URL."));
gtk_table_attach (GTK_TABLE (table), label, 0, 2, 1, 2, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gchar *message = "<small>Custom commands on incoming calls with URL. %s will be replaced with the passed URL.</small>";
gnome_info_bar (message, GTK_MESSAGE_INFO, &info_bar);
gtk_table_attach (GTK_TABLE (table), info_bar, 0, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 10, 10);
widg = gtk_check_button_new_with_mnemonic (_ ("Trigger on specific _SIP header"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widg), (g_strcasecmp (_urlhook_config->sip_enabled, "1") ==0) ?TRUE:FALSE);
......
......@@ -117,3 +117,20 @@ void gnome_main_section_new (gchar *title, GtkWidget **frame)
*frame = _frame;
}
void gnome_info_bar (gchar *message, GtkMessageType type, GtkWidget **info_bar)
{
GtkWidget *_info_bar, *message_label, *content_area;
_info_bar = gtk_info_bar_new();
gtk_widget_set_no_show_all (_info_bar, TRUE);
message_label = gtk_label_new (NULL);
gtk_widget_show (message_label);
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (_info_bar));
gtk_container_add (GTK_CONTAINER (content_area), message_label);
gtk_label_set_markup (GTK_LABEL (message_label), message); //message);
gtk_info_bar_set_message_type (GTK_INFO_BAR (_info_bar), type);
gtk_widget_show (_info_bar);
*info_bar = _info_bar;
}
......@@ -38,6 +38,8 @@ G_BEGIN_DECLS
void gnome_main_section_new (gchar *title, GtkWidget**);
void gnome_main_section_new_with_table (gchar *title, GtkWidget**, GtkWidget**, gint nb_col, gint nb_row);
void gnome_main_section_new_with_vbox (gchar *title, GtkWidget **frame, GtkWidget **vbox, gint nb_row);
void gnome_info_bar (gchar *message, GtkMessageType type, GtkWidget **info_bar);
G_END_DECLS
#endif // _UTILS_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment