~brandontschaefer/unity/show-desktop-fix

« back to all changes in this revision

Viewing changes to unity-shared/UnitySettings.cpp

  • Committer: Nick Dedekind
  • Date: 2013-05-03 18:59:08 UTC
  • mto: (3008.2.133 libunity-7.0-breakage)
  • mto: This revision was merged to the branch mainline in revision 3325.
  • Revision ID: nicholas.dedekind@gmail.com-20130503185908-wvf2jwvxaqkgjvsn
Added double-click-activate dconf key.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
const std::string SETTINGS_NAME = "com.canonical.Unity";
37
37
const std::string FORM_FACTOR = "form-factor";
 
38
const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";
38
39
}
39
40
 
40
41
//
47
48
    : parent_(owner)
48
49
    , gsettings_(g_settings_new(SETTINGS_NAME.c_str()))
49
50
    , cached_form_factor_(FormFactor::DESKTOP)
 
51
    , cached_double_click_activate_(true)
50
52
    , lowGfx_(false)
51
53
  {
52
54
    CacheFormFactor();
 
55
    CacheDoubleClickActivate();
53
56
 
54
57
    form_factor_changed_.Connect(gsettings_, "changed::" + FORM_FACTOR, [this] (GSettings*, gchar*) {
55
58
      CacheFormFactor();
56
59
      parent_->form_factor.changed.emit(cached_form_factor_);
57
60
    });
 
61
    double_click_activate_changed_.Connect(gsettings_, "changed::" + DOUBLE_CLICK_ACTIVATE, [this] (GSettings*, gchar*) {
 
62
      CacheDoubleClickActivate();
 
63
      parent_->double_click_activate.changed.emit(cached_double_click_activate_);
 
64
    });
58
65
  }
59
66
 
60
67
  void CacheFormFactor()
75
82
    }
76
83
  }
77
84
 
 
85
  void CacheDoubleClickActivate()
 
86
  {
 
87
    cached_double_click_activate_ = g_settings_get_boolean(gsettings_, DOUBLE_CLICK_ACTIVATE.c_str());
 
88
  }
 
89
 
78
90
  FormFactor GetFormFactor() const
79
91
  {
80
92
    return cached_form_factor_;
86
98
    return true;
87
99
  }
88
100
 
 
101
  bool GetDoubleClickActivate() const
 
102
  {
 
103
    return cached_double_click_activate_;
 
104
  }
 
105
 
89
106
  Settings* parent_;
90
107
  glib::Object<GSettings> gsettings_;
91
108
  FormFactor cached_form_factor_;
 
109
  bool cached_double_click_activate_;
92
110
  bool lowGfx_;
93
111
 
94
112
  glib::Signal<void, GSettings*, gchar* > form_factor_changed_;
 
113
  glib::Signal<void, GSettings*, gchar* > double_click_activate_changed_;
95
114
};
96
115
 
97
116
//
106
125
  {
107
126
    LOG_ERROR(logger) << "More than one unity::Settings created.";
108
127
  }
109
 
  
 
128
 
110
129
  else
111
 
  { 
 
130
  {
112
131
    form_factor.SetGetterFunction(sigc::mem_fun(*pimpl, &Impl::GetFormFactor));
113
132
    form_factor.SetSetterFunction(sigc::mem_fun(*pimpl, &Impl::SetFormFactor));
114
133
 
 
134
    double_click_activate.SetGetterFunction(sigc::mem_fun(*pimpl, &Impl::GetDoubleClickActivate));
 
135
 
115
136
    settings_instance = this;
116
137
  }
117
138
}