void dt_accel_connect_iop(dt_iop_module_t *module, const gchar *path, GClosure *closure) { dt_accel_t *accel = NULL; gchar accel_path[256]; dt_accel_path_iop(accel_path, 256, module->op, path); // Looking up the entry in the global accelerators list accel = _lookup_accel(accel_path); accel->closure = closure; if(accel && accel->local) { // Local accelerators don't actually get connected, just added to the list // They will be connected if/when the module gains focus _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, accel_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } }
void dt_accel_connect_slider_iop(dt_iop_module_t *module, const gchar *path, GtkWidget *slider) { // just make this callback safe for bauhaus sliders for now: // TODO: implement it for these widgets, too! // (we check for their inheritance from gtk drawing area, that's simpler) if(GTK_IS_DRAWING_AREA(slider)) return; gchar increase_path[256]; gchar decrease_path[256]; gchar reset_path[256]; gchar edit_path[256]; dt_accel_t *accel = NULL; GClosure *closure; char *paths[] = {increase_path, decrease_path, reset_path, edit_path}; dt_accel_paths_slider_iop(paths, 256, module->op, path); closure = g_cclosure_new(G_CALLBACK(slider_increase_callback), (gpointer)slider, NULL); accel = _lookup_accel(increase_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, increase_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } closure = g_cclosure_new(G_CALLBACK(slider_decrease_callback), (gpointer)slider, NULL); accel = _lookup_accel(decrease_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, decrease_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } closure = g_cclosure_new(G_CALLBACK(slider_reset_callback), (gpointer)slider, NULL); accel = _lookup_accel(reset_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, reset_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } closure = g_cclosure_new(G_CALLBACK(slider_edit_callback), (gpointer)slider, NULL); accel = _lookup_accel(edit_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, edit_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } }
void dt_accel_connect_slider_iop(dt_iop_module_t *module, const gchar *path, GtkWidget *slider) { gchar increase_path[256]; gchar decrease_path[256]; gchar reset_path[256]; gchar edit_path[256]; dt_accel_t *accel = NULL; GClosure *closure; char *paths[] = {increase_path, decrease_path, reset_path, edit_path}; dt_accel_paths_slider_iop(paths, 256, module->op, path); if (DT_IS_BAUHAUS_WIDGET(slider)) { closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_increase_callback), (gpointer)slider, NULL); } else { closure = g_cclosure_new(G_CALLBACK(slider_increase_callback), (gpointer)slider, NULL); } accel = _lookup_accel(increase_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, increase_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } if (DT_IS_BAUHAUS_WIDGET(slider)) { closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_decrease_callback), (gpointer)slider, NULL); } else { closure = g_cclosure_new(G_CALLBACK(slider_decrease_callback), (gpointer)slider, NULL); } accel = _lookup_accel(decrease_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, decrease_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } if (DT_IS_BAUHAUS_WIDGET(slider)) { closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_reset_callback), (gpointer)slider, NULL); } else { closure = g_cclosure_new(G_CALLBACK(slider_reset_callback), (gpointer)slider, NULL); } accel = _lookup_accel(reset_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, reset_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } if (DT_IS_BAUHAUS_WIDGET(slider)) { closure = g_cclosure_new(G_CALLBACK(bauhaus_slider_edit_callback), (gpointer)slider, NULL); } else { closure = g_cclosure_new(G_CALLBACK(slider_edit_callback), (gpointer)slider, NULL); } accel = _lookup_accel(edit_path); if (accel) accel->closure = closure; if(accel && accel->local) { _connect_local_accel(module, accel); } else { gtk_accel_group_connect_by_path(darktable.control->accelerators, edit_path, closure); module->accel_closures = g_slist_prepend(module->accel_closures, accel); } }