Revert "edi_scm: make sure we give a sensible window title."

This reverts commit 83adef96a9.
This commit is contained in:
Al Poole 2017-10-06 15:30:14 +01:00
parent 83adef96a9
commit 6fe6c805bf
3 changed files with 18 additions and 55 deletions

View File

@ -1,8 +1,8 @@
#include <Edi.h>
#include "edi_scm_ui.h"
#define DEFAULT_WIDTH 480
#define DEFAULT_HEIGHT 360
#define DEFAULT_WIDTH 460
#define DEFAULT_HEIGHT 280
static void
_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
@ -12,17 +12,20 @@ _win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUS
}
static Evas_Object *
window_setup(void)
_setup_win(void)
{
Evas_Object *win, *icon;
Eina_Strbuf *title;
char *path;
char *cwd;
cwd = getcwd(NULL, PATH_MAX);
title = eina_strbuf_new();
eina_strbuf_append_printf(title, "Edi Source Control :: %s", cwd);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("edi_scm", "edi_scm");
win = elm_win_util_standard_add(eina_strbuf_string_get(title), eina_strbuf_string_get(title));
icon = elm_icon_add(win);
elm_icon_standard_set(icon, "edi");
elm_win_icon_object_set(win, icon);
@ -30,33 +33,23 @@ window_setup(void)
evas_object_resize(win, DEFAULT_WIDTH * elm_config_scale_get(), DEFAULT_HEIGHT * elm_config_scale_get());
evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
path = edi_scm_ui_add(win);
if (!path)
{
fprintf(stderr, "ERR: unable to obtain path from SCM engine!\n");
exit(EXIT_FAILURE);
}
eina_strbuf_append_printf(title, "Edi Source Control :: %s", path);
elm_win_title_set(win, eina_strbuf_string_get(title));
elm_win_center(win, EINA_TRUE, EINA_TRUE);
evas_object_show(win);
eina_strbuf_free(title);
free(path);
free(cwd);
return win;
}
int main(int argc, char **argv)
{
Evas_Object *win;
ecore_init();
elm_init(argc, argv);
window_setup();
win = _setup_win();
edi_scm_ui_add(win);
elm_win_center(win, EINA_TRUE, EINA_TRUE);
evas_object_show(win);
ecore_main_loop_begin();

View File

@ -507,32 +507,7 @@ _edi_scm_ui_file_changes_cb(void *data EINA_UNUSED, int type EINA_UNUSED,
return ECORE_CALLBACK_DONE;
}
static char *
_edi_scm_find_directory(Edi_Scm_Engine *engine)
{
char *path;
char *directory = strdup(engine->workdir);
while (1)
{
if (!strcmp(directory, "/") || !strcmp(directory, "/home"))
break;
path = edi_path_append(directory, engine->directory);
if (ecore_file_exists(path))
{
free(path);
return directory;
}
free(path);
directory = ecore_file_dir_get(directory);
}
return NULL;
}
char *
void
edi_scm_ui_add(Evas_Object *parent)
{
Evas_Object *box, *frame, *hbox, *cbox, *label, *avatar, *input, *button;
@ -772,7 +747,5 @@ edi_scm_ui_add(Evas_Object *parent)
elm_box_pack_end(hbox, button);
elm_box_pack_end(box, hbox);
return _edi_scm_find_directory(engine);
}

View File

@ -24,14 +24,11 @@ extern "C" {
/**
* Create the commit dialog UI.
*
*
* @param parent Parent object to add the commit UI to.
*
* @return Path of repository directory.
*
* @ingroup SCM
*/
char *edi_scm_ui_add(Evas_Object *parent);
void edi_scm_ui_add(Evas_Object *parent);
/**
* @}