finch/libgnt/gntwm.c

branch
soc.2007.finchfeat
changeset 17590
b6e8c396671a
parent 17589
193d380e5261
child 17591
9496232d1cf0
equal deleted inserted replaced
17589:193d380e5261 17590:b6e8c396671a
1014 g_free(text); 1014 g_free(text);
1015 return TRUE; 1015 return TRUE;
1016 } 1016 }
1017 1017
1018 static gboolean 1018 static gboolean
1019 ignore_keys_start(GntBindable *bindable, GList *n){ 1019 ignore_keys_start(GntBindable *bindable, GList *n)
1020 {
1020 GntWM *wm = GNT_WM(bindable); 1021 GntWM *wm = GNT_WM(bindable);
1021 1022
1022 if(!wm->menu && !wm->_list.window && wm->mode == GNT_KP_MODE_NORMAL){ 1023 if(!wm->menu && !wm->_list.window && wm->mode == GNT_KP_MODE_NORMAL){
1023 ignore_keys = TRUE; 1024 ignore_keys = TRUE;
1024 return TRUE; 1025 return TRUE;
1025 } 1026 }
1026 return FALSE; 1027 return FALSE;
1027 } 1028 }
1028 1029
1029 static gboolean 1030 static gboolean
1030 ignore_keys_end(GntBindable *bindable, GList *n){ 1031 ignore_keys_end(GntBindable *bindable, GList *n)
1032 {
1031 return ignore_keys ? !(ignore_keys = FALSE) : FALSE; 1033 return ignore_keys ? !(ignore_keys = FALSE) : FALSE;
1032 } 1034 }
1033 1035
1034 static GntBox *
1035 check_for_window_exist(GntWM *wm, const char *title)
1036 {
1037 GList *iter;
1038 for(iter = wm->list;iter;iter = iter->next){
1039 GntBox *box = GNT_BOX(iter->data);
1040 if(!strcmp(box->title,title))
1041 return box;
1042 }
1043 return NULL;
1044 }
1045
1046 static gboolean 1036 static gboolean
1047 help_for_bindable(GntWM *wm, GntBindable *bindable) 1037 help_for_bindable(GntWM *wm, GntBindable *bindable)
1048 { 1038 {
1049 GntBox *box;
1050 char * title;
1051 gboolean ret = TRUE; 1039 gboolean ret = TRUE;
1040 GntBindableClass *klass = GNT_BINDABLE_GET_CLASS(bindable);
1052 1041
1053 title = g_strdup_printf("Bindings for %s",g_type_name(G_OBJECT_TYPE(bindable))); 1042 if (klass->help_window) {
1054 1043 gnt_wm_raise_window(wm, GNT_WIDGET(klass->help_window));
1055 if((box = check_for_window_exist(wm,title))){ 1044 } else {
1056 gnt_wm_raise_window(wm,GNT_WIDGET(box));
1057 }
1058 else{
1059 ret = gnt_bindable_build_help_window(bindable); 1045 ret = gnt_bindable_build_help_window(bindable);
1060 } 1046 }
1061 g_free(title);
1062 return ret; 1047 return ret;
1063 1048
1064 } 1049 }
1065 1050
1066 static gboolean 1051 static gboolean
1080 1065
1081 widget = wm->ordered->data; 1066 widget = wm->ordered->data;
1082 if (!GNT_IS_BOX(widget)) 1067 if (!GNT_IS_BOX(widget))
1083 return TRUE; 1068 return TRUE;
1084 1069
1085 return help_for_bindable(wm,GNT_BINDABLE(GNT_BOX(widget)->active)); 1070 return help_for_bindable(wm, GNT_BINDABLE(GNT_BOX(widget)->active));
1086 1071
1087 } 1072 }
1088 1073
1089 static void 1074 static void
1090 gnt_wm_class_init(GntWMClass *klass) 1075 gnt_wm_class_init(GntWMClass *klass)

mercurial