Mercurial > pidgin
comparison finch/libgnt/gntbindable.c @ 17932:15988e2bd270
Mostly whitespace changes.
Look for the rebinding-window in the class, instead of going over to the
field and asking everyone about it.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 08 Jun 2007 05:43:29 +0000 |
parents | 3ee6ea8a66f8 |
children | d7cd0afd3c36 |
comparison
equal
deleted
inserted
replaced
17931:3ee6ea8a66f8 | 17932:15988e2bd270 |
---|---|
63 | 63 |
64 static gboolean | 64 static gboolean |
65 gnt_bindable_rebinding_rebind(GntBindable *bindable, gpointer data) | 65 gnt_bindable_rebinding_rebind(GntBindable *bindable, gpointer data) |
66 { | 66 { |
67 | 67 |
68 if(rebind_info.keys){ | 68 if(rebind_info.keys) { |
69 gnt_bindable_register_binding(rebind_info.klass, | 69 gnt_bindable_register_binding(rebind_info.klass, |
70 NULL, | 70 NULL, |
71 rebind_info.okeys, | 71 rebind_info.okeys, |
72 rebind_info.params); | 72 rebind_info.params); |
73 gnt_bindable_register_binding(rebind_info.klass, | 73 gnt_bindable_register_binding(rebind_info.klass, |
74 rebind_info.name, | 74 rebind_info.name, |
75 rebind_info.keys, | 75 rebind_info.keys, |
76 rebind_info.params); | 76 rebind_info.params); |
77 } | 77 } |
78 gnt_bindable_free_rebind_info(); | 78 gnt_bindable_free_rebind_info(); |
79 | 79 |
80 gnt_widget_destroy(GNT_WIDGET(data)); | 80 gnt_widget_destroy(GNT_WIDGET(data)); |
81 | 81 |
187 gnt_widget_show(win); | 187 gnt_widget_show(win); |
188 | 188 |
189 } | 189 } |
190 | 190 |
191 typedef struct { | 191 typedef struct { |
192 GHashTable *hash; | 192 GHashTable *hash; |
193 GntTree *tree; | 193 GntTree *tree; |
194 } BindingView; | 194 } BindingView; |
195 | 195 |
196 static void | 196 static void |
197 add_binding(gpointer key, gpointer value, gpointer data) | 197 add_binding(gpointer key, gpointer value, gpointer data) |
198 { | 198 { |
209 } | 209 } |
210 | 210 |
211 static void | 211 static void |
212 add_action(gpointer key, gpointer value, gpointer data) | 212 add_action(gpointer key, gpointer value, gpointer data) |
213 { | 213 { |
214 BindingView *bv = data; | 214 BindingView *bv = data; |
215 g_hash_table_insert(bv->hash, value, key); | 215 g_hash_table_insert(bv->hash, value, key); |
216 } | 216 } |
217 | 217 |
218 | |
219 | |
220 | |
221 static void | 218 static void |
222 gnt_bindable_class_init(GntBindableClass *klass) | 219 gnt_bindable_class_init(GntBindableClass *klass) |
223 { | 220 { |
224 parent_class = g_type_class_peek_parent(klass); | 221 parent_class = g_type_class_peek_parent(klass); |
225 | 222 |
460 g_hash_table_destroy(hash); | 457 g_hash_table_destroy(hash); |
461 | 458 |
462 return tree; | 459 return tree; |
463 } | 460 } |
464 | 461 |
462 static void | |
463 reset_binding_window(GntBindableClass *klass) | |
464 { | |
465 klass->help_window = NULL; | |
466 } | |
467 | |
465 gboolean | 468 gboolean |
466 gnt_bindable_build_help_window(GntBindable *bindable) | 469 gnt_bindable_build_help_window(GntBindable *bindable) |
467 { | 470 { |
468 | 471 |
469 GntWidget *tree; | 472 GntWidget *tree; |
470 GntBindableClass *klass = GNT_BINDABLE_GET_CLASS(bindable); | 473 GntBindableClass *klass = GNT_BINDABLE_GET_CLASS(bindable); |
471 char *title; | 474 char *title; |
472 | 475 |
473 tree = GNT_WIDGET(gnt_bindable_bindings_view(bindable)); | 476 tree = GNT_WIDGET(gnt_bindable_bindings_view(bindable)); |
474 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(gnt_bindable_rebinding_activate), bindable); | 477 |
475 | |
476 klass->help_window = GNT_BINDABLE(gnt_window_new()); | 478 klass->help_window = GNT_BINDABLE(gnt_window_new()); |
477 title = g_strdup_printf("Bindings for %s", g_type_name(G_OBJECT_TYPE(bindable))); | 479 title = g_strdup_printf("Bindings for %s", g_type_name(G_OBJECT_TYPE(bindable))); |
478 gnt_box_set_title(GNT_BOX(klass->help_window), title); | 480 gnt_box_set_title(GNT_BOX(klass->help_window), title); |
479 if (tree) | 481 if (tree) { |
482 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(gnt_bindable_rebinding_activate), bindable); | |
480 gnt_box_add_widget(GNT_BOX(klass->help_window), tree); | 483 gnt_box_add_widget(GNT_BOX(klass->help_window), tree); |
481 else | 484 } else |
482 gnt_box_add_widget(GNT_BOX(klass->help_window), gnt_label_new("This widget has no customizable bindings.")); | 485 gnt_box_add_widget(GNT_BOX(klass->help_window), gnt_label_new("This widget has no customizable bindings.")); |
483 | 486 |
487 g_signal_connect(G_OBJECT(klass->help_window), "destroy", G_CALLBACK(reset_binding_window), klass); | |
484 gnt_widget_show(GNT_WIDGET(klass->help_window)); | 488 gnt_widget_show(GNT_WIDGET(klass->help_window)); |
489 g_free(title); | |
485 | 490 |
486 return TRUE; | 491 return TRUE; |
487 | 492 } |
488 } | 493 |
489 | |
490 |