1862 |
/***** Mimes to skip during a scan ************************************/ |
/***** Mimes to skip during a scan ************************************/ |
1863 |
/**********************************************************************/ |
/**********************************************************************/ |
1864 |
|
|
|
/* gboolean */ |
|
|
/* ess_extensions_traverse (gpointer key, gpointer value, gpointer data) */ |
|
|
/* { */ |
|
|
/* gint state = GPOINTER_TO_INT (value); */ |
|
|
/* gint i; */ |
|
|
/* gchar *tmp[2] = { "", "" }; */ |
|
|
|
|
|
/* tmp[1] = key; */ |
|
|
|
|
|
/* i = gtk_clist_append (GTK_CLIST (ess_include_list_box), (gchar **) tmp); */ |
|
|
/* if (state) */ |
|
|
/* gtk_clist_set_pixmap (GTK_CLIST (ess_include_list_box), i, 0, */ |
|
|
/* on_pix, state_mask); */ |
|
|
/* else */ |
|
|
/* gtk_clist_set_pixmap (GTK_CLIST (ess_include_list_box), i, 0, */ |
|
|
/* off_pix, state_mask); */ |
|
|
/* gtk_clist_unselect_row (GTK_CLIST (ess_include_list_box), i, 0); */ |
|
|
/* gtk_clist_set_row_data (GTK_CLIST (ess_include_list_box), i, key); */ |
|
|
/* return (FALSE); */ |
|
|
/* } */ |
|
|
|
|
1865 |
gint |
gint |
1866 |
ess_tree_printf (gpointer key, gpointer value, gpointer data) |
ess_tree_printf (gpointer key, gpointer value, gpointer data) |
1867 |
{ |
{ |
1892 |
} |
} |
1893 |
|
|
1894 |
//! This function compares the mime types |
//! This function compares the mime types |
1895 |
/*! |
/*! \return 0 or 1 |
|
\return 0 or 1 |
|
1896 |
*/ |
*/ |
1897 |
gint find_mime_type(mime_type_to_skip_t* el1, |
gint find_mime_type(mime_type_to_skip_t* el1, |
1898 |
mime_type_to_skip_t* el2) |
mime_type_to_skip_t* el2) |
1907 |
} |
} |
1908 |
|
|
1909 |
|
|
|
// WK : to modify |
|
1910 |
void |
void |
1911 |
ess_add_type_ok_clicked (GtkWidget * w, gpointer data) |
ess_add_type_ok_clicked (GtkWidget * w, gpointer data) |
1912 |
{ |
{ |
1916 |
GtkTreeView *treeview=(GtkTreeView *)ess_include_list_box; |
GtkTreeView *treeview=(GtkTreeView *)ess_include_list_box; |
1917 |
GtkTreeModel *model=gtk_tree_view_get_model (treeview); |
GtkTreeModel *model=gtk_tree_view_get_model (treeview); |
1918 |
|
|
|
//GtkTreeModel *model = (GtkTreeModel *)data; |
|
|
|
|
1919 |
temp_extension=(mime_type_to_skip_t*)g_new(mime_type_to_skip_t*,1); |
temp_extension=(mime_type_to_skip_t*)g_new(mime_type_to_skip_t*,1); |
1920 |
|
|
1921 |
temp_extension->mime_type = |
temp_extension->mime_type = |
2088 |
|
|
2089 |
} |
} |
2090 |
|
|
|
// WK |
|
|
/* void */ |
|
|
/* ess_include_selection_made (GtkWidget * clist, gint row, gint column, */ |
|
|
/* GdkEventButton * event, gpointer data) */ |
|
|
/* { */ |
|
|
/* gchar *clrow_data; */ |
|
|
/* gint state; */ |
|
|
/* gpointer *ptrtmp; */ |
|
|
|
|
|
/* ess_selected_row = row; */ |
|
|
/* clrow_data = gtk_clist_get_row_data (GTK_CLIST (ess_include_list_box), row); */ |
|
|
/* ess_selected_extension = clrow_data; */ |
|
|
|
|
|
/* if (event != NULL && event->button == 1 && event->type == GDK_2BUTTON_PRESS) */ |
|
|
/* { */ |
|
|
/* ptrtmp = g_tree_lookup (local_ess_extensions, clrow_data); */ |
|
|
/* state = GPOINTER_TO_INT (ptrtmp); */ |
|
|
/* if (state) */ |
|
|
/* { */ |
|
|
/* g_tree_insert (local_ess_extensions, clrow_data, */ |
|
|
/* GINT_TO_POINTER (0)); */ |
|
|
/* gtk_clist_set_pixmap (GTK_CLIST (ess_include_list_box), row, 0, */ |
|
|
/* off_pix, state_mask); */ |
|
|
/* } */ |
|
|
/* else */ |
|
|
/* { */ |
|
|
/* g_tree_insert (local_ess_extensions, clrow_data, */ |
|
|
/* GINT_TO_POINTER (1)); */ |
|
|
/* gtk_clist_set_pixmap (GTK_CLIST (ess_include_list_box), row, 0, */ |
|
|
/* on_pix, state_mask); */ |
|
|
/* } */ |
|
|
/* } */ |
|
|
/* } */ |
|
|
|
|
|
/* void */ |
|
|
/* ess_include_unselection_made (GtkWidget * clist, gint row, gint column, */ |
|
|
/* GdkEventButton * event, gpointer data) */ |
|
|
/* { */ |
|
|
/* ess_selected_extension = NULL; */ |
|
|
/* ess_selected_row = -1; */ |
|
|
/* gtk_widget_set_sensitive (GTK_WIDGET (ess_button_del), FALSE); */ |
|
|
/* } */ |
|
|
|
|
2091 |
static void mime_type_to_skip_selection_changed(GtkTreeSelection *selection, |
static void mime_type_to_skip_selection_changed(GtkTreeSelection *selection, |
2092 |
gpointer data) |
gpointer data) |
2093 |
{ |
{ |
2701 |
tmp=(mime_type_to_skip_t *)item->data; |
tmp=(mime_type_to_skip_t *)item->data; |
2702 |
g_print ("adding %s\n",tmp->mime_type); |
g_print ("adding %s\n",tmp->mime_type); |
2703 |
ess_tree_printf(tmp->mime_type, GINT_TO_POINTER(tmp->state), f); |
ess_tree_printf(tmp->mime_type, GINT_TO_POINTER(tmp->state), f); |
2704 |
|
g_print("state=%d\n",tmp->state); |
2705 |
item=g_list_next(item); |
item=g_list_next(item); |
2706 |
} |
} |
2707 |
|
|
3173 |
return GTK_TREE_MODEL (store); |
return GTK_TREE_MODEL (store); |
3174 |
} |
} |
3175 |
|
|
3176 |
|
// Change the state in the treeView and in the Glist |
3177 |
|
// wk: lwh |
3178 |
static void |
static void |
3179 |
mime_types_to_skip_state_toggled (GtkCellRendererToggle *cell, |
mime_types_to_skip_state_toggled (GtkCellRendererToggle *cell, |
3180 |
gchar *path_str, |
gchar *path_str, |
3184 |
GtkTreeIter iter; |
GtkTreeIter iter; |
3185 |
GtkTreePath *path = gtk_tree_path_new_from_string (path_str); |
GtkTreePath *path = gtk_tree_path_new_from_string (path_str); |
3186 |
gboolean state; |
gboolean state; |
3187 |
|
gchar *mime_type; |
3188 |
|
mime_type_to_skip_t *tmp; |
3189 |
|
gboolean done; |
3190 |
|
|
3191 |
|
GList* item; |
3192 |
|
|
3193 |
// get toggled iter |
// get toggled iter |
3194 |
gtk_tree_model_get_iter (model, &iter, path); |
gtk_tree_model_get_iter (model, &iter, path); |
3195 |
gtk_tree_model_get (model, &iter, MIME_TYPES_TO_SKIP_COLUMN_STATE, &state, -1); |
gtk_tree_model_get (model, &iter, MIME_TYPES_TO_SKIP_COLUMN_STATE, &state, -1); |
3196 |
|
gtk_tree_model_get (model, &iter, MIME_TYPES_TO_SKIP_COLUMN_MIME_TYPE, &mime_type, -1); |
3197 |
|
|
|
// do something with the value |
|
3198 |
state ^= 1; |
state ^= 1; |
3199 |
|
|
3200 |
// set new value |
// set new value |
3201 |
gtk_list_store_set (GTK_LIST_STORE (model), &iter, MIME_TYPES_TO_SKIP_COLUMN_STATE, state, -1); |
gtk_list_store_set (GTK_LIST_STORE (model), &iter, MIME_TYPES_TO_SKIP_COLUMN_STATE, state, -1); |
3202 |
|
|
3203 |
//update the glist |
//update the glist |
3204 |
//my_config->mime_to_skip_during_a_scan |
done=0; |
3205 |
|
item=g_list_first(my_config->mime_to_skip_during_a_scan); |
3206 |
|
while (item && !done) |
3207 |
|
{ |
3208 |
|
tmp=(mime_type_to_skip_t *)item->data; |
3209 |
|
if (!strcmp(tmp->mime_type,mime_type)) |
3210 |
|
{ |
3211 |
|
tmp->state=state; |
3212 |
|
done=1; |
3213 |
|
g_print ("Lets change state for %s",tmp->mime_type); |
3214 |
|
} |
3215 |
|
item=g_list_next(item); |
3216 |
|
} |
3217 |
|
|
3218 |
// clean up |
// clean up |
3219 |
gtk_tree_path_free (path); |
gtk_tree_path_free (path); |
4477 |
(scrolled_window), main_box); |
(scrolled_window), main_box); |
4478 |
gtk_widget_show (main_box); |
gtk_widget_show (main_box); |
4479 |
|
|
|
|
|
|
|
|
4480 |
/* The info plugin list */ |
/* The info plugin list */ |
4481 |
scrolled_window = gtk_scrolled_window_new (NULL, NULL); |
scrolled_window = gtk_scrolled_window_new (NULL, NULL); |
4482 |
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), |
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), |
4637 |
/* setup box to associate icons to file extensions */ |
/* setup box to associate icons to file extensions */ |
4638 |
ei_include_list_box = gtk_clist_new_with_titles (3, eititles); |
ei_include_list_box = gtk_clist_new_with_titles (3, eititles); |
4639 |
gtk_clist_set_shadow_type (GTK_CLIST (ei_include_list_box), GTK_SHADOW_OUT); |
gtk_clist_set_shadow_type (GTK_CLIST (ei_include_list_box), GTK_SHADOW_OUT); |
4640 |
/* |
|
|
gtk_clist_set_column_width (GTK_CLIST (ei_include_list_box), 0, 25); |
|
|
gtk_clist_set_column_width (GTK_CLIST (ei_include_list_box), 1, 200); |
|
|
*/ |
|
4641 |
gtk_clist_set_column_justification (GTK_CLIST |
gtk_clist_set_column_justification (GTK_CLIST |
4642 |
(ei_include_list_box), 0, |
(ei_include_list_box), 0, |
4643 |
GTK_JUSTIFY_CENTER); |
GTK_JUSTIFY_CENTER); |
4644 |
/* gtk_clist_set_column_auto_resize (GTK_CLIST (ei_include_list_box), 2, TRUE); |
|
|
*/ |
|
4645 |
gtk_clist_set_compare_func (GTK_CLIST (ei_include_list_box), |
gtk_clist_set_compare_func (GTK_CLIST (ei_include_list_box), |
4646 |
_ei_clist_g_strcasecmp); |
_ei_clist_g_strcasecmp); |
4647 |
gtk_clist_set_sort_column (GTK_CLIST (ei_include_list_box), 1); |
gtk_clist_set_sort_column (GTK_CLIST (ei_include_list_box), 1); |