Exemplo n.º 1
0
/**
 * gimp_font_select_widget_set:
 * @widget:    A font select widget.
 * @font_name: Font name to set; %NULL means no change.
 *
 * Sets the current font for the font select widget.  Calls the
 * callback function if one was supplied in the call to
 * gimp_font_select_widget_new().
 */
void
gimp_font_select_widget_set (GtkWidget   *widget,
                             const gchar *font_name)
{
  g_return_if_fail (widget != NULL);

  gimp_font_select_button_set_font (GIMP_FONT_SELECT_BUTTON (widget),
                                    font_name);
}
static void
script_fu_reset (SFScript *script)
{
  gint i;

  script_fu_script_reset (script, FALSE);

  for (i = 0; i < script->n_args; i++)
    {
      SFArgValue *value  = &script->args[i].value;
      GtkWidget  *widget = sf_interface->widgets[i];

      switch (script->args[i].type)
        {
        case SF_IMAGE:
        case SF_DRAWABLE:
        case SF_LAYER:
        case SF_CHANNEL:
        case SF_VECTORS:
        case SF_DISPLAY:
          break;

        case SF_COLOR:
          gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget),
                                       &value->sfa_color);
          break;

        case SF_TOGGLE:
          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
                                        value->sfa_toggle);
          break;

        case SF_VALUE:
        case SF_STRING:
          gtk_entry_set_text (GTK_ENTRY (widget), value->sfa_value);
          break;

        case SF_TEXT:
          {
            GtkWidget     *view;
            GtkTextBuffer *buffer;

            view = gtk_bin_get_child (GTK_BIN (widget));
            buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

            gtk_text_buffer_set_text (buffer, value->sfa_value, -1);
          }
          break;

        case SF_ADJUSTMENT:
          gtk_adjustment_set_value (value->sfa_adjustment.adj,
                                    value->sfa_adjustment.value);
          break;

        case SF_FILENAME:
        case SF_DIRNAME:
          gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget),
                                         value->sfa_file.filename);
          break;

        case SF_FONT:
          gimp_font_select_button_set_font (GIMP_FONT_SELECT_BUTTON (widget),
                                            value->sfa_font);
          break;

        case SF_PALETTE:
          gimp_palette_select_button_set_palette (GIMP_PALETTE_SELECT_BUTTON (widget),
                                                  value->sfa_palette);
          break;

        case SF_PATTERN:
          gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget),
                                                  value->sfa_pattern);
          break;

        case SF_GRADIENT:
          gimp_gradient_select_button_set_gradient (GIMP_GRADIENT_SELECT_BUTTON (widget),
                                                    value->sfa_gradient);
          break;

        case SF_BRUSH:
          gimp_brush_select_button_set_brush (GIMP_BRUSH_SELECT_BUTTON (widget),
                                              value->sfa_brush.name,
                                              value->sfa_brush.opacity,
                                              value->sfa_brush.spacing,
                                              value->sfa_brush.paint_mode);
          break;

        case SF_OPTION:
          gtk_combo_box_set_active (GTK_COMBO_BOX (widget),
                                    value->sfa_option.history);
          break;

        case SF_ENUM:
          gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget),
                                         value->sfa_enum.history);
          break;
        }
    }
}