Ejemplo n.º 1
0
void dt_accel_deregister_lib(dt_lib_module_t *module,const gchar *path)
{
  dt_accel_t *accel;
  GSList *l;
  char build_path[1024];
  dt_accel_path_lib(build_path, 1024, module->plugin_name, path);
  l = darktable.control->accelerator_list;
  while(l)
  {
    dt_accel_t *accel = (dt_accel_t*)l->data;
    if(!strncmp(accel->path, build_path, 1024))
    {
      darktable.control->accelerator_list = g_slist_delete_link(darktable.control->accelerator_list, l);
      l = NULL;
    } else {
      l = g_slist_next(l);
    }
  }
  l = module->accel_closures;
  while(l)
  {
    accel = (dt_accel_t*)l->data;
    if(!strncmp(accel->path, build_path, 1024))
    {
      module->accel_closures = g_slist_delete_link(module->accel_closures, l);
      gtk_accel_group_disconnect(darktable.control->accelerators, accel->closure);
      l = NULL;
      free(accel);
    } else {
      l = g_slist_next(l);
    }
  }
}
Ejemplo n.º 2
0
void snippets_set_default (GuSnippets* sc) {
    GError* err = NULL;
    gchar* snip = g_build_filename (GUMMI_DATA, "snippets", "snippets.cfg", NULL);
    GList* current = sc->closure_data;

    /* Remove all accelerator */
    while (current) {
        gtk_accel_group_disconnect (sc->accel_group,
                TUPLE2 (current->data)->second);
        slog (L_DEBUG, "Accelerator for `%s' disconnected\n",
                TUPLE2 (current->data)->first);
        current = g_list_next (current);
    }
    g_list_free (sc->closure_data);
    sc->closure_data = NULL;

    if (!utils_copy_file (snip, sc->filename, &err)) {
        slog (L_G_ERROR, "can't open snippets file for writing, snippets may "
                "not work properly\n");
        g_error_free (err);
    } else {
        snippets_load (sc);
    }
    g_free (snip);
}
Ejemplo n.º 3
0
void dt_accel_disconnect_list(GSList *list)
{
  dt_accel_t *accel;
  while(list)
  {
    accel = (dt_accel_t*)list->data;
    gtk_accel_group_disconnect(darktable.control->accelerators, accel->closure);
    list = g_slist_delete_link(list, list);
  }
}
Ejemplo n.º 4
0
void dt_accel_deregister_iop(dt_iop_module_t *module,const gchar *path)
{
  GSList *l = module->accel_closures_local;
  char build_path[1024];
  dt_accel_path_iop(build_path, 1024, module->op, path);
  while(l)
  {
    dt_accel_t *accel = (dt_accel_t*)l->data;
    if(!strncmp(accel->path, build_path, 1024))
    {
      module->accel_closures_local = g_slist_delete_link(module->accel_closures_local, l);
      l = NULL;
      free(accel);
    }
    else
    {
      l = g_slist_next(l);
    }
  }
  l = darktable.control->accelerator_list;
  while(l)
  {
    dt_accel_t *accel = (dt_accel_t*)l->data;
    if(!strncmp(accel->path, build_path, 1024))
    {
      darktable.control->accelerator_list = g_slist_delete_link(darktable.control->accelerator_list, l);
      l = NULL;
      free(accel);
    }
    else
    {
      l = g_slist_next(l);
    }
  }
  l = module->accel_closures;
  while(l)
  {
    dt_accel_t *accel = (dt_accel_t*)l->data;
    if(!strncmp(accel->path, build_path, 1024))
    {
      if(!accel->local || !module->local_closures_connected)
        gtk_accel_group_disconnect(darktable.control->accelerators, accel->closure);
      module->accel_closures = g_slist_delete_link(module->accel_closures, l);
      l = NULL;
      free(accel);
    }
    else
    {
      l = g_slist_next(l);
    }
  }
}
Ejemplo n.º 5
0
void dt_accel_cleanup_locals_iop(dt_iop_module_t *module)
{
  dt_accel_t *accel;
  GSList *l = module->accel_closures_local;
  while(l)
  {
    accel = (dt_accel_t*)l->data;
    if(module->local_closures_connected)
      gtk_accel_group_disconnect(darktable.control->accelerators,
                                 accel->closure);
    l = g_slist_delete_link(l, l);
  }
  module->accel_closures_local = NULL;
}
Ejemplo n.º 6
0
void remove_shortcuts(void)
{
	gint i = 0;

	if(macros == NULL)
		return;

	while(macros[i].shortcut != NULL)
	{
		gtk_accel_group_disconnect(shortcuts, macros[i].closure);
		i++;
	}

	macros_destroy();
}
Ejemplo n.º 7
0
/**
 * gtk_action_disconnect_accelerator:
 * @action: a #GtkAction
 * 
 * Undoes the effect of one call to gtk_action_connect_accelerator().
 *
 * Since: 2.4
 **/
void 
gtk_action_disconnect_accelerator (GtkAction *action)
{
  g_return_if_fail (GTK_IS_ACTION (action));

  if (!action->private_data->accel_quark ||
      !action->private_data->accel_group)
    return;

  action->private_data->accel_count--;

  if (action->private_data->accel_count == 0)
    gtk_accel_group_disconnect (action->private_data->accel_group,
				action->private_data->accel_closure);
}
Ejemplo n.º 8
0
void dt_accel_disconnect_locals_iop(dt_iop_module_t *module)
{
  dt_accel_t *accel;
  GSList *l = module->accel_closures_local;

  if(!module->local_closures_connected)
    return;

  while(l)
  {
    accel = (dt_accel_t*)l->data;
    gtk_accel_group_disconnect(darktable.control->accelerators, accel->closure);
    l = g_slist_next(l);
  }

  module->accel_closures_local = NULL;
  module->local_closures_connected = FALSE;
}
Ejemplo n.º 9
0
int
clip_GTK_ACCELGROUPDISCONNECT(ClipMachine * ClipMachineMemory)
{
   C_widget *caccelg = _fetch_cw_arg(ClipMachineMemory);

   C_object *cclosure = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   GClosure *closure;

   CHECKCWID(caccelg, GTK_IS_ACCEL_GROUP);
   CHECKOPT2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);

   closure = (GClosure *) (cclosure->object);
   _clip_retl(ClipMachineMemory, gtk_accel_group_disconnect(GTK_ACCEL_GROUP(caccelg->widget), closure));
   return 0;
 err:
   return 1;
}
Ejemplo n.º 10
0
void dt_accel_deregister_global(const gchar *path)
{
  GSList *l;
  char build_path[1024];
  dt_accel_path_global(build_path, 1024,  path);
  l = darktable.control->accelerator_list;
  while(l)
  {
    dt_accel_t *accel = (dt_accel_t*)l->data;
    if(!strncmp(accel->path, build_path, 1024))
    {
      darktable.control->accelerator_list = g_slist_delete_link(darktable.control->accelerator_list, l);
      gtk_accel_group_disconnect(darktable.control->accelerators, accel->closure);
      l = NULL;
      free(accel);
    } else {
      l = g_slist_next(l);
    }
  }
}
Ejemplo n.º 11
0
static void
free_accel_closures (GtkApplicationWindow *window)
{
  GSList *l;

  for (l = window->priv->accel_closures; l; l = l->next)
    {
       AccelClosure *closure = l->data;

       gtk_accel_group_disconnect (window->priv->accels, &closure->closure);

       g_object_unref (closure->closure.data);
       if (closure->parameter)
         g_variant_unref (closure->parameter);
       g_free (closure->action_name);
       g_closure_invalidate (&closure->closure);
       g_closure_unref (&closure->closure);
    }
  g_slist_free (window->priv->accel_closures);
  window->priv->accel_closures = NULL;
}
Ejemplo n.º 12
0
void snippets_accel_disconnect (GuSnippets* sc, const gchar* key) {
    Tuple2* closure_data = NULL;
    GList* current = NULL;

    g_return_if_fail (key != NULL);

    current = sc->closure_data;
    while (current) {
        closure_data = TUPLE2 (current->data);
        if (STR_EQU (closure_data->first, key))
            break;
        current = g_list_next (current);
    }
    if (current) {
        gtk_accel_group_disconnect (sc->accel_group, closure_data->second);
        sc->closure_data = g_list_remove (sc->closure_data, closure_data);
        g_free (closure_data);
        slog (L_DEBUG, "Accelerator for `%s' disconnected\n",
                closure_data->first);
    }
}