:: Re: [maemo-leste] Phone support on …
Pàgina inicial
Delete this message
Reply to this message
Autor: Pavel Machek
Data:  
A: Dev Null
CC: Merlijn Wajer, maemo-leste
Assumpte: Re: [maemo-leste] Phone support on Droid 4
Hi!

> you have to enable-modem the modem first before onlineing it becomes
> available.


Yes, thank you, with that it works.

Would you be willing to review/apply few patches?

Buttons were too small in sms sending, I believe send button should be
on the right, it is useful to count characters, and SMS should really
word-wrap, not scroll.

Best regards,
                                Pavel
-- 
http://www.livejournal.com/~pavelmachek

From 362b398be836d12235f61c7727b25e73de857998 Mon Sep 17 00:00:00 2001
From: Pavel Machek <pavel@???>
Date: Sat, 13 Nov 2021 13:40:12 +0100
Subject: [PATCH 1/4] Bigger buttons/labels for sms send dialog.

---
src/gui/gui-sms.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/gui/gui-sms.c b/src/gui/gui-sms.c
index 340e5bb..801e9f2 100644
--- a/src/gui/gui-sms.c
+++ b/src/gui/gui-sms.c
@@ -122,14 +122,23 @@ bool gtk_gui_sms_send_show(const MessageProperties *msg)
     GtkWidget *v1=gtk_vbox_new(FALSE,2);
     GtkWidget *to_bar=gtk_hbox_new(FALSE,0);
     GtkWidget *actions_bar=gtk_hbox_new(FALSE,0);
-    GtkWidget *to_label=gtk_label_new("To:");
+    GtkWidget *to_label=gtk_label_new("");
     GtkWidget *to_entry=gtk_entry_new();
-    GtkWidget *send_button=gtk_button_new_with_label("Send");
-    GtkWidget *cancel_button=gtk_button_new_with_label("Cancel");
+    GtkWidget *send_label=gtk_label_new("");
+    GtkWidget *send_button=gtk_button_new();
+    GtkWidget *cancel_label=gtk_label_new("");
+    GtkWidget *cancel_button=gtk_button_new();
     GtkWidget *text_edit=gtk_text_view_new();
     GtkWidget *s = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (s),
                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+    gtk_label_set_markup(GTK_LABEL(to_label), "<span font_size=\"x-large\">To:</span>");
+    gtk_label_set_markup(GTK_LABEL(send_label), "<span font_size=\"x-large\">Send</span>");
+    gtk_label_set_markup(GTK_LABEL(cancel_label), "<span font_size=\"x-large\">Cancel</span>");
+    gtk_container_add (GTK_CONTAINER (send_button), send_label);
+    gtk_container_add (GTK_CONTAINER (cancel_button), cancel_label);
+    
     
 #ifdef ENABLE_LIBHILDON
     hildon_gtk_window_set_portrait_flags(GTK_WINDOW(main_window), HILDON_PORTRAIT_MODE_SUPPORT);
@@ -172,8 +181,8 @@ bool gtk_gui_sms_send_show(const MessageProperties *msg)
 
     gtk_box_pack_start(GTK_BOX(to_bar), to_label, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(to_bar), to_entry, TRUE, TRUE, 0);
-    gtk_container_add(GTK_CONTAINER(actions_bar), send_button);
     gtk_container_add(GTK_CONTAINER(actions_bar), cancel_button);
+    gtk_container_add(GTK_CONTAINER(actions_bar), send_button);
     gtk_box_pack_start(GTK_BOX(v1), to_bar, FALSE, FALSE, 0);
     gtk_container_add(GTK_CONTAINER(s), text_edit);
     gtk_box_pack_start(GTK_BOX(v1), s, TRUE, TRUE, 0);
-- 
2.20.1


From 7bb3556b945d27f6dc52e82007f087af3fc6fe4d Mon Sep 17 00:00:00 2001
From: Pavel Machek <pavel@???>
Date: Sat, 13 Nov 2021 18:29:54 +0100
Subject: [PATCH 3/4] Count characters in sms.

---
src/gui/gui-sms.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/gui/gui-sms.c b/src/gui/gui-sms.c
index 801e9f2..31f3a25 100644
--- a/src/gui/gui-sms.c
+++ b/src/gui/gui-sms.c
@@ -38,6 +38,7 @@
 static void gui_sms_send_callback(GtkWidget *button, GtkWidget *main_window);
 static void gui_sms_cancel_callback(GtkWidget *button, GtkWidget *main_window);
 static void gui_sms_reply_callback(GtkWidget *button);
+static void gui_text_changed_callback(GtkWidget *button, GtkWidget *main_window);
 
 static void gui_sms_coming_callback(gconstpointer data, gpointer user_data)
 {
@@ -124,6 +125,7 @@ bool gtk_gui_sms_send_show(const MessageProperties *msg)
     GtkWidget *actions_bar=gtk_hbox_new(FALSE,0);
     GtkWidget *to_label=gtk_label_new("");
     GtkWidget *to_entry=gtk_entry_new();
+    GtkWidget *num_label=gtk_label_new("???");
     GtkWidget *send_label=gtk_label_new("");
     GtkWidget *send_button=gtk_button_new();
     GtkWidget *cancel_label=gtk_label_new("");
@@ -181,6 +183,7 @@ bool gtk_gui_sms_send_show(const MessageProperties *msg)
 
     gtk_box_pack_start(GTK_BOX(to_bar), to_label, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(to_bar), to_entry, TRUE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(to_bar), num_label, FALSE, FALSE, 0);
     gtk_container_add(GTK_CONTAINER(actions_bar), cancel_button);
     gtk_container_add(GTK_CONTAINER(actions_bar), send_button);
     gtk_box_pack_start(GTK_BOX(v1), to_bar, FALSE, FALSE, 0);
@@ -191,9 +194,11 @@ bool gtk_gui_sms_send_show(const MessageProperties *msg)
 
     g_object_set_data(G_OBJECT(main_window),"to_entry",to_entry);
     g_object_set_data(G_OBJECT(main_window),"text_buffer",text_buffer);
+    g_object_set_data(G_OBJECT(main_window),"num_label",num_label);
 
     gtk_widget_show_all(main_window);
-    
+
+    g_signal_connect(G_OBJECT(text_buffer),"changed", G_CALLBACK(gui_text_changed_callback),main_window);
     g_signal_connect(G_OBJECT(send_button),"clicked", G_CALLBACK(gui_sms_send_callback),main_window);
     g_signal_connect(G_OBJECT(cancel_button),"clicked", G_CALLBACK(gui_sms_cancel_callback),main_window);
     g_signal_connect(G_OBJECT(to_entry),"changed", G_CALLBACK(gui_sms_to_changed_callback_delayed),NULL);
@@ -264,6 +269,21 @@ void gui_sms_receive_show(const MessageProperties *message)
     g_free(desc);
 }
 
+void gui_text_changed_callback(GtkWidget *button, GtkWidget *main_window)
+{
+      (void)button;
+    GtkTextBuffer *text_buffer=g_object_get_data(G_OBJECT(main_window),"text_buffer");
+    GtkTextBuffer *num_label=g_object_get_data(G_OBJECT(main_window),"num_label");
+
+    gchar *text=NULL;
+    g_object_get(G_OBJECT(text_buffer),"text", &text, NULL);
+    char buf[1024];
+    
+    int l = strlen(text);
+    sprintf(buf,"<span font_size=\"x-large\">%d/150</span>", l);
+    gtk_label_set_markup(GTK_LABEL(num_label), buf);
+}
+
 void gui_sms_send_callback(GtkWidget *button, GtkWidget *main_window)
 {
     (void)button;
-- 
2.20.1


From 6b1f78933f25bceca9f51b092db5936280ef471e Mon Sep 17 00:00:00 2001
From: Pavel Machek <pavel@???>
Date: Sat, 13 Nov 2021 18:37:28 +0100
Subject: [PATCH 4/4] Enable word wrapping.

---
src/gui/gui-sms.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/gui/gui-sms.c b/src/gui/gui-sms.c
index 31f3a25..98b616f 100644
--- a/src/gui/gui-sms.c
+++ b/src/gui/gui-sms.c
@@ -180,6 +180,7 @@ bool gtk_gui_sms_send_show(const MessageProperties *msg)
     
     gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(text_edit),GTK_TEXT_WINDOW_LEFT,2);
     gtk_text_view_set_border_window_size(GTK_TEXT_VIEW(text_edit),GTK_TEXT_WINDOW_RIGHT,2);
+    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_edit),GTK_WRAP_WORD);
 
     gtk_box_pack_start(GTK_BOX(to_bar), to_label, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(to_bar), to_entry, TRUE, TRUE, 0);
-- 
2.20.1