diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-01 16:52:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-01 16:53:39 +0300 |
commit | 33b03f7f68922efada6ec7518c4fa60e9acb620a (patch) | |
tree | 369a3c221b204ea027337c94c523994b10c617d9 /source/blender/editors/space_userpref | |
parent | 3804636ee57b58c0ca02dd5360f6df62603ae929 (diff) |
Cleanup: move theme reset into it's own operator file
Diffstat (limited to 'source/blender/editors/space_userpref')
-rw-r--r-- | source/blender/editors/space_userpref/userpref_ops.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/source/blender/editors/space_userpref/userpref_ops.c b/source/blender/editors/space_userpref/userpref_ops.c index 4ba3c988c4d..f6aaf01747c 100644 --- a/source/blender/editors/space_userpref/userpref_ops.c +++ b/source/blender/editors/space_userpref/userpref_ops.c @@ -13,7 +13,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2008 Blender Foundation. + * The Original Code is Copyright (C) 2009 Blender Foundation. * All rights reserved. */ @@ -21,6 +21,54 @@ * \ingroup spuserpref */ - #include <string.h> -#include <stdio.h> + +#include "DNA_screen_types.h" + +#include "BKE_context.h" +#include "BKE_report.h" + +#include "RNA_types.h" + +#include "UI_interface.h" + +#include "../interface/interface_intern.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "ED_userpref.h" + +/* -------------------------------------------------------------------- */ +/** \name Reset Default Theme + * \{ */ + +static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op)) +{ + UI_theme_init_default(); + UI_style_init_default(); + WM_event_add_notifier(C, NC_WINDOW, NULL); + + return OPERATOR_FINISHED; +} + +static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Reset to Default Theme"; + ot->idname = "PREFERENCES_OT_reset_default_theme"; + ot->description = "Reset to the default theme colors"; + + /* callbacks */ + ot->exec = reset_default_theme_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER; +} + +/** \} */ + +void ED_operatortypes_userpref(void) +{ + WM_operatortype_append(PREFERENCES_OT_reset_default_theme); +} |