|
|
|
|
@ -586,7 +586,8 @@ int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find){
|
|
|
|
|
} return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _yon_gtk_column_minimal_fixed_size_set(GtkTreeViewColumn *column){
|
|
|
|
|
gboolean _yon_gtk_column_minimal_fixed_size_set(GtkTreeViewColumn *column){
|
|
|
|
|
g_return_val_if_fail(GTK_IS_TREE_VIEW_COLUMN(column),0);
|
|
|
|
|
const gchar *title = gtk_tree_view_column_get_title(column);
|
|
|
|
|
GtkWidget *label = gtk_label_new(title);
|
|
|
|
|
int header_width = 0;
|
|
|
|
|
@ -594,7 +595,6 @@ void _yon_gtk_column_minimal_fixed_size_set(GtkTreeViewColumn *column){
|
|
|
|
|
|
|
|
|
|
if (layout != NULL) {
|
|
|
|
|
pango_layout_get_pixel_size(layout, &header_width, NULL);
|
|
|
|
|
g_object_unref(layout);
|
|
|
|
|
}
|
|
|
|
|
if (GTK_IS_WIDGET(label)) {
|
|
|
|
|
g_object_ref_sink(label);
|
|
|
|
|
@ -602,13 +602,19 @@ void _yon_gtk_column_minimal_fixed_size_set(GtkTreeViewColumn *column){
|
|
|
|
|
|
|
|
|
|
gtk_tree_view_column_set_min_width(column, header_width+10);
|
|
|
|
|
g_object_unref(label);
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_tree_view_column_minimal_fixed_size_set(GtkTreeViewColumn *column){
|
|
|
|
|
_yon_gtk_column_minimal_fixed_size_set(column);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _yon_gtk_tree_view_minimal_fixed_size_set_full(GtkTreeView *tree){
|
|
|
|
|
GList *list = gtk_tree_view_get_columns(tree);
|
|
|
|
|
for (int i=0;i<g_list_length(list);i++){
|
|
|
|
|
_yon_gtk_column_minimal_fixed_size_set((GtkTreeViewColumn*)g_list_nth_data(list,i));
|
|
|
|
|
gdk_threads_add_idle((GSourceFunc)_yon_gtk_column_minimal_fixed_size_set,(GtkTreeViewColumn*)g_list_nth_data(list,i));
|
|
|
|
|
}
|
|
|
|
|
g_list_free(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_tree_view_minimal_fixed_size_set_full(GtkTreeView *tree){
|
|
|
|
|
@ -1214,6 +1220,32 @@ void yon_on_text_insert_only_digits(GtkEditable *editable, const gchar *text, gi
|
|
|
|
|
g_free(new_text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_on_insert_restricted_check(GtkEditable *editable, const gchar *text, gint length, gint *position, gpointer){
|
|
|
|
|
gchar *new_text = g_new(gchar, length + 1);
|
|
|
|
|
gint i, j = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
|
if (text[i]!='!'&&text[i]!='@'&&text[i]!='#'&&text[i]!='%'&&text[i]!='^'&&text[i]!='&'&&text[i]!='*'&&text[i]!='\"'&&text[i]!='\'') {
|
|
|
|
|
new_text[j] = text[i];
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (j < length) {
|
|
|
|
|
g_signal_handlers_block_by_func(editable, G_CALLBACK(yon_on_insert_restricted_check), NULL);
|
|
|
|
|
gtk_editable_insert_text(editable, new_text, j, position);
|
|
|
|
|
g_signal_handlers_unblock_by_func(editable, G_CALLBACK(yon_on_insert_restricted_check), NULL);
|
|
|
|
|
g_signal_stop_emission_by_name(editable, "insert-text");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free(new_text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_entry_block_restricted_symbols(GtkEntry *target){
|
|
|
|
|
g_return_if_fail(GTK_IS_ENTRY(target));
|
|
|
|
|
g_signal_connect(G_OBJECT(target),"insert-text",G_CALLBACK(yon_on_insert_restricted_check),NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GtkEntry section
|
|
|
|
|
// struct entry_pattern_data {
|
|
|
|
|
// GtkEntry *entry;
|
|
|
|
|
@ -1461,4 +1493,45 @@ config_str yon_resource_open_file(const char *path, int *size){
|
|
|
|
|
parsed = yon_char_parse(modules,size,"\n");
|
|
|
|
|
return parsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// dictionary *__yon_config_listeners = NULL;
|
|
|
|
|
// typedef struct {
|
|
|
|
|
// GtkWidget *target;
|
|
|
|
|
// char *widget_parameter;
|
|
|
|
|
// void *check_function;
|
|
|
|
|
// char *parameter;
|
|
|
|
|
// char *save_command;
|
|
|
|
|
// } config_listener;
|
|
|
|
|
|
|
|
|
|
// void __yon_gtk_config_activated(GtkWidget *, config_listener *current){
|
|
|
|
|
// char *parameter;
|
|
|
|
|
|
|
|
|
|
// if (((int (*)(char*, GtkWidget*, char*))(current->check_function))(parameter,current->target, current->parameter)) {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// int yon_gtk_config_add_listener (GtkWidget *target, char *parameter, char *save_command,int(check_function)(char*,GtkWidget*,char*)){
|
|
|
|
|
// if (__yon_config_listeners){
|
|
|
|
|
// dictionary *dict;
|
|
|
|
|
// for_dictionaries(dict,__yon_config_listeners){
|
|
|
|
|
// if (target==((config_listener*)dict->data)->target){
|
|
|
|
|
// return 0;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// config_listener *current = malloc(sizeof(config_listener));
|
|
|
|
|
// current->target=target;
|
|
|
|
|
// current->parameter = parameter;
|
|
|
|
|
// current->save_command = save_command;
|
|
|
|
|
// current->check_function = (void*)check_function;
|
|
|
|
|
// if (GTK_IS_TOGGLE_BUTTON(target)){
|
|
|
|
|
// g_signal_connect(G_OBJECT(target),"toggled",C_CALLBACK(__yon_gtk_config_activated),current);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// yon_dictionary_add_or_create_if_exists_with_data(__yon_config_listeners,NULL,current);
|
|
|
|
|
// return 0;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
#endif
|