本文へ移動
cccskills
無料GitHub で公開

gnome-preferences-dialog

Add a standard GNOME preferences dialog (AdwPreferencesDialog) with Ctrl+comma shortcut, PreferencesPage/Group rows, and GSettings bindings. Use when adding settings or preferences UI to a GNOME app.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md3.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Skill: Add a Preferences Dialog

Goal

Add a standard GNOME preferences dialog accessible via Ctrl+comma.

Blueprint Template

Adw.PreferencesDialog {
  search-enabled: true;
  content-width: 600;

  Adw.PreferencesPage {
    Adw.PreferencesGroup {
      title: _("Appearance");
      description: _("These settings control how the app looks.");

      Adw.SwitchRow {
        title: _("_Dark Mode");
        use-underline: true;
      }

      Adw.ComboRow {
        title: _("_Theme");
        use-underline: true;
        model: StringList { strings [_("Light"), _("Dark"), _("System")] };
      }
    }

    Adw.PreferencesGroup {
      title: _("Behavior");

      Adw.SpinRow {
        title: _("_Font Size");
        use-underline: true;
        numeric: true;
        adjustment: Adjustment { lower: 8; upper: 32; step-increment: 1; };
      }
    }

    Adw.PreferencesGroup {
      Adw.ButtonRow {
        title: _("_Clear History");
        use-underline: true;
        styles ["destructive-action"];
        activated => $on_clear_history_cb(template);
      }
    }
  }
}

GSettings Schema

<schemalist>
  <schema id="org.example.MyApp" path="/org/example/MyApp/">
    <key name="dark-mode" type="b"><default>false</default><summary>Dark mode</summary></key>
    <key name="font-size" type="i"><default>12</default><summary>Font size</summary></key>
  </schema>
</schemalist>

Menu Integration

<menu id="primary_menu">
  <section>
    <item>
      <attribute name="label" translatable="yes">P_references</attribute>
      <attribute name="action">win.show-preferences</attribute>
      <attribute name="accel">&lt;control&gt;comma</attribute>
    </item>
    <item>
      <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
      <attribute name="action">app.shortcuts</attribute>
    </item>
  </section>
</menu>

Python Code

from gi.repository import Adw, Gio

class MyApp(Adw.Application):
    def __init__(self):
        super().__init__(application_id='org.example.MyApp')
        self.create_action('shortcuts', self._on_shortcuts)

class MyWindow(Adw.ApplicationWindow):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        show_prefs = Gio.SimpleAction.new('show-preferences', None)
        show_prefs.connect('activate', self._on_preferences)
        self.add_action(show_prefs)
    
    def _on_preferences(self, action, param):
        builder = Gtk.Builder.new_from_resource('/org/example/MyApp/preferences.ui')
        dialog = builder.get_object('preferences_dialog')
        dialog.present(self)

GSettings Binding (C)

GSettings *settings = g_settings_new ("org.example.MyApp");
g_settings_bind (settings, "dark-mode", switch, "active", G_SETTINGS_BIND_DEFAULT);

Real App References

  • gnome-text-editor/src/editor-preferences-dialog.ui
  • nautilus/src/resources/ui/nautilus-preferences-dialog.blp
  • gnome-calculator/src/ui/math-preferences.blp

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Add a standard AdwAboutDialog wired to app metadata, plus the AppStream metainfo file it should share data with. Use when adding an About entry, release notes, credits, or preparing app metadata.

日本語の概要は準備中です。原文の説明を表示しています。

hanthor/gnome-gui-spec32026年10月11日 更新

Make a GTK4/libadwaita app accessible — accessible labels and roles, tooltips on icon-only buttons, keyboard navigation, contrast, and testing with Orca/Accerciser. Use when fixing a11y issues or running the accessibility category of a HIG audit.

日本語の概要は準備中です。原文の説明を表示しています。

hanthor/gnome-gui-spec32026年10月11日 更新

Responsive GNOME layouts: AdwBreakpoint conditions, BreakpointBin, MultiLayoutView, BottomSheet, narrow/wide layout swaps. Use when making an app work on phones or narrow windows.

日本語の概要は準備中です。原文の説明を表示しています。

hanthor/gnome-gui-spec32026年10月11日 更新

Onboarding tour with AdwCarousel and navigation dots, skippable welcome screens. Use when adding a first-run tour or feature showcase to a GNOME app.

日本語の概要は準備中です。原文の説明を表示しています。

hanthor/gnome-gui-spec32026年10月11日 更新

Implement GNOME's 4-tier destructive-action pattern: undo toasts instead of confirmation dialogs, AdwAlertDialog for irreversible actions. Use when adding delete, remove, clear, or other destructive actions.

日本語の概要は準備中です。原文の説明を表示しています。

hanthor/gnome-gui-spec32026年10月11日 更新

Loading, empty, and error states with AdwStatusPage and AdwSpinner — placeholder icons, titles, action buttons. Use when an app view can be empty, loading, or failed.

日本語の概要は準備中です。原文の説明を表示しています。

hanthor/gnome-gui-spec32026年10月11日 更新

hanthor のスキルをすべて見る

このスキルの問題を報告する