Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Caja (Mate) #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/SetBG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ SetBG* SetBG::get_bg_setter()
case SetBG::NEMO:
setter = new SetBGNemo();
break;
case SetBG::CAJA:
setter = new SetBGCaja();
break;
#ifdef USE_XINERAMA
case SetBG::XINERAMA:
XineramaScreenInfo *xinerama_info;
Expand Down Expand Up @@ -311,6 +314,7 @@ SetBG::RootWindowData SetBG::check_window_type(Display *display, Window window)

if (strclass == std::string("Xfdesktop")) retval.type = SetBG::XFCE; else
if (strclass == std::string("Nautilus")) retval.type = SetBG::NAUTILUS; else
if (strclass == std::string("Caja")) retval.type = SetBG::CAJA; else
if (strclass == std::string("Nemo")) retval.type = SetBG::NEMO; else
if (strclass == std::string("Pcmanfm")) retval.type = SetBG::PCMANFM; else
if (strclass == std::string("Conky") || strclass == std::string("conky"))
Expand Down Expand Up @@ -1367,6 +1371,51 @@ bool SetBGNemo::save_to_config()
return false;
}

/*
* **************************************************************************
* SetBGCaja
* **************************************************************************
*/

/**
* Returns the schema key to be used for setting background settings.
*
* Can be overridden.
*/
Glib::ustring SetBGCaja::get_gsettings_key()
{
return Glib::ustring("org.mate.background");
}

/**
* Sets the bg if caja is appearing to draw the desktop image.
*/
bool SetBGCaja::set_bg(Glib::ustring &disp, Glib::ustring file, SetMode mode, Gdk::Color bgcolor)
{
Glib::ustring strmode;
switch(mode) {
case SetBG::SET_SCALE: strmode = "stretched"; break;
case SetBG::SET_TILE: strmode = "wallpaper"; break;
case SetBG::SET_CENTER: strmode = "centered"; break;
case SetBG::SET_ZOOM: strmode = "scaled"; break;
case SetBG::SET_ZOOM_FILL: strmode = "spanned"; break;
default: strmode = "zoom"; break;
};

Glib::RefPtr<Gio::Settings> settings = Gio::Settings::create(get_gsettings_key());

Glib::RefPtr<Gio::File> iofile = Gio::File::create_for_commandline_arg(file);

settings->set_string("picture-filename", iofile->get_path());
settings->set_string("picture-options", strmode);
settings->set_string("primary-color", bgcolor.to_string());
settings->set_string("secondary-color", bgcolor.to_string());

set_show_desktop();

return true;
}

/*
* **************************************************************************
* SetBGPcmanfm
Expand Down
11 changes: 11 additions & 0 deletions src/SetBG.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class SetBG {
XINERAMA,
NEMO,
PCMANFM,
CAJA,
IGNORE // Conky, etc
};

Expand Down Expand Up @@ -184,6 +185,16 @@ class SetBGNemo : public SetBGGnome {
virtual void set_show_desktop();
};

class SetBGCaja : public SetBGGnome {
public:
virtual bool set_bg(Glib::ustring &disp,
Glib::ustring file,
SetMode mode,
Gdk::Color bgcolor);
protected:
virtual Glib::ustring get_gsettings_key();
};

class SetBGPcmanfm : public SetBGGnome {
public:
virtual Glib::ustring get_fullscreen_key();
Expand Down