예제 #1
0
파일: plugman.c 프로젝트: Davletvm/gtk
static void
enable_or_disable_plugin (GtkToggleButton *button,
                          const gchar     *name)
{
  if (plugin_enabled (name))
    disable_plugin (name);
  else
    enable_plugin (name);
}
예제 #2
0
static int ldbm_instance_generate(struct ldbminfo *li, char *instance_name,
                                  Slapi_Backend **ret_be)
{
    Slapi_Backend *new_be = NULL;
    int rc = 0;

    /* Create a new instance, process config info for it,
     * and then call slapi_be_new and create a new backend here
     */
    new_be = slapi_be_new(LDBM_DATABASE_TYPE_NAME /* type */, instance_name, 
                          0 /* public */, 1 /* do log changes */);
    new_be->be_database = li->li_plugin;
    rc = ldbm_instance_create(new_be, instance_name);
    if (rc) {
        goto bail;
    }

    ldbm_instance_config_load_dse_info(new_be->be_instance_info);
    ldbm_instance_create_default_indexes(new_be);

    /* if USN plugin is enabled, set slapi_counter */
    if (plugin_enabled("USN", li->li_identity) && ldbm_back_isinitialized()) {
        /* 
         * ldbm_back is already initialized. 
         * I.e., a new instance is being added.
         * If not initialized, ldbm_usn_init is called later and
         * be usn counter is initialized there.
         */
        if (config_get_entryusn_global()) {
            /* global usn counter is already created. 
             * set it to be_usn_counter. */
            new_be->be_usn_counter = li->li_global_usn_counter;
        } else {
            new_be->be_usn_counter = slapi_counter_new();
            slapi_counter_set_value(new_be->be_usn_counter, INITIALUSN);
        }
    }

    if (ret_be != NULL) {
        *ret_be = new_be;
    }
bail:
    return rc;
}
예제 #3
0
파일: plugman.c 프로젝트: Davletvm/gtk
static void
configure_plugins (GSimpleAction *action,
                   GVariant      *parameter,
                   gpointer       user_data)
{
  GtkBuilder *builder;
  GtkWidget *dialog;
  GtkWidget *check;
  GError *error = NULL;

  builder = gtk_builder_new ();
  gtk_builder_add_from_string (builder,
                               "<interface>"
                               "  <object class='GtkDialog' id='plugin-dialog'>"
                               "    <property name='border-width'>12</property>"
                               "    <property name='title'>Plugins</property>"
                               "    <child internal-child='vbox'>"
                               "      <object class='GtkBox' id='content-area'>"
                               "        <property name='visible'>True</property>"
                               "        <child>"
                               "          <object class='GtkCheckButton' id='red-plugin'>"
                               "            <property name='label' translatable='yes'>Red Plugin - turn your text red</property>"
                               "            <property name='visible'>True</property>"
                               "          </object>"
                               "        </child>"
                               "        <child>"
                               "          <object class='GtkCheckButton' id='black-plugin'>"
                               "            <property name='label' translatable='yes'>Black Plugin - turn your text black</property>"
                               "            <property name='visible'>True</property>"
                               "          </object>"
                               "        </child>"
                               "      </object>"
                               "    </child>"
                               "    <child internal-child='action_area'>"
                               "      <object class='GtkButtonBox' id='action-area'>"
                               "        <property name='visible'>True</property>"
                               "        <child>"
                               "          <object class='GtkButton' id='close-button'>"
                               "            <property name='label' translatable='yes'>Close</property>"
                               "            <property name='visible'>True</property>"
                               "          </object>"
                               "        </child>"
                               "      </object>"
                               "    </child>"
                               "    <action-widgets>"
                               "      <action-widget response='-5'>close-button</action-widget>"
                               "    </action-widgets>"
                               "  </object>"
                               "</interface>", -1, &error);
  if (error)
    {
      g_warning ("%s", error->message);
      g_error_free (error);
      return;
    }

  dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
  check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red"));
  g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "red");
  check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
  g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "black");

  g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);

  gtk_window_present (GTK_WINDOW (dialog));
}