[gnoduino] fall back to x-csrc if no mime detected
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino] fall back to x-csrc if no mime detected
- Date: Sun, 11 Sep 2011 20:00:07 +0000 (UTC)
commit ac8ef9b50120f003a91756557a9e7839dd10247a
Author: Lucian Langa <lucilanga gnome org>
Date: Sun Sep 11 21:59:46 2011 +0200
fall back to x-csrc if no mime detected
src/misc.py | 3 ++-
src/srcview.py | 3 ++-
ui/main.ui | 51 ++++++++++++++++++++++++++++++++++++---------------
3 files changed, 40 insertions(+), 17 deletions(-)
---
diff --git a/src/misc.py b/src/misc.py
index 90476a3..fbecf98 100644
--- a/src/misc.py
+++ b/src/misc.py
@@ -133,7 +133,8 @@ def get_mime_type(content):
"""FIXME: try with smaller chunk of content"""
if mime == "text/plain":
tmpmime = gnomevfs.get_mime_type_for_data(content.strip("\n"))
- if mime is not None: mime = tmpmime
+ if tmpmime != "text/plain": mime = tmpmime
+ else: mime = "text/x-csrc"
return mime
def merge_font_name(widget, font):
diff --git a/src/srcview.py b/src/srcview.py
index c9d688c..8b33d9b 100644
--- a/src/srcview.py
+++ b/src/srcview.py
@@ -56,7 +56,8 @@ def get_lang_for_content(content):
return lang
def instext(b, iter, text, len) :
- lang = get_lang_for_content(text)
+ cont = b.get_text(b.get_start_iter(), b.get_end_iter())
+ lang = get_lang_for_content(cont)
if lang != None:
b.set_language(lang)
diff --git a/ui/main.ui b/ui/main.ui
index 0d6d2fe..31675fb 100644
--- a/ui/main.ui
+++ b/ui/main.ui
@@ -375,37 +375,58 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="build.verbose">
- <property name="label" translatable="yes">Verbose build</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
+ <object class="GtkCheckButton" id="build.verbose">
+ <property name="label" translatable="yes">Verbose build</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="show.numbers">
<property name="label" translatable="yes">Show line numbers</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton5">
+ <property name="label" translatable="yes">Code folding</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -420,7 +441,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]