Esempio n. 1
0
static VALUE
mountoperation_set_choice(VALUE self, VALUE value)
{
	g_mount_operation_set_choice(_SELF(self), NUM2INT(value));

	return self;
}
void MountOperationQuestionDialog::onButtonClicked(QAbstractButton* button) {
  GMountOperation* op = mountOperation->mountOperation();
  for(int i = 0; i < choiceCount; ++i) {
    if(choiceButtons[i] == button) {
      g_mount_operation_set_choice(op, i);
      g_mount_operation_reply(op, G_MOUNT_OPERATION_HANDLED);
      break;
    }
  }
}
Esempio n. 3
0
static void 
g_mount_operation_set_property (GObject      *object,
                                guint         prop_id,
                                const GValue *value,
                                GParamSpec   *pspec)
{
  GMountOperation *operation;

  operation = G_MOUNT_OPERATION (object);

  switch (prop_id)
    {
    case PROP_USERNAME:
      g_mount_operation_set_username (operation, 
                                      g_value_get_string (value));
      break;
   
    case PROP_PASSWORD:
      g_mount_operation_set_password (operation, 
                                      g_value_get_string (value));
      break;

    case PROP_ANONYMOUS:
      g_mount_operation_set_anonymous (operation, 
                                       g_value_get_boolean (value));
      break;

    case PROP_DOMAIN:
      g_mount_operation_set_domain (operation, 
                                    g_value_get_string (value));
      break;

    case PROP_PASSWORD_SAVE:
      g_mount_operation_set_password_save (operation, 
                                           g_value_get_enum (value));
      break;

    case PROP_CHOICE:
      g_mount_operation_set_choice (operation, 
                                    g_value_get_int (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Esempio n. 4
0
static void
ask_question_cb (GMountOperation *op,
                 char *message,
                 char **choices,
                 gpointer user_data)
{
  char **ptr = choices;
  char *s;
  int i, choice;

  g_print ("%s\n", message);

  i = 1;
  while (*ptr)
    {
      g_print ("[%d] %s\n", i, *ptr++);
      i++;
    }

  s = prompt_for ("Choice", NULL, TRUE);
  if (!s)
    goto error;

  choice = atoi (s);
  if (choice > 0 && choice < i)
    {
      g_mount_operation_set_choice (op, choice - 1);
      g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
    }
  g_free (s);

  return;

error:
  g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
}
Esempio n. 5
0
static void
question_dialog_button_clicked (GtkDialog       *dialog,
                                gint             button_number,
                                GMountOperation *op)
{
    GtkMountOperationPrivate *priv;
    GtkMountOperation *operation;

    operation = GTK_MOUNT_OPERATION (op);
    priv = operation->priv;

    if (button_number >= 0)
    {
        g_mount_operation_set_choice (op, button_number);
        g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
    }
    else
        g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);

    priv->dialog = NULL;
    g_object_notify (G_OBJECT (operation), "is-showing");
    gtk_widget_destroy (GTK_WIDGET (dialog));
    g_object_unref (op);
}