~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to sflphone-client-gnome/src/dialpad.c

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2011-11-25 13:24:12 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20111125132412-dc4qvhyosk74cd42
Tags: 1.0.1-4
Don't assume that arch:all packages will get built (closes: #649726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
3
 
 *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
4
 
 *
5
 
 *  This program is free software; you can redistribute it and/or modify
6
 
 *  it under the terms of the GNU General Public License as published by
7
 
 *  the Free Software Foundation; either version 3 of the License, or
8
 
 *  (at your option) any later version.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
 *
19
 
 *  Additional permission under GNU GPL version 3 section 7:
20
 
 *
21
 
 *  If you modify this program, or any covered work, by linking or
22
 
 *  combining it with the OpenSSL project's OpenSSL library (or a
23
 
 *  modified version of that library), containing parts covered by the
24
 
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
25
 
 *  grants you additional permission to convey the resulting work.
26
 
 *  Corresponding Source for a non-source form of such a combination
27
 
 *  shall include the source code for the parts of OpenSSL used as well
28
 
 *  as that of the covered work.
29
 
 */
30
 
 
31
 
#include <dialpad.h>
32
 
#include <actions.h>
33
 
 
34
 
/**
35
 
 * button pressed event
36
 
 */
37
 
static void
38
 
dialpad_pressed (GtkWidget * widget UNUSED, gpointer data)
39
 
{
40
 
    gtk_widget_grab_focus (GTK_WIDGET (current_calls->view));
41
 
    sflphone_keypad (0, (gchar*) data);
42
 
}
43
 
 
44
 
GtkWidget *
45
 
get_numpad_button (const gchar* number, gboolean twolines, const gchar * letters)
46
 
{
47
 
    GtkWidget * button;
48
 
    GtkWidget * label;
49
 
    gchar * markup;
50
 
 
51
 
    button = gtk_button_new ();
52
 
    label = gtk_label_new ("1");
53
 
    gtk_label_set_single_line_mode (GTK_LABEL (label), FALSE);
54
 
    gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
55
 
    markup = g_markup_printf_escaped ("<big><b>%s</b></big>%s%s", number, (twolines == TRUE ? "\n": ""), letters);
56
 
    gtk_label_set_markup (GTK_LABEL (label), markup);
57
 
    gtk_container_add (GTK_CONTAINER (button), label);
58
 
    g_signal_connect (G_OBJECT (button), "clicked",
59
 
                      G_CALLBACK (dialpad_pressed), (gchar*) number);
60
 
 
61
 
    return button;
62
 
}
63
 
 
64
 
GtkWidget *
65
 
create_dialpad()
66
 
{
67
 
    GtkWidget * button;
68
 
    GtkWidget * table;
69
 
 
70
 
    table = gtk_table_new (4, 3, TRUE /* homogeneous */);
71
 
    gtk_table_set_row_spacings (GTK_TABLE (table), 5);
72
 
    gtk_table_set_col_spacings (GTK_TABLE (table), 5);
73
 
    gtk_container_set_border_width (GTK_CONTAINER (table), 5);
74
 
 
75
 
    button = get_numpad_button ("1", TRUE, "");
76
 
    gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
77
 
 
78
 
    button = get_numpad_button ("2", TRUE, "a b c");
79
 
    gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
80
 
 
81
 
    button = get_numpad_button ("3", TRUE, "d e f");
82
 
    gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
83
 
 
84
 
 
85
 
    button = get_numpad_button ("4", TRUE, "g h i");
86
 
    gtk_table_attach (GTK_TABLE (table), button, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
87
 
 
88
 
    button = get_numpad_button ("5", TRUE, "j k l");
89
 
    gtk_table_attach (GTK_TABLE (table), button, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
90
 
 
91
 
    button = get_numpad_button ("6", TRUE, "m n o");
92
 
    gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
93
 
 
94
 
 
95
 
    button = get_numpad_button ("7", TRUE, "p q r s");
96
 
    gtk_table_attach (GTK_TABLE (table), button, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
97
 
 
98
 
    button = get_numpad_button ("8", TRUE, "t u v");
99
 
    gtk_table_attach (GTK_TABLE (table), button, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
100
 
 
101
 
    button = get_numpad_button ("9", TRUE, "w x y z");
102
 
    gtk_table_attach (GTK_TABLE (table), button, 2, 3, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
103
 
 
104
 
 
105
 
    button = get_numpad_button ("*", FALSE, "");
106
 
    gtk_table_attach (GTK_TABLE (table), button, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
107
 
 
108
 
    button = get_numpad_button ("0", FALSE, "");
109
 
    gtk_table_attach (GTK_TABLE (table), button, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
110
 
 
111
 
    button = get_numpad_button ("#", FALSE, "");
112
 
    gtk_table_attach (GTK_TABLE (table), button, 2, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
113
 
 
114
 
    return table;
115
 
 
116
 
}