Commit ccb6f7a3 authored by Guido Gunther's avatar Guido Gunther

dialer: Rename dial button to submit button

parent 8c996b5a
......@@ -65,7 +65,7 @@ example_window_back_clicked_cb (GtkWidget *sender,
}
static void
example_window_dialed_cb (GtkWidget *widget,
example_window_submitted_cb (GtkWidget *widget,
gchar *number)
{
g_print ("Dial %s\n", number);
......@@ -100,8 +100,7 @@ example_window_class_init (ExampleWindowClass *klass)
gtk_widget_class_bind_template_callback_full (widget_class, "notify_folded_cb", G_CALLBACK(example_window_notify_folded_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "notify_visible_child_cb", G_CALLBACK(example_window_notify_visible_child_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "back_clicked_cb", G_CALLBACK(example_window_back_clicked_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "dialed_cb", G_CALLBACK(example_window_dialed_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "notify_number_cb", G_CALLBACK(example_window_notify_number_cb));
gtk_widget_class_bind_template_callback_full (widget_class, "submitted_cb", G_CALLBACK(example_window_submitted_cb));
}
static void
......
......@@ -165,7 +165,7 @@
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin">12</property>
<signal name="dialed" after="yes" handler="dialed_cb"/>
<signal name="submitted" after="yes" handler="submitted_cb"/>
<signal name="notify::number" after="yes" handler="notify_number_cb"/>
</object>
<packing>
......
......@@ -20,8 +20,8 @@ def quit(dialer, number=None):
window = Gtk.Window(title="Dialer Example with Python")
dialer = Handy.Dialer()
dialer.connect("dialed", print_number)
dialer.connect("dialed", quit)
dialer.connect("submitted", print_number)
dialer.connect("submitted", quit)
window.connect("destroy", quit)
window.add(dialer)
......
......@@ -13,10 +13,11 @@
/**
* SECTION:hdy-dialer
* @short_description: A dialer keypad for phone numbers
* @short_description: A keypad for dialing numbers
* @Title: HdyDialer
*
* The #HdyDialer widget is a keypad for dialing mobile phone numbers.
* The #HdyDialer widget is a keypad for entering numbers such as phone numbers
* or PIN codes.
*/
typedef struct
......@@ -24,7 +25,7 @@ typedef struct
HdyDialerButton *btn_0, *btn_1, *btn_2, *btn_3, *btn_4, *btn_5, *btn_6, *btn_7, *btn_8, *btn_9;
HdyDialerCycleButton *btn_hash, *btn_star, *cycle_btn;
GtkLabel *display;
GtkButton *btn_dial, *btn_del;
GtkButton *btn_submit, *btn_del;
GString *number;
} HdyDialerPrivate;
......@@ -38,7 +39,7 @@ enum {
static GParamSpec *props[PROP_LAST_PROP];
enum {
SIGNAL_DIALED,
SIGNAL_SUBMITTED,
SIGNAL_LAST_SIGNAL,
};
static guint signals [SIGNAL_LAST_SIGNAL];
......@@ -115,7 +116,7 @@ cycle_end (HdyDialer *self,
}
static void
dial_button_clicked (HdyDialer *self,
submit_button_clicked (HdyDialer *self,
GtkButton *btn)
{
HdyDialerPrivate *priv = hdy_dialer_get_instance_private (self);
......@@ -127,7 +128,7 @@ dial_button_clicked (HdyDialer *self,
stop_cycle_mode (self);
number = gtk_label_get_label (priv->display);
g_signal_emit (self, signals[SIGNAL_DIALED], 0, number);
g_signal_emit (self, signals[SIGNAL_SUBMITTED], 0, number);
}
static void
......@@ -230,18 +231,19 @@ hdy_dialer_class_init (HdyDialerClass *klass)
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
/**
* HdyDialer::dialed:
* HdyDialer::submitted:
* @self: The #HdyDialer instance.
* @number: The number at the time of activation.
*
* This signal is emitted when the dialer's dial button is activated.
* Connect to this signal to perform the dialing.
* This signal is emitted when the dialer's 'dial' button is activated.
* Connect to this signal to perform to get notified when the user
* wants to submit the dialed number.
*/
signals[SIGNAL_DIALED] =
g_signal_new ("dialed",
signals[SIGNAL_SUBMITTED] =
g_signal_new ("submitted",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (HdyDialerClass, dialed),
G_STRUCT_OFFSET (HdyDialerClass, submitted),
NULL, NULL, NULL,
G_TYPE_NONE,
1,
......@@ -262,7 +264,7 @@ hdy_dialer_class_init (HdyDialerClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, HdyDialer, btn_hash);
gtk_widget_class_bind_template_child_private (widget_class, HdyDialer, btn_star);
gtk_widget_class_bind_template_child_private (widget_class, HdyDialer, display);
gtk_widget_class_bind_template_child_private (widget_class, HdyDialer, btn_dial);
gtk_widget_class_bind_template_child_private (widget_class, HdyDialer, btn_submit);
gtk_widget_class_bind_template_child_private (widget_class, HdyDialer, btn_del);
}
......@@ -349,9 +351,9 @@ hdy_dialer_init (HdyDialer *self)
"swapped-signal::cycle-end", G_CALLBACK (cycle_end), self,
NULL);
g_signal_connect_object (priv->btn_dial,
g_signal_connect_object (priv->btn_submit,
"clicked",
G_CALLBACK (dial_button_clicked),
G_CALLBACK (submit_button_clicked),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->btn_del,
......@@ -373,7 +375,7 @@ hdy_dialer_init (HdyDialer *self)
"/sm/puri/handy/icons");
image = gtk_image_new_from_icon_name ("phone-dial-symbolic",
GTK_ICON_SIZE_BUTTON * 1.3);
gtk_button_set_image (priv->btn_dial, image);
gtk_button_set_image (priv->btn_submit, image);
priv->number = g_string_new (NULL);
priv->cycle_btn = NULL;
......
......@@ -22,7 +22,7 @@ G_DECLARE_DERIVABLE_TYPE (HdyDialer, hdy_dialer, HDY, DIALER, GtkGrid)
/**
* HdyDialerClass:
* @parent_class: The parent class
* @dialed: Class handler for the #HdyDialer::dialed signal
* @submitted: Class handler for the #HdyDialer::submitted signal
*/
struct _HdyDialerClass
{
......@@ -30,8 +30,8 @@ struct _HdyDialerClass
/* Signals
*/
void (*dialed) (HdyDialer *self,
const gchar *number);
void (*submitted) (HdyDialer *self,
const gchar *number);
};
GtkWidget *hdy_dialer_new (void);
......
......@@ -171,7 +171,7 @@
</child>
<child>
<object class="GtkButton" id="btn_dial">
<object class="GtkButton" id="btn_submit">
<property name="label"></property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......
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