diff options
author | hark <hark@puscii.nl> | 2014-01-22 13:03:55 +0000 |
---|---|---|
committer | hark <hark@puscii.nl> | 2014-01-22 13:03:55 +0000 |
commit | a076abb5744106eeef18a78db8a0bdb179a4d0c3 (patch) | |
tree | 0b5b9aa9b380a089fc9928f907fd0a45299f7efd | |
parent | 404506a6036ef616921db2222f2180678922526f (diff) | |
download | gnunet-gtk-a076abb5744106eeef18a78db8a0bdb179a4d0c3.tar.gz gnunet-gtk-a076abb5744106eeef18a78db8a0bdb179a4d0c3.zip |
fix some compiler warnings about gtk
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 335 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.h | 10 |
2 files changed, 193 insertions, 152 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c index f05eabe1..054e8184 100644 --- a/src/conversation/gnunet-conversation-gtk.c +++ b/src/conversation/gnunet-conversation-gtk.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #define UPDATE_STATUS(format, ...) update_status(g_strdup_printf (format, ## __VA_ARGS__)) | 46 | #define UPDATE_STATUS(format, ...) update_status(g_strdup_printf (format, ## __VA_ARGS__)) |
47 | 47 | ||
48 | #define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format, ## __VA_ARGS__)) | 48 | //#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format, ## __VA_ARGS__)) |
49 | 49 | ||
50 | #define LOG(format, ...) log_message(g_strdup_printf (format, ## __VA_ARGS__)) | 50 | #define LOG(format, ...) log_message(g_strdup_printf (format, ## __VA_ARGS__)) |
51 | 51 | ||
@@ -55,6 +55,7 @@ | |||
55 | * @param name name of the object | 55 | * @param name name of the object |
56 | * @return NULL on error | 56 | * @return NULL on error |
57 | */ | 57 | */ |
58 | |||
58 | static GObject * | 59 | static GObject * |
59 | get_object (const char *name) | 60 | get_object (const char *name) |
60 | { | 61 | { |
@@ -62,7 +63,8 @@ get_object (const char *name) | |||
62 | } | 63 | } |
63 | 64 | ||
64 | /* | 65 | /* |
65 | * log a message to gtk thing | 66 | * log a message to gtk log textbuffer |
67 | * @param Message to be logged | ||
66 | */ | 68 | */ |
67 | 69 | ||
68 | void | 70 | void |
@@ -76,13 +78,9 @@ log_message (const char *message) | |||
76 | GtkTextIter iter; | 78 | GtkTextIter iter; |
77 | gchar *fmsg; | 79 | gchar *fmsg; |
78 | 80 | ||
79 | // update_status(message); | 81 | log_view = GTK_TEXT_VIEW(get_object ("GNUNET_GTK_conversation_log")); |
80 | //UPDATE_STATUS("status update testje: %s", message); | ||
81 | //FPRINTF(stderr,"now logging: %s",message); | ||
82 | |||
83 | log_view = get_object ("GNUNET_GTK_conversation_log"); | ||
84 | 82 | ||
85 | logbuff = gtk_text_view_get_buffer (log_view); | 83 | logbuff = GTK_TEXT_BUFFER(gtk_text_view_get_buffer (log_view)); |
86 | 84 | ||
87 | fmsg = g_strdup_printf (" %s \n", message); | 85 | fmsg = g_strdup_printf (" %s \n", message); |
88 | 86 | ||
@@ -94,12 +92,22 @@ log_message (const char *message) | |||
94 | 92 | ||
95 | } | 93 | } |
96 | 94 | ||
95 | /* | ||
96 | * does nothing | ||
97 | */ | ||
98 | |||
97 | void | 99 | void |
98 | update_state () | 100 | update_state () |
99 | { | 101 | { |
100 | // LOG('update_state called',NULL); | 102 | // LOG('update_state called',NULL); |
101 | } | 103 | } |
102 | 104 | ||
105 | /* | ||
106 | * update status | ||
107 | * | ||
108 | * @param message Message to put in statusbar | ||
109 | */ | ||
110 | |||
103 | void | 111 | void |
104 | update_status (const gchar * message) | 112 | update_status (const gchar * message) |
105 | { | 113 | { |
@@ -107,10 +115,9 @@ update_status (const gchar * message) | |||
107 | GtkStatusbar *status_bar; | 115 | GtkStatusbar *status_bar; |
108 | guint status_bar_context; | 116 | guint status_bar_context; |
109 | 117 | ||
110 | //static int count = 1; | ||
111 | gchar *buff; | 118 | gchar *buff; |
112 | 119 | ||
113 | status_bar = get_object ("GNUNET_GTK_conversation_statusbar"); | 120 | status_bar = GTK_STATUSBAR(get_object ("GNUNET_GTK_conversation_statusbar")); |
114 | status_bar_context = gtk_statusbar_get_context_id (status_bar, "blaat"); | 121 | status_bar_context = gtk_statusbar_get_context_id (status_bar, "blaat"); |
115 | 122 | ||
116 | 123 | ||
@@ -124,11 +131,11 @@ update_status (const gchar * message) | |||
124 | } | 131 | } |
125 | 132 | ||
126 | /* | 133 | /* |
127 | * adds a item to the call history | 134 | * adds a item to the call history |
128 | types: | 135 | * |
129 | 1: accepted | 136 | * @param type type of call: 1: accepted 2: rejected |
130 | 2: rejected | 137 | * @return void |
131 | */ | 138 | */ |
132 | 139 | ||
133 | void | 140 | void |
134 | history_add (int type, char *contactName) | 141 | history_add (int type, char *contactName) |
@@ -142,27 +149,39 @@ history_add (int type, char *contactName) | |||
142 | contactName, -1); | 149 | contactName, -1); |
143 | } | 150 | } |
144 | 151 | ||
152 | /* | ||
153 | * set button text | ||
154 | * @param button_name name of button | ||
155 | * @param label label on the button | ||
156 | */ | ||
157 | |||
145 | void | 158 | void |
146 | set_button_text (const char *button_name, const char *label) | 159 | set_button_text (const char *button_name, const char *label) |
147 | { | 160 | { |
148 | //GtkButton *button; | 161 | //GtkButton *button; |
149 | GtkWidget *button; | 162 | GtkWidget *button; |
150 | 163 | ||
151 | button = get_object (button_name); | 164 | button = GTK_WIDGET(get_object (button_name)); |
152 | gtk_widget_hide (button); | 165 | gtk_widget_hide (button); |
153 | } | 166 | } |
154 | 167 | ||
155 | void | 168 | /* |
156 | set_infobar_text (const gchar * text) | 169 | * set infobar text |
157 | { | 170 | */ |
158 | GtkLabel *infolabel; | 171 | // |
159 | 172 | //void | |
160 | infolabel = get_object ("GNUNET_GTK_new_call_label"); | 173 | //set_infobar_text (const gchar * text) |
161 | log_message ("setting infobar text"); | 174 | //{ |
162 | gtk_label_set_text (infolabel, text); | 175 | // GtkLabel *infolabel; |
163 | } | 176 | // |
164 | 177 | // infolabel = GTK_LABEL(get_object ("GNUNET_GTK_new_call_label")); | |
165 | 178 | // log_message ("setting infobar text"); | |
179 | // gtk_label_set_text (infolabel, text); | ||
180 | //} | ||
181 | // | ||
182 | /* | ||
183 | * disable button | ||
184 | */ | ||
166 | 185 | ||
167 | void | 186 | void |
168 | disable_button (const char *button_name) | 187 | disable_button (const char *button_name) |
@@ -170,42 +189,53 @@ disable_button (const char *button_name) | |||
170 | //GtkButton *button; | 189 | //GtkButton *button; |
171 | GtkWidget *button; | 190 | GtkWidget *button; |
172 | 191 | ||
173 | button = get_object (button_name); | 192 | button = GTK_WIDGET(get_object (button_name)); |
174 | gtk_widget_hide (button); | 193 | gtk_widget_hide (button); |
175 | } | 194 | } |
176 | 195 | ||
196 | /* | ||
197 | * enable button | ||
198 | */ | ||
199 | |||
177 | void | 200 | void |
178 | enable_button (const char *button_name) | 201 | enable_button (const char *button_name) |
179 | { | 202 | { |
180 | //GtkButton *button; | 203 | //GtkButton *button; |
181 | GtkWidget *button; | 204 | GtkWidget *button; |
182 | 205 | ||
183 | button = get_object (button_name); | 206 | button = GTK_WIDGET(get_object (button_name)); |
184 | gtk_widget_show (button); | 207 | gtk_widget_show (button); |
185 | } | 208 | } |
186 | 209 | ||
187 | void | 210 | /* |
188 | show_infobar () | 211 | * show infobar |
189 | { | 212 | */ |
190 | // GtkInfoBar *infobar; | 213 | // |
191 | GtkWidget *infobar; | 214 | //void |
192 | 215 | //show_infobar () | |
193 | infobar = get_object ("GNUNET_GTK_conversation_infobar"); | 216 | //{ |
194 | 217 | // GtkWidget *infobar; | |
195 | gtk_widget_show (infobar); | 218 | // |
196 | } | 219 | // infobar = GTK_WIDGET(get_object ("GNUNET_GTK_conversation_infobar")); |
197 | 220 | // | |
198 | void | 221 | // gtk_widget_show (infobar); |
199 | hide_infobar () | 222 | //} |
200 | { | 223 | // |
201 | //GtkInfoBar *infobar; | 224 | /* |
202 | GtkWidget *infobar; | 225 | * hide infobar |
203 | 226 | */ | |
204 | infobar = get_object ("GNUNET_GTK_conversation_infobar"); | 227 | // |
205 | 228 | //void | |
206 | gtk_widget_hide (infobar); | 229 | //hide_infobar () |
207 | } | 230 | //{ |
208 | 231 | // //GtkInfoBar *infobar; | |
232 | // GtkWidget *infobar; | ||
233 | // | ||
234 | // infobar = GTK_WIDGET(get_object ("GNUNET_GTK_conversation_infobar")); | ||
235 | // | ||
236 | // gtk_widget_hide (infobar); | ||
237 | //} | ||
238 | // | ||
209 | 239 | ||
210 | 240 | ||
211 | /** | 241 | /** |
@@ -231,10 +261,10 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, | |||
231 | caller_num_gen); | 261 | caller_num_gen); |
232 | 262 | ||
233 | 263 | ||
234 | UPDATE_INFOBAR (_("Incoming call from `%s' on line %u\n"), caller_id, | 264 | //UPDATE_INFOBAR (_("Incoming call from `%s' on line %u\n"), caller_id, |
235 | caller_num_gen); | 265 | // caller_num_gen); |
236 | 266 | ||
237 | show_infobar (); | 267 | //show_infobar (); |
238 | // TODO: make sound | 268 | // TODO: make sound |
239 | 269 | ||
240 | cl = GNUNET_new (struct CallList); | 270 | cl = GNUNET_new (struct CallList); |
@@ -268,7 +298,7 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, | |||
268 | phone_state = PS_LISTEN; | 298 | phone_state = PS_LISTEN; |
269 | } | 299 | } |
270 | GNUNET_free (cl); | 300 | GNUNET_free (cl); |
271 | gtk_widget_destroy (dialog); | 301 | gtk_widget_destroy (GTK_WIDGET(dialog)); |
272 | break; | 302 | break; |
273 | 303 | ||
274 | } | 304 | } |
@@ -381,6 +411,8 @@ call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code) | |||
381 | GNUNET_break (CS_CONNECTED == call_state); | 411 | GNUNET_break (CS_CONNECTED == call_state); |
382 | LOG (_("Connection to `%s' resumed (by other user)\n"), peer_name); | 412 | LOG (_("Connection to `%s' resumed (by other user)\n"), peer_name); |
383 | break; | 413 | break; |
414 | case GNUNET_CONVERSATION_EC_CALL_ERROR: | ||
415 | LOG ("GNUNET_CONVERSATION_EC_CALL_ERROR %s", peer_name); | ||
384 | } | 416 | } |
385 | } | 417 | } |
386 | 418 | ||
@@ -844,7 +876,8 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | |||
844 | static void | 876 | static void |
845 | add_continuation (void *cls, int32_t success, const char *emsg) | 877 | add_continuation (void *cls, int32_t success, const char *emsg) |
846 | { | 878 | { |
847 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; | 879 | |
880 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; | ||
848 | 881 | ||
849 | *qe = NULL; | 882 | *qe = NULL; |
850 | if (GNUNET_YES != success) | 883 | if (GNUNET_YES != success) |
@@ -871,8 +904,8 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, | |||
871 | const char *name) | 904 | const char *name) |
872 | { | 905 | { |
873 | 906 | ||
874 | FPRINTF (stderr, _("identity_cb name: `%s' caller_id: `%s' \n"), name, | 907 | // FPRINTF (stderr, _("identity_cb name: `%s' caller_id: `%s' \n"), name, |
875 | caller_id); | 908 | // caller_id); |
876 | 909 | ||
877 | if (NULL == name) | 910 | if (NULL == name) |
878 | return; | 911 | return; |
@@ -930,7 +963,9 @@ GIG_get_configuration () | |||
930 | static void | 963 | static void |
931 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 964 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
932 | { | 965 | { |
933 | struct OperationContext *oc; | 966 | |
967 | //TODO: make this work | ||
968 | //struct OperationContext *oc; | ||
934 | 969 | ||
935 | /* | 970 | /* |
936 | GIG_advertise_shutdown_ (); | 971 | GIG_advertise_shutdown_ (); |
@@ -1001,7 +1036,7 @@ GNUNET_GTK_conversation_quit_cb (GObject * object, gpointer user_data) | |||
1001 | 1036 | ||
1002 | 1037 | ||
1003 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | 1038 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); |
1004 | return 0; | 1039 | //return 0; |
1005 | 1040 | ||
1006 | } | 1041 | } |
1007 | 1042 | ||
@@ -1016,8 +1051,8 @@ GNUNET_GTK_conversation_quit_cb (GObject * object, gpointer user_data) | |||
1016 | static void | 1051 | static void |
1017 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1052 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1018 | { | 1053 | { |
1019 | GtkTreeIter iter; | 1054 | //GtkTreeIter iter; |
1020 | GtkWidget *main_window; | 1055 | GtkWindow *main_window; |
1021 | 1056 | ||
1022 | //line = 0; | 1057 | //line = 0; |
1023 | 1058 | ||
@@ -1029,7 +1064,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1029 | /* setup main window */ | 1064 | /* setup main window */ |
1030 | main_window = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_window")); | 1065 | main_window = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_window")); |
1031 | main_window = | 1066 | main_window = |
1032 | GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG", main_window); | 1067 | GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG", GTK_WIDGET(main_window)); |
1033 | gtk_window_set_default_size (main_window, 300, 700); | 1068 | gtk_window_set_default_size (main_window, 300, 700); |
1034 | contacts_liststore = | 1069 | contacts_liststore = |
1035 | GTK_LIST_STORE (get_object | 1070 | GTK_LIST_STORE (get_object |
@@ -1063,7 +1098,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1063 | /* make GUI visible */ | 1098 | /* make GUI visible */ |
1064 | if (!tray_only) | 1099 | if (!tray_only) |
1065 | { | 1100 | { |
1066 | gtk_widget_show (main_window); | 1101 | gtk_widget_show (GTK_WIDGET(main_window)); |
1067 | gtk_window_present (GTK_WINDOW (main_window)); | 1102 | gtk_window_present (GTK_WINDOW (main_window)); |
1068 | } | 1103 | } |
1069 | 1104 | ||
@@ -1133,6 +1168,65 @@ main (int argc, char *const *argv) | |||
1133 | 1168 | ||
1134 | /* gui stuff start */ | 1169 | /* gui stuff start */ |
1135 | 1170 | ||
1171 | /* | ||
1172 | * Function to open a dialog box displaying the message provided. | ||
1173 | * | ||
1174 | * @param message message in the dialogbox | ||
1175 | * @param caller_id | ||
1176 | */ | ||
1177 | |||
1178 | void | ||
1179 | quick_message (gchar * message, const char *caller_id) | ||
1180 | { | ||
1181 | GtkWidget *caller_name, *notification, *content_area; | ||
1182 | GtkDialog *dialog; | ||
1183 | GtkWindow *main_window; | ||
1184 | main_window = GTK_WINDOW(get_object("GNUNET_GTK_conversation_window")); | ||
1185 | // Create the widgets | ||
1186 | |||
1187 | |||
1188 | dialog = gtk_dialog_new_with_buttons ("Incoming call!", | ||
1189 | main_window, | ||
1190 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
1191 | _("Accept call"), | ||
1192 | GTK_RESPONSE_ACCEPT, | ||
1193 | _("Reject call"), | ||
1194 | GTK_RESPONSE_REJECT, | ||
1195 | _("Decide later"), | ||
1196 | GTK_RESPONSE_CANCEL, | ||
1197 | |||
1198 | NULL); | ||
1199 | content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); | ||
1200 | |||
1201 | |||
1202 | notification = gtk_label_new ("Incoming call from:"); | ||
1203 | caller_name = gtk_label_new (caller_id); | ||
1204 | |||
1205 | // Add the labels, and show everything we've added to the dialog | ||
1206 | gtk_container_add (GTK_CONTAINER (content_area), notification); | ||
1207 | gtk_container_add (GTK_CONTAINER (content_area), caller_name); | ||
1208 | gtk_widget_show_all (GTK_WIDGET(dialog)); | ||
1209 | |||
1210 | switch(gtk_dialog_run(dialog)){ | ||
1211 | case GTK_RESPONSE_ACCEPT : | ||
1212 | do_status(""); | ||
1213 | gtk_widget_destroy(GTK_WIDGET(dialog)); | ||
1214 | do_accept("0"); | ||
1215 | break; | ||
1216 | case GTK_RESPONSE_REJECT : | ||
1217 | do_reject(NULL); | ||
1218 | do_status(""); | ||
1219 | gtk_widget_destroy(GTK_WIDGET(dialog)); | ||
1220 | break; | ||
1221 | case GTK_RESPONSE_CANCEL : | ||
1222 | do_status(""); | ||
1223 | gtk_widget_destroy(GTK_WIDGET(dialog)); | ||
1224 | break; | ||
1225 | } | ||
1226 | |||
1227 | |||
1228 | } | ||
1229 | |||
1136 | 1230 | ||
1137 | 1231 | ||
1138 | 1232 | ||
@@ -1143,14 +1237,9 @@ void | |||
1143 | GNUNET_CONVERSATION_GTK_on_call_clicked () | 1237 | GNUNET_CONVERSATION_GTK_on_call_clicked () |
1144 | { | 1238 | { |
1145 | char *to_addr; | 1239 | char *to_addr; |
1146 | |||
1147 | // /og_message ("call clicked"); | ||
1148 | //update_status(); | ||
1149 | //address dingetje | ||
1150 | |||
1151 | GtkEntry *address_entry; | 1240 | GtkEntry *address_entry; |
1152 | 1241 | ||
1153 | address_entry = GTK_ENTRY ((get_object ("GNUNET_GTK_conversation_address"))); | 1242 | address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address")); |
1154 | to_addr = gtk_entry_get_text (address_entry); | 1243 | to_addr = gtk_entry_get_text (address_entry); |
1155 | 1244 | ||
1156 | // FPRINTF (stderr, _("calling: %s \n"), to_addr ); | 1245 | // FPRINTF (stderr, _("calling: %s \n"), to_addr ); |
@@ -1184,7 +1273,7 @@ GNUNET_CONVERSATION_GTK_on_accept_clicked () | |||
1184 | { | 1273 | { |
1185 | FPRINTF (stderr, "accept clicked \n"); | 1274 | FPRINTF (stderr, "accept clicked \n"); |
1186 | do_accept (0); | 1275 | do_accept (0); |
1187 | hide_infobar (); | 1276 | // hide_infobar (); |
1188 | } | 1277 | } |
1189 | 1278 | ||
1190 | 1279 | ||
@@ -1205,13 +1294,13 @@ void | |||
1205 | GNUNET_CONVERSATION_GTK_on_pause_clicked () | 1294 | GNUNET_CONVERSATION_GTK_on_pause_clicked () |
1206 | { | 1295 | { |
1207 | // GtkEntry *entry; | 1296 | // GtkEntry *entry; |
1208 | 1297 | do_suspend("0"); | |
1209 | //FPRINTF (stderr, "pause clicked \n"); | 1298 | //FPRINTF (stderr, "pause clicked \n"); |
1210 | //do_pause(""); | 1299 | //do_pause(""); |
1211 | // entry = GTK_ENTRY((get_object ("GNUNET_GTK_conversation_address"))); | 1300 | // entry = GTK_ENTRY((get_object ("GNUNET_GTK_conversation_address"))); |
1212 | //FPRINTF (stderr, gtk_entry_get_text (entry)); | 1301 | //FPRINTF (stderr, gtk_entry_get_text (entry)); |
1213 | // gtk_entry_set_text (entry, "testtextje"); | 1302 | // gtk_entry_set_text (entry, "testtextje"); |
1214 | show_infobar (); | 1303 | // show_infobar (); |
1215 | } | 1304 | } |
1216 | 1305 | ||
1217 | /** | 1306 | /** |
@@ -1238,6 +1327,13 @@ GNUNET_CONVERSATION_GTK_on_status_clicked () | |||
1238 | //quick_message('hee blaaat you have a call from blaat'); | 1327 | //quick_message('hee blaaat you have a call from blaat'); |
1239 | } | 1328 | } |
1240 | 1329 | ||
1330 | /* | ||
1331 | void | ||
1332 | GNUNET_contact_test () | ||
1333 | { | ||
1334 | FPRINTF (stderr, "gnunet contact test" | ||
1335 | } | ||
1336 | */ | ||
1241 | 1337 | ||
1242 | void | 1338 | void |
1243 | use_current_incoming_address () | 1339 | use_current_incoming_address () |
@@ -1292,11 +1388,15 @@ void | |||
1292 | GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, | 1388 | GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, |
1293 | gpointer * user_data) | 1389 | gpointer * user_data) |
1294 | { | 1390 | { |
1295 | gint response_id; | 1391 | // gint response_id; |
1296 | 1392 | ||
1297 | FPRINTF (stderr, "add clicked \n"); | 1393 | FPRINTF (stderr, "add clicked \n"); |
1298 | GtkWidget *caller_name, *notification, *content_area, *currentCheckButton, | 1394 | //unused: *anotherArea, *labelName, *labelAddres *caller_name |
1299 | *nameEntry, *addressEntry, *anotherArea, *labelName, *labelAddres; | 1395 | |
1396 | GtkLabel *notification; | ||
1397 | GtkHBox *content_area; | ||
1398 | GtkButton *currentCheckButton; | ||
1399 | GtkEntry *nameEntry, *addressEntry; | ||
1300 | GtkDialog *dialog; | 1400 | GtkDialog *dialog; |
1301 | GtkWindow *main_window; | 1401 | GtkWindow *main_window; |
1302 | 1402 | ||
@@ -1315,14 +1415,14 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, | |||
1315 | GTK_DIALOG_DESTROY_WITH_PARENT, | 1415 | GTK_DIALOG_DESTROY_WITH_PARENT, |
1316 | _("Add contact"), GTK_RESPONSE_ACCEPT, | 1416 | _("Add contact"), GTK_RESPONSE_ACCEPT, |
1317 | _("Cancel"), GTK_RESPONSE_CANCEL, NULL); | 1417 | _("Cancel"), GTK_RESPONSE_CANCEL, NULL); |
1318 | gtk_dialog_add_action_widget (dialog, currentCheckButton, GTK_RESPONSE_OK); | 1418 | gtk_dialog_add_action_widget (dialog, GTK_WIDGET(currentCheckButton), GTK_RESPONSE_OK); |
1319 | FPRINTF (stderr, "response id : %u", response_id); | 1419 | // FPRINTF (stderr, "response id : %u", response_id); |
1320 | g_signal_connect (GTK_BUTTON (currentCheckButton), "clicked", | 1420 | g_signal_connect (GTK_BUTTON (currentCheckButton), "clicked", |
1321 | G_CALLBACK (use_current_incoming_address), NULL); | 1421 | G_CALLBACK (use_current_incoming_address), NULL); |
1322 | 1422 | ||
1323 | 1423 | ||
1324 | gtk_dialog_add_action_widget (dialog, nameEntry, 2); | 1424 | gtk_dialog_add_action_widget (dialog, GTK_WIDGET(nameEntry), 2); |
1325 | gtk_dialog_add_action_widget (dialog, addressEntry, 3); | 1425 | gtk_dialog_add_action_widget (dialog, GTK_WIDGET(addressEntry), 3); |
1326 | 1426 | ||
1327 | content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); | 1427 | content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); |
1328 | 1428 | ||
@@ -1331,9 +1431,9 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, | |||
1331 | // caller_name = gtk_label_new (caller_id); | 1431 | // caller_name = gtk_label_new (caller_id); |
1332 | 1432 | ||
1333 | // Add the labels, and show everything we've added to the dialog | 1433 | // Add the labels, and show everything we've added to the dialog |
1334 | gtk_container_add (GTK_CONTAINER (content_area), notification); | 1434 | gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification)); |
1335 | // gtk_container_add (GTK_CONTAINER (content_area), caller_name); | 1435 | // gtk_container_add (GTK_CONTAINER (content_area), caller_name); |
1336 | gtk_widget_show_all (dialog); | 1436 | gtk_widget_show_all (GTK_WIDGET(dialog)); |
1337 | 1437 | ||
1338 | switch (gtk_dialog_run (dialog)) | 1438 | switch (gtk_dialog_run (dialog)) |
1339 | { | 1439 | { |
@@ -1342,19 +1442,19 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, | |||
1342 | do_status (""); | 1442 | do_status (""); |
1343 | add_contact (gtk_entry_get_text (nameEntry), | 1443 | add_contact (gtk_entry_get_text (nameEntry), |
1344 | gtk_entry_get_text (addressEntry)); | 1444 | gtk_entry_get_text (addressEntry)); |
1345 | gtk_widget_destroy (dialog); | 1445 | gtk_widget_destroy (GTK_WIDGET(dialog)); |
1346 | break; | 1446 | break; |
1347 | case GTK_RESPONSE_CANCEL: | 1447 | case GTK_RESPONSE_CANCEL: |
1348 | FPRINTF (stderr, "cancel clicked"); | 1448 | FPRINTF (stderr, "cancel clicked"); |
1349 | do_status (""); | 1449 | do_status (""); |
1350 | gtk_widget_destroy (dialog); | 1450 | gtk_widget_destroy (GTK_WIDGET(dialog)); |
1351 | break; | 1451 | break; |
1352 | case GTK_RESPONSE_OK: | 1452 | case GTK_RESPONSE_OK: |
1353 | //use_current_incoming_address(); | 1453 | //use_current_incoming_address(); |
1354 | gtk_entry_set_text (addressEntry, callerName); | 1454 | gtk_entry_set_text (GTK_ENTRY(addressEntry), callerName); |
1355 | add_contact (gtk_entry_get_text (nameEntry), callerName); | 1455 | add_contact (gtk_entry_get_text (nameEntry), callerName); |
1356 | // add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1)); | 1456 | // add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1)); |
1357 | gtk_widget_destroy (dialog); | 1457 | gtk_widget_destroy (GTK_WIDGET(dialog)); |
1358 | 1458 | ||
1359 | // memmove(&address+1,&address+51,1); | 1459 | // memmove(&address+1,&address+51,1); |
1360 | break; | 1460 | break; |
@@ -1372,65 +1472,6 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button, | |||
1372 | } | 1472 | } |
1373 | 1473 | ||
1374 | 1474 | ||
1375 | /* | ||
1376 | * Function to open a dialog box displaying the message provided. | ||
1377 | * | ||
1378 | * @param message message in the dialogbox | ||
1379 | * @param caller_id | ||
1380 | */ | ||
1381 | |||
1382 | void | ||
1383 | quick_message (gchar * message, const char *caller_id) | ||
1384 | { | ||
1385 | GtkWidget *caller_name, *notification, *content_area; | ||
1386 | GtkDialog *dialog; | ||
1387 | GtkWindow *main_window; | ||
1388 | main_window = get_object("GNUNET_GTK_conversation_window"); | ||
1389 | // Create the widgets | ||
1390 | |||
1391 | |||
1392 | dialog = gtk_dialog_new_with_buttons ("Incoming call!", | ||
1393 | main_window, | ||
1394 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
1395 | _("Accept call"), | ||
1396 | GTK_RESPONSE_ACCEPT, | ||
1397 | _("Reject call"), | ||
1398 | GTK_RESPONSE_REJECT, | ||
1399 | _("Decide later"), | ||
1400 | GTK_RESPONSE_CANCEL, | ||
1401 | |||
1402 | NULL); | ||
1403 | content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); | ||
1404 | |||
1405 | |||
1406 | notification = gtk_label_new ("Incoming call from:"); | ||
1407 | caller_name = gtk_label_new (caller_id); | ||
1408 | |||
1409 | // Add the labels, and show everything we've added to the dialog | ||
1410 | gtk_container_add (GTK_CONTAINER (content_area), notification); | ||
1411 | gtk_container_add (GTK_CONTAINER (content_area), caller_name); | ||
1412 | gtk_widget_show_all (dialog); | ||
1413 | |||
1414 | switch(gtk_dialog_run(dialog)){ | ||
1415 | case GTK_RESPONSE_ACCEPT : | ||
1416 | do_status(""); | ||
1417 | gtk_widget_destroy(dialog); | ||
1418 | do_accept("0"); | ||
1419 | break; | ||
1420 | case GTK_RESPONSE_REJECT : | ||
1421 | do_reject(NULL); | ||
1422 | do_status(""); | ||
1423 | gtk_widget_destroy(dialog); | ||
1424 | break; | ||
1425 | case GTK_RESPONSE_CANCEL : | ||
1426 | do_status(""); | ||
1427 | gtk_widget_destroy(dialog); | ||
1428 | break; | ||
1429 | } | ||
1430 | |||
1431 | |||
1432 | } | ||
1433 | |||
1434 | /* | 1475 | /* |
1435 | * row activated | 1476 | * row activated |
1436 | * @return void | 1477 | * @return void |
@@ -1439,8 +1480,8 @@ quick_message (gchar * message, const char *caller_id) | |||
1439 | void | 1480 | void |
1440 | GNUNET_CONVERSATION_GTK_row_activated () | 1481 | GNUNET_CONVERSATION_GTK_row_activated () |
1441 | { | 1482 | { |
1442 | char *callAddress; | 1483 | gchar *callAddress; |
1443 | char *type; | 1484 | gchar *type; |
1444 | 1485 | ||
1445 | FPRINTF (stderr, "row activated \n"); | 1486 | FPRINTF (stderr, "row activated \n"); |
1446 | 1487 | ||
diff --git a/src/conversation/gnunet-conversation-gtk.h b/src/conversation/gnunet-conversation-gtk.h index 8e75a8ae..112a05a7 100644 --- a/src/conversation/gnunet-conversation-gtk.h +++ b/src/conversation/gnunet-conversation-gtk.h | |||
@@ -63,12 +63,12 @@ static int tray_only; | |||
63 | /** | 63 | /** |
64 | * Head of operations. | 64 | * Head of operations. |
65 | */ | 65 | */ |
66 | static struct OperationContext *oc_head; | 66 | //static struct OperationContext *oc_head; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Tail of operations. | 69 | * Tail of operations. |
70 | */ | 70 | */ |
71 | static struct OperationContext *oc_tail; | 71 | //static struct OperationContext *oc_tail; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Possible states of the phone. | 74 | * Possible states of the phone. |
@@ -188,7 +188,7 @@ static struct CallList *cl_tail; | |||
188 | * Desired phone line. | 188 | * Desired phone line. |
189 | */ | 189 | */ |
190 | static unsigned int line; | 190 | static unsigned int line; |
191 | static unsigned int line1; | 191 | //static unsigned int line1; |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Our speaker. | 194 | * Our speaker. |
@@ -204,8 +204,8 @@ static struct GNUNET_MICROPHONE_Handle *mic; | |||
204 | * Our configurations. | 204 | * Our configurations. |
205 | */ | 205 | */ |
206 | static struct GNUNET_CONFIGURATION_Handle *cfg; | 206 | static struct GNUNET_CONFIGURATION_Handle *cfg; |
207 | static struct GNUNET_CONFIGURATION_Handle *cfg1; | 207 | //static struct GNUNET_CONFIGURATION_Handle *cfg1; |
208 | static struct GNUNET_CONFIGURATION_Handle *cfg2; | 208 | //static struct GNUNET_CONFIGURATION_Handle *cfg2; |
209 | 209 | ||
210 | 210 | ||
211 | /** | 211 | /** |